Node API
Supported Chains
API Reference
Solana

Solana


Solana API is available on Web3 API platform (opens in a new tab).

Solana is a decentralized blockchain built to enable scalable, user-friendly apps for the world.

In order for your Web3 application to interact with the Arbitrum blockchain — either by reading blockchain data or sending transactions to the network — it must connect to a Solana node. Developers interact with the blockchain using the methods provided by the API.

The API interaction follows the JSON-RPC (opens in a new tab) which is a stateless, lightweight remote procedure call (RPC) protocol. It defines several data structures and the rules around their processing. It is transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in many various message-passing environments. It uses JSON (RFC 4627) as data format.

Methods


Deprecated


  • getConfirmedBlock — Returns identity and transaction information about a confirmed block in the ledger.
  • getConfirmedBlocks — Returns a list of confirmed blocks between two slots.
  • getConfirmedBlocksWithLimit — Returns a list of confirmed blocks starting at the given slot.
  • getConfirmedSignaturesForAddress2 — Returns signatures for confirmed transactions that include the given address in their accountKeys list.
  • getConfirmedTransaction — Returns transaction details for a confirmed transaction.
  • getFeeCalculatorForBlockhash — Returns the fee calculator associated with the query blockhash, or null if the blockhash has expired.
  • getFeeRateGovernor — Returns the fee rate governor information from the root bank.
  • getFees — Returns a recent block hash from the ledger, a fee schedule that can be used to compute the cost of submitting a transaction using it, and the last slot in which the blockhash will be valid.
  • getRecentBlockhash — Returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.
  • getSnapshotSlot — Returns the highest slot that the node has a snapshot for.

getAccountInfo

Returns all information associated with the account of provided 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>: pubkey of account to query, as base-58 encoded string.
    • <object> (optional): 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.
      • encoding (string): encoding for Account data, either "base58" (slow), "base64", "base64+zstd", or "jsonParsed". "base58" is limited to Account data of less than 129 bytes. "base64" will return base64 encoded data for Account data of any size. "base64+zstd" compresses the Account data using Zstandard (opens in a new tab) and base64-encodes the result. "jsonParsed" encoding (opens in a new tab) 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 "base64" encoding, detectable when the data field is type string.
      • dataSlice (object): limit the returned account data using the provided offset: <usize> and length: <usize> fields; only available for "base58", "base64" or "base64+zstd" encodings.
      • minContextSlot (number): sets the minimum slot that the request can be evaluated at.

Returns


  • <null>: if the requested account doesn't exist.
  • <object>: otherwise a JSON object containing:
    • lamports (u64): number of lamports assigned to this account, as a u64.
    • owner (string): base-58 encoded Pubkey of the program this account has been assigned to.
    • data ([string, encoding]|object): data associated with the account, either as encoded binary data or JSON format {<program>: <state>}, depending on the encoding parameter.
    • executable (boolean): 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.

Request example 1

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

Response example 1

{
    "jsonrpc": "2.0",
    "result": {
        "context": {
            "apiVersion": "1.13.5",
            "slot": 171939795
        },
        "value": {
            "data": [
                "df8aQUMTjEzaM7MBx7gWDVgHXxWNHx5rtjKTNMLR4JXHcXryskBMwTfNn6ksWcJgReufRevDzprYBek226dD3YrE2oXPyyhXvFdzbczZGvuD",
                "base58"
            ],
            "executable": false,
            "lamports": 2000000,
            "owner": "11111111111111111111111111111111",
            "rentEpoch": 361
        }
    },
    "id": 1
}

Request example 2

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

Response example 2

{
    "jsonrpc": "2.0",
    "result": {
        "context": {
            "apiVersion": "1.13.5",
            "slot": 171940021
        },
        "value": {
            "data": {
                "parsed": {
                    "info": {
                        "authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX",
                        "blockhash": "9pf2WiEJT91VKq38PjvEdeom4Aug3NhCGRR7u3kwjhp5",
                        "feeCalculator": {
                            "lamportsPerSignature": "5000"
                        }
                    },
                    "type": "initialized"
                },
                "program": "nonce",
                "space": 80
            },
            "executable": false,
            "lamports": 2000000,
            "owner": "11111111111111111111111111111111",
            "rentEpoch": 361
        }
    },
    "id": 1
}

getBalance

Returns the balance of the account of provided 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>: pubkey of account to query, as base-58 encoded string.

    • <object>: configuration object containing the following fields:

      • commitment (string; optional): 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; optional): sets the minimum slot that the request can be evaluated at.

