0

I want to accept BTC from different clients during an ICO, for this, I'm planning to use a combination of BIP32 and BIP39.

var bip39 = require("bip39");
var bitcoin = require("bitcoinjs-lib");

var mnemonic = 'praise you muffin lion enable neck grocery crumble super myself license ghost';
var seed = bip39.mnemonicToSeed(mnemonic);
var root = bitcoin.HDNode.fromSeedBuffer(seed);

console.log(root.derivePath("m/0'/0/0").getAddress());
//'1AVQHbGuES57wD68AJi7Gcobc3RZrfYWTC'
console.log(root.derivePath("m/0'/0/1").getAddress());
//'1Ad6nsmqDzbQo5a822C9bkvAfrYv9mc1JL'

Can I use this mnemonic to login into some pre-existing wallet and transfer the funds sent to the addresses generated using the root to transfer funds to any other BTC wallet? Or can someone suggest a better strategy?

1 Answer 1

1

A BIP32 master extended private key can be used to derive child addresses, but to spend coins sent to those child addresses, you will need the private key of each individual address. The master xpriv key cannot spend the coins located in one of its child addresses.

Remember that an address derived via BIP32 is otherwise indistinguishable from any other address. In order for a transaction spending any address' balance to be valid, it must be signed by the private key of that address.

That said, good wallet software will take care of key management in the background for you, so as long as the derivation scheme is correct you should be able to spend the funds sent to your master xpriv key's derived addresses using a BIP32 & 39 compatible wallet. Again, this will be done by deriving the child addresses and using their private keys to sign transactions.

2

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.