Solana
Solana
Solana
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
isBlockhashValid tells you whether a given Solana blockhash is still recent enough to anchor a transaction. You pass a base-58 blockhash and the node replies with a boolean wrapped in an RpcResponse: true if a transaction built on it would still be accepted, false once it has aged out (after roughly 150 blocks at ~400ms slots). It is a cheap pre-flight check that saves you from spending a SOL fee broadcasting a transaction the cluster would reject. Call it on TheRPC at https://solana.therpc.io/YOUR_API_KEY.
getLatestBlockhash only when this returns false, avoiding a wasted broadcast.getFeeCalculatorForBlockhash validity check, which used to double as a way to test whether a blockhash was still alive.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | blockhash | string | 是 | Base-58 blockhash to check. |
| 2 | config | object | 否 | Options: commitment, minContextSlot. |
| 类型 | 描述 |
|---|---|
| object | RpcResponse wrapping a bool — true if the blockhash is still valid. |
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32602 | Invalid params | A param is missing, of the wrong type, or malformed (e.g. a non-base58 pubkey or a bad config field). |
-32603 | Internal error | The node hit an internal error serving the request — retry, and reduce the requested range/encoding if it persists. |
false result means the blockhash has expired. Fetch a new one with getLatestBlockhash, rebuild and re-sign the transaction, then resend.RpcResponse under result.value. Read that nested field, not a bare top-level boolean.