Issue when running a built version
See original GitHub issueHey 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
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Please read the readme.
You need to reserve words in your uglify step.
ECPair is getting mangled.
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%?