Before You Start
Finding a Contract’s ABI
These functions require the ABI for a single event or function, not the entire contract ABI. To find the ABI for a specific event or function:- Go to the contract’s page on Etherscan (or the relevant chain’s block explorer).
- Navigate to Contract > Code > Contract ABI.
- Locate the JSON object for the specific event or function you want to decode.
- Copy that single JSON object, not the full array.
Finding the topic0 for an Event
topic0 is the keccak256 hash of the event signature (name and parameter types). Use it to filter logs tables for specific events.
To find a topic0:
- Open an example transaction on a block explorer.
- Go to the Logs tab.
- Identify the event and copy the value in the topic0 field.

Finding the MethodId for a Function Call
The MethodId is the first 4 bytes of the keccak256 hash of the function signature. Use it withstarts_with(input, <MethodId>) to filter traces tables for specific function calls.
To find a MethodId:
- Open an example transaction on a block explorer.
- In the Overview tab, click Click to show more.
- Copy the MethodId from the Input Data field.

Function Reference
decode_evm_event()
decode_evm_event(abi, input [, topics [, data [, null_on_error]]])
Decodes EVM events according to the provided ABI. Returns each decoded parameter as a separate column.
Arguments
| Argument | Required | Type | Default | Description |
|---|---|---|---|---|
abi | Yes | varchar | Event specification in JSON format. Must be constant at analysis time. Each input in the ABI produces one output column. | |
input | Yes | table | Table or subquery providing topics and data columns. Must be preceded with the TABLE keyword. | |
topics | No | descriptor | DESCRIPTOR(topic0, topic1, topic2, topic3) | Specifies which columns contain the event topics. Null topics are ignored. |
data | No | descriptor | DESCRIPTOR(data) | Specifies which column contains the event data. |
null_on_error | No | boolean | true | When true, decoding errors produce null values. When false, errors are raised. |
Output
One column per parameter defined in the ABI inputs. Column names match the ABI parameter names, or default to_arg0, _arg1, etc. Columns are ordered with indexed inputs first.
All columns from the input table are passed through. The returned table contains one column for each ABI argument, followed by all columns from the input table.
Examples
decode_evm_function_call()
decode_evm_function_call(abi, data [, input [, output [, null_on_error]]])
Decodes EVM function calls according to the provided ABI. Returns each decoded input and output parameter as separate columns.
Arguments
| Argument | Required | Type | Default | Description |
|---|---|---|---|---|
abi | Yes | varchar | Function call specification in JSON format. Must be constant at analysis time. Each input and output in the ABI produces one output column. | |
data | Yes | table | Table or subquery providing input and output columns. Must be preceded with the TABLE keyword. | |
input | No | descriptor | DESCRIPTOR(input) | Specifies which column contains the function call input bytes. |
output | No | descriptor | DESCRIPTOR(output) | Specifies which column contains the function call output bytes. |
null_on_error | No | boolean | true | When true, decoding errors produce null values. When false, errors are raised. |
Output
One column per input and output defined in the ABI. Column names match the ABI parameter names, or default to_input0, _input1, _output0, _output1, etc. If two arguments share the same name, the last declared argument takes precedence.
All columns from the data table are passed through. The returned table contains one column for each ABI argument, followed by all columns from the data table.