For AI agents: an LLM-friendly Markdown version of every page is available by appending .md to its URL or by sending an Accept: text/markdown request header. The full documentation index is at https://www.ankr.com/docs/llms.txt
Skip to main content

Solana — Methods

API reference for Solana. All methods ->

getVoteAccounts

Returns the account info and associated stake for all the voting accounts in the current bank.

Parameters


  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <object> (optional): the configuration object containing the following fields:
      • commitment (string): the commitment describes how finalized a block is at that point in time. When querying the ledger state, it's recommended to use lower levels of commitment to report progress and higher levels to ensure the state will not be rolled back. For processing many dependent transactions in series, it's recommended to use "confirmed" commitment, which balances speed with rollback safety. For total safety, it's recommended to use "finalized" commitment:
        • finalized: the node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.
        • confirmed: the node will query the most recent block that has been voted on by 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 that block.
          • this confirmation level also upholds "optimistic confirmation" guarantees in release 1.3 and onwards.
        • processed: the node will query its most recent block. Note that the block may still be skipped by the cluster.
      • votePubkey (string): only returns the results for this validator vote address (base-58 encoded).
      • keepUnstakedDelinquents (boolean): set to true to not filter out delinquent validators with no stake.
      • delinquentSlotDistance (u64): specify the number of slots behind the tip that a validator must fall to be considered delinquent. NOTE: For the sake of consistency between ecosystem products, it is not recommended that this argument be specified.

Returns

The result field will be a JSON object of current and delinquent accounts, each containing an array of JSON objects with the following subfields:

  • votePubkey (string): the vote account address, as base-58 encoded string.
  • nodePubkey (string): the validator identity, as base-58 encoded string.
  • activatedStake (u64): the stake, in lamports, delegated to this vote account and active in this epoch.
  • epochVoteAccount (boolean): true if the vote account is staked for this epoch, otherwise false.
  • commission (number): the percentage (0-100) of rewards payout owed to the vote account.
  • lastVote (u64): the most recent slot voted on by this vote account.
  • epochCredits (array): the history of how many credits earned by the end of each epoch, as an array of arrays containing: [epoch, credits, previousCredits].

Request example 1

curl -X POST https://rpc.ankr.com/solana/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getVoteAccounts"
}'

Response example 1

{
"jsonrpc": "2.0",
"result": {
"current": [
{
"activatedStake": 2364534867609880,
"commission": 100,
"epochCredits": [
[
863,
931848333,
924939069
],
[
864,
938750237,
931848333
],
[
865,
945661181,
938750237
],
[
866,
952567578,
945661181
],
[
867,
953877279,
952567578
]
],
"epochVoteAccount": true,
"lastVote": 374626126,
"nodePubkey": "Cw6X5R68muAyGRCb7W8ZSP2YbaRjwMs1t5sBEPkhdwbM",
"rootSlot": 374626095,
"votePubkey": "7AETLyAGJWjp6AWzZqZcP362yv5LQ3nLEdwnXNjdNwwF"
}
]
},
"id": 1
}

Request example 2

Restricts the results to a single validator vote account.

curl -X POST https://rpc.ankr.com/solana/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getVoteAccounts",
"params": [
{
"votePubkey": "BZxzPVaLuAp2JUzR9gbtbrv47qYdSdRQfBWzatxPVjcD"
}
]
}'

Response example 2

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"current": [],
"delinquent": [
{
"activatedStake": 1997717120,
"commission": 100,
"epochCredits": [
[
851,
13346414,
6438750
],
[
852,
18873026,
13346414
],
[
853,
23618152,
18873026
],
[
854,
29813698,
23618152
],
[
855,
33504018,
29813698
]
],
"epochVoteAccount": true,
"lastVote": 369591011,
"nodePubkey": "9AyV9DykRupCenmHzvFckXLa2Hg8kvG61c6yX215EZCm",
"rootSlot": 369590980,
"votePubkey": "BZxzPVaLuAp2JUzR9gbtbrv47qYdSdRQfBWzatxPVjcD"
}
]
}
}

isBlockhashValid

tip

NEW: This method is only available in solana-core v1.9 or newer. Please use getFeeCalculatorForBlockhash for solana-core v1.8

Returns whether a blockhash is still valid or not.

Parameters


  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • blockhash (string; required): the blockhash of this block, as base-58 encoded string.
    • <object> (optional): the configuration object containing the following fields:
      • commitment (string): used for retrieving blockhash; the commitment describes how finalized a block is at that point in time. When querying the ledger state, it's recommended to use lower levels of commitment to report progress and higher levels to ensure the state will not be rolled back. For processing many dependent transactions in series, it's recommended to use "confirmed" commitment, which balances speed with rollback safety. For total safety, it's recommended to use "finalized" commitment:
        • finalized: the node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.
        • confirmed: the node will query the most recent block that has been voted on by 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 that block.
          • this confirmation level also upholds "optimistic confirmation" guarantees in release 1.3 and onwards.
        • processed: the node will query its most recent block. Note that the block may still be skipped by the cluster.
      • minContextSlot (number): sets the minimum slot that the request can be evaluated at.

