Overview

Smart contracts emit event logs when certain predefined actions are completed. The emitted event logs are stored on the blockchain and are publicly accessible. Event logs are an important tool for smart contract developers to communicate with the outside world, as well as for data analysts to keep track of what happens inside of a smart contract.

For example, the TRC20 standard defines the Transfer event, which is emitted every time a token transfer occurs. The event log contains the sender, the recipient and the amount of tokens transferred.

event Transfer(address indexed from, address indexed to, uint256 value);

Decoded event logs always originate from the fields topic0, topic1, topic2, topic3 and data in the logs table.

Event Logs in Dune

In Dune, we store all event logs of decoded smart contracts in separate tables.

The structure published in these logs is predefined by the developer of the smart contract, the content is dynamically created during the transaction.

Logs are useful for monitoring, alerting and in general keeping track of what happens inside of a smart contract. Logs are your best friend as a data analyst since they reliably present you with data that is intended to be analyzed post factum. If you ever want to see which logs can be emitted by a smart contract, you can simply search for the keyword emit in the source code of the smart contract.

We will decode all event logs for smart contracts into tables named accordingly to this schema:

[projectname_blockchain].[contractName]_evt_[eventName]