I am using NBitcoin, C# and the Bip44 standard to create an hdroot to derive child keys from. I then create keys that I want to use for Litecoin and Ethereum addresses by setting the proper 'coin_type' in my derive statement:

var ltcAddress = hdroot.Derive(new KeyPath("m/44'/2'/0'/0/0"));
var ethAddress = hdroot.Derive(new KeyPath("m/44'/60'/0'/0/0"));

Obviously these are Bitcoin addresses by default. How can I now convert them to the proper Litecoin and Ethereum counterparts?


Not sure how NBitcoin works, but it looks like so far you have derived your private and public key, you now need to hash it in the Ethereum method rather than the bitcoin way.

Look at step 3 in this answer: https://ethereum.stackexchange.com/questions/3542/how-are-ethereum-addresses-generated

Edit: Nethereum has implemented it in C#: https://github.com/Nethereum/Nethereum/blob/master/src/Nethereum.Signer/EthECKey.cs#L115


We documented on https://programmingblockchain.gitbook.io/programmingblockchain/key_generation/bip_32

That said, for tracking a hd wallet I advice you to use https://github.com/dgarage/NBXplorer/ this is an API that work on a bitcoin node, even pruned, that do the heavy lifting and is well integrated to NBitcoin.

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