Cross-Chain Interoperable — How to Traverse the ETH <>xDAI<>BSC Bridges

THIS ARTICLE HAS BEEN UPDATED TO A NEW ARTICLE THAT INCLUDEs BRIDGES TO POLYGON (formerly MATIC) called Traversing the ETH<>Polygon<>xDAI<>BSC Cross-Chain BridgesLinked

Cross-chain interoperability refers to the ability of a token to exist on more than one blockchain. Since a token can never actually leave its native network (chain), this must be done by locking a token in one chain and creating a wrapped (synthetic) version of it on another chain. When the wrapped version of a token is brought back to it’s native chain, it is burned (destroyed) and the original token is released.

Token cross-chain interoperability can become more complicated when a token crosses into a network from more than one other network. This is the case with xDAI STAKE (xDAI). Tokens can cross into xDAI from both Ethereum Mainnet and Binance Smart Chain (BSC).

This article walks through the process of transferring tokens between Ethereum and BSC using the xDAI STAKE network and bridges. It is intended for anyone to use to better navigate these networks and cross-chain bridges, however, as an active member of the SURF Finance community, I am gearing this article to the most novice SURF Finance user. SURF Finance is expanding its ecosystem to multiple blockchains, including xDAI STAKE (xDAI) and Binance Smart Chain (BSC). This article is intended as an aide to our community and its members in this endeavor.

Adding Networks (Chains) to MetaMask

The first thing a user will need to do is add the ability for MetaMask to interact with xDAI and BSC. To do this, add a Custom RPC for each additional chain as shown below.

Here is the information that needs to be entered to interact with Binance Smart Chain (BSC):

Network Name: Binance Smart Chain
New RPC URL: https://bsc-dataseed.binance.org/
Chain ID: 56
Symbol: BNB
Block Explorer URL: https://bscscan.com

Here is the information that needs to be entered to interact with xDAI STAKE (xDAI):

Network Name: xDai STAKE
New RPC URL: https://rpc.xdaichain.com/
Chain ID: 100
Symbol: xDai
Block Explorer URL: https://blockscout.com/poa/xdai

Alternative xDAI STAKE RPCs: 1) https://xdai.poanetwork.dev/
2) https://xdai.1hive.org/ | 3) https://rpc.xdaichain.com/

There and Back Again

To better demonstrate a variety of the potential processes of using the xDAI cross-chain bridges, I will transfer both SURF and DAI from Ethereum to BSC, where I will sell my SURF for DAI to be taken back to Ethereum Mainnet. Since I am starting with .2 ETH, I will only buy .05 ETH worth of DAI and .05 ETH worth of SURF. This way, there will (hopefully) be enough to cover all transaction fees.

Note: It is not recommended to do all these transactions with such small amounts on Ethereum. It’s too expensive. This is being done for demonstrative purposes.

Trade ETH for DAI on Ethereum:

  1. Go to the Uniswap swap here.
  2. Click the Select a token button.
  3. Type in DAI and select it when it appears at the top.

Trade ETH for SURF on Ethereum:

Trading ETH for SURF on Uniswap is slightly different because SURF is not automatically added to Uniswap the way DAI is. Uniswap makes it easy to add a new token to both Uniswap and MetaMask. Additional steps to swap ETH for SURF the first time are:

  1. Type in SURF.
  2. Click the Import button (make sure it’s the right SURF token).
  3. Check box for Disclaimer.
  4. Click the Import button.
  5. When the swap window comes up you will need to click the gear icon.
  6. In the next window increase the slippage to 1.1%. (This needs to be done because SURF has a 1% transaction fee that goes to the Whirlpool to benefit the SURF ecosystem and Whirlpool stakers.)
  7. After the transaction is submitted, be sure to “Add SURF to Metamask” before closing the window.

Take SURF across the Ethereum bridge to xDAI STAKE

