openSVM/zindexer
solana indexer for clickhouse in zig
A high-performance, memory-efficient Solana validator monitoring system written in Zig. Designed for high-throughput, low-latency block ingestion and real-time analytics across multiple Solana Virtual Machine (SVM) networks simultaneously.
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β β β β
β Solana Network β β Solana Network β β Solana Network β
β (Mainnet) β β (Devnet) β β (Testnet) β
β β β β β β
ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ ββββββββββ¬βββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β WebSocket Clients β
β β
ββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β Parser Engine β
β β
ββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β ClickHouse Storage β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Zindexer stores the following data types:
Clone the repository:
git clone https://github.com/yourusername/zindexer.git
cd zindexer
Build the project:
zig build -Drelease-fast
Configure your RPC nodes:
src/rpc_nodes.json
to add your RPC endpointssrc/ws_nodes.json
to add your WebSocket endpointsSet up ClickHouse:
./scripts/apply_schema.sh
# Set environment variables (optional)
export CLICKHOUSE_URL="http://localhost:8123"
export CLICKHOUSE_USER="default"
export CLICKHOUSE_PASS=""
export CLICKHOUSE_DB="solana"
# Run the indexer
./zig-out/bin/zindexer
The rpc_nodes.json
file defines the HTTP RPC endpoints for each network:
{
"networks": [
{
"name": "mainnet",
"nodes": [
"https://api.mainnet-beta.solana.com",
"https://solana-api.projectserum.com"
]
},
{
"name": "devnet",
"nodes": [
"https://api.devnet.solana.com"
]
}
]
}
The ws_nodes.json
file defines the WebSocket endpoints for each network:
{
"networks": [
{
"name": "mainnet",
"nodes": [
"wss://api.mainnet-beta.solana.com",
"wss://solana-api.projectserum.com"
]
},
{
"name": "devnet",
"nodes": [
"wss://api.devnet.solana.com"
]
}
]
}
Zindexer creates the following tables in ClickHouse:
blocks
: Block-level informationtransactions
: Transaction detailsinstructions
: Program instructionsaccounts
: Account state changesprogram_executions
: Program execution statisticsaccount_activity
: Account activity metricsValidator Monitoring
DeFi Analytics
NFT Market Analysis
Security Monitoring
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.