generateWallets
Batch-generates Ethereum wallets and supports EVM-compatible chains for efficient wallet creation in bulk.
Instructions
Batch-generating ethereum wallets
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:19-58 (handler)Handler function that generates the specified number (1-100) of random Ethereum wallets using ethers.Wallet.createRandom(). Each wallet includes address, privateKey, and mnemonic phrase. Returns a JSON-formatted text response or error.async ({ count }) => { try { const wallets = []; // Generate the specified number of random wallets for (let i = 0; i < count; i++) { const wallet = ethers.Wallet.createRandom(); wallets.push({ address: wallet.address, privateKey: wallet.privateKey, mnemonic: wallet.mnemonic.phrase, }); } // Return the generated wallets in JSON format return { content: [ { type: "text", text: JSON.stringify( wallets, null, 2 ), }, ], isError: false, }; } catch (error) { // Return an error message if wallet generation fails return { content: [ { type: "text", text: `Error generating wallets: ${error.message}`, }, ], isError: true, }; } }
- index.js:16-18 (schema)Zod input schema: 'count' parameter (number, min 1, max 100, default 1).z.object({ count: z.number().min(1).max(100).default(1), // Limit the number of wallets to generate (1-100) }),
- index.js:13-59 (registration)MCP server tool registration for 'generateWallets': includes name, description, Zod schema, and handler function.server.tool( "generateWallets", "Batch-generating ethereum wallets", z.object({ count: z.number().min(1).max(100).default(1), // Limit the number of wallets to generate (1-100) }), async ({ count }) => { try { const wallets = []; // Generate the specified number of random wallets for (let i = 0; i < count; i++) { const wallet = ethers.Wallet.createRandom(); wallets.push({ address: wallet.address, privateKey: wallet.privateKey, mnemonic: wallet.mnemonic.phrase, }); } // Return the generated wallets in JSON format return { content: [ { type: "text", text: JSON.stringify( wallets, null, 2 ), }, ], isError: false, }; } catch (error) { // Return an error message if wallet generation fails return { content: [ { type: "text", text: `Error generating wallets: ${error.message}`, }, ], isError: true, }; } } );