-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bn.toBuffer issue or make BN and Buffer available #227
Comments
Hey @Ayms , if there issues, can you paste commands for reproduce too? (and which result expected by you). Instead I do not think that use |
Hi @fanatid, indeed... toArrayLike works, but still BN is loaded twice, anyway closing it, thanks for the answer |
How you count BN loading? |
For now I don't know very well how browserify is working, usually I prefer to do that stuff myself, but this is working quite well so it seems useless to reinvent things, now browserify is including twice the BN code, probably because I am calling elliptic and separately BN (because BN is not available from EC) |
Not clear? (or again asking for things that have a trivial solution or already existing :-) ) See again https://github.com/Ayms/bitcoin-transactions/blob/master/src/keys.js I would like to do instead |
Hi @fanatid Looks like the issue is on elliptic side, BN is called in utils, then in elliptic and is probably loaded twice (I removed BN from my code and browserify still includes twice the BN code) It's not dramatic but probably it should be fixed |
If this on |
Yes, closing this one and will reopen on elliptic, I don't think it's a browserify issue, please wait ~week, the whole code of bitcoin-transactions and browserification process will be released |
Browserifying https://github.com/Ayms/bitcoin-transactions, everything going well except an unexpected "trivial" issue, calling BN outside of elliptic in https://github.com/Ayms/bitcoin-transactions/blob/master/src/keys.js (see the first function privatekeyderive)
This causes browserify to duplicate twice BN and a call to bn.toBuffer just throws because Buffer is undefined
Not using the latest bn.js version but looking at the code it does not throw now but is just ignored, so if I am correct the "problem" is still there
Suggested fix (or simple workaround instead of making everything available from ec):
if (Buffer===undefined) { Buffer=Uint8Array; };
I don't see what it could harm and to whatever else than Uint8Array Buffer could be derived from if undefined
The text was updated successfully, but these errors were encountered: