Hey there,
I've been working on a small project using your library and everything is working top notch.
Today I tried to host the build version of my app but ran into an issue :(
I'd like to know if you know why this happens...
My project was created using the create-react-app npm package
and built using the build command available in a create-react-app project
After building the project everything js related is found in the
/service-worker.js and /static/js/main.645d2b1c.js files.
This is my code (keep in mind that I'm trying to create a bitcoin wallet):
const randomBytes = crypto.randomBytes(16);
const mnemonic = bip39.entropyToMnemonic(randomBytes.toString('hex'));
const seed = bip39.mnemonicToSeed(mnemonic);
const bitcoinNetwork = bitcoin.networks.bitcoin;
const hdMaster = bitcoin.HDNode.fromSeedBuffer(seed, bitcoinNetwork);
const key = hdMaster.derivePath("m/0");
const address = key.keyPair.getAddress();
const secret = key.keyPair.toWIF();
This is the error I get: "Expected property "0" of type ECPair, got r"
on this line: const hdMaster = bitcoin.HDNode.fromSeedBuffer(seed, bitcoinNetwork);
When everything gets compiled and minified the seed constant gets renamed to r
So I'm wondering if you would know why a built version would throw such error?
Thanks
Please read the readme.
You need to reserve words in your uglify step.
ECPair is getting mangled.
Also, m/44’/0’/0’/0/0 is recommended over m/0
Also, m/44’/0’/0’/0/0 is recommended over m/0
What are the statistics for that these days?
For P2PKH which the code example is using, BIP44 derivation is king.
@dabura667 Awesome, thank you for the quick reply! 👍
@dabura667 I don't disagree, but, what is the statistics either way?
@dabura667 I'd be curious to know too
Looking at the wallets on bitcoin.org
Every single wallet that offers single sig p2pkh uses BIP44 except breadwallet.
Outside of that, I can think of Copay and its derivitaves (bitcoin.com wallet), btc.com wallet, samourai wallet, Edge wallet (last two are in beta) all use BIP44 for p2pkh.
Soooo 99%?
Most helpful comment
Please read the readme.
You need to reserve words in your uglify step.
ECPair is getting mangled.