0

Can anyone please help me to get list of transaction for ERC20 token similar to

https://api-ropsten.etherscan.io/api?module=account&action=txlist&address=0xd39bdb16d138e5219d013cba3d94c327bd246302&sort=asc

This is my ERC20 token address : 0xd39bdb16d138e5219d013cba3d94c327bd246302

I tried with this

http://api.etherscan.io/api?module=account&action=tokentx&address=0xd39bdb16d138e5219d013cba3d94c327bd246302&startblock=0&endblock=999999999&sort=asc&apikey=YourApiKeyToken

But am getting no transactions found

enter image description here

But i can see transactions in etherscan

enter image description here

1
  1. Change module=account to module=logs
  2. Change action=tokentx to action=getLogs
  3. Add topic0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef

The last one is the hash of an ERC20 Transfer event.

You can obtain it programmatically, for example, using web3.js v1.x:

const Web3 = require("web3");
const TRANSFER_EVENT = Web3.utils.keccak256("Transfer(address,address,uint256)");
console.log(TRANSFER_EVENT);
| improve this answer | |
0

Through web3 code, when you query a particular transaction using web3.eth.getTransactionReceipt(id)

The response will contain a input parameter, check input.substring(0,10) == '0xa9059cbb' to ensure it is an erc20 transaction

Then you need to check input.substring(34,75) to get "to" address.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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