Skip to main content
Glama

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
NameRequiredDescriptionDefault
commitmentNo

Implementation Reference

  • 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)}`); } }
  • 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,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dcSpark/mcp-server-helius'

If you have feedback or need assistance with the MCP directory API, please join our Discord server