Simple production-ready setup for streaming account updates from a Solana validator into ClickHouse.
- Receives account update notifications from Geyser.
- Buffers updates through an in-memory channel.
- Writes updates in batches to ClickHouse with retry/backoff.
- Automatically creates database and table schema (optional).
- Rust stable toolchain
- Solana validator /
solana-test-validator - Docker + Docker Compose
docker compose up -dClickHouse will be available at:
- HTTP:
http://127.0.0.1:8123 - Native:
127.0.0.1:9000
cargo build --releasePlugin artifact will be one of:
- macOS:
target/release/libsolana_geyser_clickhouse.dylib - Linux:
target/release/libsolana_geyser_clickhouse.so
Update config.json:
- Set
libpathto the absolute path of your built plugin artifact. - Keep
clickhouse_urlashttp://127.0.0.1:8123unless running remotely.
Example:
{
"libpath": "/absolute/path/to/libsolana_geyser_clickhouse.so",
"clickhouse_url": "http://127.0.0.1:8123",
"clickhouse_database": "solana",
"clickhouse_table": "accounts",
"batch_size": 1000,
"batch_timeout_ms": 5000,
"max_retries": 3,
"channel_capacity": 100000,
"create_schema": true
}solana-test-validator --geyser-plugin-config ./config.jsonTrigger account activity (transfer, airdrop, etc.), then query ClickHouse:
docker exec -it solana-clickhouse clickhouse-client --query "
SELECT slot, pubkey, lamports, write_version
FROM solana.accounts
ORDER BY slot DESC
LIMIT 10"The plugin creates this table automatically when create_schema=true:
slot UInt64pubkey Stringowner Stringlamports UInt64executable UInt8rent_epoch UInt64data String(hex-encoded account data)updated_at_unix_ms Int64txn_signature Nullable(String)write_version UInt64
Engine:
ReplacingMergeTree(write_version)ORDER BY (pubkey, slot)
- Keep
channel_capacityhigh enough for your account update throughput. - Tune
batch_sizeandbatch_timeout_msfor your latency/throughput target. - On unload, the plugin drains remaining channel messages before worker exit.