Returns


  • value (u64): an account balance.

Request example

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

Response example

{
    "jsonrpc": "2.0",
    "result": {
        "context": {
            "apiVersion": "1.13.5",
            "slot": 171949127
        },
        "value": 2000000
    },
    "id": 1
}

getBlock

Returns identity and transaction information about a confirmed block in the ledger.

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):

    • <u64>: slot, as a u64 integer.
    • <object> (optional): configuration object containing the following optional fields:
      • encoding (string): encoding for each returned Transaction, either "json", "jsonParsed", "base58" (slow), "base64". If parameter not provided, the default encoding is "json". "jsonParsed" encoding (opens in a new tab) attempts to use program-specific instruction parsers to return more human-readable and explicit data in the transaction.message.instructions list. If "jsonParsed" is requested but a parser cannot be found, the instruction falls back to regular JSON encoding (accounts, data, and programIdIndex fields).
      • transactionDetails (string): level of transaction detail to return, either "full", "accounts", "signatures", or "none". If parameter not provided, the default detail level is "full". If "accounts" are requested, transaction details only include signatures and an annotated list of accounts in each transaction. Transaction metadata is limited to only: fee, err, pre_balances, post_balances, pre_token_balances, and post_token_balances.
      • rewards (boolean): whether to populate the rewards array. If parameter not provided, the default includes rewards.
      • commitment (string; default: "finalized"): 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.
      • maxSupportedTransactionVersion (number): sets the max transaction version to return in responses. If the requested block contains a transaction with a higher version, an error will be returned. If this parameter is omitted, only legacy transactions will be returned, and a block containing any versioned transaction will prompt the error.

Returns


  • <null>: if specified block is not confirmed.
  • <object>: if block is confirmed, an object with the following fields:
    • blockhash (string): the blockhash of this block, as base-58 encoded string.
    • previousBlockhash (string): the blockhash of this block's parent, as base-58 encoded string; if the parent block is not available due to ledger cleanup, this field will return "11111111111111111111111111111111".
    • parentSlot (u64): the slot index of this block's parent.
    • transactions (array): to be included if "full" transaction details are requested; an array of JSON objects containing:
      • transaction (object|[string,encoding]): a transaction object (opens in a new tab), either in JSON format or encoded binary data, depending on encoding parameter.
      • meta (object): a transaction status metadata object, containing null or:
        • err (object|null): an error if transaction failed, null if transaction succeeded. TransactionError definitions (opens in a new tab).
        • fee (u64): a fee this transaction was charged with, as u64 integer.
        • preBalances (array): an array of u64 account balances from before the transaction was processed.
        • postBalances (array): an array of u64 account balances after the transaction was processed.
        • innerInstructions (array|null): the list of inner instructions (opens in a new tab) or null if inner instruction recording was not enabled during this transaction.
        • preTokenBalances (array|undefined): the list of token balances (opens in a new tab) from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction.
        • postTokenBalances (array|undefined): the list of token balances (opens in a new tab) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction.
        • logMessages (array|null): an array of string log messages or null if log message recording was not enabled during this transaction.
        • rewards (array|null): transaction-level rewards, populated if rewards are requested; an array of JSON objects containing:
          • pubkey (string): the public key, as base-58 encoded string, of the account that received the reward.
          • lamports (i64): the number of reward lamports credited or debited by the account, as an i64.
          • postBalance (u64): an account balance in lamports after the reward was applied.
          • rewardType (string|undefined): the type of reward: "fee", "rent", "voting", "staking".
          • commission (u8|undefined): a vote account commission when the reward was credited, only present for voting and staking rewards.
        • [DEPRECATED] status (object): a transaction status:
          • "Ok": <null>: a transaction was successful.
          • "Err": <ERR>: a transaction failed with TransactionError.
        • loadedAddresses (object|undefined): transaction addresses loaded from address lookup tables. Undefined if maxSupportedTransactionVersion is not set in request params:
          • writable (array[string]): an ordered list of base-58 encoded addresses for writable loaded accounts.
          • readonly (array[string]): an ordered list of base-58 encoded addresses for readonly loaded accounts.
        • returnData (object|undefined): 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.
        • computeUnitsConsumed (u64|undefined): the number of compute units (opens in a new tab) consumed by the transaction.
      • version ("legacy"|number|undefined): a transaction version; undefined if maxSupportedTransactionVersion is not set in request params.
    • signatures (array): to be included if "signatures" are requested for transaction details; an array of signatures strings, corresponding to the transaction order in the block.
    • rewards (array|undefined): block-level rewards, present if rewards are requested; an array of JSON objects containing:
      • pubkey (string): the public key, as base-58 encoded string, of the account that received the reward.
      • lamports (i64): the number of reward lamports credited or debited by the account, as an i64.
      • postBalance (u64): an account balance in lamports after the reward was applied.
      • rewardType (string|undefined): the type of reward: "fee", "rent", "voting", "staking".
      • commission (u8|undefined): the vote account commission when the reward was credited, included for voting and staking rewards only.
    • blockTime (i64|null): estimated production time, as Unix timestamp (seconds since the Unix epoch). null if not available.
    • blockHeight (u64|null): the number of blocks beneath this block.

