The Flipside Engineering team developed a new tool we call the Universal Event Decoder. This tool has the power to decode nearly all Ethereum and EVM based chain log-events, even without a contract ABI.
The average Ethereum block contains over 326 log events. These log events alert that something worthy of tracking and reacting to has occurred in a contract or application.
The only problem is they look something like this 😞
And to do anything useful in analytics we need them to look a bit more like this 😋
Decoding the raw data above and getting to that readable table requires what’s called an ABI, also known as an Application Binary Interface…😴…it’s much fancier than it sounds. Think of an ABI as a map to a puzzle telling you how to interpret and decode the raw data above.
Developers can choose to publish ABIs for their contract addresses to sites like Github, Gitlab, or Etherscan. Typically when decoding the above raw data one would first download the ABI for the contract address “0x2791bca1f2de4661ed88a30c99a7a9449aa84174” and then use the downloaded ABI to decode the raw data.
The problem is developers don’t always publish ABIs for every contract address. If they do upload an ABI to Github or Gitlab, the contract doesn’t always have a specific on-chain address associated with itself.
Without an ABI, those 326 log events per block are not telling us much. So what can we do if we don’t have an ABI for every contract address (besides manually finding the ABI and decoding it 🙄)?
Enter the Universal Event Decoder
Rather than think of each ABI as unique to a contract, what if we broke up an ABI into smaller components — generating something akin to an ABI per event. With an ABI per event, we can hash it, and build a look-up index.
Since developers frequently re-use each other’s code, in particular Event signatures, we can also re-use ABIs to decode data across Ethereum contracts and all EVM compatible chains. With enough event-level ABIs indexed there is a pretty high probability we’ll be able to decode any raw event data we encounter.
To date, Flipside’s engineering team has indexed almost half a million ABIs and it’s growing every single day.
This has some pretty immense implications.
- The majority of contracts now no longer require any manual decoding or wait for a contract-specific ABI to be published.
- Any EVM compatible chain or layer 2 can be decoded using the same index of ABIs.
- Any ABI we encounter that’s not associated with a specific address can be indexed by Flipside and used to decode events. This is immensely helpful when pulling from open-source repositories where most contracts and ABIs don’t have a specific address associated.
Most importantly, this means you now will have access to a lot more decoded event data when creating queries on Velocity!
Give it a try yourself by querying the `ethereum.events_emitted` table in Velocity. Universal decoder support coming soon for multiple layer 2s 🥳
Access the data:
- First, sign up or log in to Velocity
- Then create a new collection by clicking on the top right “new” button
- Then create a new query
- Finally, find the `ethereum.events_emitted` table on the left hand side.