An ABI decoder is a tool used to translate the data in a blockchain event or function calls into human-readable information.
It works by using the ABI definition of a smart contract to map the raw hexadecimal data in events or function calls to the actual data types and values specified in the ABI.
For example, instead of showing a string of hexadecimal characters for the signature of the event
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef using ABI you would see the actual name of the event
Transfer. You would also see the indexed parameters of this event. Since it is a transfer event for ERC-20 tokens, you would see that topic 1 stands for
topic 2 stand for
to. Notice that the Transfer event below has more than 2 parameters, but it is common to refer primarily to indexed parameters, and so do we as well.
Transfer (index_topic_1 address from, index_topic_2 address to, uint256 value)
An ABI decoder can be helpful for developers and users to understand the details of a blockchain transaction or event, as it provides a more user-friendly representation of the data. It can also help in debugging issues with smart contracts, as it makes it easier to identify any unexpected values or errors in the data.
Currently ABI decoder only supports events, however, function calls are coming soon.
For example, suppose a smart contract has an event that is triggered whenever a user transfers funds. In that case, the raw data in the blockchain for this event might look like a string of hexadecimal characters that is difficult for a human to interpret. An ABI decoder, using the contract's ABI definition, can decode this data and display the actual values of the event parameters, such as the sender's address, the recipient's address, and the number of funds transferred.
Set up an ABI
Setting up an ABI on Tsunami API is a simple process that can be accomplished in a few steps:
- Open your Harbour account
- Navigate to the ABI decoder
- Click the “+Upload new ABI” button
- Upload the ABI of a contract you want to monitor
- Select the events you want to be decoding
- Save your ABI decoder
ABI Decoder X Real Time Filters
We have integrated the ABI decoder into our Real Time Filters solution, so you can set up monitoring of your contract’s events and calls with less hustle and effort. Simply specify the contract you want to follow and upload its ABI. You will see the list of available events and calls of the contract and you will see their decoded names and parameters.
Read more about how to set up an ABI decoder in Real Time filters here.
As an example of where to get an ABI, if you plan to monitor a third-party contract, you can find their contract ABI on etherscan or similar services. You need to navigate to contract’s page, select contract tab and copy the contract ABI from there. For example, here is Uniswap’s ABI
ABI Decoder X More features are coming
ABI decoder is a useful tool and we have more features preparing behind the curtains. Follow our social media and documentation pages for updates.