This repo contains a fully functional gRPC interface for Solana, built and maintained by Triton One. It is built around Solana's Geyser interface. In this repo, we have the plugin and sample clients for multiple languages.
It provides the ability to get slots, blocks, transactions, deshred pre-execution transactions, and account update notifications over a standardised path.
For additional documentation, please see: https://docs.triton.one/rpc-pool/grpc-subscriptions
Block reconstruction inside gRPC plugin is based on information provided by BlockMeta, unfortunately, the number of entries for blocks generated on validators is always equal to zero. These blocks will always have zero entries. See issue on GitHub: https://github.com/solana-labs/solana/issues/33823
solana-validator --geyser-plugin-config yellowstone-grpc-geyser/config.json
cargo-fmt && cargo run --bin config-check -- --config yellowstone-grpc-geyser/config.json
The recommended way to configure gRPC listeners is grpc.listen.
grpc.listen is an array where each item can define:
address: requiredtls: optional, per-listener TLS configauth: optional, per-listener authentication modeaddress accepts:
"0.0.0.0:10000""unix:///var/run/geyser.sock"{
"address": {
"path": "unix:///var/run/geyser.sock",
"mode": 432
}
}
mode is decimal (example above is 0o660).
listen[].tls)You can configure TLS in two ways:
cert_path + key_path)cert_dir) with PEM files{
"tls": {
"identity": {
"cert_path": "/etc/yellowstone/tls/server.crt",
"key_path": "/etc/yellowstone/tls/server.key"
}
}
}
{
"tls": {
"cert_dir": "/etc/yellowstone/certs"
}
}
Notes:
listen[].auth)Auth is configured per listener with type.
type: "http"
host and token.subscription_id and rate limits (rate_limits or ratelimits).HTTP resolver contract:
GET<subscription_resolver_url>?host=<request-host>&token=<x-token>host: host extracted from the incoming gRPC request URItoken: value from the incoming x-token header200 OK: valid (host, token) pair, returns subscription info JSON404 Not Found: invalid (host, token) pairThe 404 behavior is important: the gRPC server treats it as an unauthenticated request for that host/token pair.
Example request:
GET http://127.0.0.1:8080/?host=api.example.com&token=test
Example 200 OK response body:
{
"subscription_id": "test-sub",
"ratelimits": {
"methods": {
"/geyser.Geyser/Subscribe": 2000,
"/geyser.Geyser/SubscribeReplayInfo": 2000,
"/geyser.Geyser/Ping": 2000,
"/geyser.Geyser/GetLatestBlockhash": 2000,
"/geyser.Geyser/GetBlockHeight": 2000,
"/geyser.Geyser/GetSlot": 2000,
"/geyser.Geyser/IsBlockhashValid": 2000,
"/geyser.Geyser/GetVersion": 2000
}
}
}
{
"auth": {
"type": "http",
"subscription_resolver_url": "http://127.0.0.1:8080/",
"subscription_resolution_cache_ttl": "30s",
"max_concurrent_auth_requests": 1000
}
}
type: "file"
token, host, and subscription_info.{
"auth": {
"type": "file",
"subscription_resolver_path": "/etc/yellowstone/subscriptions.json"
}
}
Example /etc/yellowstone/subscriptions.json:
[
{
"token": "test",
"host": "127.0.0.1",
"subscription_info": {
"subscription_id": "test-sub",
"ratelimits": {
"methods": {
"/geyser.Geyser/Subscribe": 2000,
"/geyser.Geyser/SubscribeReplayInfo": 2000,
"/geyser.Geyser/Ping": 2000,
"/geyser.Geyser/GetLatestBlockhash": 2000,
"/geyser.Geyser/GetBlockHeight": 2000,
"/geyser.Geyser/GetSlot": 2000,
"/geyser.Geyser/IsBlockhashValid": 2000,
"/geyser.Geyser/GetVersion": 2000
}
}
}
},
{
"token": "prod-token-1",
"host": "api.example.com",
"subscription_info": {
"subscription_id": "prod-sub-1",
"ratelimits": {
"methods": {
"/geyser.Geyser/Subscribe": 2000,
"/geyser.Geyser/SubscribeReplayInfo": 2000,
"/geyser.Geyser/Ping": 2000,
"/geyser.Geyser/GetLatestBlockhash": 2000,
"/geyser.Geyser/GetBlockHeight": 2000,
"/geyser.Geyser/GetSlot": 2000,
"/geyser.Geyser/IsBlockhashValid": 2000,
"/geyser.Geyser/GetVersion": 2000
}
}
}
}
]
NOTE: method rate-limit is not yet implemented.
type: "trusted-metadata"
x-subscription-id header and skips external auth checks.{
"auth": {
"type": "trusted-metadata"
}
}
listen example{
"grpc": {
"listen": [
{
"address": "0.0.0.0:10000",
"auth": {
"type": "http",
"subscription_resolver_url": "http://127.0.0.1:8080/",
"subscription_resolution_cache_ttl": "30s",
"max_concurrent_auth_requests": 1000
}
},
{
"address": "0.0.0.0:10001",
"tls": {
"identity": {
"cert_path": "/etc/yellowstone/tls/server.crt",
"key_path": "/etc/yellowstone/tls/server.key"
}
},
"auth": {
"type": "trusted-metadata"
}
},
{
"address": {
"path": "unix:///var/run/geyser.sock",
"mode": 432
},
"auth": {
"type": "file",
"subscription_resolver_path": "/etc/yellowstone/subscriptions.json"
}
}
]
}
}
grpc.address, grpc.tls_config, and grpc.cert_dir are legacy and deprecated in favor of grpc.listen.
Use grpc.listen for new configurations, especially if you need different TLS/auth behavior per endpoint.
Install repository hooks:
make install-hooks
The pre-commit hook will:
commit.gpgsign=true)cargo fmt --all -- --check and print a warning if formatting failsGeyser interface on block update does not provide detailed information about transactions and account updates. To provide this information with a block message, we must collect all messages and expect a specified order. By default, if we failed to reconstruct full block, we log an error message and increase the invalid_full_blocks_total counter in prometheus metrics. If you want to panic on invalid reconstruction, change the option block_fail_action in config to panic (default value is log).
Please check yellowstone-grpc-proto/proto/geyser.proto for details.
commitment — commitment level: processed / confirmed / finalizedaccounts_data_slice — array of objects { offset: uint64, length: uint64 }, allow to receive only required data from accountsping — optional boolean field. Some cloud providers (like Cloudflare, Fly.io) close the stream if the client doesn't send anything during some time. You can send the same filter every N seconds as a workaround, but this would not be optimal since you need to keep this filter. Instead, you can send a subscribe request with ping field set to true and ignore the rest of the fields in the request. Since we sent a Ping message every 15s from the server, you can send a subscribe request with ping as a reply and receive a Pong message.filter_by_commitment — by default, slots are sent for all commitment levels, but with this filter, you can receive only the selected commitment levelAccounts can be filtered by:
account — account Pubkey, match to any Pubkey from the arrayowner — account owner Pubkey, match to any Pubkey from the arrayfilters — same as getProgramAccounts filters, array of dataSize or Memcmp (bytes, base58, base64 are supported)If all fields are empty, then all accounts are broadcast. Otherwise, fields work as logical AND and values in arrays as logical OR (except values in filters that works as logical AND).
vote — enable/disable broadcast vote transactionsfailed — enable/disable broadcast failed transactionssignature — match only specified transactionaccount_include — filter transactions that use any account from the listaccount_exclude — opposite to account_includeaccount_required — require all accounts from the list to be used in the transactionIf all fields are empty, then all transactions are broadcast. Otherwise, fields work as logical AND and values in arrays as logical OR.
SubscribeDeshred is a separate bi-directional stream for pre-execution transactions. Instead of waiting for Replay to execute a transaction and produce TransactionStatusMeta, the server reconstructs entries from incoming shreds and streams the decoded transaction as soon as it is available.
This gives you an earlier signal than the regular transactions stream, but it comes with less context:
slot, signature, is_vote, raw transaction, loaded_writable_addresses, loaded_readonly_addressesTransactionStatusMetaloaded_writable_addresses and loaded_readonly_addresses contain addresses resolved from address lookup tables, so deshred filters can match both static account keys and dynamically loaded addresses.
Availability:
SubscribeDeshredyellowstone-grpc-geyser server in this repository currently returns UNIMPLEMENTED for SubscribeDeshredmaster-triton-ext branchThe deshred transaction filter supports:
vote — enable/disable broadcast vote transactionsaccount_include — match transactions that mention any listed account, including ALT-loaded addressesaccount_exclude — exclude transactions that mention any listed account, including ALT-loaded addressesaccount_required — require all listed accounts to be present, including ALT-loaded addressesCurrently, we do not have filters for the entries, all entries are broadcast.
account_include — filter transactions and accounts that use any account from the listinclude_transactions — include all transactionsinclude_accounts — include all accounts updatesinclude_entries — include all entriesSame as Blocks but without transactions, accounts, and entries. Currently, we do not have filters for block meta, all messages are broadcast.
It's possible to add limits for filters in the config. If the filters field is omitted, then filters don't have any limits.
"grpc": {
"filters": {
"accounts": {
"max": 1,
"any": false,
"account_max": 10,
"account_reject": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],
"owner_max": 10,
"owner_reject": ["11111111111111111111111111111111"]
},
"slots": {
"max": 1
},
"transactions": {
"max": 1,
"any": false,
"account_include_max": 10,
"account_include_reject": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],
"account_exclude_max": 10,
"account_required_max": 10
},
"blocks": {
"max": 1,
"account_include_max": 10,
"account_include_any": false,
"account_include_reject": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],
"include_transactions": true,
"include_accounts" : false,
"include_entries" : false
},
"blocks_meta": {
"max": 1
},
"entry": {
"max": 1
}
}
}
For a SubscribeDeshred CLI example, see examples/rust.
[!NOTE] Some load balancers will terminate gRPC connections if no messages are sent from the client for a period of time. In order to mitigate this, you need to send a message periodically. The
pingfield in the SubscribeRequest is used for this purpose. The gRPC server already sends pings to the client, so you can reply with a ping, and your connection will remain open. You can see in the rust example how to reply to the ping from the server with the client.