Solana RPC Methods & Documentation
Interact with Solana nodes directly with the JSON RPC API via the HTTP andWebsocket methods.
Configuring State Commitment
For preflight checks and transaction processing, Solana nodes choose which bankstate to query based on a commitment requirement set by the client. Thecommitment describes how finalized a block is at that point in time. Whenquerying the ledger state, it's recommended to use lower levels of commitment toreport progress and higher levels to ensure the state will not be rolled back.
In descending order of commitment (most finalized to least finalized), clientsmay specify:
finalized- the node will query the most recent block confirmed bysupermajority of the cluster as having reached maximum lockout, meaning thecluster has recognized this block as finalizedconfirmed- the node will query the most recent block that has been voted onby supermajority of the cluster.- It incorporates votes from gossip and replay.
- It does not count votes on descendants of a block, only direct votes on thatblock.
- This confirmation level also upholds "optimistic confirmation" guarantees inrelease 1.3 and onwards.
processed- the node will query its most recent block. Note that the blockmay still be skipped by the cluster.
For processing many dependent transactions in series, it's recommended to useconfirmed commitment, which balances speed with rollback safety. For totalsafety, it's recommended to usefinalized commitment.
Default Commitment
If commitment configuration is not provided, the node willdefault tofinalized commitment
Only methods that query bank state accept the commitment parameter. They areindicated in the API Reference below.
RpcResponse Structure
Many methods that take a commitment parameter return an RpcResponse JSON objectcomprised of two parts:
context: An RpcResponseContext JSON structure including aslotfield atwhich the operation was evaluated.value: The value returned by the operation itself.
Parsed Responses
Some methods support anencoding parameter, and can return account orinstruction data in parsed JSON format if"encoding":"jsonParsed" is requestedand the node has a parser for the owning program. Solana nodes currently supportJSON parsing for the following native and SPL programs:
| Program | Account State | Instructions |
|---|---|---|
| Address Lookup | v1.15.0 | v1.15.0 |
| BPF Loader | n/a | stable |
| BPF Upgradeable Loader | stable | stable |
| Config | stable | |
| SPL Associated Token Account | n/a | stable |
| SPL Memo | n/a | stable |
| SPL Token | stable | stable |
| SPL Token 2022 | stable | stable |
| Stake | stable | stable |
| Vote | stable | stable |
The list of account parsers can be foundhere,and instruction parsershere.
Filter criteria
Some methods support providing afilters object to enable pre-filtering thedata returned within the RpcResponse JSON object. The following filters exist:
memcmp: object- compares a provided series of bytes with program accountdata at a particular offset. Fields:offset: usize- offset into program account data to start comparisonbytes: string- data to match, as encoded stringencoding: string- encoding for filterbytesdata, either "base58" or"base64". Data is limited in size to 128 or fewer decoded bytes.
NEW: This field, and base64 support generally, is only available insolana-core v1.14.0 or newer. Please omit when querying nodes on earlierversions
dataSize: u64- compares the program account data length with the provideddata size
Is this page helpful?