Skip to content
A global perspective on digital assetsGLOBAL PERSPECTIVE · LOCAL CONTEXT
ChainView BTC866CHAIN VIEW
Learn

Contract ABIs: Functions, Events and Custom Errors

An ABI tells tools how to encode calls, returns and events, but it does not prove the deployed bytecode matches the publication or that the contract was audited.

Read inEnglish简体中文繁體中文한국어РусскийالعربيةEspañol (México)Tiếng Việtไทย
Contract ABIs: Functions, Events and Custom Errors

Original topic illustration: ChainView BTC866 original topic diagram · ChainView BTC866 Editorial · CC BY 4.0

An ABI describes an interface, not trust

An ABI tells tools how to encode calls, returns and events, but it does not prove the deployed bytecode matches the publication or that the contract was audited. Verify address, chain, proxy implementation and source.

A public ABI can be stale or attached to the wrong address. Compare the implementation and source documentation first. Proxy entry points and business logic differ, and a wrong ABI can produce a plausible but incorrect function label. Readable output still needs an evidence trail.

An ABI describes how contract calls and outputs are encoded, but it does not prove that the deployed implementation matches a published description.

Use the complete function signature

Selectors derive from the complete typed signature. Overloads need exact types, and arrays and tuples follow specific encoding. Confirm units and decimals before reading raw hexadecimal values as amounts.

A selector contains only a limited number of bytes and cannot universally prove one function meaning. Use the complete signature, contract context and implementation together. Human-readable text in an unfamiliar signing request may omit important effects. Read-only examples provide a safer learning boundary.

A function selector and encoded parameters help a tool display a call, while overloaded functions require the complete typed signature for interpretation.

Separate event topics and data

Indexed fields occupy topics, and a dynamic indexed value may be a hash rather than recoverable text. Non-indexed fields are encoded in data. Record log position, transaction and contract instead of relying on a display label.

Events are not complete state snapshots. A Transfer log still needs the genuine asset contract and execution context. Hashed dynamic values cannot be reconstructed from nothing; names shown by a page may come from external indexing. Distinguish chain fields from a tool's inference in the citation.

Event topics, indexed parameters and data fields follow different encoding rules; dynamic indexed values can be hashes rather than recoverable plain text.

Interpret revert data carefully

Custom or standard errors can explain a rejected path, but missing ABI, proxy changes and state can limit interpretation. A revert does not prove malicious intent or guarantee a retry will work. Do not broadcast an unknown transaction just to test an error.

Contracts define their own error text, so a friendly message is not automatically trustworthy. Failed execution and gas charging have separate rules. Keep raw return data and block context during diagnosis rather than repeatedly increasing amounts or broadcasting variations to an unknown contract.

Revert data may decode as a custom error or standard message, but missing ABI, proxy configuration or changed state can limit interpretation; practice with harmless read-only examples.

Practise with read-only examples

Use harmless public calls and record selector, parameters, returns and events. Compare them with source documentation, keeping ABI version and block height. An ABI is a coding map, not a promise about money or authority.

A practice table can pair raw bytes, decoded value, source and limitation. Mark an unsupported type as undecoded instead of guessing to fill the table. Do not install an unknown decoder plugin. Publicly decodable business data still deserves a privacy and relevance check before republication.

A useful final exercise compares a tool's decoded read-only result with the same value exposed through a documented interface. Agreement supports that narrow interpretation, not the safety of every function in the contract. If they differ, inspect types, decimals, block references and implementation version first. This turns a decoding lesson into a reproducible diagnostic procedure while avoiding the dangerous shortcut of signing an unknown transaction simply to see what its readable label says.

For the practice record, organise function signature, encoded arguments, event fields and error data into concept, fictional input, observed result and limitation. Check units and timing step by step, distinguishing a mathematical result from a tool interpretation. Leave an uncertain field unresolved instead of guessing merely to complete the table. Learning does not require a live private key or a large transaction; preserving method and version is sufficient. Before carrying the lesson into a real service, recheck present software behaviour, charges and local eligibility. A walkthrough teaches a way to ask better questions rather than certifying every provider that uses similar labels.

Sources

  1. Solidity contract ABI specification (opens in a new tab)
  2. Solidity contract ABI specification (opens in a new tab)