In this track: Build, test and reason
advanced · 4 MIN READ

Differential testing

Compare independent implementations on the same defined input.

LET’S PICTURE IT

Two independently built calculators can reveal a disagreement worth investigating.

SEE IT FOR YOURSELF
Build a transfer call from typed fieldsStep 1 / 4
Build a transfer call from typed fieldstransfer(address,uint256)Recipient: 0x0000…0001Raw amount: 100Diagram labels abbreviate addresses; the lab shows full bytes4-byte selectora9059cbbEach box is one byte; this prefix is not a 32-byte wordWord 0 · recipient address12 zero bytes20 address bytes000…0001Left padding preserves the lower-order address valueSelector4 bytesa9059cbbAddress32 bytesword 0Amount32 bytesword 1 → 0x644 + 32 + 32 = 68 bytesThe integer does not contain token decimals or market price

The standard transfer interface takes an address and a raw integer amount. This diagram uses address one and amount one hundred.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

Choose one precise specification

For ABI encoding, both implementations need the same canonical types and exact values. A mismatch in input schema is not an implementation disagreement.

Normalize only irrelevant formatting

Hex letter case may be display-only, but leading byte width and integer value can be meaningful. Do not erase a real mismatch during normalization.

Investigate both sides

Agreement is useful evidence; disagreement identifies a question. One implementation is not automatically correct merely because it is more familiar.

Retain reproduction details

Record library versions, schemas and complete inputs. Small deterministic fixtures make the result useful for debugging and regression checks.

Define the test

same typed input
→ implementation A bytes
→ independent implementation B bytes
compare and investigate any mismatch

Test plans are framework-neutral unless labeled as complete Solidity or JavaScript. Use a local test environment and no real funds.

QUICK CHECK · NO PRESSURE

Does disagreement automatically prove the newer implementation is wrong?

Your progress stays in this browser.
Keep exploring the original referenceethereum.org ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.