OpenParable
Skip to content
← Back to skills

Hd Wallets

Development
hd-wallets

Hd Wallets is an Agent Skill for development published in the Nethereum/Nethereum repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Derive multiple Ethereum accounts from a mnemonic seed phrase using Nethereum HD wallets. Use this skill whenever the user asks about mnemonic phrases, seed phrases, BIP-39, BIP-32, BIP-44, HD wallets, deriving accounts from a seed, wallet recovery, 12-word or 24-word phrases, derivation paths, or generating multiple addresses from one key in C#/.NET.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/Nethereum/Nethereum/blob/HEAD/plugins/nethereum-skills/skills/hd-wallets/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/hd-wallets, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

HD Wallets with Nethereum

Two implementations available:

Full HD Wallet (NBitcoin-based)

NuGet: Nethereum.HDWallet

dotnet add package Nethereum.HDWallet

Generate New Wallet

using Nethereum.HdWallet;
using NBitcoin;

var wallet = new Wallet(Wordlist.English, WordCount.Twelve);
var mnemonic = string.Join(" ", wallet.Words);

Restore from Mnemonic

var wallet = new Wallet("rapid squeeze excess salute ...", seedPassword: null);
var account = wallet.GetAccount(0, chainId: 1);
var web3 = new Web3(account, "https://your-rpc-url");

Derivation Paths

// Default: m/44'/60'/0'/0/x (MetaMask, TREZOR, MEW)
var wallet = new Wallet(words, null, Wallet.DEFAULT_PATH);

// Ledger/Electrum: m/44'/60'/0'/x
var wallet = new Wallet(words, null, Wallet.ELECTRUM_LEDGER_PATH);

Key Methods

var addresses = wallet.GetAddresses(10);     // First 10 addresses
var privateKey = wallet.GetPrivateKey(0);     // Private key bytes
var ethKey = wallet.GetEthereumKey(0);        // EthECKey for signing
var account = wallet.GetAccount(0, chainId: 1); // Account for Web3

Watch-Only (Public Wallet)

var xPub = wallet.GetMasterExtPubKey();
var publicWallet = new PublicWallet(xPub);
var addresses = publicWallet.GetAddresses(10);

Light HD Wallet (Zero Dependencies)

Included in Nethereum.Accounts — no extra package needed. Uses only System.Security.Cryptography. Modern .NET only (net6.0+).

using Nethereum.Accounts.Bip32;

// Generate mnemonic
var mnemonic = Bip39.GenerateMnemonic(12);

// Create wallet
var wallet = new MinimalHDWallet(mnemonic);

// Derive keys (m/44'/60'/0'/0/{index})
var key = wallet.GetEthereumKey(0);
var address = wallet.GetEthereumAddress(0);

// Custom path
var key = wallet.GetKeyFromPath("m/44'/60'/0'/0/5");

When to Use Which

FeatureNethereum.HDWalletMinimalHDWallet
DependenciesNBitcoinNone
Frameworksnet452+net6.0+
Extended keys (xPub)YesNo
Key cachingYesNo
Best forFull wallet appsEmbedded, mobile, WASM

For full documentation, see: https://docs.nethereum.com/docs/signing-and-key-management/guide-hd-wallets