I am looking for a way to get all erc20 token transfers with specifying block number only.

For ETH there is already a way exists here.

I have done some search and found this method to find transfers of a specific address.


Is there any way to list all token transfers of a specific block by just providing a block number as a parameter in any way ?

New contributor
Deepak M is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

You can use the Web3 APIs to pretty easily do this.

You just need to know that the ERC20 standard has a fixed ABI, and thus will have a fixed "method id"

Function: transfer(address _to, uint256 _value) 
MethodID: 0xa9059cbb

Any ERC20 transfer that happens in a block should start with 0xa9059cbb since this determines which function is called in a contract.

With this information, you just need to:

  • Get a block
  • Get all transaction hashes
  • Get all transactions
  • Check the first 10 characters match

Like so:

window.web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/<APIKEY>"));

async function getERC20Transfers(blockNumber) {
  let block = await web3.eth.getBlock(blockNumber);
  for (var transactionIndex in block.transactions) {
    let transactionHash = block.transactions[transactionIndex];
    let transaction = await web3.eth.getTransaction(transactionHash);
    if (transaction.input.substr(0,10) == "0xa9059cbb") {


You can find a working example which prints to your browser console here: https://jsfiddle.net/4sujyx5g/2/

Your Answer

Deepak M is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.