anchor_hash
Anchor a 32-byte hash to Base and Solana mainnets in one call, receiving transaction hashes and block-explorer URLs as cryptographic proof of existence.
Instructions
Anchor a 32-byte hash to BOTH Base mainnet (as EIP-1559 calldata) and Solana mainnet (via the Memo program) in a single call. Returns both transaction hashes plus block-explorer URLs as cryptographic proof of when the hash existed. Pure infrastructure — no opinions about content. Use for DAO vote receipts, AI decision attestations, contract notarization, scientific data integrity, audit trails. $0.005 USDC.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hash | No | Pre-computed 32-byte hex hash (64 chars, no 0x prefix). Mutually exclusive with `data`. | |
| data | No | Arbitrary JSON to be canonicalized + SHA-256'd by the server. Mutually exclusive with `hash`. | |
| note | No | Optional 200-char note included in the response (NOT on-chain). |
Implementation Reference
- index.js:69-88 (schema)Tool definition and inputSchema for the 'anchor_hash' tool. Defines three optional inputs: hash (64-char hex), data (arbitrary JSON), and note (200-char string). The description explains it anchors a 32-byte hash to both Base and Solana mainnets.
{ name: "anchor_hash", description: "Anchor a 32-byte hash to BOTH Base mainnet (as EIP-1559 calldata) and Solana mainnet (via the Memo program) in a single call. Returns both transaction hashes plus block-explorer URLs as cryptographic proof of when the hash existed. Pure infrastructure — no opinions about content. Use for DAO vote receipts, AI decision attestations, contract notarization, scientific data integrity, audit trails. $0.005 USDC.", inputSchema: { type: "object", properties: { hash: { type: "string", description: "Pre-computed 32-byte hex hash (64 chars, no 0x prefix). Mutually exclusive with `data`.", }, data: { description: "Arbitrary JSON to be canonicalized + SHA-256'd by the server. Mutually exclusive with `hash`.", }, note: { type: "string", description: "Optional 200-char note included in the response (NOT on-chain).", }, }, }, - index.js:202-204 (registration)Registration of all tools (including anchor_hash) via ListToolsRequestSchema handler. Returns the TOOLS array which contains the anchor_hash definition.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, })); - index.js:208-220 (handler)Handler logic for 'anchor_hash' inside the buildRequest switch statement. Constructs a POST request to `${BASE_URL}/v1/anchor` with optional hash, data, and note fields in the JSON body. This is the core function that executes the anchor_hash tool logic by building the API request.
case "anchor_hash": return { url: `${BASE_URL}/v1/anchor`, opts: { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ ...(args.hash !== undefined ? { hash: args.hash } : {}), ...(args.data !== undefined ? { data: args.data } : {}), ...(args.note ? { note: String(args.note).slice(0, 200) } : {}), }), }, }; - index.js:302-343 (helper)The CallToolRequestSchema handler that dispatches all tool calls via buildRequest(), then executes the request using a payment-enabled fetch (paidFetch) and returns the JSON response. Used by all tools including anchor_hash.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args = {} } = request.params; let req; try { req = buildRequest(name, args); } catch (err) { return { content: [{ type: "text", text: `Error: ${err.message}` }], isError: true, }; } try { const res = await paidFetch(req.url, req.opts); if (res.status === 402) { const body = await res.text().catch(() => ""); const msg = paymentEnabled ? `Payment failed (402). The wallet may be out of USDC on Base, or the x402 facilitator rejected the payload.\n\nResponse body: ${body.slice(0, 300)}` : `Payment required (402). Set ANCHOR_WALLET_PRIVATE_KEY in your MCP config so this server can pay automatically:\n\n "env": {\n "ANCHOR_WALLET_PRIVATE_KEY": "0xYOUR_BASE_WALLET_PRIVATE_KEY"\n }\n\nFund the wallet with USDC on Base (any amount > $0.05 is plenty). The wallet pays $0.001–$0.010 per call.\n\nResponse body: ${body.slice(0, 300)}`; return { content: [{ type: "text", text: msg }], isError: true }; } if (!res.ok) { const body = await res.text().catch(() => ""); return { content: [{ type: "text", text: `anchor-x402 returned ${res.status}: ${body.slice(0, 500)}` }], isError: true, }; } const data = await res.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (err) { return { content: [{ type: "text", text: `anchor-x402 request failed: ${err.message}` }], isError: true, }; } });