[Ethereum] Get the value of ERC20 tokens transferred using the Etherscan API


I am using Etherscan API to get transaction and other details for addresses.

I need to find out no. of tokens transferred between two addresses. For Ex – for Below TxHash I see 1564+ tokens transferred. When I use this API call I see from and to address but not token value. enter image description here

Best Answer

Here's json result from your api call:

    jsonrpc: "2.0",
    id: 1,
    result: {
        blockHash: "0x8fe66b0c15a1c1155338bb5628db55f05cfe72d1194931134b4721cd07e9eda7",
        blockNumber: "0x416850",
        from: "0x167a9333bf582556f35bd4d16a7e80e191aa6476",
        gas: "0x13880",
        gasPrice: "0x4e3b29200",
        hash: "0x03430ecdf52d37a8d3645fa9b19c072ec367edbd0d4eba3cc1c7f7c5e7dcc7d2",
        input: "0xa9059cbb0000000000000000000000007a2641bb2fb31ccd33ba5488c886c3bc4714ec6b000000000000000000000000000000000000000000000054ca7578dcf8bb7aa0",
        nonce: "0x15a82",
        to: "0x9a642d6b3368ddc662ca244badf32cda716005bc",
        transactionIndex: "0x2a",
        value: "0x0",
        v: "0x25",
        r: "0x790a06d5773006ecbc719354d966d100470e6267a68d3446ca0ebfd8df4452b5",
        s: "0x4e58eb2997a3c8add1386a47a71ac5bb915a2a53343883ea1ea4d8e69a6be486"

Please take care of the input field:

  • First 4 bytes is method hash:

  • Next 32 bytes is target address:

  • Last 32 bytes is value of ERC20 tokens transferred:


0x54ca7578dcf8bb7aa0 = 1.5641152016500001e+21

Related Topic