Installation
No additional peer dependencies required. The Algorand SDK includes mnemonic utilities.Basic usage
Configuration
Whether to persist the mnemonic to localStorage.
Async function that prompts the user for their mnemonic passphrase.Default: Browser
prompt() dialogExample:Type definition
Features
MainNet blocking
The Mnemonic wallet actively blocks MainNet connections. Attempting to use it on MainNet will throw an error:Private key access
The Mnemonic wallet supports thewithPrivateKey method for advanced use cases:
Automatic key zeroing
Private keys are zeroed from memory after use to minimize exposure:Methods
connect()
Prompts for the mnemonic and derives the Algorand account. Returns:Promise<WalletAccount[]>
Throws:
Error: 'Production network detected. Aborting.'if on MainNetError: 'No mnemonic provided'if user cancels prompt
disconnect()
Disconnects and removes the mnemonic from storage (if persisted). Returns:Promise<void>
signTransactions()
Signs transactions using the derived private key. No user prompts - signs silently. Parameters:txnGroup: Transaction or array of transactions to signindexesToSign?: Optional array of indexes to sign
Promise<(Uint8Array | null)[]>
Throws: Error: 'Production network detected. Aborting.' if on MainNet
withPrivateKey()
Provides scoped access to the private key via a callback. The key is automatically zeroed after the callback completes. Parameters:callback: Async function that receives the 64-byte Algorand secret key
Promise<T> - Returns the result of the callback
Throws: Error: 'Production network detected. Aborting.' if on MainNet
Session management
Session behavior depends on thepersistToStorage option:
When persistToStorage: false (default):
- Mnemonic is not stored
- User must re-enter mnemonic on page reload
- More secure (mnemonic exists only in memory during session)
persistToStorage: true:
- Mnemonic is stored in localStorage
- Sessions persist across page reloads
- Extremely insecure (mnemonic stored in plaintext)
Storage key
When persisting to storage, the mnemonic is stored at:Platform support
- Web: Full support (development only)
- Mobile: Full support (development only)
- Desktop: Full support (development only)
Use cases
Appropriate use cases:
- Local development with AlgoKit LocalNet
- Automated testing scripts
- TestNet development and testing
- Quick prototyping
Security considerations
Comparison with KMD
Both Mnemonic and KMD are for development only:| Feature | Mnemonic | KMD |
|---|---|---|
| Setup | Just enter mnemonic | Requires KMD service |
| Storage | Optional localStorage | KMD database |
| Use case | Quick testing | Local node development |
| Security | Very low | Low |