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 Bridges ← Linked
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):
Here is the information that needs to be entered to interact with xDAI STAKE (xDAI):
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:
- Go to the Uniswap swap here.
- Click the Select a token button.
- 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:
- Type in SURF.
- Click the Import button (make sure it’s the right SURF token).
- Check box for Disclaimer.
- Click the Import button.
- When the swap window comes up you will need to click the gear icon.
- 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.)
- 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 :
- 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.
- 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:
- Select the STAKE dropdown.
- If this is the first time sending SURF, click the + Add Custom Token link.
- The Add Custom Token window will appear. To get the Token Contract Address open MetaMask.
- Make sure the Assets tab is selected.
- Select the SURF token that was added to MetaMask via Uniswap earlier.
- Select the three dots.
- Select View on Etherscan in the dropdown menu.
- Click the Surf Finance (SURF) link in the Etherscan page for the contract.
- Hover your icon to the right of the Token Contract Address and click the copy icon when it appears.
- 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.
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:
- Open MetaMask and click on the Account to copy the your address.
- Paste your address in the receiver address field.
- Select the I am human box and complete the hCaptcha puzzle
- 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:
- Switch back to Ethereum Network in Metamask.
- Indicate a transfer amount.
- 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:
- Receive BNB from another wallet on BSC.
- Use Binance to purchase BNB and send BEP-20 BNB directly to the MetaMask wallet address.
- 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:
- 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.
- 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.