spb/coinexplorer Public MIT
Self-hosted, zero-API-key explorer for stablecoins and major crypto.
Python 60.3%
HTML 23.6%
JavaScript 8.1%
CSS 6.8%
SQL 1%
1-- Author: Simon-Pierre Boucher2-- Mail: contact@spboucher.ai3-- Canonical schema (auto-derived from indexer/db.py SCHEMA).4-- Runtime auto-applies this on connect; file kept for manual PostgreSQL setup.56CREATE TABLE IF NOT EXISTS chains (7 chain TEXT PRIMARY KEY,8 family TEXT,9 chain_id BIGINT10);1112CREATE TABLE IF NOT EXISTS transfers (13 chain TEXT NOT NULL,14 block BIGINT NOT NULL,15 block_hash TEXT,16 tx_hash TEXT NOT NULL,17 log_index INTEGER NOT NULL,18 timestamp BIGINT,19 token TEXT NOT NULL,20 symbol TEXT,21 "from" TEXT,22 "to" TEXT,23 amount TEXT,24 decimals INTEGER,25 PRIMARY KEY (chain, tx_hash, log_index)26);27CREATE INDEX IF NOT EXISTS idx_transfers_token_block ON transfers (chain, token, block);28CREATE INDEX IF NOT EXISTS idx_transfers_ts ON transfers (symbol, timestamp);29CREATE INDEX IF NOT EXISTS idx_transfers_from ON transfers ("from");30CREATE INDEX IF NOT EXISTS idx_transfers_to ON transfers ("to");3132CREATE TABLE IF NOT EXISTS cursors (33 chain TEXT PRIMARY KEY,34 last_block BIGINT NOT NULL,35 last_hash TEXT,36 backfill_block BIGINT,37 head_block BIGINT38);3940CREATE TABLE IF NOT EXISTS rpc_health (41 chain TEXT NOT NULL,42 url TEXT NOT NULL,43 score REAL,44 ok INTEGER,45 fail INTEGER,46 latency_ms REAL,47 cooldown_s REAL,48 updated BIGINT,49 PRIMARY KEY (chain, url)50);5152CREATE TABLE IF NOT EXISTS tokens (53 chain TEXT NOT NULL,54 address TEXT NOT NULL,55 symbol TEXT,56 decimals INTEGER,57 native INTEGER,58 PRIMARY KEY (chain, address)59);6061CREATE TABLE IF NOT EXISTS supply_snapshots (62 chain TEXT NOT NULL,63 token TEXT NOT NULL,64 symbol TEXT,65 supply TEXT,66 decimals INTEGER,67 timestamp BIGINT NOT NULL,68 PRIMARY KEY (chain, token, timestamp)69);70CREATE INDEX IF NOT EXISTS idx_supply_ts ON supply_snapshots (symbol, timestamp);71