get_wallet_address_from_private_key
Retrieve a wallet address from a private key with checksum formatting, enabling secure interaction with EDUCHAIN's token and pool data.
Instructions
Get wallet address from private key with proper checksum formatting
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| privateKey | Yes | Private key of the wallet |
Input Schema (JSON Schema)
{
"properties": {
"privateKey": {
"description": "Private key of the wallet",
"type": "string"
}
},
"required": [
"privateKey"
],
"type": "object"
}
Implementation Reference
- src/blockchain.ts:60-68 (handler)Core handler function that creates an ethers.Wallet from the provided private key and returns the checksummed wallet address.export function getWalletAddressFromPrivateKey(privateKey: string): string { try { const wallet = new ethers.Wallet(privateKey); return ethers.getAddress(wallet.address); // Format to checksum address } catch (error) { console.error('Error getting wallet address from private key:', error); throw error; } }
- src/index.ts:447-460 (schema)Input schema definition for the 'get_wallet_address_from_private_key' tool, listed in the ListTools response.{ name: 'get_wallet_address_from_private_key', description: 'Get wallet address from private key with proper checksum formatting', inputSchema: { type: 'object', properties: { privateKey: { type: 'string', description: 'Private key of the wallet', }, }, required: ['privateKey'], }, },
- src/index.ts:1000-1015 (registration)MCP tool registration and dispatch handler in the CallToolRequestSchema switch statement. Validates input and delegates to the blockchain module handler.case 'get_wallet_address_from_private_key': { if (!args.privateKey || typeof args.privateKey !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Private key is required'); } const walletAddress = blockchain.getWalletAddressFromPrivateKey(args.privateKey); return { content: [ { type: 'text', text: JSON.stringify({ walletAddress }, null, 2), }, ], }; }