Skip to main content
Glama

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

Implementation Reference

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

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