Closed educob closed 1 year ago
Update your tiny-secp256k1 version.
Thanks for answering.
I updated to version 2.2.1 and now I get error: TypeError: Cannot read properties of undefined (reading 'isPoint')
And ecpair release is v2.1.0
Thanks.
I updated to version 2.2.1 and now I get error:
TypeError: Cannot read properties of undefined (reading 'isPoint')
And
For me it is working fine.
isPoint
is exported here: https://github.com/bitcoinjs/tiny-secp256k1/blob/master/src_ts/index.ts#L75
I have a feeling that you may not be importing the library correctly. Are you using webpack/browser? In webpack, it is imported as a Promise because it is packaged as WASM. Maybe that. Please share a small code snippet if you like.
Thanks for answering.
I am working in a react native project. Don't know if webpack is used (I guess not). The code I am using (taken from the doc) is the one I pasted above:
import { ECPairFactory } from 'ecpair';
import tinysecp from 'tiny-secp256k1';
const ECPair = ECPairFactory(tinysecp);
Thanks.
You can't use tiny-secp256k1 in react-native (or at least easily). It uses WASM which was not very well supported (if at all) by react-native.
Your easiest way out is:
You'll need to use tiny-sepc256k1 version 1 (that version was using elliptic pure javascript library as fallback) and switch back to ecpair 2.0 (elliptic doesn't implement all the methods required by ecpair 2.1).
You can also use noble. It was not possible until a couple of weeks ago because it used BigInt
which was not supported in react native. This changed in react-native starting from 0.7 (using the new Javascript engine Hermes) but integrating it all requires a bit more work. The good part is it's fast as hell once it works.
I would suggest tiny-secp256k1 v1 + ecpair 2.0 as the easiest way to get it working.
Hi.
I tried with tiny at v1 and ecpair v2 but I get TypeError: ecc.privateNegate is not a function
I'll try with noble.
Thanks.
Make sure it's ecpair 2.0.1 Note that it does not test against privateNegate: https://github.com/bitcoinjs/ecpair/blob/v2.0.1/src/testecc.js
vs. 2.1.0 that does: https://github.com/bitcoinjs/ecpair/blob/v2.1.0/src/testecc.js
2.1.0
breaks compatibility with tiny-secp256k1@1.*
I'm wondering if this should be considered a breaking change.
As of today, tiny-secp256k1@2.*
isn't usable in some environments (e.g. React Native)
Make sure it's ecpair 2.0.1
Thanks. It works now!!
Hi.
Running this code:
Throws error:
TypeError: ecc.privateNegate is not a function
Thanks.