zetrix_crypto_sign
Sign messages with a private key on the Zetrix blockchain to authenticate transactions and verify data integrity.
Instructions
Sign a message with a private key
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | The message to sign (hex string) | |
| privateKey | Yes | The private key to sign with |
Implementation Reference
- src/zetrix-encryption.ts:161-177 (handler)Core implementation of the cryptographic signing function using the zetrix-encryption-nodejs library's signature.sign method.async sign(message: string, privateKey: string): Promise<ZetrixSignature> { await this.initEncryption(); try { const signData = this.signature.sign(message, privateKey); const publicKey = this.KeyPair.getEncPublicKey(privateKey); return { signData, publicKey, }; } catch (error) { throw new Error( `Failed to sign message: ${error instanceof Error ? error.message : String(error)}` ); } }
- src/index.ts:1310-1326 (handler)MCP server tool handler for 'zetrix_crypto_sign' that validates input, calls ZetrixEncryption.sign, and formats the response.case "zetrix_crypto_sign": { if (!args) { throw new Error("Missing arguments"); } const signature = await zetrixEncryption.sign( args.message as string, args.privateKey as string ); return { content: [ { type: "text", text: JSON.stringify(signature, null, 2), }, ], }; }
- src/index.ts:583-600 (schema)Input schema definition for the 'zetrix_crypto_sign' tool, specifying required message and privateKey parameters.{ name: "zetrix_crypto_sign", description: "Sign a message with a private key", inputSchema: { type: "object", properties: { message: { type: "string", description: "The message to sign (hex string)", }, privateKey: { type: "string", description: "The private key to sign with", }, }, required: ["message", "privateKey"], }, },
- src/index.ts:768-770 (registration)Registration of all tools list handler, which exposes the 'zetrix_crypto_sign' tool via the tools array.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });