Documentation Index
Fetch the complete documentation index at: https://docs.moralis.com/llms.txt
Use this file to discover all available pages before exploring further.
Question it answers
“Give me every raw event log of signature T (topic0), chain-wide, in on-chain order.”
The by-event-type mirror of Contract Logs — the same raw-log extraction, but keyed by the event signature (topic0) instead of the emitting contract. Use it to index one event across all contracts: every Transfer, every Approval, every Uniswap Swap — typically scoped to a block range.
What you get
One row per log, keyed by event signature. Same columns as Contract Logs —topic0…topic3, data, contract_address, tx_hash, and the (block_number, transaction_index, log_index) ordering tuple — but topic0 leads the sort key so a chain-wide “all logs of this signature” read is a contiguous range.
On-chain ordering
Every destination is keyedtopic0 first, then the on-chain tuple:
- ClickHouse —
ORDER BY (chain_id, topic0, block_number, transaction_index, log_index, …).topic0is low cardinality (one value per signature), so it’s a cheap, highly selective leading key. - Postgres / MySQL — a composite index on
(topic0, block_number, transaction_index, log_index);WHERE topic0 = T AND block_number BETWEEN … ORDER BY …is answered by an index range scan with no filesort.
topic0 (anonymous events) are filtered out — they have no signature to key on.
Optional: scope to a contract (topic0 + contract)
The primary key leads withtopic0, so “all Transfer logs emitted by contract X” prefix-scans to the signature and filters contract_address within it. Because a popular signature (Transfer, Approval) spans millions of contracts, an opt-in (topic0, contract_address, …) structure makes that read a tight (topic0, contract) range that stays sort-free and skips the signature’s other contracts. Shipped commented-out in each schema:
| Destination | Optional structure |
|---|---|
| Postgres | CREATE INDEX … (topic0, contract_address, block_number, transaction_index, log_index) |
| MySQL | ADD KEY (topic0, contract_address, block_number, transaction_index, log_index) |
| ClickHouse | A contract_address bloom_filter skip-index (light), or a projection sorted by (chain_id, topic0, contract_address, …) (sort-free, heavier) |
Destination
| Destination | Table | By-signature access |
|---|---|---|
| ClickHouse (first-class) | fact_logs | Prefix scan on (chain_id, topic0, …); read with FINAL |
| Postgres | topic_logs | Composite index (topic0, block_number, transaction_index, log_index) |
| MySQL | topic_logs | Composite key (topic0, block_number, transaction_index, log_index) |
block array → itemType = 'log', tx_hash recovered from the sibling transaction row; immutable append-only logs in a collapsing table).
Full schema
Identical columns to Contract Logs — the only difference is the sort key leads withtopic0. Keep the columns you need (see Schema & flexibility).
ClickHouse — fact_logs (topic0-keyed)
ClickHouse — fact_logs (topic0-keyed)
topic_logs table keyed (topic0, block_number, transaction_index, log_index), with the optional (topic0, contract_address, …) index commented out.Example reads
All logs of an event signature in a block range, in on-chain order (ClickHouse):Modes
Shipped defaults: ClickHousehybrid, Postgres / MySQL historical. For live/reorg-safe ingestion use ClickHouse.
EVM only
Like Contract Logs, this extracts EVM event logs (topic0…3 + data); Solana program logs are a different model.
Related
Contract Logs
The sibling — every log from one contract, keyed by emitter.
Onchain Event Indexing
The use case these raw-log recipes power.

