helius_get_latest_blockhash
Retrieve the current blockhash from the Solana blockchain to validate transactions and ensure data integrity.
Instructions
Get the latest blockhash from the Solana blockchain
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commitment | No |
Implementation Reference
- src/handlers/helius.ts:128-135 (handler)The core handler function that fetches the latest blockhash using the Helius SDK's connection.getLatestBlockhash method and formats the response.export const getLatestBlockhashHandler = async (input: GetLatestBlockhashInput): Promise<ToolResultSchema> => { try { const { blockhash, lastValidBlockHeight } = await (helius as any as Helius).connection.getLatestBlockhash(input.commitment); return createSuccessResponse(`Latest blockhash: ${blockhash}, Last valid block height: ${lastValidBlockHeight}`); } catch (error) { return createErrorResponse(`Error getting latest blockhash: ${error instanceof Error ? error.message : String(error)}`); } }
- src/tools.ts:91-100 (schema)Defines the tool's input schema, including optional commitment parameter.{ name: "helius_get_latest_blockhash", description: "Get the latest blockhash from the Solana blockchain", inputSchema: { type: "object", properties: { commitment: { type: "string", enum: ["confirmed", "finalized", "processed"] } }, required: [] }
- src/tools.ts:555-555 (registration)Maps the tool name to its handler function in the central handlers dictionary."helius_get_latest_blockhash": getLatestBlockhashHandler,