← Glossary
Glossary

Event log

An event log is a record a smart contract writes while a transaction runs, such as an ERC-20 Transfer or a Uniswap Swap. On EVM chains a log names the contract, carries up to four topics and a data field, and sits in the transaction’s receipt. Contracts cannot read logs, but anyone reading the chain can.

In BlockJuice

BlockJuice reads event logs with stream sources, which read blocks in order through SQD Portal and keep the logs they need. evm-erc20-transfers keeps the Transfer logs of the tokens you list. evm-uniswap-v2, -v3 and -v4 keep the pool creations and Swaps of Uniswap pools that trade those tokens. evm-chainlink-price-feeds keeps the AnswerUpdated log a Chainlink aggregator emits for each round.

The id of a Transfer or Swap log is its place on its chain, <block>:<logIndex>, so a log loaded twice stays one row. analytics.erc20_transfers has one row per Transfer log, with its tx_hash and log_index.

A log says only what the contract chose to emit. An AnswerUpdated log names no feed, so the seed chainlink_feeds.csv maps each aggregator to its feed and decimals. Before anyone writes SQL against a protocol, its contracts, events and ABIs go into catalog/protocols/<name>/, each proven on a real transaction. The example answer on the home page counted one pool’s 42 Swap logs again, straight from SQD Portal, and got the same 42 as the by-pool analysis.

Example

Each row of analytics.erc20_transfers is one Transfer log. This query lists the latest on Base, with the transaction and the log’s index in it.

select block_timestamp, tx_hash, log_index, token, from_address, to_address, value
from analytics.erc20_transfers
where chain = 'base'
order by block_timestamp desc
limit 20