gRPC

Highly configurable real-time data streams.

What are gRPC streams?

gRPC streams provide the fastest and most efficient way to stream Solana data directly to your backend. With gRPC, you can subscribe to blocks, slots, transactions, and account updates. It is highly configurable. You can filter or limit each subscription. It allows the client-server to create new subscriptions or cancel existing ones immediately.

Subscribe Request

In the subscribe request, you need to include the following:

commitment: Specifies the commitment level, which can be processed, confirmed, or finalized.

accounts_data_slice: An array of objects { offset: uint64, length: uint64 } that allows you to receive only the required data slices from accounts.

ping: An optional boolean. Some cloud providers (e.g., Cloudflare) close idle streams. To keep the connection alive, set this to true. The server will respond with a Pong message every 15 seconds, avoiding the need to resend filters.

Next, you’ll need to specify the filters for the data you want to subscribe to, such as accounts, blocks, slots, or transactions.

Last updated