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 (4/4)

API reference for Solana. All methods ->

Part 4 of 4: 1 · 2 · 3 · 4

getTransactionCount

Returns the current Transaction count 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):

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

Returns


  • <u64>: the count.

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": "getTransactionCount"
}'

Response example

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

getVersion

Returns the current solana versions running on 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): None.

Returns

The result object contains the following parameters:

  • solana-core: the software version of solana-core.
  • feature-set: a unique identifier of the current software's feature set.

Request parameters

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

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"feature-set": 3294202862,
"solana-core": "2.2.3"
}
}