Using NBitcoin or C# to derive Litecoin and Ethereum Addresses from Master HD Key

2

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?

INNVTV

Posted 2017-10-03T22:20:05.843

Reputation: 133

Answers

2

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

feedthedogs

Posted 2017-10-03T22:20:05.843

Reputation: 21