Skip to main content
React Native SDK for iOS and Android wallet apps. Requires Xcode/iOS Simulator or Android Studio.
React Native SDK
Requirements: React >=18.2.0, React Native >=0.71.0, iOS >=12.0

Example App

Complete React Native example with wallet, transfers, and Lightning

Getting Started

To get started, follow the steps below.
1

Install SDK

Install the Spark SDK packages using your package manager of choice.
2

Add Required Polyfills

Install the required polyfills for React Native compatibility.
3

Import Polyfills at App Entry

Critical: Import polyfills at the very top of your index.js file, BEFORE importing your app or any other modules. The crypto module will fail to load if this order is wrong.
index.js
4

Install Native Modules (iOS)

For iOS, you must install the native module dependencies. This step is required for bare React Native apps.
If you skip this step, you’ll see errors like Cannot read property 'decryptEcies' of null when initializing the wallet.
5

Setup Wallet

Create a wallet instance that will be used to interact with the Spark network.
wallet.jsx
6

Start Building

You’re ready to start building.
App.jsx

Initialize a Wallet

A wallet requires either a mnemonic or raw seed for initialization. The initialize() function accepts both. If no input is given, it will auto-generate a mnemonic and return it.

Mnemonic Phrases

A mnemonic is a human-readable encoding of your wallet’s seed. It’s a 12- or 24-word phrase from the BIP-39 wordlist, used to derive the cryptographic keys that control your wallet.

Troubleshooting

Cannot read property 'decryptEcies' of null

This error occurs when native crypto modules aren’t loaded properly. Fix it by:
  1. Ensure polyfills are imported first in your index.js - they must come before any other imports
  2. Run pod install in your ios/ directory for iOS builds
  3. Rebuild your app completely (not just a hot reload)

Wallet initialization fails silently

Make sure you’re awaiting the initialize() call and handling errors: