A minimal Solana Geyser plugin scaffold written in Rust. This repository provides a drop-in example plugin you can build and load into solana-test-validator
(or a full validator) to learn how Geyser plugins receive and process ledger events.
The Solana Geyser plugin interface lets external libraries receive real-time notifications from a running Solana validator about block, transaction, and account updates. Plugins are dynamic libraries (.so) loaded by the validator and called via a C ABI to process or forward ledger events.
It has two implementations of the Geyser plugin:
master
branch: a minimal example plugin.logger_impl
branch: with an external logger file.
Prerequisites:
- Rust toolchain (stable) and
cargo
. - Solana
solana-test-validator
available on PATH (from Solana toolchain/CLI). - linux or macOS or WSL (Windows Subsystem for Linux)
- Build the plugin (release):
cargo build --release
- Confirm the produced library exists (default path in config):
ls -l target/release/libsolana_geyser_plugin_scaffold.so
- Start the test validator with the plugin config from the repo root:
Note: Make sure you have correct path to the built library in
libpath
.
solana-test-validator --geyser-plugin-config geyser-plugin.json
If you get errors that the plugin cannot be found, open geyser-plugin.json
and set libpath
to the absolute path of the library file you built.
- Produce some activity (in a second terminal) so the plugin receives events. For example:
# use the local validator's RPC
solana airdrop 1
solana transfer --allow-unfunded-recipient <RECIPIENT_PUBKEY> 0.001
- Inspect plugin output:
You can also check the validator logs in test-ledger/validator.log
for plugin load messages.
To follow validator logs in real time:
tail -f test-ledger/validator.log