githubEdit

rootSubscribe – Solana

The rootSubscribe JSON-RPC method enables clients to subscribe to notifications when a new root slot is set by the Solana validator.

circle-check

In Solana's blockchain architecture, the root slot represents the most recent finalized block. This information helps applications maintain up-to-date state without polling the network.

Supported Networks

  • Mainnet

Parameters

circle-info

None: This method does not require any parameters.

Result

The response returns an integer value that serves as the subscription ID.

Result Format

  • integer: The subscription ID to be used for unsubscribing.

Request Example

API Endpoints

wss://go.getblock.io/<ACCESS-TOKEN>/

JSON-RPC Request

Response

A successful request returns the subscription ID.

Example Response

In this response:

  • result: The subscription ID.

Notification Format

Notifications are sent as JSON-RPC responses containing the latest root slot.

Example Notification

Error Handling

Common rootSubscribe error scenarios:

  • Network connectivity issues.

  • Server-side configuration errors.

Example Error Response

Use Cases

The Solana rootSubscribe method is essential for:

  • Monitoring network finality.

  • Ensuring application state consistency.

  • Developing real-time analytics tools.

Code rootSubscribe Example – Web3 Integration

Integration with Web3

By integrating Web3 rootSubscribe into Solana's Core API, developers can:

  • Monitor root slot changes in real-time.

  • Optimize resource usage.

Build responsive and efficient dApps.

Last updated

Was this helpful?