Giter VIP home page Giter VIP logo

rif-relay-sample-dapp's Introduction

RIF Relaying Services SDK sample dApp

This is a sample dApp that displays how users can submit relayed transactions to the Rootstock blockchain using the RIF Relay Sample dApp SDK. You will need to connect to the dApp with MetaMask but only for signing transactions with the account that owns the Smart Wallets.

For a detailed step-by-step guide on getting started with RIF Relay, refer to the RIF Relay Starter kit.

Pre-Requisites

For details on the RIF Relay modules, see RIF Relay project.

Running the sample dApp

To setup the dApp:

  1. Clone this repository and install dependencies:
    # clone repository
    git clone https://github.com/rsksmart/relaying-services-sdk-dapp
    cd relaying-services-sdk-dapp
    # install dependencies
    npm install --force
  2. Create a new file named .env in the top directory, and add the following lines in it (with the contract addresses generated when we deployed the contracts) in the Set up RIF Relay Contracts section above:
    REACT_APP_CONTRACTS_RELAY_HUB=0x463F29B11503e198f6EbeC9903b4e5AaEddf6D29
    REACT_APP_CONTRACTS_DEPLOY_VERIFIER=0x14f6504A7ca4e574868cf8b49e85187d3Da9FA70
    REACT_APP_CONTRACTS_RELAY_VERIFIER=0xA66939ac57893C2E65425a5D66099Bc20C76D4CD
    REACT_APP_CONTRACTS_SMART_WALLET_FACTORY=0x79bbC6403708C6578B0896bF1d1a91D2BB2AAa1c
    REACT_APP_CONTRACTS_SMART_WALLET=0x987c1f13d417F7E04d852B44badc883E4E9782e1
    
    REACT_APP_RIF_RELAY_CHAIN_ID=33
    REACT_APP_RIF_RELAY_GAS_PRICE_FACTOR_PERCENT=0
    REACT_APP_RIF_RELAY_LOOKUP_WINDOW_BLOCKS=1e5
    REACT_APP_RIF_RELAY_PREFERRED_RELAYS=http://localhost:8090
    REACT_APP_BLOCK_EXPLORER=https://explorer.testnet.rsk.co
  3. Run the dApp
    # run app in regtest environment
    ENV_VALUE="regtest" npm run start
  4. Ensure that MetaMask is configured to use the same network where you deployed the contracts (e.g. Regtest or Testnet).
  5. Open a browser and navigate to http://localhost:3000

Running the sample dApp as a Docker container

You can run the sample dApp as a Docker container. Docker and Docker compose should be installed. The steps are the same as indicated here. The difference is in the step 3. Instead of npm start, run this:

docker-compose build && docker-compose up

Troubleshooting

Error On Transaction Nonce

When using the RSK Regtest enviroment, it may happen 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:

  1. Choose the account in which you have the problem
  2. Enter Metamask Advanced Settings
  3. Click on Reset Account. This will delete all data from the account saved in metamask, and it will look it up again on the chain. Please note that this procedure does not delete the account, but only the info gathered from the current connected blockchain.

Read more about this on this medium post

rif-relay-sample-dapp's People

Contributors

antomor avatar franciscotobar avatar dependabot[bot] avatar david-iov avatar jurajpiar avatar andresquijano avatar ironfe93 avatar zdaodu-iov avatar kayseriiovlabs avatar mortelli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.