Open theDevSoham opened 1 year ago
buffer
and react-native-get-random-values
dependency
import {Buffer} from 'buffer';
import 'react-native-get-random-values';
global.crypto.getRandomValues; global.Buffer = Buffer;
3. import global.js in index.js
```javascript
/**
* @format
*/
import './global.js';
import { AppRegistry } from 'react-native';
import App from './App';
AppRegistry.registerComponent(appName, () => App);
I don't think fs error coming from this library
And u can refer this if cipher-base error happens if u install stream
https://github.com/bitcoinjs/bitcoinjs-lib/issues/1865
if u install tiny-secp256k1
as well, u need to use version with 1.0.0~1.1.6 unless u r gonna integrate WASM in mobile.
And u probably need to install events
as well
Thanks @ChrisCho-H . Yes this fixes the issue for me. By the way created a template repo for integrating bitcoinjs-lib
and ethers
into react native v0.71.x so that others don't have to go through this hassle already 🙂. Feel free to check this out:
https://github.com/theDevSoham/react_native_crypto_wallet_template
https://www.npmjs.com/package/@bitcoin-js/tiny-secp256k1-asmjs
Released asmjs version of tiny-secp256k1.
Also, @bitcoinerlab/secp256k1
also implements the same interface and is slightly faster (but it uses native JS BigInt, so if your build environment can't handle that, you can't use it)
Thanks @ChrisCho-H . Yes this fixes the issue for me. By the way created a template repo for integrating
bitcoinjs-lib
andethers
into react native v0.71.x so that others don't have to go through this hassle already 🙂. Feel free to check this out: https://github.com/theDevSoham/react_native_crypto_wallet_template
It is working fine.
@divyangkhatri happy to help 😊
Hi, I'm trying to integrate
bitcoinjs-lib@6.0.2
in react-native project. The errors I'm facing are pretty much understandable. For eg:ReferenceError: Property 'Buffer' doesn't exist, js engine: hermes
. ORfs cannot be found in node modules
etc.It seems some core node modules are not available in react-native. Possible solutions I tried:
rn-nodeify
and shimming the libraries not present in react native (Problem: some modules likereact-native-udp uses compile method in it's gradle file which is deprecated.
)react-native-bitcoinjs-lib
orrn-bitcoinjs-lib
(Problem: They require rn-nodeify which recurs the previous problem)Please let me know if it's possible to suggest a workaround because the client needs this library only. Thanks a lot in advance.