There are two protocols bridging Ethereum to xDAI STAKE :

  1. xDAI Bridge: The xDAI Bridge can only be used to send DAI to xDAI STAKE; converting it to xDAI STAKE’s native token, xDAI. Sending DAI via the xDAI Bridge has a lower gas cost than sending other tokens via the OmniBridge.
  2. OmniBridge: All other ERC-20 tokens need to use the OmniBridge. Do not send DAI over the OmniBridge. It will not convert into xDAI, but rather a wrapped version of xDAI that there is no liquidity for.

Sending SURF over the OmniBridge to xDAI STAKE: Once you arrive here, take the following steps to send SURF over the bridge:

  1. Select the STAKE dropdown.
  2. If this is the first time sending SURF, click the + Add Custom Token link.
  3. The Add Custom Token window will appear. To get the Token Contract Address open MetaMask.
  4. Make sure the Assets tab is selected.
  5. Select the SURF token that was added to MetaMask via Uniswap earlier.
  6. Select the three dots.
  7. Select View on Etherscan in the dropdown menu.
  8. Click the Surf Finance (SURF) link in the Etherscan page for the contract.
  9. Hover your icon to the right of the Token Contract Address and click the copy icon when it appears.
  10. Go back to the OmniBridge tab and paste the copied address in the Token Contract Address field and click add token.

Once SURF is added and selected, enter the number of tokens to Unlock or just select Max and select the Unlock button. This will bring up the MetaMask window and require a transaction be completed. Once this transaction is completed, verify the number of tokens to send, and select the Transfer button to bring up MetaMask and complete the transfer.

When the transaction is completed, the sent SURF tokens will be parked in an Ethereum contract here, and an xDAI STAKE version of your tokens will appear in your wallet. To see the transferred tokens, change the MetaMask network to the xDAI STAKE network added earlier.

xDAI Faucet

Since only SURF was sent to xDAI STAKE via the OmnBridge it won’t be possible to do any transactions on xDAI STAKE. Fortunately, there is a faucet to get .01 free xDAI, enough for several transaction.

To get the xDAI go here.

To receive xDAI:

  1. Open MetaMask and click on the Account to copy the your address.
  2. Paste your address in the receiver address field.
  3. Select the I am human box and complete the hCaptcha puzzle
  4. Click the Request 0.01 xDAI button.

Taking DAI across the Ethereum bridge to xDAI STAKE

Instead of using the xDAI Faucet, I could have sent DAI over the xDAI Bridge here, converting it into xDAI. To do this I need to:

  1. Switch back to Ethereum Network in Metamask.
  2. Indicate a transfer amount.
  3. Complete two transactions on MetaMask. One to Unlock and one to Transfer the DAI.

While on xDAI STAKE, be sure to check out its biggest DEX Honeyswap. To add SURF to a Honeyswap swap, it’s xDAI STAKE address is 0xc12956b840B403b600014a3092f6EBD9259738fE which can be seen and copied here.

The BNB Conundrum

Now I am stuck. I can start the process of sending SURF to BSC using the BSC-xDAI OmniBridige, however, without BNB in my wallet, there will be no way to claim my bridged tokens. The BEP-20 (BSC) version of BNB is the native token of Binance Smart Chain (BSC), and is what is used to pay transaction fees. Without BNB in my wallet, there is no way to claim any transferred tokens.

Options for getting BEP-20 BNB into a wallet are:

  1. Receive BNB from another wallet on BSC.
  2. Use Binance to purchase BNB and send BEP-20 BNB directly to the MetaMask wallet address.
  3. Add Binance Chain Wallet to browser (similar to MetaMask), and use Binance US to purchase BNB and send BEP-2 to the Binance Chain Wallet Address. Once BNB is in a Binance Chain Wallet, a cross chain transfer can be done internally by sending BNB to the wallet address and selecting Binance Smart Chain. The Binance Chain Wallet can be a new wallet, or the current MetaMask wallet can be imported to it.

There are likely other options, and hopefully something will be created to allow users to get BEP-20 BNB into their wallet directly from xDAI STAKE.

Take SURF Across the Bridge to Binance Smart Chain (BSC)

