Derive the first four digest bytes from a canonical signature.
LET’S PICTURE IT
A short action label is calculated from an agreed full action description.
SEE IT FOR YOURSELF
Build a transfer call from typed fieldsStep 1 / 4
The standard transfer interface takes an address and a raw integer amount. This diagram uses address one and amount one hundred.
The standard transfer interface takes an address and a raw integer amount. This diagram uses address one and amount one hundred.Keccak-256 of the canonical signature supplies the first four bytes. The transfer selector is a9059cbb.An address is twenty bytes. Standard ABI encoding adds twelve zero bytes on the left to fill one thirty-two-byte word.The integer one hundred is hex 64, left-padded in word one. Selector plus two words produces sixty-eight bytes of standard calldata.
Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.
Normalize the signature
Use function name and canonical input types with no names or spaces. For the transfer example, use transfer(address,uint256).
Hash as UTF-8 text
Calculate Keccak-256 of the signature bytes. Finalized SHA3-256 is a different algorithm and cannot be substituted here.
Take the prefix correctly
The first four bytes are eight hex digits after 0x. Do not take four digits or the final four bytes.
Verify and state limits
The transfer fixture should produce 0xa9059cbb. A selector is short and can collide, so it is not a globally unique authenticated function identity.