If you haven't worked through the earlier parts of this guide, check them out before continuing with this lesson.
In the last lesson, we learnt how to build queries on raw transaction data. Now, we'll dive into raw Logs and Traces data.
Understanding Traces
Every transaction triggers a number of small changes in the state of the blockchain (value transfers, instructions sent, .etc)
Information about the execution of these small actions can be retrieved as traces.
There are three types of trace actions. A single transaction can include any combination of these:
- CREATE: Create a smart contract
- SUICIDE: Destroy a smart contract
- CALL: Transfer native token (eg. ETH, MATIC, BNB) or call a function on a smart contract
Dune stores trace information for every EVM chain.
Application 1: Contract Creation
Many protocols use a ‘factory’ contract to create new smart contracts. For example, on Uniswap, every liquidity pool (e.g. the ETH/USD trading pool) is a smart contract created by Uniswap’s factory.
Another example of a protocol that uses factories is Partybid. Partybid makes it easy to create DAOs that crowdfund, buy NFTs, and vote on treasury decisions. Every DAO created using Partybid has a smart contract deployed by Partybid’s factory.
We can use the Ethereum Traces table on Dune to find out how many DAO contracts have been created with Partybid.
(1) Give GPT the schema of the ethereum.traces
table using this prompt: