🧩Solana RPC Methods

Interact with Solana nodes directly using HTTP and WebSocket-based JSON RPC methods.

State Commitment Configuration Summary

Solana nodes use a commitment level set by the client to decide which bank state to query during preflight checks and transaction processing. Commitment levels reflect how finalized a block is and affect how likely that state is to change.

Available commitment levels (from most to least finalized):

  • finalized: Block confirmed by a supermajority and considered final (maximum lockout).

  • confirmed: Block directly voted on by a supermajority, based on gossip and replay; supports optimistic confirmation.

  • processed: Most recent block seen by the node; may be skipped by the cluster.

Recommendations:

  • Use confirmed for processing dependent transactions (balance of speed and safety).

  • Use finalized for maximum safety against rollback.

  • Default is finalized if no commitment is specified.

  • Only API methods that query bank state accept the commitment parameter, as indicated in the API reference.

RPC Response Structure

Many methods that take a commitment parameter return an RpcResponse JSON object comprised of two parts:

  • context : An RpcResponseContext JSON structure including a slot field at which the operation was evaluated.

  • value : The value returned by the operation itself.

Parsed Responses

Some methods support an encoding parameter, and can return account or instruction data in parsed JSON format if "encoding":"jsonParsed" is requested and the node has a parser for the owning program.

Filter Criteria Summary

Some RPC methods allow a filters object to pre-filter program account data returned in the response.

Supported filters:

  • memcmp: Compares a specific byte sequence at a given offset within the account data.

    • offset (usize): Position in the data to begin comparison.

    • bytes (string): The byte sequence to match (encoded).

    • encoding (string): "base58" or "base64" encoding.

      ⚠️ base64 support is only available in solana-core v1.14.0+. Omit this field when querying older nodes.

  • dataSize (u64): Matches accounts with a specific data length.

These filters help reduce unnecessary data by only returning accounts that meet the specified criteria.

Last updated

Was this helpful?