zetrix_crypto_generate_keypair
Generate a new cryptographic key pair for Zetrix blockchain accounts, providing private key, public key, and wallet address for secure transactions and smart contract interactions.
Instructions
Generate a new Zetrix key pair with private key, public key, and address
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:529-535 (registration)Tool registration in the tools array, defining the name, description, and empty input schema (no parameters required).name: "zetrix_crypto_generate_keypair", description: "Generate a new Zetrix key pair with private key, public key, and address", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:1238-1248 (handler)MCP tool handler in the switch statement that invokes ZetrixEncryption.generateKeyPair() and formats the response.case "zetrix_crypto_generate_keypair": { const keyPair = await zetrixEncryption.generateKeyPair(); return { content: [ { type: "text", text: JSON.stringify(keyPair, null, 2), }, ], }; }
- src/zetrix-encryption.ts:59-74 (handler)Core implementation of key pair generation using the official zetrix-encryption-nodejs library's KeyPair class.async generateKeyPair(): Promise<ZetrixKeyPair> { await this.initEncryption(); try { const kp = new this.KeyPair(); return { privateKey: kp.getEncPrivateKey(), publicKey: kp.getEncPublicKey(), address: kp.getAddress(), }; } catch (error) { throw new Error( `Failed to generate key pair: ${error instanceof Error ? error.message : String(error)}` ); } }
- src/zetrix-encryption.ts:38-53 (helper)Lazy initialization of the external zetrix-encryption-nodejs library used by generateKeyPair.private async initEncryption() { if (this.encryption) return; try { // Dynamically import the CommonJS module const module = await import("zetrix-encryption-nodejs"); this.encryption = module.default || module; this.KeyPair = this.encryption.keypair; this.signature = this.encryption.signature; this.keystore = this.encryption.keystore; } catch (error) { throw new Error( `Failed to initialize Zetrix Encryption: ${error instanceof Error ? error.message : String(error)}` ); } }