Skip to main content
Glama

store_wallet

Securely store a wallet by encrypting its mnemonic phrase with a password. Use this tool for safe wallet management on the Algorand blockchain network, ensuring protection of sensitive data.

Instructions

Securely store a wallet with encrypted mnemonic

Input Schema

NameRequiredDescriptionDefault
mnemonicYesMnemonic phrase to store securely
nameYesWallet name/identifier
passwordYesPassword to encrypt the mnemonic

Input Schema (JSON Schema)

{ "properties": { "mnemonic": { "description": "Mnemonic phrase to store securely", "type": "string" }, "name": { "description": "Wallet name/identifier", "type": "string" }, "password": { "description": "Password to encrypt the mnemonic", "type": "string" } }, "required": [ "name", "mnemonic", "password" ], "type": "object" }

Implementation Reference

  • The main handler for the 'store_wallet' tool. Parses input arguments using Zod schema, imports the account from mnemonic to retrieve the address, encrypts the mnemonic using AES-256-GCM via AlgorandService, stores the encrypted data and address in an in-memory Map, and returns a success message.
    case 'store_wallet': { const parsed = StoreWalletArgsSchema.parse(args); try { // Import account to get address const account = algorandService.importAccountFromMnemonic(parsed.mnemonic); // Encrypt mnemonic const { encryptedMnemonic, iv } = algorandService.encryptMnemonic(parsed.mnemonic, parsed.password); // Store wallet walletStorage.set(parsed.name, { encryptedMnemonic, iv, address: account.addr.toString() }); return { content: [ { type: 'text', text: `Wallet "${parsed.name}" stored securely!\nAddress: ${account.addr}\n\n⚠️ Remember your password - it's required to access the wallet.`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error storing wallet: ${error}`, }, ], isError: true, }; } }
  • Zod schema defining the input validation for the store_wallet tool: wallet name, mnemonic phrase, and encryption password.
    const StoreWalletArgsSchema = z.object({ name: z.string(), mnemonic: z.string(), password: z.string(), });
  • src/index.ts:323-344 (registration)
    Tool registration in the TOOLS array, including name, description, and JSON input schema for MCP protocol.
    { name: 'store_wallet', description: 'Securely store a wallet with encrypted mnemonic', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Wallet name/identifier', }, mnemonic: { type: 'string', description: 'Mnemonic phrase to store securely', }, password: { type: 'string', description: 'Password to encrypt the mnemonic', }, }, required: ['name', 'mnemonic', 'password'], }, },
  • Helper method in AlgorandService class that encrypts the mnemonic phrase using AES-256-GCM with a key derived from the password, producing encrypted mnemonic and initialization vector (IV). Called by the store_wallet handler.
    encryptMnemonic(mnemonic: string, password: string): { encryptedMnemonic: string; iv: string } { const key = crypto.scryptSync(password, 'salt', 32); const iv = crypto.randomBytes(16); const cipher = crypto.createCipheriv('aes-256-gcm', key, iv); let encrypted = cipher.update(mnemonic, 'utf8', 'hex'); encrypted += cipher.final('hex'); const authTag = cipher.getAuthTag(); return { encryptedMnemonic: encrypted + ':' + authTag.toString('hex'), iv: iv.toString('hex') }; }

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/Jake-loranger/algorand-mcp-server'

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