0

I'm exploring Blocks & Transactions at the moment. I can see in the blocks there's transactions which show what addresses sent ETH and where to. However, I'm wondering how to tell if these are for different tokens. For example, how could I tell if the transaction was for ETH or for USDT? or USDC etc.

Block Example

block {
  baseFeePerGas: '0x4b0ce30e8',
  difficulty: BigNumber { s: 1, e: 16, c: [ 117, 57266980469439 ] },
  extraData: '0x706f6f6c696e2e636f6d219fcef6b51a14a06e',
  gasLimit: 29970705,
  gasUsed: 10738766,
  hash: '0x73254c2d0bcb9d027f40aeacf5943c8582ed53ca5a7e4019a80e0927954361f5',
  logsBloom: '...',
  miner: '0x2a20380dca5bc24d052acfbf79ba23e988ad0050',
  mixHash: '0x05f661e39cdd515b4b66b09b77509cd5c3887b04e4f99ab923d5554462eb2f1d',
  nonce: '0xfc838359a8219d77',
  number: 15227722,
  parentHash: '0x45b5b40422f11d0f15530dc19c0947a4fcd6a06b48cf66aeada57e72bcd0da52',
  receiptsRoot: '0xf8ac4fd701bab45660c183d5374350d1a741cd1bd6881abb5361627042010e05',
  sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
  size: 33930,
  stateRoot: '0x942f2b68a681b7d55e464c32dd4327aa15617ca124de16fa0000e56f5dca5809',
  timestamp: 1658967825,
  totalDifficulty: BigNumber { s: 1, e: 22, c: [ 550079581, 93688522278105 ] },
  transactions: [
    '0x619cd9170319b19899b1b0021e4c8c949d01c186651e8ba10857816a9fcdbac9',
    '...'
  ],
  transactionsRoot: '0xc8d9c89e9b45a4f6519d6e1b6e7c64e7a65562f748aee3f51b776942898580df',
  uncles: []
}

Transaction Example

  transaction {
    blockHash: '0xc0f4906fea23cf6f3cce98cb44e8e1449e455b28d684dfa9ff65426495584de6',
    blockNumber: 2000000,
    from: '0x32be343b94f860124dc4fee278fdcbd38c102d88',
    gas: 333333,
    // gasPrice: BigNumber { s: 1, e: 10, c: [ 30000000000 ] },
    hash: '0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef',
    input: '0x',
    nonce: 126917,
    r: '0x51222d91a379452395d0abaff981af4cfcc242f25cfaf947dea8245a477731f9',
    s: '0x3a997c910b4701cca5d933fb26064ee5af7fe3236ff0ef2b58aa50b25aff8ca5',
    to: '0x104994f45d9d697ca104e5704a7b77d7fec3537c',
    transactionIndex: 0,
    type: '0x0',
    v: '0x1b',
    // value: BigNumber { s: 1, e: 20, c: [ 1499900 ] }
    // value: 149 9900 0000 0000 0000 00
  }

1 Answer 1

2

You have to analyze each of the transactions. The basic analysis is quite simple: if the target address is the address of USDC/whatever, then the transaction is interacting with USDC.

It gets somewhat trickier with internal transactions. What if the initial target is some contract which then interacts with the USDC contract? I'm not exactly sure how Etherscan does this, but basically you either have to analyze the input data to see whether its execution eventually calls USDC, or simulate the transaction and see if it touched USDC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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