In this track: Read logs and failures
advanced · 4 MIN READ

Indexed strings and hashed topics

An indexed string topic is a digest, not recoverable text.

LET’S PICTURE IT

A fingerprint can confirm a candidate document without containing the document itself.

SEE IT FOR YOURSELF
From an emitted Transfer event to a receipt logStep 1 / 4
From an emitted Transfer event to a receipt logToken executionApply coded rulesUpdate relevant balancesEmit Transferfrom · to · valueA structured logA reverted execution portion does not keep its emitted logsTransfer(address,address,uint256)Topic 0: 0xddf252ad…b3efFull digest · 32 bytesEvent topic zero and a function selector use different lengthsTopic 1from addressIndexedTopic 2to addressIndexedDataraw valueNot indexedThis diagram is specifically the common ERC-20 Transfer layoutReceipt logTopics + dataBlock contextApplication viewDecoded fieldsImplementation still mattersThe local event tool does not query or authenticate a deployed token

A token implementation may update balances and emit its standard Transfer event. State and the emitted record are related but distinct.

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

Identify the dynamic indexed value

For an indexed string, the topic holds a Keccak-256 hash of the special indexed-event encoding. It does not contain an offset to a string tail.

Use the correct hashing input

A direct indexed string uses its content bytes for this special encoding. More complex indexed structures have additional rules, so ordinary abi.encode is not a universal replacement.

Understand the information loss

A decoder cannot reconstruct arbitrary original text from a digest. If you already know a candidate string, you can compute its expected topic and compare the bytes.

Emit a readable companion when needed

A contract can include both an indexed digest-bearing field and a non-indexed copy when applications need filtering and readable content. That is a deliberate event design choice.

Inspect the example

event Label(string indexed text);
text candidate: hello
expected indexed topic: 0x1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36deac8

This topic is the digest of the candidate UTF-8 bytes, without an ABI offset or length word.

TURN UNDERSTANDING INTO PRACTICEOpen the Event decoder →
QUICK CHECK · NO PRESSURE

Can a generic decoder recover an arbitrary indexed string from its hash?

Your progress stays in this browser.
Keep exploring the original referenceSolidity documentation ↗

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