Network/blockhash
Fresh blockhash
$0.01per call after 25 free a dayA fresh blockhash and how many blocks (and about how many seconds) are left before it expires.
Run just before building a transaction to sign. Blockhashes expire in about 60-90 seconds; this says how long is left.
Saves money. Says how many seconds the blockhash has left. A transaction built on an expired one gets rejected after the agent has done all the work.
Call it
| Transport | How |
|---|---|
| HTTP | POST /api/tools/blockhash with a JSON body of the inputs below. |
| MCP | tools/call with name blockhash on /mcp. |
Inputs
| Name | What it's looking for | Where to get it |
|---|---|---|
network"mainnet-beta" | "devnet", optional | Default "mainnet-beta" (real money). | "devnet" only for test wallets. |
Returned fields
Every field the tool returns, what it is, and exactly how it's worked out.
| Field | What it is | How it's worked out |
|---|---|---|
blockhashstring | The blockhash to put in your transaction. | getLatestBlockhash. |
valid_until_heightnumber | Once the chain passes this block height, the transaction is rejected. | Returned with the blockhash. |
current_heightnumber | The chain's block height right now. | getBlockHeight. |
blocks_leftnumber | Blocks left before the blockhash expires. | valid_until_height minus current_height. |
seconds_leftnumber | Rough time left to sign and send. | blocks_left x 0.4 seconds (the target block time). Real times vary, so leave a margin. |