Ever wondered what it is like to create a mobile wallet like Rainbow or Trust Wallet? Being a wallet developer unlocks superpowers to understand how accounts, transactions and providers work.
In this tutorial, we will build a simple web3 wallet with the WalletConnect Web3Wallet SDK via React Native Expo, which empowers you with the foundations to be a web3 wallet developer.
This is written with a focus on Ethereum; however, the same principles can be transferred to Solana, Cosmos and other chains as the Web3Wallet SDK is designed to work multi-chain.
What is a web3 wallet?
If we examine the Ethereum address of `0x1234….`, it has several properties:
- An account address called a public key
- A private key to authorize certain actions
- Balance of ETH / tokens
- Send and receive tokens (ERC20, ERC721 & more) and perform other actions via the private key
- Other elements such as nonce, codeHash & storageHash
This is the foundation of a web3 wallet and which allows users to interact with the blockchain. More info here.
Desktop/browser <> mobile wallets
The most commonly-used desktop wallet is MetaMask. Since 2016, they have remained the most popular method for interacting with the Ethereum blockchain on the web browser.
However, there is a strong understanding that mobile devices are the primary mode of communication for people and great mobile wallets such as Rainbow, Trust and Argent have unlocked this.
WalletConnect is the decentralized web3 messaging layer and the standard for connecting blockchain wallets to dapps. You may have used WalletConnect when you scanned a QR code to connect to a dapp. In addition to this, there are several SDKs that developers can use with WalletConnect such as Web3Modal, the WalletConnect Chat API, the WalletConnect Push API and Web3Wallet, which will be used today.
What is the Web3Wallet SDK?
The Web3Wallet (W3W) SDK combines WalletConnect’s Sign API v2.0 and Auth API into one package, which allows developers to sign from both the dapp and wallet sign as well as authenticate into the application. I highly recommend going through the documentation before starting.
What will we be building?
Here is the example repo of what we will be creating via Expo, which is a tool to help with React Native (RN) development.
You can either start fresh from the beginning with this tutorial or follow along by reading the code.