The xDAI bridge to BSC is a different OmniBridge located here.

The xDAI to BSC bridge has the exact same interface as the above described Ethereum to xDAI OmniBridge. Two differences to keep in mind with the xDAI to BSC bridge versus the Ethereum to xDAI bridge are:

  1. The same token will have a different xDAI address. In the case of SURF, the xDAI token address is 0xc12956b840B403b600014a3092f6EBD9259738fE. When adding a custom token to your transfer, paste this address to add SURF.
  2. All tokens, including xDAI (DAI), use the xDAI to BSC OmniBridge. This is in contrast to Ethereum to xDAI, which has a bridge specific for xDAI (DAI).

Again, be sure to have some BNB in your wallet on Binance Smart Chain (BSC), otherwise you will not be able to claim your transfer.

There are numerous AMM DEXs on BSC; a couple of good ones are PancakeSwap and BSCEX SwapX. A couple of familiar Ethereum DEXs have also branched out to BSC. Namely, 1inch and the newest entrant, SushiSwap.

SURF is one of the first tokens to add liquidity to SushiSwap on BSC. Since I am looking to trade SURF, I will head to SushiSwap’s alternate network swap site here.

For the time being, SURF will have to be traded with it’s BSC liquidity pair, DAI. This will likely change as SushiSwap increases its foothold on BSC, but for the time being, users will need to trade SURF for DAI, and then trade that DAI for something else on another BSC DEX if they want to trade into another token on BSC.

In this case, I am going to trade SURF for DAI, and take that DAI back to Ethereum. To trade SURF for DAI on SushiSwap, I will again have to add it as a custom token. SURF on BSC will have another new address, which is 0x0d1a15b277d25598144593836e5c6c20d427b61d and can be copied here.

You shouldn’t have to add DAI as a custom token, but just in case, the address for DAI on BSC can be found here.

After approving, I can now swap my 168 SURF for 75 DAI.

The DAI Journey back to Ethereum

To take my 75 DAI back to Ethereum, I have to return to the same OmniBridge used to cross over to BSC here.

The process is similar to sending tokens from xDAI to BSC, except that when sending token from BSC to xDAI, you will not need to claim them on the xDAI side.

Unfortunately, not all DAIs are created the same. The 75 DAI I transferred over is DAI(BSC). I will need to convert it to xDAI before the final leg of our journey. To do this, first go to Component on xDai located here.

Swap DAI(BSC) for WXDAI. As illustrated above, it is not exactly a 1:1 ratio, but pretty close.

After the DAI(BSC) is converted into WXDAI, I will need to head over to the Honeyswap swap here, and unwrap it into xDAI.

We now come full circle by taking the 74.93 xDAI accross the xDAI Bridge.

To claim my DAI, I will have to switch to Ethereum Mainnet and pay Ethereum gas fees. This is not something I would normally do for a 75 DAI transaction. Ethereum transaction fees make small transactions simply not worth it.

I hope you found this guide helpful. Token cross-chain interoperability is an exciting new piece of the crypto puzzle. It is important that any crypto user get comfortable utilizing cross-chain bridges to their fullest. They can create opportunities one might not otherwise realize.

--

--

--

Avid Gamer | Economics Geek | Decentralization Enthusiast

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to explain blockchain to a novice programmer?

Tokoin: An Innovative Platform for all Types Enterprises

Breaking Blockchain  — A Framework to Evaluate Blockchain Use Cases

Open Science Organization Introduces the Unique Research Identity

WAYC MARKETPLACE — STARGAZE

China Launches BSN Global Blockchain Network for Commercial Use

[Project Tracker] Cosmos #20- November 2020 Updates

WEF has created a set of blockchain tools for supply chains.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Yostari

Yostari

Avid Gamer | Economics Geek | Decentralization Enthusiast

More from Medium

Blockchain: First step towards it….

How to use DeFi on Avalanche🔺in less than 10 minutes

Cryptosnake game platform gets audited by Smart State

OlympusV2 — How & Why to migrate?