Build the jito-geyser-cli
masterTo build and run the Starrider Geyser Example CLI, use cargo run targeting the jito-geyser-cli binary.
cargo run --bin jito-geyser-clirepository·master·Indexed 40 days ago
https://github.com/jito-foundation/geyser-grpc-pluginA lightweight gRPC service and Geyser plugin for Solana validators designed to stream account, slot, transaction, and block updates to subscribers. Includes the jito-geyser-cli for interacting with the service, a Rust client for consuming streams with monotonicity and ordering guarantees, and jito-geyser-protos for protobuf definitions supporting Solana libraries approximately version ~v1.14.
To build and run the Starrider Geyser Example CLI, use cargo run targeting the jito-geyser-cli binary.
cargo run --bin jito-geyser-cliYou can build the plugin using either cargo or docker.
Important Compatibility Requirements:
cargo version (defined in rust-toolchain.toml) must match the rust-toolchain.toml used in the Solana repository.Build Options:
./f script to build the binary within a container, which outputs the result to a container-output folder.# Using cargo
$ cargo b --release
# Using docker
$ ./fTo integrate the plugin into your Solana validator, follow these steps:
./server/example-config.json) to match your validator's requirements.--geyser-plugin-config startup argument to your Solana validator command, pointing to your edited JSON file.Starting GeyserPluginService from config filesgeyser_grpc_plugin_server::server# Example validator startup argument
--geyser-plugin-config geyser.jsonThe protobufs in this repository are largely copied from Solana Labs. If you need to update them to match newer Solana Labs changes, note the following:
confirmed_block.proto and transaction_by_addr.proto are currently untouched.tonic::include_proto! to expose the definitions. If you modify the proto files, you may need to update the module declarations in lib.rs to match the new paths.To use the protobuf definitions provided by this library, add jito-geyser-protos to your Cargo.toml dependencies. This library supports Solana libraries approximately version ~v1.14.
jito-geyser-protos = "0.0.2"When connecting to Jito's load-balanced RPC cluster (https://mainnet.rpc.jito.wtf), you must provide an access token. You can export this token as an environment variable, which the CLI and proxies can use for authentication via headers.
To access the cluster, you may need to request a token via the Jito access token form.
export ACCESS_TOKEN=<access_token>The SubscriptionStream struct is used to manage real-time data streams and provides a mechanism to notify other processes when a client's subscription is closed. This is essential for cleaning up state associated with a specific stream when a connection is dropped.
SubscriptionStream is dropped (e.g., the client disconnects), it automatically triggers a signal to a provided StreamClosedSender.tokio_stream::Stream trait, allowing it to be used with standard async stream utilities.ID and a name for logging and tracking.To create a new stream, use SubscriptionStream::new. You must provide a receiver for the data, a unique ID, and a sender that implements the StreamClosedSender trait to handle the cleanup event.
// Conceptual usage pattern for creating a SubscriptionStream
let stream = SubscriptionStream::new(
stream_rx, // Receiver<Result<T, Status>>
stream_id, // Unique ID
(event_sender, event), // (S, E) where S: StreamClosedSender<E>
"stream_name", // &'static str
);access_token is provided in the geyser_service_config within the plugin configuration, the gRPC server will require all incoming requests to include an access-token in their metadata. Requests missing this token or providing an incorrect one will receive an unauthenticated status error.The GeyserConsumer provides an opinionated approach to consuming account updates, ensuring data integrity through two main guarantees:
To maintain these guarantees, the consumer tracks the highest_rooted_slot and uses a max_rooted_slot_distance to determine if an incoming update is too stale to process.
The plugin supports TLS encryption. To enable it, provide a tls_config object inside geyser_service_config containing the paths to your certificate and private key files.
Required keys in tls_config:
cert_path: Path to the PEM-encoded certificate.key_path: Path to the PEM-encoded private key.Once the dependency is added, you can import specific Solana protobuf types. For example, to use the ConfirmedBlock type, use the following import path:
use jito_geyser_protos::solana::storage::confirmed_block::ConfirmedBlock;The plugin is configured via a JSON file. The configuration defines network settings, buffer sizes for different update types, and security settings like TLS and access tokens.
Key configuration fields include:
bind_address: The network address and port the gRPC server will listen on.account_update_buffer_size, slot_update_buffer_size, block_update_buffer_size, transaction_update_buffer_size: Sizes for the internal channels used to pipe updates to the gRPC service.slot_entry_update_buffer_size: Size for slot entry updates (defaults to 1,000,000 if not provided).skip_startup_stream: If set to true, the plugin will ignore updates during the initial startup phase.account_data_notifications_enabled: If set to false, account data notifications are disabled.geyser_service_config: Contains GeyserServiceConfig settings, including access_token for authentication and tls_config for encrypted connections.{
"bind_address": "0.0.0.0:10000",
"account_update_buffer_size": 100000,
"slot_update_buffer_size": 100000,
"slot_entry_update_buffer_size": 1000000,
"block_update_buffer_size": 100000,
"transaction_update_buffer_size": 100000,
"skip_startup_stream": false,
"account_data_notifications_enabled": true,
"geyser_service_config": {
"heartbeat_interval_ms": 1000,
"subscriber_buffer_size": 1000000,
"access_token": "YOUR_ACCESS_TOKEN",
"tls_config": {
"cert_path": "/path/to/cert.pem",
"key_path": "/path/to/key.pem"
}
}
}