Skip to main content

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.
Then, import the library in your app’s entrypoint file (e.g index.js), before the @solana/web3.js library is imported.
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 July 21, 2026