How to use the RIF Relay Sample dApp SDK

Getting Started

This guide helps to quickly get started with setting up your environment to use RIF Relay and also use the sample dApp to test relay services.

Step 1: Run the Rootstock node

You need to set up and run a Rootstock node, preferably the latest version from RSKj releases. The node can operate locally or via Docker. In either case, a node.conf file is used.

Refer to the Rootstock Node Installation Guide for a detailed guide on this step.

Step 2: Add network to Metamask

To interact with the Rootstock network, you need to add it to Metamask. Since we're using the node on --regtest mode, follow the Metatmask guide on How to add a custom network RPC and add the Rootstock RegTest Network to Metamask with the following data:

To learn more about Metatmask and how to add it to Rootstock programmatically, see Metamask and How to add Metamask to Rootstock Programmatically.

Step 3: Set up RIF Relay contracts

To set up RIF relay contract, clone the RIF Relay Contracts Repository:, then follow the RIF Relay Deployment guide to deploy an RIF Relay contract, enable revenue sharing, and whitelist the token by allowing it.

  1. Check allowed tokens
    npx hardhat allowed-tokens --network regtest
    rif-relay-contracts % npx hardhat allowed-tokens --network regtest
    deployVerifier [ '0x6f217dEd6c86A57f1211F464302e6fA544045B4f' ]
    relayVerifier [ '0x6f217dEd6c86A57f1211F464302e6fA544045B4f' ]
    customDeployVerifier [ '0x6f217dEd6c86A57f1211F464302e6fA544045B4f' ]
    customRelayVerifier [ '0x6f217dEd6c86A57f1211F464302e6fA544045B4f' ]
    nativeHolderDeployVerifier [ '0x6f217dEd6c86A57f1211F464302e6fA544045B4f' ]
    nativeHolderRelayVerifier [ '0x6f217dEd6c86A57f1211F464302e6fA544045B4f' ]
  2. Mint token
    • To mint new units of the UtilToken into the Metamask wallet address:
      • Go to the Metamask wallet, and copy the wallet address:
      • Execute the command to mint the token, where:
        • --token-address → this is the address for UtilToken
        • --amount → quantity to be minted
        • --receiver → wallet address
        npx hardhat mint \
        --token-address 0x6f217dEd6c86A57f1211F464302e6fA544045B4f \
        --amount 10000000000000000000 \
        --receiver <wallet-address> \
        --network regtest 
      • Import the minted token into the wallet.
      • To see the token in the wallet, click on “import tokens”, and then paste the token address.

Step 4: Set up RIF Relay Server

Clone the RIF Relay Server Repository, then refer to Run the RIF Relay Server for a complete guide on setting up the RIF Relay server.

RIF Relay Sample dApp

This sample dApp shows you how to send transactions to the Rootstock blockchain using the RIF Relay Sample dApp SDK. You'll need to connect the dApp with MetaMask for signing transactions with the account managing your Smart Wallets.

  • Clone SDK repository and install dependencies:
    # clone repository
    git clone
    cd relaying-services-sdk-dapp
    # install dependencies
    npm install --force
  • Configure environment variables
    • 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:
  • Run the dApp
    # run app in regtest environment
    ENV_VALUE="regtest" npm run start
    Run the dApp
  • Connect metamask wallet for signing Connect Metamask Wallet
  • Create a new smart wallet Create a new Smart Wallet
  • Mint tokens to the wallet
    • For commands to mint token, See step 6 in the Set up RIF Relay contracts section above.
    Mint Tokens
  • Transfer to different addresses, using TKN for transfer fees payment, instead of RBTC Transfer using TKN

Receive updates

Get the latest updates from the Rootstock ecosystem