Returns


  • <boolean>: returns true if the blockhash is still valid.

Request example

curl -X POST https://rpc.ankr.com/solana/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"id":45,
"jsonrpc":"2.0",
"method":"isBlockhashValid",
"params":[
"Fv8Be2iVvuSbWr3M5krNf5UT4TwwwtyY14jHBZXiatdv",
{"commitment": "processed"}
]
}'

Response example

{
"id": 45,
"jsonrpc": "2.0",
"result": {
"context": {
"apiVersion": "2.2.3",
"slot": 374626674
},
"value": false
}
}

minimumLedgerSlot

Returns the lowest slot that the node has information about in its ledger.

This value may increase over time if the node is configured to purge older ledger data.

Parameters


  • id (integer; required): a request ID (example: 1).
  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).
  • method (string; required): a method used for the request.
  • params (array; required): None.

Returns


  • <u64>: the minimum ledger slot.

Request example

curl -X POST https://rpc.ankr.com/solana/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"id":45,
"jsonrpc":"2.0",
"method":"minimumLedgerSlot"
}'

Response example

{
"jsonrpc": "2.0",
"result": 370994242,
"id": 45
}

requestAirdrop

Requests an airdrop of lamports to a Pubkey.

Parameters


  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <string> (required): the Pubkey of the account to receive lamports, as base-58 encoded string.
    • integer (required): lamports, as a u64.
    • object (optional): the configuration object containing the following field:
      • commitment (string): used for retrieving blockhash and verifying airdrop success; the commitment describes how finalized a block is at that point in time. When querying the ledger state, it's recommended to use lower levels of commitment to report progress and higher levels to ensure the state will not be rolled back. For processing many dependent transactions in series, it's recommended to use "confirmed" commitment, which balances speed with rollback safety. For total safety, it's recommended to use "finalized" commitment:
        • finalized: the node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.
        • confirmed: the node will query the most recent block that has been voted on by 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 that block.
          • this confirmation level also upholds "optimistic confirmation" guarantees in release 1.3 and onwards.
        • processed: the node will query its most recent block. Note that the block may still be skipped by the cluster.

Returns


  • <string>: the Transaction Signature of airdrop, as base-58 encoded string.

Request example

curl -X POST https://rpc.ankr.com/solana/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "requestAirdrop",
"params": [
"83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
1000000000
]
}'

Response example

{
"jsonrpc": "2.0",
"result": "4fv3RBynFREuU71Ajt9GyyiBJ7NKa9NmATmzdyKojdaGC111NfZBni1CJ5pb3AtnryqdjaVKWF9f1wp1d4gwoki5",
"id": 1
}

sendTransaction

Submits a signed transaction to the cluster for processing.

This method does not alter the transaction in any way; it relays the transaction created by clients to the node as-is.

If the node's rpc service receives the transaction, this method immediately succeeds, without waiting for any confirmations. A successful response from this method does not guarantee the transaction is processed or confirmed by the cluster.

While the rpc service will reasonably retry to submit it, the transaction could be rejected if transaction's recent_blockhash expires before it lands.

Use getSignatureStatuses to ensure a transaction is processed and confirmed.

Before submitting, the following preflight checks are performed:

  1. The transaction signatures are verified.
  2. The transaction is simulated against the bank slot specified by the preflight commitment. On failure an error will be returned. Preflight checks may be disabled if desired. It is recommended to specify the same commitment and preflight commitment to avoid confusing behavior.

The returned signature is the first signature in the transaction, which is used to identify the transaction (transaction id). This identifier can be easily extracted from the transaction data before submission.

Parameters


  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <string> (required): a fully-signed Transaction, as encoded string.
    • <object> (optional): the configuration object containing the following fields:
      • skipPreflight (boolean): if true, skip the preflight transaction checks (default: false).
      • preflightCommitment (string; default: "finalized"): a commitment level to use for preflight. The commitment describes how finalized a block is at that point in time. When querying the ledger state, it's recommended to use lower levels of commitment to report progress and higher levels to ensure the state will not be rolled back. For processing many dependent transactions in series, it's recommended to use "confirmed" commitment, which balances speed with rollback safety. For total safety, it's recommended to use "finalized" commitment:
        • finalized: the node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.
        • confirmed: the node will query the most recent block that has been voted on by 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 that block.
          • this confirmation level also upholds "optimistic confirmation" guarantees in release 1.3 and onwards.
        • processed: the node will query its most recent block. Note that the block may still be skipped by the cluster.
      • encoding (string; default: "base58"): the encoding used for the transaction data. Either "base58" (slow, DEPRECATED), or "base64".
      • maxRetries (usize): the maximum number of times for the RPC node to retry sending the transaction to the leader. If this parameter not provided, the RPC node will retry the transaction until it is finalized or until the blockhash expires.
      • minContextSlot (number): sets the minimum slot at which to perform preflight transaction checks.

