Skip to main content
Glama
lienhage

Blockchain MCP Server

by lienhage

Generate Ethereum Vanity Address

generate-vanity-address

Create Ethereum addresses with custom prefix and suffix patterns using parallel processing. Optimize results by adjusting thread count and case sensitivity settings with the Blockchain MCP Server.

Instructions

Generate Ethereum addresses matching specified prefix and suffix patterns with concurrent computation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
caseSensitiveNoWhether to match case-sensitively, default false
prefixNoAddress prefix (without 0x), e.g., '1234'
suffixNoAddress suffix, e.g., 'abcd'
workersNoNumber of concurrent worker threads, default 4

Implementation Reference

  • Registers the 'generate-vanity-address' tool with the MCP server, including title, description, input schema, and the handler function.
          "generate-vanity-address",
          {
            title: "Generate Ethereum Vanity Address",
            description: "Generate Ethereum addresses matching specified prefix and suffix patterns with concurrent computation",
            inputSchema: {
              prefix: z.string().optional().describe("Address prefix (without 0x), e.g., '1234'"),
              suffix: z.string().optional().describe("Address suffix, e.g., 'abcd'"),
              workers: z.number().min(1).max(16).default(4).describe("Number of concurrent worker threads, default 4"),
              caseSensitive: z.boolean().default(false).describe("Whether to match case-sensitively, default false")
            }
          },
          async ({ prefix, suffix, workers = 4, caseSensitive = false }) => {
            if (!prefix && !suffix) {
              return {
                content: [{
                  type: "text",
                  text: "Error: Must specify at least one of prefix or suffix"
                }],
                isError: true
              };
            }
    
            try {
              const result = await this.generateVanityAddress({
                prefix: prefix?.toLowerCase(),
                suffix: suffix?.toLowerCase(),
                workers,
                caseSensitive
              });
    
              return {
                content: [{
                  type: "text",
                  text: `✅ Successfully generated vanity address!
    
    🔹 Address: ${result.address}
    🔹 Private Key: ${result.privateKey}
    🔹 Attempts: ${result.attempts.toLocaleString()}
    🔹 Time Taken: ${(result.timeMs / 1000).toFixed(2)} seconds
    🔹 Hash Rate: ${Math.round(result.attempts / (result.timeMs / 1000)).toLocaleString()} addresses/sec
    
    ⚠️  Please keep the private key secure and never share it with others!`
                }]
              };
            } catch (error) {
              return {
                content: [{
                  type: "text",
                  text: `Error generating vanity address: ${error instanceof Error ? error.message : String(error)}`
                }],
                isError: true
              };
            }
          }
        );
  • Orchestrates multiple worker threads to generate a vanity address matching the specified prefix and/or suffix patterns, collects statistics, and returns the result.
    private async generateVanityAddress(options: {
      prefix?: string;
      suffix?: string;
      workers: number;
      caseSensitive: boolean;
    }): Promise<VanityResult> {
      const startTime = Date.now();
      const workers: Worker[] = [];
      let totalAttempts = 0;
      let found = false;
      let result: VanityResult | null = null;
    
      return new Promise((resolve, reject) => {
        for (let i = 0; i < options.workers; i++) {
          const worker = new Worker(join(__dirname, 'worker.js'), {
            workerData: {
              prefix: options.prefix,
              suffix: options.suffix,
              caseSensitive: options.caseSensitive,
              workerId: i
            }
          });
    
          worker.on('message', (data) => {
            if (data.type === 'found' && !found) {
              found = true;
              result = {
                address: data.address,
                privateKey: data.privateKey,
                attempts: totalAttempts + data.attempts,
                timeMs: Date.now() - startTime
              };
              
              workers.forEach(w => w.terminate());
              resolve(result);
            } else if (data.type === 'progress') {
              totalAttempts += data.attempts;
            }
          });
    
          worker.on('error', (error) => {
            if (!found) {
              workers.forEach(w => w.terminate());
              reject(error);
            }
          });
    
          workers.push(worker);
        }
    
        setTimeout(() => {
          if (!found) {
            workers.forEach(w => w.terminate());
            reject(new Error('Generation timeout, try reducing difficulty or increasing worker threads'));
          }
        }, 300000);
      });
    }
  • Core logic in worker thread: continuously generates random Ethereum wallets using ethers.Wallet.createRandom() until an address matches the prefix/suffix patterns, then sends result to parent.
    function generateAndCheck(): void {
      while (true) {
        const wallet = ethers.Wallet.createRandom();
        attempts++;
        
        if (matchesPattern(wallet.address, prefix, suffix, caseSensitive)) {
          parentPort?.postMessage({
            type: 'found',
            address: wallet.address,
            privateKey: wallet.privateKey,
            attempts: attempts
          });
          break;
        }
        
        if (attempts % progressInterval === 0) {
          parentPort?.postMessage({
            type: 'progress',
            attempts: progressInterval,
            workerId: workerId
          });
          attempts = 0;
        }
      }
    }
  • Utility function to check if an Ethereum address matches the given prefix and suffix patterns (case-sensitive option).
    function matchesPattern(address: string, targetPrefix?: string, targetSuffix?: string, isCaseSensitive?: boolean): boolean {
      const addr = isCaseSensitive ? address : address.toLowerCase();
      const addrWithoutPrefix = addr.slice(2);
      
      let prefixMatch = true;
      let suffixMatch = true;
      
      if (targetPrefix) {
        prefixMatch = addrWithoutPrefix.startsWith(targetPrefix);
      }
      
      if (targetSuffix) {
        suffixMatch = addrWithoutPrefix.endsWith(targetSuffix);
      }
      
      return prefixMatch && suffixMatch;
    }
  • src/index.ts:13-17 (registration)
    Instantiates VanityAddressGenerator and calls registerWithServer to register its tools with the main MCP server.
    const vanityGenerator = new VanityAddressGenerator();
    const castCommands = new CastCommands();
    const rpcService = new RpcService();
    
    vanityGenerator.registerWithServer(server);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'concurrent computation' which hints at performance characteristics, but fails to address critical aspects like computational intensity, time expectations, whether this is a read-only operation, or any potential side effects. For a tool that likely involves significant computation, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core purpose without unnecessary words. It's appropriately sized and front-loaded with the main functionality, making it easy for an agent to quickly understand what the tool does.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a computational tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the output looks like (address format, private key handling), doesn't warn about computational requirements, and provides minimal behavioral context. Given the complexity of vanity address generation, more completeness is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, providing complete parameter documentation. The description adds no additional parameter semantics beyond what's already in the schema, so it meets but doesn't exceed the baseline expectation. No parameters are explained in the description text itself.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Generate Ethereum addresses') and resource ('matching specified prefix and suffix patterns'), with the additional detail 'with concurrent computation' distinguishing it from basic address generation tools. It precisely communicates what the tool does without being tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. While sibling tools like 'validate-ethereum-address' or 'get-balance' exist, there's no mention of when this vanity address generation is appropriate versus other address-related operations, leaving the agent without contextual usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/lienhage/blockchain-mcp'

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