0%
HomeBlogProducts
Transfers API: Historical Transactions 500x Faster in One Request

Transfers API: Historical Transactions 500x Faster in One Request

Author: Omar Ceja

Reviewed by Brady Werkheiser


Published on May 13, 20212 min read

Imagine if there was a method that could answer: “How much ETH, SUSHI, USDT, … (you get the picture), has Vitalik Buterin sent to Elon Musk?” Well, with Alchemy’s Transfers API, now there is (provided that you know their wallet addresses). With a single API call, you can fetch historical transactions for any address and any tokens, without having to scan the entire chain for each of your users.

Whether you're a developer for the newest DEX or the hottest gaming dApp, you know the struggle is real when it comes to accessing historical transactions.

If you're using the native Ethereum client methods, you're probably querying for each block to get ETH transfers, then filtering for ERC20 and ERC721 transfers by parsing through thousands of logs, and keeping all of this information in some underlying datastore. Aside from being a mouthful, the process of building out this infrastructure in a way that is scalable and consistent takes up a lot of engineering resources and is extremely slow. Don't even get me started on parsing transaction traces to access internal transactions from contract addresses - as Nikola Vuković from DefiSaver puts it, "internal transfers are almost impossible to get".

After learning about this painful process for such a simple and universal use case, we decided to build out our Transfers API that does all of this work behind the scenes. Now, all you have to do is make a call to a single endpoint and watch as the ETH, ERC20 and ERC721 transfers come rolling in. As an added bonus and optimization, this API supports pagination so that you can reduce network latency and fetch results sequentially without hitting timeouts or having to stitch together the results yourself.

diagram of alchemy transfer api infrastructure
Transfers API Infrastructure

Transfers API Infrastructure

Once you've accessed all of the transactions your users have made in the past, you can easily set up Address Activity Notifications to continue to receive ETH, ERC20 and ERC721 in real time. Together, Alchemy's Transfers API and Address Activity Notifications are a powerful tool set for any developer interested in building a backend for user transactions.

Okay, now for the cool stuff - a live demo. To see our Transfers API in action, checkout this example query in our Public Composer to view transfers sent from Uniswap V2: Router 2 to Yearn: Deployer - it's super simple and will help you get started!

Our results show that a call to alchemy_getAssetTransfers is up to 500x faster (and for some use cases literally 1,000,000x faster) than using the geth methods eth_getBlockByNumber and eth_getLogs concurrently to query 10K blocks for all ETH, ERC20 and ERC721 transfers sent to WETH. Don't believe us? A skeptic - I like it. Good thing you can always test the performance yourself with this script. If you want to see the optimization really kick in, try querying for more blocks. If there's a 500x speed up for 10K blocks, imagine the speed up you'll see for 10M blocks 🚀!


If you’re interested in exploring the Transfers API you can get started today by signing up with Alchemy for free and checking out the documentation.

Section background image

Build blockchain magic

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.

Get your API key