Why an ERC-20 transfer shows value 0
Last updated:
At a glance
| Property | Value |
|---|---|
| Transaction value | Ether only — usually 0 for a token transfer |
| Transaction to | The token contract, not the recipient |
| Transfer event | Transfer(address indexed _from, address indexed _to, uint256 _value) |
| Where the amount is | Log data (non-indexed _value) and the call data |
What you see
eth_getTransactionByHash for a token payment shows value 0x0 and the token contract, not the recipient, in the to field. The amount you expected is nowhere in the obvious fields.
Why this happens
An ERC-20 transfer calls the token contract's transfer function, so to is the contract and value is the ether sent along — normally none. The call data starts with a four-byte function selector ("the first four bytes of the Keccak-256 hash" of the signature) followed by the recipient and amount. EIP-20 requires the event Transfer(address indexed _from, address indexed _to, uint256 _value) to "trigger when tokens are transferred, including zero value transfers": _from and _to are indexed and appear as topics, while the non-indexed _value is ABI-encoded into the log's data. That log is in the transaction's receipt and is what eth_getLogs filters on.
What to do
- Read the receipt (eth_getTransactionReceipt) and find logs whose topic 0 is keccak256("Transfer(address,address,uint256)"); decode the amount from data.
- To follow one address, filter eth_getLogs by the token contract and put the address in topic 1 (sender) or topic 2 (recipient), left-padded to 32 bytes.
- Treat the transaction's to as the token contract and value as ether only.
- Scale the raw amount by the token's decimals before showing it.
When this is not our problem
Where the amount lives is fixed by the ERC-20 standard and the EVM transaction format, the same on every node, whoever operates it, Triport included.
FAQ
- Why does my USDT transfer on Ethereum show value 0?
- Because value only carries ether. The token amount is in the call data and in the Transfer event log in the receipt.
- How do I find all ERC-20 transfers to an address?
- Filter eth_getLogs by the Transfer event signature in topic 0 and the address, padded to 32 bytes, in topic 2.