Traversing the ETH<>Polygon<>xDAI<>BSC Cross-Chain Bridges
Article Last Updated: May 1, 2021
- Omni bridges connecting both Ethereum and BSC to xDAI STAKE can both be accessed at the same URL: https://omni.xdaichain.com/
- The bridge connecting Polygon (formerly Matic) to xDAI STAKE that was located at https://xdai-matic-connext.vercel.app/ has been upgraded to a 3-Chain (BSC, Polygon, and xDAI STAKE); 3-token (DAI, USDC, and USDT) bridge located at https://www.xpollinate.io/
- Primary liquidity for $SURF on Binance Smart Chain (BSC) has been migrated from a SURF-DAI liquidity pool on Sushiswap to a SURF-BNB liquidity pool on Pancakeswap.
- Primary liquidity for $SURF on Polygon has been migrated from a SURF-DAI liquidity pool on Sushiswap to a SURF-WETH liquidity pool on Quickswap.
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 on 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 STAKE 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. This is followed by a walk through of an xDAI STAKE to Polygon (Matic) token transfer using the Xpolinate Bridge; and a Polygon (Matic) to Ethereum token transfer using the Matic Bridge v2.
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, it is geared to the most novice SURF Finance user. SURF Finance is expanding its ecosystem to multiple blockchains, including xDAI STAKE (xDAI), Binance Smart Chain (BSC), and Polygon (formerly Matic). This article is intended as an aide to our community and its members in this endeavor.
* Note: Matic network was rebranded to Polygon. The terms Matic, Polygon, and Polygon (formerly Matic) all reference the same network, and are used interchangeably within this article.
Adding Networks (Chains) to Metamask
The first thing a user will need to do is add the ability for Metamask to interact with BSC, Polygon, and xDAI STAKE. 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 Polygon (formerly Matic):
Alternative Polygon RPC: https://rpc-mainnet.maticvigil.com/
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.
- 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.
- This is an update to an article written prior to the existence of the xDAI-Matic Bridge. Transfers using the xDAI-Matic Bridge as well as the Ethereum-Matic Bridge have been added as an additional section at the end of the article called A Polygon Detour.
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, make sure Metamask is connected to the network (chain) tokens are being transferred from, and that the correct two chains are selected in the drop down at the top right of the webpage.
Once the correct network and bridge option are confirmed, take the following steps:
- 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.
There is also a Bao-Community xDai Faucet, which can be accessed here.
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 primary DEX, Honeyswap. To add SURF to a Honeyswap swap, its 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 OmniBridge, 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 that same OmniBridge used to to transfer SURF from Ethereum to xDAI STAKE located here. Again, make sure Metamask is connected to the correct network (chain), and that the correct two chains are selected in the drop down at the top right of the webpage.
Once the correct chain connection and bridge option is confirmed, take the same steps as described above for transferring SURF from Ethereum to xDAI STAKE. 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 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.
SURF liquidity on Binance Smart Chain (BSC) is on the network’s biggest AMM DEX, Pancakeswap. To trade SURF for DAI on Pancakeswap, SURF will again have to be added 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 78 DAI.
The DAI Journey back to Ethereum
To take 75 of my 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, as Ethereum transaction fees make small transactions simply not worth it.
A Polygon Detour
Cross-Chain Bridge (Xpollinate Bridge): Another bridge option is the 3 chain — 3 token Cross-Chain Bridge at https://www.xpollinate.io/ by Connext. The Xpolinate Bridge allows users to transfer 3 tokens (DAI, USDC, and USDT) across 3 chains (xDAI STAKE, Polygon, and Binance Smart Chain).
I want to transfer xDAI from xDAI STAKE to Polygon using the Xpollinate Bridge. Once there, I will swap my xDAI (DAI on Polygon) for SURF, and then transfer the SURF, plus some previously purchased SURF, back to Ethereum using the Matic Bridge v2.
Sending xDAI over the Xpollinate Bridge to Polygon (formerly Matic): Once you arrive here, take the following steps to send xDAI over the bridge.
- Make sure Metamask is connected to the xDAI STAKE network.
- In the dropdown menu, select the chain (network) tokens are being transferred from.
- In the dropdown menu, select the chain (network) tokens are being transferred to.
- In the dropdown menu, select the token being transferred across the bridge.
- Enter the address the tokens are being sent too. (This field should auto-populate with the address of the active account, but best to always double check).
- Click the “CROSS-CHAIN TRANSFER” button. Sign the Metamask signature request that pops up. In the next pop-up, indicate the number of tokens to Transfer, Click Swap, and confirm the Metamask transaction.
What is this?
I’m getting the error message, “Router Has Insufficient Collateral. Please Try Again Later”.
I failed to notice that the Xpollinate UI indicated there was only 0.22 DAI Exit Liquidity on Matic. To complete this transaction I will have to wait until more DAI Exit Liquidity is available on Matic.
One Hour Later . . .
There is 93,348.33 Exit Liquidity DAI on Matic, more than enough to complete the transfer. After a repeat of the above process, my 50 DAI has successfully crossed the blockchain chasm from xDAI STAKE to Polygon (Matic).
SURF liquidity on Polygon (Matic) is on the network’s biggest AMM DEX, Quickswap. To trade DAI for SURF on Quickswap, SURF will again have to be added as a custom token. SURF on Polygon will have another new address, which is 0x1E42EDbe5376e717C1B22904C59e406426E8173F 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 Polygon can be found here.
After approving, I can now swap my 50 DAI for 98.7039 SURF.
The Matic Bridge v2 can now be used to transfer SURF from Polygon to Ethereum.
Matic Bridge v2: The Matic Bridge v2 can be used to send any token mapped to both networks back and forth between chains. Matic Bridge v2 offers two bridge options: the Plasma bridge, and the PoS Bridge (Proof of Stake Bridge). When transferring tokens between Ethereum and Polygon using the Matic Bridge v2, always be sure that you are using the PoS Bridge as the transfer mode. It should be the default. Transfers using the Plasma Bridge will take 7 days to process, whereas transfers across the PoS Bridge take about 3 hours.
Sending SURF over Matic Bridge v2 from Polygon to Ethereum: Once you arrive here, take the following steps to send SURF over the bridge:
- Click the Switch button to show Matic Network as the network you are sending tokens from. (Ethereum is the default.)
- Select the Ether (PoS-WETH) drop down and a search window will appear.
- Type in SURF.
- Select the SURF.Finance option when it appears.
- Indicate the number of SURF tokens to transfer and click the Transfer button. (Make sure your Transfer Mode is PoS Bridge.)
- Review Important window and click Continue.
- Review the Transfer Overview and click Continue. Be sure to note the gas needed to claim tokens on Ethereum.
- Claim transferred SURF tokens after about 3 hours. To claim tokens, MetaMask will need to be connected to Ethereum network. If the claim window does not appear, check the red circle with a number in it on the right of the top bar of the website. Click on the red circle to see any transactions.
Success! Our tokens journeyed from Ethereum across two bridges to get to BSC (Binance Smart Chain). Came back across a bridge to xDAI STAKE. From there, some tokens crossed a bridge directly back to Ethereum, while others made a two bridge detour through Polygon to arrive at Ethereum. Best of all, this was all done on-chain, no CEX needed.
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.
To follow me on Twitter click here. I often post charts and and other information related to blockchain.