Request example 1

curl -X POST https://rpc.ankr.com/solana \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "getBlock",
      "params": [430, {"encoding": "json","maxSupportedTransactionVersion":0,"transactionDetails":"full","rewards":false}],
      "id": 1
    }'

Response example 1

{
  "jsonrpc": "2.0",
  "result": {
    "blockHeight": 428,
    "blockTime": null,
    "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
    "parentSlot": 429,
    "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
    "transactions": [
      {
        "meta": {
          "err": null,
          "fee": 5000,
          "innerInstructions": [],
          "logMessages": [],
          "postBalances": [499998932500, 26858640, 1, 1, 1],
          "postTokenBalances": [],
          "preBalances": [499998937500, 26858640, 1, 1, 1],
          "preTokenBalances": [],
          "rewards": null,
          "status": {
            "Ok": null
          }
        },
        "transaction": {
          "message": {
            "accountKeys": [
              "3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe",
              "AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc",
              "SysvarS1otHashes111111111111111111111111111",
              "SysvarC1ock11111111111111111111111111111111",
              "Vote111111111111111111111111111111111111111"
            ],
            "header": {
              "numReadonlySignedAccounts": 0,
              "numReadonlyUnsignedAccounts": 3,
              "numRequiredSignatures": 1
            },
            "instructions": [
              {
                "accounts": [1, 2, 3, 0],
                "data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1",
                "programIdIndex": 4
              }
            ],
            "recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B"
          },
          "signatures": [
            "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv"
          ]
        }
      }
    ]
  },
  "id": 1
}

Request example 2

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

Response example 2

{
  "jsonrpc": "2.0",
  "result": {
    "blockHeight": 428,
    "blockTime": null,
    "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
    "parentSlot": 429,
    "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
    "rewards": [],
    "transactions": [
      {
        "meta": {
          "err": null,
          "fee": 5000,
          "innerInstructions": null,
          "logMessages": null,
          "postBalances": [499998932500, 26858640, 1, 1, 1],
          "postTokenBalances": [],
          "preBalances": [499998937500, 26858640, 1, 1, 1],
          "preTokenBalances": [],
          "rewards": [],
          "status": {
            "Ok": null
          }
        },
        "transaction": [
          "AVj7dxHlQ9IrvdYVIjuiRFs1jLaDMHixgrv+qtHBwz51L4/ImLZhszwiyEJDIp7xeBSpm/TX5B7mYzxa+fPOMw0BAAMFJMJVqLw+hJYheizSoYlLm53KzgT82cDVmazarqQKG2GQsLgiqktA+a+FDR4/7xnDX7rsusMwryYVUdixfz1B1Qan1RcZLwqvxvJl4/t3zHragsUp0L47E24tAFUgAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAAAHYUgdNXR0u3xNdiTr072z2DVec9EQQ/wNo1OAAAAAAAtxOUhPBp2WSjUNJEgfvy70BbxI00fZyEPvFHNfxrtEAQQEAQIDADUCAAAAAQAAAAAAAACtAQAAAAAAAAdUE18R96XTJCe+YfRfUp6WP+YKCy/72ucOL8AoBFSpAA==",
          "base64"
        ]
      }
    ]
  },
  "id": 1
}

getBlockHeight

Returns the current block height of the node.

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): 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.
      • minContextSlot (number): sets the minimum slot that the request can be evaluated at.

Returns


  • <u64>: a current block height.

Request example

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

Response example

{
    "jsonrpc": "2.0",
    "result": 156071111,
    "id": 1
}

getBlockProduction

