Build a reusable, production-grade blockchain indexing platform that provides:
- Canonical on-chain data (source of truth)
- Derived protocol-level insights (modular & extensible)
- High-performance APIs for downstream applications
This repo is NOT an intelligence system (Argus). This is the data foundation layer.
Separate:
- Truth Layer (Core Indexer) — raw, canonical blockchain data
- Derived Layer (Protocol Modules) — decoded, interpretable events
1. Core Indexer Layer (Always Present)
- Block ingestion
- Transactions & receipts
- Logs
- ERC-20 transfers
- ERC-721 ownership
- ERC-1155 balances
- NFT metadata pipeline
- Data integrity & reconciliation
- Read models (holdings, stats, summaries)
- Public API with Swagger docs
2. Protocol Decoder Layer (Modular & Pluggable)
- DEX swaps (Uniswap V2 implemented)
- Lending activity
- NFT marketplace events
- Bridges / cross-chain
- Vault interactions
- Custom contracts
- Truth vs Derived — protocol data is always rebuildable, reorg-safe, and decoupled from ingestion
- Modularity — each protocol is an isolated module implementing
ProtocolDecoderinterface - Replayability — backfills, reorg handling, and full rebuilds supported
- Performance First — partition large tables, composite indexes, cursor pagination, read models
Status: COMPLETE
- Block ingestion pipeline
- Transactions + receipts
- Logs ingestion
- ERC-20 transfer decoding
- Token metadata discovery (name, symbol, decimals via RPC)
- Checkpoint-based resumable sync
- Confirmation depth (default 6 blocks)
- Idempotent processing (INSERT ON CONFLICT DO NOTHING)
- Backfill system with pause/resume/progress tracking
- Reorg detection (parent hash validation) + rollback + audit trail
- Partitioned tables (transactions, receipts, logs, token_transfers, nft_transfers)
- Partition manager service (auto-creates partitions ahead of sync)
- Composite indexes for address lookups (from_address, to_address + block_number DESC)
- Read models: address_summaries, token_stats
- MetricsService (counters, gauges, rate tracking, error recording)
- Admin status/metrics/checkpoints/reorgs endpoints
- Search endpoint (tx hash, block number/hash, address)
- Response DTOs with Swagger decorators
- Validation pipes (class-validator/class-transformer)
- Feature-based NestJS module organization
- 87 integration + unit tests
Status: COMPLETE
- Transfer decoding (4-topic Transfer logs)
- Contract standard detection (ERC-165 supportsInterface probing)
- Contract standard persistence (contract_standards table)
- erc721_ownership table — PK (token_address, token_id), exactly one owner
- Ownership updates: mint/transfer/burn
- Reorg-safe rollback of ownership
- TransferSingle decoding (ABI decode from data field)
- TransferBatch decoding (expand arrays into individual rows)
- erc1155_balances table — PK (token_address, token_id, owner_address)
- Balance tracking: increment/decrement with quantity
- Burn: delete row when balance reaches 0
- nft_token_metadata table with fetch status (PENDING/FETCHING/SUCCESS/FAILED/RETRYABLE)
- NftMetadataService — tokenURI fetch, IPFS/Arweave/data URI normalization
- Queue-backed metadata worker (Bull NFT_METADATA queue)
- Fire-and-forget from decoder — never blocks ingestion
- address_nft_holdings — fast lookup of NFTs held by address
- nft_contract_stats — collection-level transfer counts, holder counts
- Incremental updates during decode/backfill
- Cursor pagination on all NFT transfer history endpoints
- NftReconciliationService — validate + rebuild all derived tables
- Rebuild order: nft_transfers → ownership/balances → holdings → stats
- Admin endpoints: POST /admin/nfts/reconcile, GET /admin/nfts/validate
- Drift detection: ownership mismatches, holdings gaps, stats errors
- dryRun mode for validation without mutation
- GET /nfts/collections/:address/transfers (cursor paginated)
- GET /nfts/collections/:address/tokens/:tokenId (metadata + owners)
- GET /nfts/collections/:address/tokens/:tokenId/transfers
- GET /nfts/collections/:address/tokens/:tokenId/owners
- GET /addresses/:address/nfts (from holdings read model)
- GET /addresses/:address/nft-transfers (cursor paginated)
Status: COMPLETE
- ProtocolDecoder interface (decodeBlock, rollbackFrom, rebuild)
- ProtocolRegistryService (register, decodeBlock, rollbackFrom)
- Self-registration via onModuleInit
- protocol_contracts table (cross-protocol contract registry)
- dex_pairs table (pair metadata: token0, token1, factory)
- dex_swaps table (normalized swap events)
- Integrated into decode worker queue processor
- Integrated into backfill runner (inline decode)
- Reorg rollback for protocol-derived tables
- Protocol API: GET /protocols/dex/swaps, /pairs, /addresses/:address/dex-swaps
- Swap event decoding (topic0 = 0xd78ad95f...)
- Pair detection: memory cache → DB → RPC probe (token0/token1/factory)
- Persistence in dex_swaps + dex_pairs + protocol_contracts
- Idempotent (orIgnore on unique tx_hash + log_index)
- Mint / Burn (LP) events
- Sync event for reserve tracking
- Approval(address indexed owner, address indexed spender, uint256 value) decoding
- token_approvals table (historical events, unique on tx_hash + log_index)
- token_allowances_current table — PK (token_address, owner_address, spender_address)
- Erc20ApprovalDecoderService — 3-topic Approval logs, value in data
- Inline decode in backfill runner
- Reorg rollback for approvals + allowances
- API: GET /tokens/:address/allowance/:owner/:spender
- API: GET /addresses/:address/approvals (paginated history)
- API: GET /addresses/:address/allowances (current state)
- Swap(address,address,int256,int256,uint160,uint128,int24) decoding
- Pool detection: memory cache → DB (dex_pairs) → RPC probe (token0/token1/fee/factory)
- Reuse dex_swaps with protocol_name = UNISWAP_V3
- Signed amount mapping: positive → amountIn, negative → amountOut
- Self-registering via ProtocolDecoder + onModuleInit
- Inline decode in backfill runner
- Idempotent (orIgnore on unique tx_hash + log_index)
- Liquidity position tracking (optional, future)
Seaport (OpenSea):
- OrderFulfilled event decoding (nested SpentItem/ReceivedItem struct arrays)
- nft_sales table (collection, tokenId, seller, buyer, paymentToken, totalPrice)
- Sale direction detection: offer NFT + consideration ETH/ERC20 = sell, vice versa = buy
- Price extraction: sum consideration payments to seller
Blur:
- OrdersMatched event decoding (nested Order/Input struct pairs)
- Reuses nft_sales table with protocol_name = BLUR
- Seller/buyer determination from sell/buy order sides + maker/taker roles
Shared:
- Self-registering via ProtocolDecoder + onModuleInit
- Reorg rollback for both protocols
- API: GET /nfts/collections/:address/sales (cursor paginated)
- API: GET /addresses/:address/nft-sales (cursor paginated)
- lending_events table (generic, reusable for Compound/Aave/etc.)
- AaveDecoder — Deposit/Supply, Withdraw, Borrow, Repay, LiquidationCall
- Supports both Aave V2 (Deposit) and V3 (Supply) event signatures
- Liquidation decoding with collateralAsset, debtToCover, liquidatedCollateral, liquidator
- Self-registering via ProtocolDecoder + onModuleInit
- Inline in backfill via protocol registry
- Reorg rollback
- API: GET /protocols/lending/events?protocolName=&eventType=&assetAddress= (cursor paginated)
- API: GET /addresses/:address/lending (cursor paginated)
- CompoundDecoder — Mint (→DEPOSIT), Redeem (→WITHDRAW), Borrow, RepayBorrow, LiquidateBorrow
- Reuses lending_events table with protocol_name = COMPOUND
- Compound events use non-indexed params (all in data) — different decode pattern from Aave
- Self-registering, backfill-integrated, reorg-safe
- Erc4626Decoder — Deposit and Withdraw events
- Reuses lending_events table with protocol_name = ERC4626
- Self-registering, backfill-integrated, reorg-safe
- LayerZero
- Hop
- Stargate
- Native L2 bridges
- Swaps
- Liquidity events
- Multi-token pool support
- Position lifecycle
- Liquidations
- Name registration
- Transfers
- 1inch
- 0x
- Paraswap Note: Requires multi-call reconstruction
- Transaction execution
- Module interactions
- UserOperation decoding
- Chain-aware entity design (chain_id column or separate schemas)
- Multiple chain provider instances
- Per-chain workers and checkpoints
- debug_traceBlockByNumber or trace_block
- internal_transactions table
- Requires archive node
- Store verified contract ABIs
- Auto-decode all events for verified contracts
- Next.js 15 with App Router + Tailwind CSS v4
- Home page: stats dashboard + latest blocks + search bar
- Block list page: block table (age, miner, gas, base fee)
- Block detail page: header fields + transaction table
- Transaction detail page: status, from/to, value, gas, token transfers, event logs
- Address page with 6 tabs: Transactions, Tokens, NFTs, DEX Swaps, Allowances, Lending
- Token detail page: symbol, decimals, standard, recent transfers
- NFT collection page: transfer history table
- NFT token detail page: metadata image, description, owners, transfer history
- Search: auto-redirect to block/tx/address
- Pagination component (Previous/Next with page numbers)
- Dark theme, responsive, server-rendered
- Real-time updates via WebSocket
Do NOT include:
- Wallet intelligence scoring
- Smart money detection
- Alerting systems
- Trading strategies
- Machine learning models
- Cross-wallet behavioral analysis
| Difficulty | Protocols |
|---|---|
| Easy | |
| Medium | |
| Hard | Aggregators, Router-based swaps |
Core stability (Phase 1)DONENFT support (Phase 2)DONEProtocol framework + Uniswap V2 (Phase 3)DONEERC-20 Approvals + Uniswap V3DONENFT marketplaces (Seaport + Blur)DONELending: Aave + CompoundDONEERC-4626 VaultsDONE- Bridges ← NEXT
- Advanced protocols