Function Signature Hash
Overview
When users interact with a smart contract on Ethereum or EVM-compatible chains, they send a transaction with data. The beginning of this data typically starts with the function signature hash, allowing the Ethereum Virtual Machine to determine which function within the contract the users are aiming to call.
Get function signature hash via Etherscan
To obtain the function signature hash from Etherscan enter the smart contract address into the search bar. Then, click on the "+Click to show more" button to view additional details, as shown below.
Get function signature hash via Internal Transactions API
Users can also obtain the function signature hash (sig_hash
) by using Internal Transactions API.
As an example, we will filter the results based on the following parameters:
- the USDC contract address:
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
- an EOA wallet as the origin address:
0x21b97409b8fa7480f82fa2bf2f8e8a381cf80860
- the block range set by number:
1
tolatest
By executing the request below, you will retrieve all internal transactions called by the specified origin,
on the USDC contract. Be sure to replace YOUR_API_KEY
with your actual API key.
import {ChainId, TsunamiApiClient} from '@parsiq/tsunami-client';
const tsunami = new TsunamiApiClient('', ChainId.ETH_MAINNET);
const calls = ;
console.log());
Response
You can view the function signature hash as sig_hash
and transaction hash as tx_hash
in the list of items.
{
"range": {
"has_more": false,
"start_block": 1,
"end_block": 16541428,
"next_offset": null
},
"items": [
{
"id": "0000000000fc660e-0018-00000000",
"sender": "0x21b97409b8fa7480f82fa2bf2f8e8a381cf80860",
"sig_hash": "0x095ea7b3",
"tx_hash": "0x71f0866502848f379b4b35d24f3588df5c14b669506dfb7ce2eb7121d36fb66c",
"block_hash": "0x5f301020023d0f1a4b63eaf656f2071e9561b6d5ed68758858f99d4aaeaaff12",
"block_number": 16541198,
"timestamp": 1675341887,
"origin": "0x21b97409b8fa7480f82fa2bf2f8e8a381cf80860",
"contract": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"input_data": "0x095ea7b3000000000000000000000000c92e8bdf79f0507f65a392b0ab4667716bfe0110ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}
]
}