Decode your Events and Calls for Historical and Real-Time data

Background

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 from and 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)

Use cases

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:

  1. Open your Harbour account
  2. Navigate to the ABI decoder
  3. Click the “+Upload new ABI” button
  4. Upload the ABI of a contract you want to monitor
  5. Select the events you want to be decoding
  6. Save your ABI decoder

📘

Where to get an ABI?

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 Real-Time Filters

We have integrated the ABI decoder into our Real Time Filters solution so that 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.

ABI Decoder X historical Events endpoint

You can use the ABI decoder to decode historical Events on the go with our new endpoint Decoded Data Events. Make sure to pass the ABI in the body of the request.

It works similarly to our Events endpoint, but here you can get the actual name of the event with indexed params.

ABI Decoder X historical Calls endpoint

You can use the ABI decoder to decode historical Calls on the go with our new endpoint Decoded Data Calls.

It works similarly to our Calls endpoint, but here you can get the actual name of the call with indexed params. Make sure to pass the ABI in the body of the request.

ABI Decoder X More features are coming :soon:

ABI decoder is a useful tool and we have more features prepared behind the curtains. Follow our social media and documentation pages for updates.