xDai <> Mainnet Step by Step Guide

We are thrilled to announce that Gnosis Protocol has now been deployed to xDai!

DXdao
5 min readNov 2, 2020

--

Gnosis Protocol is a fully permissionless DEX that enables ring trades to maximize liquidity. The protocol uses consecutive 5 minute batch auctions to settle orders. You can trade on Gnosis Protocol using Mesa, the first dapp built on the protocol, developed and maintained by the DXdao.

We’re happy to offer the Mesa dapp on xDai, an Ethereum sidechain designed for fast and inexpensive transactions, providing a developer-friendly environment that retains real world economic incentives. xDai has migration capabilities with Ethereum Mainnet via “bridges,” that allow tokens to be transferred from Mainnet to xDai and back again. This allows our community to avoid prohibitively high gas fees.

This guide will outline how to move funds from Mainnet to xDai, place an order on Mesa, and then return your funds to Ethereum Mainnet.

Steps:

I. Install and set up xDai-enabled Metamask

II. Transfer tokens from Mainnet to xDai

III. Trade on xDai using Mesa

IV. Get tokens back from xDai to Mainnet

I. Install and set up xDai-enabled Metamask

The first entry point to accessing the xDai chain is downloading Metamask if you do not already have it. Once you have Metamask installed, follow these instructions to set up a “custom RPC” (Remote Procedure Call) to connect to the xDai network as described here:

(1) Open Metamask and select “Custom RPC” from the network dropdown

(2) Select “Custom RPC settings” and enter the xDAI network details below:

Please note the following consideration from the xDAI Metamask setup instructions:

MetaMask recently updated the ChainID to be a required field. When you update, you may need to reenter the chain id 100, and it will be converted to a hexidecimal: 0x64. If you are having issues, try entering 100 for Chain ID and resaving the configuration.

II. Transfer tokens from Mainnet to xDAI

The first difference you will encounter between the xDai and Ethereum Mainnet environments is that the native token on xDai is DAI instead of ETH. While this alleviates the pain point of gas costs on Mainnet, it means you must pay for transactions in DAI. You can acquire DAI to cover these transactions using Mesa, and then move them over to xDai

  1. Bridge Mainnet DAI to native xDai DAI using https://bridge.xdaichain.com/.

Make sure you’re logged into Ethereum Mainnet via Metamask while making this transfer. Gnosis Protocol allows wrapping /unwrapping native xDai to tradeable ERC-20 tokens (like how ETH/WETH occurs on Mainnet).

2. To trade any other Mainnet ERC20 token, bridge it over to xDai using https://xdai-omnibridge.web.app/.

III. Trade on xDai using Mesa

You can access Mesa similarly on xDai as you would on Ethereum Mainnet once you have transferred your tokens.

Important: Make sure you’re on the xDai network on Metamask, and then:

  1. Head to mesa.eth.link.
  2. Enable the token you want to trade on Mesa, including wrapped xDai or xETH so it can be deposited.

You can view tradable deposits in the Balances tab:

3. After enabling the token, deposit the token you want to trade

4. Place an order for the trade you want to make. Be sure to use the Mesa price indicator to get a price that can be matched. You may use the “fill-price” suggestions to increase your likelihood of getting your order completely filled.

5. Wait for the next 5 minute mark for an order to become “tradable.” The status should read “Pending solver submission”:

6. Wait at least 5 more minutes for the trade to be cleared. You can check a trade’s status in “Your orders” section. If no trade occurs you may have to resubmit your order at a more competitive price.

7. To withdraw your funds, go to the Balances tab, click on the — (minus sign) next to the token you want to withdraw:

8. Wait for the next 5 minute batch to pass, then you can “claim” your withdrawal:

Note that you can only claim once the batch auction in which you requested the withdrawal is over, which may take up to 5 minutes. This is to avoid double spending of funds on the protocol.

And… now we have 4 OWL in our wallet on the xDai network! How, then, can we transfer them back to Mainnet?

IV. Getting tokens from xDai back to Mainnet

After trading on Mesa, you will likely want to bridge your tokens back to Ethereum Mainnet.

Make sure you’re on the xDai network on Metamask, and then:

Wrapped native DAI (wxDai) needs to be unwrapped and sent back using this DAI-specific bridge:https://bridge.xdaichain.com/.

Any other Ethereum token can be sent back using another bridge: https://xdai-omnibridge.web.app/.

Be sure to stay on the xDai network via Metamask until the transaction completes, or the transaction may get stuck! If you need to check the status of a transaction on Omnibridge, visit https://alm-xdai.herokuapp.com. and enter the transaction hash of your bridge transfer.

That’s it! We’ve successfully bridged tokens to xDai, placed a trade on Mesa, and bridged our tokens back to Ethereum Mainnet again.

Questions about Mesa?

Check out the DXdao website at https://dxdao.eth.link, and get in touch via our Keybase or on Telegram at https://t.me/dxDAO and https://t.me/mesadex.

--

--

DXdao

The DXdao is a decentralized organization, owned and operated by the community. It develops, governs, and grows DeFi protocols and products.