RIF Wallet App - Developer Reference Guide
The developer reference documentation is intended for developers looking to build and deploy a fully programmable wallet compatible with Bitcoin and Rootstock networks.
In this section, we will cover:
- Prerequisites needed to run the RIF Wallet App
- How to install the tools
- Deploying a wallet
Prerequisites
To run the RIF Wallet Application, you need to set up your development environment, follow the steps below to install the necessary components.
- Node (v16+). See the Nodejs documentation for instructions on how to setup your node environment.
- Yarn
- Install the dependecies using yarn. This will also run the postinstall script that shims the missing packages: yarn
- The postinstall script runs the
rn-nodeify
package which adds packages that are native to the browser but not to react native. - For iOS you need to run the additional installation steps:
cd ios
and thenpod install
- Watchman
- Ruby (2.7.6+) To install Ruby, use the Ruby Version Manager.
- Cocoapods
- Xcode
- IOS Simulator
- Flipper (Optional) Flipper is a platform for debugging iOS, Android and React Native apps. You can install flipper for your OS by visiting the Flipper Website.
Note: Some of these deps have been bundled into a script for your convenience, please see the starter kit section (coming soon) for installation instructions or use the Sandbox environment (coming soon).
Main Dependencies
- React (v18)
- React Native (v0.70).
- See official instructions
- Use the 'React Native CLI Quickstart' tabs not the 'Expo' tabs.
- Follow the instructions explicitly as a small deviation can cause it to fail.
- Ethers (v5.4)
- Bitcoinjs-lib (v6.0)
- RIF Wallet Libs
- To use the RIF Wallet Libs, see section on using the Libraries.
- If you already have these prerequisites set up in your environment, you can skip to section on Installing the tools for more instructions.
Installation and Setup Instructions
If you would like to skip this step above, go ahead and follow the steps starting from clone the repos.
Clone the repos
To set up the RIF Wallet App, we need to clone the following repositories.
- Clone the RIF Wallet Repo
- Run Backend Server locally or connect to an instance.
Installing the tools
Operating Systems
- Android
For android, ensure to install the following: Node, Watchman, JDK 11(Java development kit), Android Studio, Android SDK, and Configure ANDROID_SDK_ROOT. See the setup instructions
- IOS
- For IOS, you will need to install node, watchman, Ruby, Xcode, Xcode Command Line Tools, CocoaPods, IOS Simulator. See a detailed setup instructions in the React Native Documentation
- Using Android, see setup instructions
Xcode
Depending on your operating system, for Mac users, the easiest way to download and install Xcode is via the Mac App Store. For other platforms, the easiest way is to install the Android Studio Development Tool.
See the Troubleshooting section, for information on how to resolve some issues.
React
Ensure you have react (v18.0) and above already installed. To install react, use the command below or follow the instructions in the official react documentation to install react.
npm install -g create-react-app
React Native
We will need to install Node (16+), Yarn, Watchman, Ruby(2.7.6+), Cocoapods, Xcode (Via Mac App Store), and IOS Simulator.
See the React Native CLI Quickstart instructions, and follow the steps in the official documentation to install react native.
Android Studio Setup
For Android setup, you will need Node, the React Native command line interface, a JDK, and Android Studio.
See the Android Setup Instructions page.
Installing Android SDK 12 (S)
- To install this version, open Android Studio, click on the "Configure" button and select "SDK Manager".
- Select SDK Platforms and make sure that the following options are selected and installed.
3. Select SDK Tools and make sure that the 31.0.0 option is selected 4. Finally, click "Apply" to download and install the Android SDK and the related build tools.
Configuring ANDROID_SDK_ROOT
The React Native tools require some environment variables to be set up in order to build apps with native code.
Add the following lines to your $HOME/.bash_profile or $HOME/.bashrc
(if you are using zsh then ~/.zprofile or ~/.zshrc) config file:
export ANDROID_SDK_ROOT=$HOME/Library/Android/Sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
Installing Emulator
To install Emulator, see the guide in Create and manage virtual devices.
Ethersjs:
To install Ethers, follow these steps in the Ethersjs official documentation or use the command below.
npm install --save ethers
Fees
See Fees
Deploying a wallet
To send a token out of the RIF Wallet, the user is required to deploy their wallet.
Note that initial deployment of the wallet is FREE for end users and has been subsidized by IOV Labs. The wallet cannot be redeployed after deployment. See section on deploying a wallet for how to deploy the RIF Wallet.