sign_raw_transaction
Sign a raw VeChain transaction to authorize blockchain operations using cryptographic verification.
Instructions
Decode and sign a raw transaction.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rawTransaction | Yes |
Implementation Reference
- src/tools.ts:576-599 (handler)Handler function that signs a raw VeChain transaction using the agent's secret key from environment variable. Decodes the hex input, signs with secp256k1, encodes, and returns the signed transaction hex.callback: async ({ rawTransaction }: { rawTransaction: string }) => { const secretKey = process.env.AGENT_SECRET_KEY if (!secretKey) { throw new Error("Missing AGENT_SECRET_KEY variable to use this tool.") } const secretKeyBytes = Address.of(secretKey).bytes const decodedTxBytes = Hex.of(rawTransaction).bytes const decodedTx = Transaction.decode(decodedTxBytes, true); const signedTx = decodedTx.sign(secretKeyBytes) const signedTxBytes = signedTx.encoded const signedTxHex = Hex.of(signedTxBytes).toString() return { content: [{ type: "text", text: JSON.stringify(signedTxHex, null, 2) }] }; }
- src/tools.ts:573-575 (schema)Zod input schema defining the required 'rawTransaction' parameter as a string (hex-encoded raw transaction).inputSchema: { rawTransaction: z.string(), },
- src/server.ts:74-92 (registration)Registration of all vechainTools (including sign_raw_transaction) with the MCP server using registerTool, passing name, schema, and wrapper around the tool's callback.for (const t of vechainTools) { server.registerTool( t.name, { title: t.name, description: t.description, inputSchema: t.inputSchema }, async (args) => { const result = await t.callback(args); return { content: result.content.map(item => ({ ...item, type: "text" as const })) }; } ); }