getLatestBlockhash

Fetch a recent Solana blockhash and its last valid block height for signing transactions.

getLatestBlockhash returns a recent blockhash to reference when signing a transaction, plus the last block height at which that blockhash is still valid. Every transaction needs a fresh blockhash; a stale one is the most common cause of a dropped transaction.

Request

curl -s https://rpc.rpcedge.com \
  -H 'content-type: application/json' \
  -H 'x-api-key: YOUR_UUID_KEY' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getLatestBlockhash",
    "params": [{ "commitment": "processed" }]
  }'

Parameters

PositionNameTypeNotes
0configobjectOptional. commitment and minContextSlot.

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "context": { "slot": 429641447 },
    "value": {
      "blockhash": "EkSnNWid2cvwEVnVx9aBqawnmiCNiDgp3gUdkDPTKN1N",
      "lastValidBlockHeight": 429641900
    }
  }
}
FieldMeaning
blockhashBase-58 blockhash to set on your transaction message.
lastValidBlockHeightThe transaction is only valid while the chain's block height is this. After that, re-sign with a fresh blockhash.
getLatestBlockhash · rpc edge docs