Logs

Logs (or event logs), is a way for smart contracts to communicate with the outside world by "documenting" small pieces of information. Event logs allow other people to know that something has happened without them having to query the contract directly.

The most common form of event logs today are ERC20 (and ERC721) token transfer events.

To learn more, please refer to the following articles:

Sample Query

Querying the event logs from the example given below.

select *
  from ethereum.raw.logs
where block_number = '15543975'
and transaction_hash ='0x9068357001dc45c59a0c0383860f25fd64daeef205f723c5cbd980f280baca38'

Table Columns

The example used is a USDC transfer event which is part of a Uniswap swap transaction, between ETH and USDC.

Column NameDescriptionExample

block_timestamp

The time when the block that contains this log was included on the blockchain.

2022-09-16 04:59:59

block_number

The length of the chain, in blocks.

15543975

block_hash

Unique identifier of the block that includes this log.

0xe3eb6f24b34ab179646608ca100a3cd1d2fd1144f83544d029c0352429371b6d

address

The address of the contract that emitted this log.

0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 (In this example, this is the USDC contract address)

data

Unindexed data containing further information of the event, encoded in hex.

0x000000000000000000000000000000000000000000000000000000001dcd6500

topic0

The keccak256 hash of a flattened event signature string.

0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef (This is the token_transfer event)

topic1

First indexed topic of the event.

0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640

topic2

Second indexed topic of the event

0x7e63870ac9cb1491928e3c8922c19b2595331ac9

topic3

Third indexed topic of the event.

null

log_index

The position of this log in the block that it belongs to. The first log has index 0.

121

transaction_hash

Unique identifier of the transaction that this log belongs to.

0x9068357001dc45c59a0c0383860f25fd64daeef205f723c5cbd980f280baca38

transaction_index

The position of this transaction in the block that it belongs to. The first transaction has index 0.

62

Last updated