Skip to main content
Glama
Zetrix-Chain

Zetrix MCP Server

Official
by Zetrix-Chain

zetrix_crypto_generate_keypair

Generate a new Zetrix blockchain key pair with private key, public key, and address for secure account creation and transaction signing.

Instructions

Generate a new Zetrix key pair with private key, public key, and address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:528-535 (registration)
    Tool registration including name, description, and input schema (empty object)
    {
      name: "zetrix_crypto_generate_keypair",
      description: "Generate a new Zetrix key pair with private key, public key, and address",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • MCP server dispatch handler that calls the encryption module's generateKeyPair method
    case "zetrix_crypto_generate_keypair": {
      const keyPair = await zetrixEncryption.generateKeyPair();
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(keyPair, null, 2),
          },
        ],
      };
    }
  • Core implementation of key pair generation using the official zetrix-encryption-nodejs library
    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)}`
        );
      }
    }
  • TypeScript interface defining the structure of the returned key pair object
    export interface ZetrixKeyPair {
      privateKey: string;
      publicKey: string;
      address: string;
    }
  • 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)}`
        );
      }
    }

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/Zetrix-Chain/zetrix-mcp-server'

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