1

I am very new to Bitcoin development so forgive me...

I'm using NBitcoin in a .Net console app to generate a master key using a mnemonic and then derive hierarchical keys. Here is the code I am using:

Mnemonic mnemo = new Mnemonic(Wordlist.English, WordCount.Twelve);
ExtKey hdroot = mnemo.DeriveExtKey();
var wif = hdroot.GetWif(Network.Main);
var defaultAddress = hdroot.Derive(new KeyPath("m/0/0"));

Here is the Mnemonic I get as a result, as wells as a public address derived from the master key using the "m/0/0" path:

Mnemonic: dry brown drive parade drastic shine embrace hard report loan fold iron

Path: m/0/0/: 1GcchMaHAN1XRQsoi8gPg8TShqzN4sNGvu

I tested recreating my keys using the mnemonic and was always able to derive the same exact keys as expected within my console app.

Being curious I wanted to see if I could import this mnemonic into existing wallet software and get the same keys as well. Since the Exodus wallet uses a standard twelve word mnemonic I fired it up and generated my wallet using the same mnemonic. However none of the keys match up! I exported my public key and made sure it was the same path of "m/0/0" from the master. As you can see it is NOT a match:

Exported public key from Exodus using the same mnemonic:

Mnemonic: dry brown drive parade drastic shine embrace hard report loan fold iron

Address: 1DMDJ266gxMCJiTcWk5MZFbfxxx4Ss3URN

Path: m/0/0

I also tested the mnemonic on Jaxx as well as the the Coinomi wallet on Android and it derived the same keys as Exodus does.

So I am completly confused. The only thing I can think of is that there is a standard entropy that these wallets use that is missing from my implementation?

My question is, how can I use NBitcoin to create the same mnemonic standrad that wallets like Exodus, Coinomi and Jaxx use?

1 Answer 1

1

The mnemonic standard is BIP 39, and that is not the problem. The problem is the derivation paths.

Exodus, Jaxx, Coinomi, and many other wallets use the BIP 44 specification for deriving keys. This means the m for those wallets is actually the key at the path m/44'/0'/0'. However in your code with NBitcoin, you are using direct BIP 32 paths, so your m is actually m. So in NBitcoin, your keypath is actually m/0/0 but in other wallet software, the path is m/44'/0'/0'/0/0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.