getRecentBlockhash RPC Method
Description
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.
Please note that this method is deprecated, no longer available on Devnet and Testnet, and will be removed from Mainnet soon. For a similar method, you can use Solana's getLatestBlockhash RPC method.
Parameters
object
(array, optional) - The configuration object with the following fields:commitment
(string, optional) - The level of commitment required for the query. Options:finalized
- The node will query the most recent block confirmed by the supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.confirmed
- The node will query the most recent block that has been voted on by the supermajority of the cluster.processed
- The node will query its most recent block. Note that the block may not be complete.
Returns
result
- An RpcResponse JSON object with the following fields:context
- Metadata about the current state of the Solana network at the time of processing:apiVersion
- The version number.slot
- The current slot in the Solana cluster when the request was processed.
value
- An object containing:blockhash
- The blockhash as a base-58 encoded string, used to calculate transaction fees.feeCalculator
- A JSON object representing the fee calculator:lamportsPerSignature
- The number of lamports required to process each signature in the transaction, encoded as a u64 integer.
Code Examples
getProgramAccounts
Returns all accounts owned by the provided program Pubkey.
getRecentPerformanceSamples
Returns a list of recent performance samples, in reverse slot order. Performance samples are taken every 60 seconds and include the number of transactions and slots that occur in a given time window.