In this guide, we’ll explore how to create a Web3 wallet using Flutter, leveraging the web3dart package for wallet generation and the bip39 package for mnemonic phrase creation. This tutorial is tailored for developers familiar with Flutter who want to venture into blockchain development.
Table of Contents
- Introduction to Web3 and Wallets
 - Setting Up the Project
 - Dependencies
 - Creating the Web3 Service
 - Building the UI
 - Testing the Wallet Generation
 - Conclusion
 
1. Introduction to Web3 and Wallets
A Web3 wallet is a digital tool for managing cryptocurrencies, tokens, and interactions with decentralized applications (dApps). It uses:
- Private Key: Signs transactions (kept secret).
 - Public Key: Derives the wallet address (shared publicly).
 
Key Steps Covered:
- Generate a BIP39 mnemonic phrase (12/24-word seed).
 - Derive private/public keys from the mnemonic.
 - Create a wallet address using the private key.
 
👉 Learn more about Web3 wallets
2. Setting Up the Project
Create a Flutter project:
flutter create web3_wallet_example cd web3_wallet_example- Ensure Flutter SDK is properly configured.
 
3. Dependencies
Add these packages to pubspec.yaml:
dependencies:
  flutter:
    sdk: flutter
  web3dart: ^2.7.3
  bip39: ^1.0.6
  bip32_bip44: ^1.0.0Run flutter pub get to install.  
Why These Packages?
web3dart: Ethereum address generation and smart contract interactions.bip39: Mnemonic phrase generation.bip32_bip44: HD wallet derivation (BIP32/BIP44 standards).
4. Creating the Web3 Service
Create web3_service.dart to handle:
Mnemonic Generation:
mnemonic = bip39.generateMnemonic();Private/Public Key Derivation:
final Chain chain = Chain.seed(bip39.mnemonicToSeedHex(mnemonic)); final ExtendedKey extendedKey = chain.forPath("m/44'/60'/0'/0/0"); privateKey = extendedKey.privateKeyHex();Wallet Address Generation:
final EthPrivateKey ethPrivateKey = EthPrivateKey.fromHex(privateKey); walletAddress = (await ethPrivateKey.extractAddress()).hex;
👉 Explore advanced wallet features
5. Building the UI
Example UI (wallet_view.dart):
ElevatedButton(
  onPressed: _generateWallet,
  child: Text("Generate Wallet"),
),
if (_mnemonic != null) Text("Mnemonic: $_mnemonic"),Displays:
- Mnemonic phrase
 - Private/public keys
 - Wallet address
 
6. Testing the Wallet Generation
- Run the app (
flutter run). - Click Generate Wallet to see the keys and address.
 
7. Conclusion
You’ve built a Flutter app that:
✅ Generates a secure Web3 wallet.  
✅ Derives keys from a mnemonic.  
✅ Creates a blockchain-compatible address.  
Next Steps:
- Integrate with smart contracts.
 - Develop dApps for Ethereum or other blockchains.
 
FAQ
1. What is a mnemonic phrase?
A 12/24-word seed phrase used to recover a wallet.
2. Is the private key stored securely?
No—this example displays it for demo purposes. In production, use encrypted storage.
3. Can I use this for other blockchains?
Yes! Adjust the BIP44 path (e.g., m/44'/60' for Ethereum).