bip32
bip32 copied to clipboard
Alternatives to tiny-secp256k1?
The library tiny-secp256k1 breaks builds both in vite/rollup, as well as, some webpack configurations. This library's dependency on tiny-secp256k1 makes it unusable. Can you suggests alternatives to tiny-secp256k1? Thank you 🙏🏾
You can use tiny-secp256k1 v1 without schnorr support.
For schnorr support, convince your bundlers to support WASM out of the box with 0 configuration.
Is there a good way to support it in chrome extensions? It doesn't support WASM by default in browser extensions. Would be great to have an alternative that works by default. I totally understand if not though.
Thanks @junderw ! v1 worked for me.
I see v1 has functions signSchnorr and verifySchnorr. Will these not work? (edit: my mistake, those functions are in bip32, but not in tiny-secp256k1@1, leaving for posterity).
convince your bundlers to support WASM out of the box with 0 configuration.
I'm still on newish to JavaScript, what's needed to support V2. What config can I do on my own to support V2? (i.e. would rather not be on V1...)
correct. Those will not work.
There's a pure JS implementation out there, but it uses Native JS BigInt, which is newer than WASM.
Had same problem here with webpack 5 and CRA.
Even with experimental wasm flags or wasm loader it won't work.
Downgraded tiny-secp256k1 to last 1.* (1.1.6) and worked from first try.
Had same problem here with webpack 5 and CRA. Even with experimental wasm flags or wasm loader it won't work. Downgraded
tiny-secp256k1to last 1.* (1.1.6) and worked from first try.
Thank for this comment, it seem that bip32 don't work with the 2.0 version of tiny-secp256k1.
I was having this error: ecc library invalid
So I downgraded to 1.1.6 and no more error.
bip32 works with the latest tiny-secp256k1
bip32 works with the latest tiny-secp256k1
@junderw does this include React Native / web based or are you talking Node?
React Native always lags behind on implementing every single standard API in JavaScript.
Node has been much better with keeping up with browsers in recent years.
The current tiny-secp256k1 will work with webpack/browserify etc. as long as your browser environment supports WebAssembly, and you have the correct config in your webpack config etc.
That said, if you have no use for schnorr signatures, using v1 with latest bip32 (which is pure JS for browser builds) is fine.
Last I checked there was a polyfill that enables WASM in RN. If you want schnorr, you'll have to look into that, or create a thin wrapper library around another crypto library so it matches the required interface.
If you are encountering this issue, you may want to try using this alternative module that does not require WASM:
https://github.com/bitcoinerlab/secp256k1 (disclaimer: I'm the dev of that module).
Also, @Hyunhum has proposed PR #69 that will make tiny-secp256k1 version 1 compatible again.