Returns recent block production information from the current or previous epoch.

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): configuration object containing the following optional 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.
      • range (object): a slot range to return block production for. If parameter not provided, defaults to current epoch:
        • firstSlot (u64): the first slot to return block production information for (inclusive).
        • lastSlot (u64): the last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot.
      • identity (string): only return results for this validator identity (base-58 encoded).

Returns


  • value (object): the value containing the following parameters:
    • byIdentity (object): a dictionary of validator identities, as base-58 encoded strings. Value is a two element array containing the number of leader slots and the number of blocks produced.
    • range (object): a block production slot range:
      • firstSlot (u64): the first slot of the block production information (inclusive).
      • lastSlot (u64): the last slot of block production information (inclusive).

Request example 1

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

Response example 1

{
    "jsonrpc": "2.0",
    "result": {
        "context": {
            "slot": 9887
        },
        "value": {
            "byIdentity": {
                "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr": [
                    9888,
                    9886
                ]
            },
            "range": {
                "firstSlot": 0,
                "lastSlot": 9887
            }
        }
    },
    "id": 1
}

Request example 2

curl -X POST https://rpc.ankr.com/solana \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "getBlockProduction",
      "params": [
          {
            "identity": "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr",
            "range": {
              "firstSlot": 40,
              "lastSlot": 50
            }
          }
      ],
      "id": 1
    }'

Response example 2

{
    "jsonrpc": "2.0",
    "result": {
        "context": {
            "slot": 10102
        },
        "value": {
            "byIdentity": {
                "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr": [
                    11,
                    11
                ]
            },
            "range": {
                "firstSlot": 50,
                "lastSlot": 40
            }
        }
    },
    "id": 1
}

getBlockCommitment

Returns commitment for particular block.

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):

    • <u64> (required): the block identified by slot.

Returns


  • commitment: a commitment, comprising either:
    • null: an unknown block.
    • <array>: a commitment, array of u64 integers logging the amount of cluster stake in lamports that has voted on the block at each depth from 0 to MAX_LOCKOUT_HISTORY + 1.
  • totalStake: a total active stake, in lamports, of the current epoch.

Request example

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

Response example

{
    "jsonrpc": "2.0",
    "result": {
      "commitment": [
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 10, 32
      ],
      "totalStake": 42
    },
    "id": 1
}

getBlocks

Returns a list of confirmed blocks between two slots.

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):

    • <u64>: start_slot, as a u64 integer.
    • <u64>: end_slot, as u64 integer (must be no more than 500,000 blocks higher than the start_slot).
    • <object>: a configuration object containing the following field:
      • commitment (string; default: "finalized"): 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.

Returns

The result field will be an array of u64 integers listing confirmed blocks between start_slot and either end_slot, if provided, or latest confirmed block, inclusive. Max range allowed is 500,000 slots.

Request example

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

Response example

{
    "jsonrpc": "2.0",
    "result": [5, 6, 7, 8, 9, 10],
    "id": 1
}

getBlocksWithLimit

Returns a list of confirmed blocks starting at the given slot.

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):

    • <u64>: start_slot, as u64 integer.
    • <u64>: limit, as u64 integer (must be no more than 500,000 blocks higher than the start_slot).
    • <object> (optional): a configuration object containing the following field:
      • commitment (string; default: "finalized"): 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.

Returns

The result field will be an array of u64 integers listing confirmed blocks starting at start_slot for up to limit blocks, inclusive.

Request example

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

Response example

{
    "jsonrpc": "2.0",
    "result": [5, 6, 7],
    "id": 1
}

getBlockTime

Returns the estimated production time of a block.

Each validator reports their UTC time to the ledger on a regular interval by intermittently adding a timestamp to a Vote for a particular block. A requested block's time is calculated from the stake-weighted mean of the Vote timestamps in a set of recent blocks recorded on the ledger.

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):

    • <u64>: the block identified by slot.

Returns


  • <i64>: estimated production time, as Unix timestamp (seconds since the Unix epoch).
  • null: the timestamp is not available for this block.

Request example

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

Response example

{
    "jsonrpc": "2.0",
    "result": 1574721591,
    "id": 1
}

getClusterNodes

Returns information about all the nodes participating in the cluster.

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

The result field will be an array of JSON objects, each with the following subfields:

  • pubkey (string): the node public key, as base-58 encoded string.
  • gossip (string|null): a gossip network address for the node.
  • tpu (string|null): a TPU network address for the node.
  • rpc (string|null): a JSON RPC network address for the node, or null if the JSON RPC service is not enabled.
  • version (string|null): the software version of the node, or null if the version information is not available.
  • featureSet (u32|null): the unique identifier of the node's feature set.
  • shredVersion (u16|null): the shred version the node has been configured to use.

