Skip to content

feat: Add wallet management tools for RustChain MCP Server#26

Open
HuiNeng6 wants to merge 1 commit intoScottcjn:mainfrom
HuiNeng6:wallet-tools
Open

feat: Add wallet management tools for RustChain MCP Server#26
HuiNeng6 wants to merge 1 commit intoScottcjn:mainfrom
HuiNeng6:wallet-tools

Conversation

@HuiNeng6
Copy link

Summary

This PR implements wallet management tools for the RustChain MCP Server as part of Bounty #2302 (75 RTC).

New Features

rustchain_crypto.py module:

  • Ed25519 key pair generation and signing
  • BIP39 mnemonic generation (12/24 words) and validation
  • Key derivation from mnemonic seed
  • AES-256-GCM encrypted keystore storage
  • PBKDF2 key derivation (100,000 iterations)

9 New Wallet Tools:

  1. \wallet_create\ - Generate new Ed25519 wallet with BIP39 mnemonic
  2. \wallet_balance\ - Check RTC balance for any wallet ID or address
  3. \wallet_history\ - Get transaction history for a wallet
  4. \wallet_transfer_signed\ - Sign and submit RTC transfer from local wallet
  5. \wallet_list\ - List all wallets in local keystore
  6. \wallet_export\ - Export encrypted keystore JSON for backup
  7. \wallet_import\ - Import wallet from keystore JSON or mnemonic
  8. \wallet_export_mnemonic\ - Export BIP39 seed phrase (use with caution!)
  9. \wallet_delete\ - Delete wallet from local keystore

Security Features

  • Private keys encrypted at rest with AES-256-GCM
  • Mnemonic stored encrypted, never exposed in tool responses
  • Password-based encryption with PBKDF2 (100,000 iterations)
  • Secure keystore location: ~/.rustchain/mcp_wallets/\
  • Minimum 8-character password requirement

Testing

  • 24 comprehensive unit tests added
  • All tests passing
  • Coverage includes: key generation, signing, encryption, wallet CRUD, import/export

Dependencies Added

  • \cryptography>=41.0\ - Ed25519, AES-GCM encryption
  • \mnemonic>=0.20\ - BIP39 seed phrase support

Documentation

  • README updated with wallet tool documentation
  • Usage examples for all tools
  • Security best practices section

Testing

\\�ash
pip install cryptography mnemonic pytest
pytest tests/test_wallet_tools.py -v

24 passed in 6.33s

\\

Bounty Info

  • Bounty: #2302 (75 RTC)
  • Wallet Address: 9dRRMiHiJwjF3VW8pXtKDtpmmxAPFy3zWgV2JY5H6eeT

Checklist

  • Implemented all required wallet tools
  • Used Ed25519 signing (via cryptography library)
  • Secure keystore storage at ~/.rustchain/mcp_wallets/
  • Never expose private keys or seed phrases in responses
  • Unit tests for each tool (24 tests, all passing)
  • Updated README documentation

- Add rustchain_crypto.py module with Ed25519 and BIP39 support
- Add 9 new wallet tools:
  - wallet_create: Generate new Ed25519 wallet with BIP39 mnemonic
  - wallet_balance: Check RTC balance for any wallet
  - wallet_history: Get transaction history
  - wallet_transfer_signed: Sign and submit RTC transfers
  - wallet_list: List wallets in local keystore
  - wallet_export: Export encrypted keystore JSON
  - wallet_import: Import from keystore or mnemonic
  - wallet_export_mnemonic: Export BIP39 seed phrase
  - wallet_delete: Delete wallet from keystore

- Security features:
  - AES-256-GCM encryption for private keys
  - PBKDF2 key derivation (100,000 iterations)
  - Mnemonic stored encrypted, never exposed in responses
  - Secure keystore at ~/.rustchain/mcp_wallets/

- Add comprehensive unit tests (24 tests, all passing)
- Update README with wallet documentation
- Update dependencies: cryptography>=41.0, mnemonic>=0.20

Bounty: #2302 (75 RTC)
Wallet: 9dRRMiHiJwjF3VW8pXtKDtpmmxAPFy3zWgV2JY5H6eeT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant