Skip to main content
Glama

sign_raw_transaction

Sign raw VeChain blockchain transactions using cryptographic keys to authorize and validate network operations before execution.

Instructions

Decode and sign a raw transaction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rawTransactionYes

Implementation Reference

  • The handler function for 'sign_raw_transaction' tool. It retrieves the agent's secret key from environment, decodes the raw transaction hex, signs it with the secret key, encodes the signed transaction back to hex, and returns it as a text response.
    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) }] }; }
  • Input schema for the 'sign_raw_transaction' tool, requiring a 'rawTransaction' string.
    inputSchema: { rawTransaction: z.string(), },
  • src/tools.ts:569-600 (registration)
    Registration of the 'sign_raw_transaction' tool in the tools array, including name, title, description, schema, and inline handler callback.
    { name: "sign_raw_transaction", title: "Sign raw transaction", description: "Decode and sign a raw transaction.", inputSchema: { rawTransaction: z.string(), }, 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) }] }; } }

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/leandrogavidia/vechain-mcp-server'

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