RAILGUN Wallets
RAILGUN Wallets are created using an encryption key and mnemonic. They will be encrypted and stored into the LevelDOWN database, which you initialized in Step 1 of the Getting Started section.
Wallets must be generated using a 12- or 24- word mnemonic. In order to add a RAILGUN wallet to the local database, you can either import using a previously generated mnemonic or create a new mnemonic using ethers.js.
Example: Generate mnemonic using ethers.js
You may provide an optional creationBlockNumberMap
which contains the block numbers for each chain when the wallet was created. This mapping will optimize private balance scans, especially for newly created wallets.
Example: Create local RAILGUN Wallet from mnemonic
After Railgun Wallets are loaded into the local DB for the first time using createRailgunWallet
, You will want to store the field railgunWallet.id
and reuse the encryptionKey
in order to load it again. On subsequent launches of your dApp, instead of calling createRailgunWallet
again, you must use the loadWalletByID
function to instantly reload the Railgun Wallet. The railgunWallet.id
field will additionally be used to reference the wallet when scanning balances, requesting transaction history, or creating new transactions.
Example: Load stored RAILGUN Wallet from ID
Last updated