Yellowstone Dragon's Mouth - a Geyser based gRPC interface for Solana

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

Known bugs

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

Validator

solana-validator --geyser-plugin-config yellowstone-grpc-geyser/config.json

Plugin config check

cargo-fmt && cargo run --bin config-check -- --config yellowstone-grpc-geyser/config.json

gRPC listen, TLS, and auth configuration

The recommended way to configure gRPC listeners is grpc.listen.

grpc.listen is an array where each item can define:

Listen address formats

address accepts:

{
   "address": {
      "path": "unix:///var/run/geyser.sock",
      "mode": 432
   }
}

mode is decimal (example above is 0o660).

TLS options (listen[].tls)

You can configure TLS in two ways:

  1. Identity pair (cert_path + key_path)
  2. Certificate directory (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:

Auth options (listen[].auth)

Auth is configured per listener with type.

type: "http"

HTTP resolver contract:

The 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"

{
   "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"

{
   "auth": {
      "type": "trusted-metadata"
   }
}

Full 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"
            }
         }
      ]
   }
}

Legacy fields

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.

Pre-commit hooks

Install repository hooks:

make install-hooks

The pre-commit hook will:

Block reconstruction

Geyser 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).

Filters for streamed data

Please check yellowstone-grpc-proto/proto/geyser.proto for details.

Slots

Account

Accounts can be filtered by:

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).

Transactions

If all fields are empty, then all transactions are broadcast. Otherwise, fields work as logical AND and values in arrays as logical OR.

Deshred transactions

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:

loaded_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:

The deshred transaction filter supports:

Entries

Currently, we do not have filters for the entries, all entries are broadcast.

Blocks

Blocks meta

Same as Blocks but without transactions, accounts, and entries. Currently, we do not have filters for block meta, all messages are broadcast.

Limit filters

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
      }
   }
}

Unary gRPC methods

Ping

GetLatestBlockhash

GetBlockHeight

GetSlot

IsBlockhashValid

GetVersion

Examples

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 ping field 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.

Projects based on Geyser gRPC