ZIndexer is a high-performance indexer for Solana Virtual Machine (SVM) networks, capable of subscribing to and indexing data from multiple networks simultaneously.
- Multi-Network Support: Index multiple SVM networks (mainnet, devnet, testnet, localnet) simultaneously
- Comprehensive Indexing:
- Automated Market Makers (AMMs)
- Metaplex NFTs and marketplaces
- Token transfers and balances
- Account balance changes
- Transactions and instructions
- Blocks and slots
- Account activity
- Real-time and Historical Modes: Choose between real-time indexing or historical backfilling
- Database Integration: High-performance storage and querying of indexed data with support for ClickHouse and QuestDB
- Interactive TUI: Monitor indexing progress across all networks in real-time
- Zig 0.14.0 or later
- ClickHouse server or QuestDB server
- Internet connection to access SVM networks
zig buildThe indexer uses two configuration files:
src/rpc_nodes.json: HTTP RPC endpoints for each networksrc/ws_nodes.json: WebSocket endpoints for each network
You can customize these files to add or remove networks, or to use different RPC providers.
# Run in real-time mode (default)
./zig-out/bin/zindexer
# Run in historical mode
./zig-out/bin/zindexer --mode historical
# Customize ClickHouse connection
./zig-out/bin/zindexer --database-type clickhouse --database-url localhost:9000 --database-user default --database-password "" --database-name solana
# Use QuestDB instead
./zig-out/bin/zindexer --database-type questdb --database-url localhost:9000 --database-user admin --database-password "quest" --database-name solana
# Show help
./zig-out/bin/zindexer --help-m, --mode <mode>: Indexer mode (historical or realtime)-r, --rpc-nodes <file>: RPC nodes configuration file-w, --ws-nodes <file>: WebSocket nodes configuration file-t, --database-type <type>: Database type (clickhouse or questdb)-c, --database-url <url>: Database server URL-u, --database-user <user>: Database username-p, --database-password <pass>: Database password-d, --database-name <db>: Database name-b, --batch-size <size>: Batch size for historical indexing--max-retries <count>: Maximum retry attempts--retry-delay <ms>: Delay between retries in milliseconds
--clickhouse-url <url>: ClickHouse server URL--clickhouse-user <user>: ClickHouse username--clickhouse-password <pass>: ClickHouse password--clickhouse-database <db>: ClickHouse database name
--questdb-url <url>: QuestDB server URL--questdb-user <user>: QuestDB username--questdb-password <pass>: QuestDB password--questdb-database <db>: QuestDB database name-h, --help: Show help message
The schema can be automatically applied to your database instance using the included script:
DB_TYPE=clickhouse CLICKHOUSE_URL="http://localhost:8123" ./scripts/apply_schema.shDB_TYPE=questdb QUESTDB_URL="http://localhost:9000" ./scripts/apply_schema.shZIndexer is built with a modular architecture:
- Core Indexer: Manages connections to multiple networks and coordinates indexing
- RPC Client: Handles communication with SVM networks via HTTP and WebSocket
- Database Abstraction Layer: Provides a common interface for different database backends
- ClickHouse Client: Manages data storage and retrieval in ClickHouse
- QuestDB Client: Manages data storage and retrieval in QuestDB
- Indexing Modules:
- Transaction Indexer: Processes transaction data
- Instruction Indexer: Processes instruction data
- Account Indexer: Tracks account changes
- Token Indexer: Tracks token transfers and balances
- DeFi Indexer: Tracks AMM and DeFi protocol activity
- NFT Indexer: Tracks NFT mints, sales, and marketplace activity
- Security Indexer: Monitors for suspicious activity
ZIndexer creates several tables in ClickHouse:
transactions: Basic transaction datainstructions: Instruction data with program IDsaccounts: Account state changesaccount_activity: Account usage statisticstoken_transfers: Token transfer eventstoken_accounts: Token account balancestoken_holders: Token holder informationnft_mints: NFT mint eventsnft_sales: NFT sale eventspool_swaps: AMM swap eventsliquidity_pools: AMM pool information
ZIndexer uses GitHub Actions for CI/CD:
- CI Workflow: Automatically builds and tests the code on Ubuntu and macOS
- Lint Workflow: Checks code formatting using
zig fmt - Release Workflow: Creates binary releases when a new tag is pushed
Status badges: