Data Stack
Sarafu Data

Sarafu Data Guide

This database (chain_data) contains indexed Ethereum blockchain events.

Schema Overview

Every event row links back to a tx row via tx_id. Contract addresses in event tables can be joined to tokens or pools for human-readable metadata.

Table Reference

tx — Transaction records

ColumnTypeDescription
idINTInternal surrogate key.
tx_hashVARCHAR(66)Full Ethereum transaction hash (0x + 64 hex chars). Unique.
block_numberINTBlock number this transaction was included in.
date_blockTIMESTAMPBlock timestamp in UTC.
successBOOLEANtrue if the transaction was not reverted on-chain.

token_transfer — ERC-20 Transfer events

ColumnTypeDescription
idINTSurrogate key.
tx_idINTFK → tx.id.
sender_addressVARCHAR(42)Address that sent tokens.
recipient_addressVARCHAR(42)Address that received tokens.
contract_addressVARCHAR(42)Token contract. Join to tokens for name/symbol.
transfer_valueNUMERICRaw on-chain integer amount (divide by 10^token_decimals).
log_indexBIGINTPosition of this log entry within the transaction. Used together with tx_id to uniquely identify the event.

token_mint — Token minting events

ColumnTypeDescription
idINTSurrogate key.
tx_idINTFK → tx.id.
minter_addressVARCHAR(42)Address that triggered the mint (usually a privileged operator).
recipient_addressVARCHAR(42)Address that received the newly minted tokens.
contract_addressVARCHAR(42)Token contract.
mint_valueNUMERICRaw on-chain integer amount.
log_indexBIGINTLog position within the transaction.

token_burn — Token burn / sink events

ColumnTypeDescription
idINTSurrogate key.
tx_idINTFK → tx.id.
burner_addressVARCHAR(42)Address that burned tokens.
contract_addressVARCHAR(42)Token contract.
burn_valueNUMERICRaw on-chain integer amount.
log_indexBIGINTLog position within the transaction.

faucet_give — Faucet distribution events

ColumnTypeDescription
idINTSurrogate key.
tx_idINTFK → tx.id.
token_addressVARCHAR(42)Address of the token being distributed.
recipient_addressVARCHAR(42)Address that received the faucet payout.
contract_addressVARCHAR(42)Faucet contract that emitted the event.
give_valueNUMERICRaw on-chain integer amount.
log_indexBIGINTLog position within the transaction.

pool_swap — Liquidity pool swap events

ColumnTypeDescription
idINTSurrogate key.
tx_idINTFK → tx.id.
initiator_addressVARCHAR(42)Address that initiated the swap.
token_in_addressVARCHAR(42)Token being sold into the pool.
token_out_addressVARCHAR(42)Token being bought out of the pool.
in_valueNUMERICRaw amount of token_in sold.
out_valueNUMERICRaw amount of token_out received.
feeNUMERICRaw fee charged by the pool (same unit as in_value).
contract_addressVARCHAR(42)Pool contract. Join to pools for name/symbol.
log_indexBIGINTLog position within the transaction.

pool_deposit — Liquidity pool deposit events

ColumnTypeDescription
idINTSurrogate key.
tx_idINTFK → tx.id.
initiator_addressVARCHAR(42)Address depositing into the pool.
token_in_addressVARCHAR(42)Token being deposited.
contract_addressVARCHAR(42)Pool contract.
in_valueNUMERICRaw on-chain integer amount deposited.
log_indexBIGINTLog position within the transaction.

ownership_change — Contract ownership transfer events

ColumnTypeDescription
idINTSurrogate key.
tx_idINTFK → tx.id.
previous_ownerVARCHAR(42)Address that previously owned the contract.
new_ownerVARCHAR(42)Address that now owns the contract.
contract_addressVARCHAR(42)Contract whose ownership changed.
log_indexBIGINTLog position within the transaction.

tokens — Token metadata

ColumnTypeDescription
idINTSurrogate key.
contract_addressVARCHAR(42)Unique token contract address.
token_nameTEXTHuman-readable name (e.g. Grassroots Economics).
token_symbolTEXTTicker symbol (e.g. GE).
token_decimalsINTDecimal places. Divide raw values by 10^token_decimals for human units.
sink_addressVARCHAR(42)Designated sink/burn address for this token, if any.
removedBOOLEANtrue if the token has been de-listed from the indexer.

pools — Pool metadata

ColumnTypeDescription
idINTSurrogate key.
contract_addressVARCHAR(42)Unique pool contract address.
pool_nameTEXTHuman-readable pool name.
pool_symbolTEXTPool ticker symbol.
removedBOOLEANtrue if the pool has been de-listed from the indexer.

Conventions

  • Addresses are checksummed Ethereum addresses i.e. hexadecimal with 0x prefix, 42 characters total.
  • Values are raw on-chain integers. To convert to a human-readable amount:
    transfer_value / power(10, t.token_decimals)
  • Timestamps (date_block) are in UTC.
  • Idempotency: each event is stored at most once, identified by (tx_id, ..., log_index). Duplicate on-chain events within the same transaction are deduplicated using the log index.
  • Removed flag: rows in tokens and pools with removed = true are contracts that the indexer has stopped tracking. They are kept for historical completeness.

Restoring the Dump

Option A: Docker (recommended for local analysis)

docker run -d \
  --name chain-data \
  -e POSTGRES_PASSWORD=password \
  -e POSTGRES_DB=chain_data \
  -p 5432:5432 \
  postgres:18-alpine
 
psql -h localhost -U postgres -d chain_data -f /path/to/dump.sql

Option B: Existing Postgres instance

# Create the database first
createdb -h localhost -U postgres chain_data
# Or plain SQL
psql -h localhost -U postgres -d chain_data -f /path/to/dump.sql

Querying with DuckDB

DuckDB (opens in a new tab) is a fast, in-process analytical SQL engine that runs locally with no server setup. It is well suited for ad-hoc analysis of this dataset.