Negative values use two’s-complement and sign extension.
LET’S PICTURE IT
A fixed-width signed notation needs a rule for carrying the negative sign into a larger word.
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.
Start with the declared range
int8 supports −128 through 127, while int256 has a much larger signed range. A value outside the declared range should be rejected rather than silently reinterpreted.
Use two’s-complement bits
For a negative number, standard ABI encoding extends the sign into the thirty-two-byte word. The encoding of −1 therefore has every byte set to ff.
The schema changes interpretation
The same all-ff word read as uint256 is a very large positive number. Raw bits do not tell a decoder whether the intended type was signed or unsigned.
Test a boundary
Compare int8 values −1 and 127 in a typed encoder. The first sign-extends; the positive value is zero-padded. Do not infer sign from a display name alone.
Follow the bytes
types: int8
values: ["-1"]
no function selector prefix
word 0 · argument offset 0 bytes
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
A correct decoder needs the int8 schema, not merely the word length.