For the complete documentation index, see llms.txt. This page is also available as Markdown.

getLatestBlockhash

All the specifications for getLatestBlockhash RPC Method on Solana

Returns the latest blockhash. For older v1.8 of solana-core, please use getRecentBlockhash.

Parameters required for this RPC call

  • configuration : This contains the following parameters, all are optional fields.

    • commitment: The commitment describes how finalized a block is at that point in time. processed, confirmed and finalized are supported.

    • minContextSlot: The minimum slot that the request can be evaluated at.

curl https://rpc.shyft.to?api_key=YOUR-API-KEY -s -X \
  POST -H "Content-Type: application/json" -d ' 
   {
     "jsonrpc": "2.0",
     "id": 1,
     "method": "getLatestBlockhash",
     "params": [
       {
         "commitment": "processed"
       }
     ]
   }
 '
import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed");

let commitment: Commitment = "processed";
let latestBlockhash = await connection.getLatestBlockhash(commitment);

console.log(latestBlockhash);

Last updated