Resources & Troubleshooting
Troubleshooting
ReferenceError: Can't find variable: BigInt using React
Occasionally, users encounter errors in web3.js due to external dependencies, which may seem challenging to resolve within the web3.js framework alone.
Resolution Steps:
- Install
rn-nodeify
as a development dependency:
yarn add --dev rn-nodeify
- Add the
big-integer
package:
yarn add big-integer
- Create a file named
shim.js
at the root of your project and include the following polyfill:
if (typeof BigInt === 'undefined') {
global.BigInt = require('big-integer');
}
- Import shim.js at the top of your App.js:
// Make sure you use `import` and not `require`!
import './shim.js';
Additional Info:
Facebook/React-native Issue #28492
TypeError: Cannot read property 'prototype' of undefined, js engine: hermes
This error occurs when trying to use Web3.js with React Native. To solve this error, use the react-native-quick-crypto
package.
Resolution Steps:
- Install
react-native-quick-crypto
as a dependency:
yarn add react-native-quick-crypto
- Set up
react-native-quick-crypto
:
cd ios && pod install
- Ensure that Web3.js is imported using the default import, as using a named import does not work:
import Web3 from 'web3';
Resources
Web3.js v4 course
This comprehensive 14-part video course from ChainSafe equips you with the skills to conquer the blockchain using web3.js v4. Unlock the potential of web3.js v4 and build cutting-edge dApps. This course caters to all skill levels.
Web3.js series
This series of 3 videos takes you on a journey through web3.js. Whether you're a complete beginner or want to refine your skills, these videos have something for you:
-
Getting Started: Kick off your web3 adventure by learning the ropes of web3.js. Master the basics, from installation to making your first call to the blockchain.
-
Essential Tools: Unleash the power of web3.js utilities! From generating random bytes to hashing and checksumming addresses, you'll gain mastery of essential tools for Ethereum development.
-
Sending Transactions: Dive deep into wallets and accounts. Learn how to sign and send transactions to the network, empowering you to interact with the blockchain directly.
Hackathons and Bounties
You'll find the latest hackathons opportunities by following web3js on X.