1
First of all all addresses below are for testing purposes so I don't care about private keys.
So dumped wallet created by Bitcoin-qt v0.16.2:
extended private masterkey: xprv9s21ZrQH143K3mYiBBH7MwWV9VTkeB5q5sxEFGgvLbLqRZ3xPVAKvwyxSLVtTcL2tz665vdZnHLrMQPr6MWGKdDHYoncZmUNiUgtShGCmZE
From what I can understand from the rest of the dump the first receive address is:
addr=3DhmoRSx2bjxyJm7A1Crs3bCPnVcEx51fE hdkeypath=m/0'/0'/0'
Now I am trying to generate same addess using bitcoinjs-lib but haven't had any success so far with it.
import { HDNode } from "bitcoinjs-lib";
const key = HDNode.fromBase58(
"xprv9s21ZrQH143K3mYiBBH7MwWV9VTkeB5q5sxEFGgvLbLqRZ3xPVAKvwyxSLVtTcL2tz665vdZnHLrMQPr6MWGKdDHYoncZmUNiUgtShGCmZE"
);
console.log(key.derivePath("m/0'/0'/0'").getAddress()); // prints 1NoQERVA18v5WcFUbgvz22tDGigmAkqy4U
Now I get confused becuase I use same derive path but I get 2 different addresses and on top of that looks like address from dump is multisig? Is it becuase of multisig?
If so how should I generate wallet.dat that is not multisig and is HD.
Thanks! One more question. Is it possible to use this api to generate addresses using from xpub? I get
TypeError: Missing private key for hardened child keyerror. – elderapo – 2018-08-28T23:40:28.040No, you cannot derive hardened keys from an xpub. However you can use the xpub and derive keys with a non-hardened path. This means that your keypath cannot contain
',h, orHwhich indicate that that index should use hardened derivation. – Andrew Chow – 2018-08-28T23:50:57.053If I remove
'from keypath now I can generate addresses using xpub now I believe that bitcoin-qt won't monitor these addresses right? – elderapo – 2018-08-28T23:58:13.103Yes, those will be different addresses. – Andrew Chow – 2018-08-29T00:32:34.943