This a basic sample dApp to showcase how users can submit transactions to the RSK blockchain paying a RelayServer for the transaction fees with tokens. You will need to connect to the dApp with Metamask but only for signing transactions with the account that controls your Smart Wallets.
See https://github.com/rsksmart/enveloping for the RIF Enveloping project.
- RSKj Node Running
- Enveloping Contracts deployed.
- Enveloping Server running.
To setup the dApp do this:
- Clone this repo
- Run
npm i
To run the sample dApp follow these steps:
-
Edit the sample dApp config file located in
.env
and add the contract addresses from the deployment executed in step 2 from Running a RelayServer. By default the project imports.env
on thenpm start
. Look for these lines and modify them accordingly: -
Open a terminal in the sample dApp project root and execute
npm start
-
Ensure that MetaMask is configured to use the same network that you used to deploy the contracts (e.g. Regtest or Testnet).
-
Open a browser and navigate to http://localhost:3000
-
If you are running an RSKj node in Regtest you will need to register the Token used in the demo with the Relay and Deploy verifiers. To achieve this select in Metamask an account with funds, connect Metamask to the dApp, open the developer console in the browser and execute the following command:
await App.acceptNewToken()
It may happen to you when using the RSK Regtest enviroment that an alert pop up may show indicating that the Transaction nonce is wrong. This is due to a MetaMask problem in which it saves the nonce locally and when you reset the chain the nonce is changed.
Solution:
- Choose the account in which you have the problem
- Enter Metamask
Advanced Settings
- Click on
Reset Account
. This will deleted all data from the account saved in metamask, and it will look it up again on the chain. Please note that it does not delete the account, only the info gathered from the current connected blockchain.
Read more about this on this medium post