paint-brush
Token Bridge - Crossing ERC20 Tokens between RSK & Ethereumby@rootstock_io
1,130 reads
1,130 reads

Token Bridge - Crossing ERC20 Tokens between RSK & Ethereum

by RootstockOctober 6th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Token Bridge allows to safely cross tokens between RSK and Ethereum networks. It is available at tokenbridge.rsk.co for mainnet or testnet.co. The tokens you want to cross, let’s say DAI on. Ethereum, are locked by the Token Bridge smart contracts and an event is emitted with all the information about the transaction. This event is listened by the. validators, they check the information and resend the. information to the Token. Bridge smart. contracts on the other chain, in this case, RSK. You can transfer tokens in the other direction too, using the same method too.

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Token Bridge - Crossing ERC20 Tokens between RSK & Ethereum
Rootstock HackerNoon profile picture

The Token Bridge decentralized application allows to safely cross tokens between RSK and Ethereum networks. It is available at tokenbridge.rsk.co for mainnet or testnet.tokenbridge.rsk.co for testnet.

How it works

The tokens you want to cross, let’s say DAI on Ethereum, are locked by the Token Bridge smart contracts and an event is emitted with all the information about the transaction.

This event is listened by the validators, they check the information and resend the event to the Token Bridge smart contracts on the other chain, in this case, RSK.

Once the majority of the validators acknowledge the transaction, the Token Bridge mints the same amount of tokens in a mirror token to the same address that originally called the bridge.

The mirror token has the same ticker but an r or an e depending on the network, in this case the mirror is called rDAI. To learn more about this read the FAQ.

Currently there is a list of the tokens that can be crossed, like DAI, USDC, USDT, FLIXX and LINK also there you have to cross at least 1 token and at most 10.000 tokens per transaction, and a fee of 0.2%.

RSK has a plan to upgrade the token bridge to a trustless fully decentralized bridge, look at the POC here.

What we need

You will need either Chrome, Chromium or Brave web browser, with one of the following wallet browser extensions:

Nifty Wallet using a custom network for RSK to keep the same addresses as Ethereum.

Metamask using a custom network to add the RSK network.

Gas to pay the transactions,  ETH in Ethereum y RBTC in RSK. You can get ETH from the  Kovan faucet and RBTC from the RSK testnet faucet

Steps

Start by connecting your wallet (Nifty Wallet or Metamask) and select the network of your choice, in this case we will use RSK Testnet network.

If everything is correct, you should see the following screen:

Then select the token that you want to transfer. For example, tRIF token (you can obtain them from the Rif Faucet).

Once you have selected it, enter the amount you want to transfer, then click the Convert tokens button.

As soon as the process starts, you will see a loader and a disclaimer explaining that you will have to wait around 30 seconds until the transaction gets mined.

A double pop-up message would be displayed, you’re meant to confirm the transaction, then click submit the transaction. The following image gives an example of the confirmation popup. The first one is to approve the bridge contract to use the token, the second one is to notify the bridge contract to cross the tokens. These steps require around 30 seconds each for the transaction to be mined.

Once all the steps are done, you have to wait around 5 minutes in testnet or 1 hour in mainnet for the tokens to cross.

Check the transaction on the explorer to see that everything is ok.
You can check the token contract on the other network by clicking on the token symbol (in this case etRIF). You can also check it on your wallet. To do this, change the network on your wallet (in this case we would change to Kovan) and add a custom token using the address of the crossed token, you should see the amount crossed once you wait for the corresponding crossing time.

You can transfer tokens in the other direction too, using the same method.

If you are a developer here are the contracts addresses and the github repository of the token bridge.

Author: Pedro Prete