# getLatestBlockhash

Solana API method that returns the latest blockhash.


  • <object> — (optional) the configuration object containing the following fields:
    • commitment: <string> — (optional) the commitment used for retrieving blockhash.
    • minContextSlot: <number> — (optional) the minimum slot that the request can be evaluated at.


  • RpcResponse <object> — the RPC response JSON object with value field set to a JSON object including:
    • blockhash: <string> — a hash as a base58 encoded string.
    • lastValidBlockHeight: <u64> — the last block height at which the blockhash will be valid.


  • Solana web3.js
  • Solana.py
  • cURL
import { Connection } from "@solana/web3.js";

const nodeUrl = "CHAINSTACK_NODE_URL"
const connect = new Connection(nodeUrl);

(async () => {  
  console.log(await connect.getLatestBlockhash());