Returns


  • <string>: the first Transaction Signature embedded in the transaction, as base-58 encoded string (transaction id).

Request example

curl -X POST https://rpc.ankr.com/solana/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "sendTransaction",
"params": ["4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT"]
}'

Response example

{
"jsonrpc": "2.0",
"result": "2id3YC2jK9G5Wo2phDx4gJVAew8DcY5NAojnVuao8rkxwPYPe8cSwE5GzhEgJA2y8fVjDEo6iR6ykBvDxrTQrtpb",
"id": 1
}

simulateTransaction

Simulates sending a transaction.

Parameters


  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <string> (required): the transaction, as an encoded string. The transaction must have a valid blockhash, but is not required to be signed.
    • <object> (optional): the configuration object containing the following fields:
      • sigVerify (boolean): if true the transaction signatures will be verified (default: false, conflicts with replaceRecentBlockhash).
      • commitment (string; default: "finalized"): a commitment level to simulate the transaction at. The commitment describes how finalized a block is at that point in time. When querying the ledger state, it's recommended to use lower levels of commitment to report progress and higher levels to ensure the state will not be rolled back. For processing many dependent transactions in series, it's recommended to use "confirmed" commitment, which balances speed with rollback safety. For total safety, it's recommended to use "finalized" commitment:
        • finalized: the node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.
        • confirmed: the node will query the most recent block that has been voted on by 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 that block.
          • this confirmation level also upholds "optimistic confirmation" guarantees in release 1.3 and onwards.
        • processed: the node will query its most recent block. Note that the block may still be skipped by the cluster.
      • encoding (string; default: "base58"): the encoding used for the transaction data. Either "base58" (slow, DEPRECATED), or "base64".
      • replaceRecentBlockhash (boolean): if true the transaction recent blockhash will be replaced with the most recent blockhash. (default: false, conflicts with sigVerify).
      • accounts (object): the accounts configuration object containing the following fields:
        • encoding (string): encoding for returned Account data, either "base64" (default), "base64+zstd" or "jsonParsed". "jsonParsed" encoding attempts to use program-specific state parsers to return more human-readable and explicit account state data. If "jsonParsed" is requested but a parser cannot be found, the field falls back to binary encoding, detectable when the data field is type <string>.
        • addresses (array): an array of accounts to return, as base-58 encoded strings.
      • minContextSlot (number): sets the minimum slot that the request can be evaluated at.

Returns

The result will be a JSON object with the value containing the following fields:

  • err (object|string|null): Error if transaction failed, null if transaction succeeded. See the TransactionError definitions.
  • logs (array|null): an array of log messages the transaction instructions output during execution, null if simulation failed before the transaction was able to execute (for example due to an invalid blockhash or signature verification failure).
  • accounts (array|null): an array of accounts with the same length as the accounts.addresses array in the request:
    • <null>: if the account doesn't exist or if err is not null.
    • <object>: otherwise, a JSON object containing:
      • lamports (u64): the number of lamports assigned to this account, as a u64.
      • owner (string): the base-58 encoded Pubkey of the program this account has been assigned to.
      • data ([string, encoding]|object): the data associated with the account, either as encoded binary data or JSON format {<program>: <state>}, depending on encoding parameter.
      • executable (boolean): a boolean indicating if the account contains a program (and is strictly read-only).
      • rentEpoch (u64): the epoch at which this account will next owe rent, as u64.
    • unitsConsumed (u64|undefined): the number of compute budget units consumed during the processing of this transaction.
    • returnData (object|null): the most-recent return data generated by an instruction in the transaction, with the following fields:
      • programId (string): the program that generated the return data, as base-58 encoded Pubkey.
      • data ([string, encoding]): the return data itself, as base-64 encoded binary data.

Request example

curl -X POST https://rpc.ankr.com/solana/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "simulateTransaction",
"params": ["AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=",
{
"encoding": "base64"
}
]
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"context": {
"apiVersion": "2.2.3",
"slot": 374627777
},
"value": {
"accounts": null,
"err": "BlockhashNotFound",
"innerInstructions": null,
"logs": [],
"replacementBlockhash": null,
"returnData": null,
"unitsConsumed": 0
}
}
}