curl --fail-with-body "$THORNODE_RPC_URL" \
--header 'content-type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "getLatestBlockhash",
"params": [
{
"commitment": "processed"
}
]
}'
const body = {
"jsonrpc": "2.0",
"id": 1,
"method": "getLatestBlockhash",
"params": [
{
"commitment": "processed"
}
]
};
const response = await fetch(process.env.THORNODE_RPC_URL, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify(body),
});
const { result, error } = await response.json();
console.log(result ?? error);
{
"jsonrpc": "2.0",
"result": {
"context": {
"apiVersion": "4.1.2",
"slot": 439749118
},
"value": {
"blockhash": "DoLUbTY3nUpNK9YvxzYBjvpg6BdmDvqhjCfnzY5yeWU",
"lastValidBlockHeight": 417799829
}
},
"id": 1
}
HTTP methods
getLatestBlockhash
Returns the latest Solana blockhash required for constructing fresh transactions. Blockhashes expire after ~150 slots. Fetch one just before signing to maximize the inclusion window.
curl --fail-with-body "$THORNODE_RPC_URL" \
--header 'content-type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "getLatestBlockhash",
"params": [
{
"commitment": "processed"
}
]
}'
const body = {
"jsonrpc": "2.0",
"id": 1,
"method": "getLatestBlockhash",
"params": [
{
"commitment": "processed"
}
]
};
const response = await fetch(process.env.THORNODE_RPC_URL, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify(body),
});
const { result, error } = await response.json();
console.log(result ?? error);
{
"jsonrpc": "2.0",
"result": {
"context": {
"apiVersion": "4.1.2",
"slot": 439749118
},
"value": {
"blockhash": "DoLUbTY3nUpNK9YvxzYBjvpg6BdmDvqhjCfnzY5yeWU",
"lastValidBlockHeight": 417799829
}
},
"id": 1
}
Returns the latest Solana blockhash required for constructing fresh transactions. Blockhashes expire after ~150 slots. Fetch one just before signing to maximize the inclusion window.