getRecentBlockhash | Solana

The Solana getRecentBlockhash method returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.

This method is crucial for transaction construction and submission in Solana. The returned blockhash is used to indicate when a transaction was constructed, which is important for security reasons. The fee calculator provides information about the current network fees.

👍

Get your own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

This method does not require any parameters.

Response

  • blockhash — a string representing the blockhash of a recent block.
  • feeCalculator — an object containing:
    • lamportsPerSignature — the current fee in lamports per signature.

Use case

A common use case for getRecentBlockhash is in transaction preparation. When constructing a transaction, you need to include a recent blockhash to ensure the transaction is processed in a timely manner and to prevent replay attacks. The fee calculator information can be used to estimate the cost of the transaction.

Try the getRecentBlockhash RPC method yourself

Language
Click Try It! to start a request and see the response here!