Installation
Add the library to your project:
Polyfills
The following polyfills are needed, only if you intend to use the Keypair.generate function. Otherwise, this polyfill is not
required to use @solana/web3.js.
Install getRandomValues
Add the react-native-get-random-values library to your project.
yarn add react-native-get-random-values
Then, import the library in your app’s entrypoint file (e.g index.js), before the @solana/web3.js library is imported.
import "react-native-get-random-values";
// ...other imports below
TIPAlternatively, you can use the expo-crypto library to polyfill crypto.getRandomValues. View this sample app for a reference of how to polyfill the crypto class.
Example
Last modified on February 10, 2026