Request example

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

Response example

{
    "jsonrpc": "2.0",
    "result": [
      {
        "gossip": "10.239.6.48:8001",
        "pubkey": "9QzsJf7LPLj8GkXbYT3LFDKqsj2hHG7TA3xinJHu8epQ",
        "rpc": "10.239.6.48:8899",
        "tpu": "10.239.6.48:8856",
        "version": "1.0.0 c375ce1f"
      }
    ],
    "id": 1
}

getEpochInfo

Returns information about the current epoch.

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): 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.
      • minContextSlot (number): sets the minimum slot that the request can be evaluated at.

Returns

The result field will be an object with the following fields:

  • absoluteSlot (u64): the current slot.
  • blockHeight (u64): the current block height.
  • epoch (u64): the current epoch.
  • slotIndex (u64): the current slot relative to the start of the current epoch.
  • slotsInEpoch (u64): the number of slots in this epoch.
  • transactionCount (u64|null) total number of transactions processed without error since genesis.

Request example

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

Response example

{
    "jsonrpc": "2.0",
    "result": {
        "absoluteSlot": 172112108,
        "blockHeight": 156089334,
        "epoch": 398,
        "slotIndex": 176108,
        "slotsInEpoch": 432000,
        "transactionCount": 132596922065
    },
    "id": 1
}

getEpochSchedule

Returns epoch schedule information from this cluster's genesis config.

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

The result is an object containing the following parameters:

  • slotsPerEpoch (u64): the maximum number of slots in each epoch.
  • leaderScheduleSlotOffset (u64): the number of slots before beginning of an epoch to calculate a leader schedule for that epoch.
  • warmup (boolean): whether epochs start short and grow.
  • firstNormalEpoch (u64): the first normal-length epoch, log2(slotsPerEpoch) - log2(MINIMUM_SLOTS_PER_EPOCH).
  • firstNormalSlot (u64): MINIMUM_SLOTS_PER_EPOCH * (2.pow(firstNormalEpoch) - 1).

Request example

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

Response example

{
    "jsonrpc": "2.0",
    "result": {
        "firstNormalEpoch": 0,
        "firstNormalSlot": 0,
        "leaderScheduleSlotOffset": 432000,
        "slotsPerEpoch": 432000,
        "warmup": false
    },
    "id": 1
}

getFeeForMessage

Returns the fee the network will charge for a particular message.

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):

    • message (string, required): a base-64 encoded message.
    • <object> (optional): a configuration object containing the following optional 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; optional): sets the minimum slot that the request can be evaluated at.

Returns

  • <u64|null>: the fee corresponding to the message at the specified blockhash.

Request example

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

Response example

{
    "jsonrpc": "2.0",
    "result": {
        "context": {
            "apiVersion": "1.13.5",
            "slot": 172266779
        },
        "value": 5000
    },
    "id": 1
}

getFirstAvailableBlock

Returns the slot of the lowest confirmed block that has not been purged from the ledger.

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>: a slot.

Request example

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

Response example

{
    "jsonrpc": "2.0",
    "result": 172148976,
    "id": 1
}

getGenesisHash

Returns the genesis hash.

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


  • <string>: the hash as base-58 encoded string.

Request example

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

Response example

{
    "jsonrpc": "2.0",
    "result": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d",
    "id": 1
}

getHealth

Returns the current health of the node.

If one or more --known-validator arguments are provided to solana-validator, "ok" is returned when the node has within HEALTH_CHECK_SLOT_DISTANCE slots of the highest known validator, otherwise an error is returned. "ok" is always returned if no known validators are provided.

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

If the node is healthy: "ok" If the node is unhealthy, a JSON RPC error response is returned. The specifics of the error response are UNSTABLE and may change in the future.

Request example

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

Response example (healthy)

{
    "jsonrpc": "2.0",
    "result": "ok",
    "id": 1
}

Response example (unhealthy)

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32005,
        "message": "Node is unhealthy",
        "data": {}
    },
    "id": 1
}

Response example (unhealthy; additional info)

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32005,
        "message": "Node is behind by 42 slots",
        "data": {
            "numSlotsBehind": 42
        }
    },
    "id": 1
}

getHighestSnapshotSlot

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

Returns the highest slot information that the node has snapshots for.

This will find the highest full snapshot slot, and the highest incremental snapshot slot based on the full snapshot slot, if there is one.

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