Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Database Schema

The per-chain transactions store (mevlog-txs-v1-{chain_id}.db) has three tables you can query with query --sql.

Column hints below are not part of the type, but tell you how to write working queries:

HintMeaning
u25632-byte big-endian BLOB; use u256_sum / u256_mul / u256_add / u256_to_dec
addr20-byte address BLOB; predicates need X'..' literals
hash32-byte hash BLOB
selector4-byte method selector BLOB
unixunix epoch seconds
0/1SQLite has no boolean; stored as 0 / 1

A ? after a column name means it is nullable; all other columns are NOT NULL. Addresses and hashes in predicates must be written as blob literals (X'a0b8...').

transactions

ColumnTypeHint
block_numberBIGINT
tx_indexBIGINT
tx_hashBLOBhash
nonceBIGINT
from_addressBLOBaddr
to_address?BLOBaddr
valueBLOBu256
gas_limitBIGINT
gas_usedBIGINT
effective_gas_priceBIGINT
gas_priceBIGINT
max_fee_per_gasBIGINT
max_priority_fee_per_gasBIGINT
transaction_type?BIGINT
successBOOLEAN0/1
coinbase_transfer?BLOBu256
signature_hash?BLOBselector
signature?TEXT

blocks

A row exists for every indexed block (even empty ones), so this table doubles as the indexed-block tracker.

ColumnTypeHint
block_numberINTEGER
block_hashBLOBhash
minerBLOBaddr
gas_usedBIGINT
timestampBIGINTunix
base_fee_per_gas?BIGINT

logs

ColumnTypeHint
block_numberBIGINT
tx_indexBIGINT
log_indexBIGINT
addressBLOBaddr
topic0?BLOBhash
topic1?BLOBhash
topic2?BLOBhash
topic3?BLOBhash
dataBLOB
erc20_amount?BLOBu256
signature?TEXT

Signatures DB

The separate mevlog-sqlite-v5.db holds method/event signatures and chain metadata. It is downloaded prebuilt from a CDN and is not queried via --sql.