Streaming Blocks & BlocksMeta

Subscription Requests for streaming blocks as they are produced on Solana

Streaming Block Updates

With gRPC, you can stream solana blocks as they are produced. However, to reduce network load, Shyft requires at least one filter to be added. Only blocks matching the filter criteria will be streamed. The blocks filter has a specific structure to define these criteria.

We need atleast one filter for streaming blocks with Shyft gRPCs

{
  "slots": {},
  "accounts": {},
  "transactions": {},
  "blocks": {
    "blockLabel": {
	"accountInclude": string[],
	"includeTransactions": boolean | undefined, //optional
	"includeAccounts": boolean | undefined, //optional
	"includeEntries": boolean | undefined //optional
     }
  },
  "blocksMeta": {
    "block": []
  },
  "accountsDataSlice": [],
  "commitment": CommitmentLevel.PROCESSED, // Subscribe to processed blocks for the fastest updates, confirmed and finalized also available
  "entry": {},
  "transactionsStatus": {}
}

To stream transactions or accounts involving specific accounts, you can use the accountInclude field to filter for those updates. includeAccounts and includeTransactions are simply boolean flags which work as they are named.

{
  "slots": {},
  "accounts": {},
  "transactions": {},
  "blocks": {
    "blocks": {
      "accountInclude": ["So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo"]
    }
  },
  "blocksMeta": {},
  "accountsDataSlice": []
};

Subscribing to BlocksMeta

The blocksMeta subscription is useful when you only need updates about blocks being processed, not the full block data. The blocksMeta subscription has the following request format:

{
  "slots": {},
  "accounts": {},
  "transactions": {},
  "blocks": {},
  "blocksMeta": {
    "blockmetadata": {}
  },
  "accountsDataSlice": []
}

Last updated