Block Methods

getBlock

POST - JSON-RPC

Returns identity and transaction information about a confirmed block.

integerrequired

Slot number (u64).

object

Configuration object:

  • commitment (string) - finalized or confirmed
  • encoding (string) - json, jsonParsed, base58, base64
  • transactionDetails (string) - full, accounts, signatures, none
  • rewards (boolean) - include rewards
  • maxSupportedTransactionVersion (integer) - max transaction version
bash
curl https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getBlock","params":[430,{"encoding":"json","maxSupportedTransactionVersion":0,"transactionDetails":"full","rewards":false}]}'
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlock",
  "params": [
    430,
    {
      "encoding": "json",
      "maxSupportedTransactionVersion": 0,
      "transactionDetails": "full",
      "rewards": false
    }
  ]
}
json
{
  "jsonrpc": "2.0",
  "result": {
    "blockHeight": 428,
    "blockTime": null,
    "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA",
    "parentSlot": 429,
    "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B",
    "transactions": []
  },
  "id": 1
}

getBlockTime

POST - JSON-RPC

Returns the estimated block time for a given block on the Solana blockchain.

integerrequired

Block slot number (u64).

bash
curl https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getBlockTime","params":[5]}'
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlockTime",
  "params": [5]
}
json
{
  "jsonrpc": "2.0",
  "result": 1574721591,
  "id": 1
}

getBlockCommitment

POST - JSON-RPC

Returns the commitment for a specific block, providing cluster stake voting information.

integerrequired

Slot number (u64).

bash
curl https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getBlockCommitment","params":[5]}'
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlockCommitment",
  "params": [5]
}
json
{
  "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
}

getBlockHeight

POST - JSON-RPC

Returns the current block height of the Solana blockchain node.

object

Configuration object with optional commitment and minContextSlot.

bash
curl https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getBlockHeight"}'
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlockHeight"
}
json
{
  "jsonrpc": "2.0",
  "result": 1233,
  "id": 1
}

getBlockProduction

POST - JSON-RPC

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

object

Configuration object:

  • commitment (string)
  • identity (string) - filter by validator identity
  • range (object) - { firstSlot, lastSlot } to limit range
bash
curl https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getBlockProduction"}'
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlockProduction"
}
json
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 9887 },
    "value": {
      "byIdentity": {
        "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr": [9888, 9886]
      },
      "range": { "firstSlot": 0, "lastSlot": 9887 }
    }
  },
  "id": 1
}

getBlocks

POST - JSON-RPC

Returns a list of confirmed blocks between two specified slots.

integerrequired

Start slot (u64).

integer

End slot (u64, optional). Must be no more than 500,000 slots higher than start slot.

object

Configuration object with optional commitment. Only finalized and confirmed are accepted.

getBlocks does not support processed commitment. Use finalized or confirmed only.

bash
curl https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getBlocks","params":[5,10]}'
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlocks",
  "params": [5, 10]
}
json
{
  "jsonrpc": "2.0",
  "result": [5, 6, 7, 8, 9, 10],
  "id": 1
}

getBlocksWithLimit

POST - JSON-RPC

Returns a list of confirmed blocks starting from a slot up to a given limit.

integerrequired

Start slot (u64).

integerrequired

Limit (u64, max 500,000).

object

Configuration object with optional commitment. Only finalized and confirmed are accepted.

bash
curl https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"getBlocksWithLimit","params":[5,3]}'
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlocksWithLimit",
  "params": [5, 3]
}
json
{
  "jsonrpc": "2.0",
  "result": [5, 6, 7],
  "id": 1
}