Encoding and decoding should agree under the exact schema.
LET’S PICTURE IT
A form printed and read back should retain the original typed fields.
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.
Generate values inside the type range
An int8 fixture must remain within its signed range; a bytes4 fixture needs exactly four bytes. Invalid values should be tested under rejection properties instead.
Keep the schema fixed and explicit
Encode the generated values with known types and decode with those same types. Raw bytes do not carry the complete ABI schema themselves.
Compare values losslessly
Normalize harmless representation differences without converting large integers through unsafe floating-point numbers. Preserve byte sequence lengths.
Add independent byte fixtures
One library’s encoder and decoder can share a mistake. Known expected words and another implementation provide additional evidence beyond a round trip.
Define the test
typed values → encode → bytes → decode → typed values
assert equality
then compare selected fixtures with independently calculated words
Test plans are framework-neutral unless labeled as complete Solidity or JavaScript. Use a local test environment and no real funds.