Gas costs are exploding again, ETH2.0 is still too far away and people are now looking at layer 2 solutions. Here's a good overview of existing layer 2 projects: https://github.com/Awesome-Layer-2/awesome-layer-2. Today we will take a closer look at xDai as a solution for your Dapp.
Historical context: The name and consensus design below reflect 2020. The network is now Gnosis Chain and completed its move to permissionless proof of stake on December 8, 2022. It uses GNO for staking and xDai for gas; the old STAKE/POSDAO description is historical.
What are sidechains?
Sidechains are generally EVM-compatible, separate blockchains with their own consensus models. xDai is moving towards a Proof-of-Stake mechanism using their own STAKE token on the Ethereum mainnet. Sidechains are designed to easily allow transfer of value and arbitrary state with the Ethereum chain.
+ allow you to run fully functioning smart contracts
+ arbitrary data exchange with mainchain
- security relies on small set of nodes in the sidechain
- not suitable for extremely high-value applications
Why xDai

Historical context: The following authority-validator discussion describes the old xDai setup. It does not describe the current Gnosis proof-of-stake validator set or its geographic distribution.
You may have heard about xDai especially given the high current gas prices. It's a working mainnet deployed sidechain focusing on simplicity and using the stable coin DAI as underlying main currency. The current implementation is still a PoA (proof of authority) chain with selected and trusted, public validators based in the United States.
The biggest advantages of xDai are the 3 S:
1. Simplicity
For a new application, choose Gnosis mainnet or Chiado testnet and use the corresponding RPC, chain ID and gas token. To bridge assets, use the current Gnosis bridge workflow. The older POA Network wallet/bridge instructions are historical.
2. Stable
Since we are using xDai as native currency, this will be used to pay for all gas costs as well. In contrast to ETH, this means we have a stable base currency to pay the very low transactions costs.
Win win.
3. Support
Most of the times tools only support the Ethereum mainnet and maybe 1-2 testnets. However with xDai, you get support for example from:
TheGraph: An extremely useful tool to query blockchain data, see my previous tutorial here.
Blocknative: Transaction status service.
AnyBlock: Blockchain analytics service.
Existing projects on xDai
- Gnosis: xDai and Gnosis started a partnership just days ago. You can find their core protocol and multisigs deployed on xDai.
- KickBack: Event Management and RSVP accountability
- HoneySwap: Uniswap v2 Fork
- RealityCards: NFTs for prediction voting
How to deploy to xDai
Deploying to the xDai sidechain is very simple. If you're using Truffle, simply add the xDai network configuration like this:
// Legacy Truffle configuration. HDWalletProvider and mnemonic are defined by the surrounding project.
module.exports = {
networks: {
gnosis: {
provider: () => new HDWalletProvider(mnemonic, "https://rpc.gnosischain.com"),
network_id: 100,
},
},
};
You'll also need funds in the sidechain of course, see further below on how to use the bridge.
Wrapped xDai
Onboarding users
MetaMask
Chain ID 100 is Gnosis mainnet, not a testnet. The test network is Chiado, chain ID 10200. Use the official wallet settings to choose the correct network.

Value transfer from and to sidechain
1. Getting the native xDai
The old direct-transfer instructions and addresses have been withdrawn. The maintained Gnosis xDai Bridge documentation now specifies USDS as the default Ethereum-side deposit asset and a bridge-contract workflow. Sending a token directly to an address copied from this old article is not that workflow.
Open the bridge through the official documentation, select the intended source and destination networks, and review its current supported assets and deposit requirements.

2. Moving ERC-20 and other tokens
For other supported assets, the current unified bridge interface and Omnibridge information are linked from the Gnosis bridge documentation. Asset support and transfer requirements can differ from the native xDai bridge.

3. Arbitrary data transfer
Of course you can also transfer arbitrary data. There is naturally no UI for this, you will need to call the contracts directly.
The Future with POS
Historical context: This roadmap was written in 2020. Gnosis completed its proof-of-stake transition in 2022; the plans for STAKE and POSDAO below should be read as project history.
xDai is transitioning towards POS. They implemented a POSDAO system which is using a DAO to find consensus and using Randao for its randomness. Randao is essentially a commit-reveal scheme, see here. You can find the complete POSDAO whitepaper at https://forum.poa.network/t/posdao-white-paper/2208. The next phase of staking is currently actively in development. You can now start staking your STAKE at https://easy-staking.xdaichain.com/.
Given the underlying Randao, you will also be able to use this to get on-chain randomness. Once again I wouldn't use this for billion dollar projects, see the reasoning here for last-revealer problem. But it's nevertheless a great addition for when it's good enough.
Layer-2 solutions
With the rise of gas prices we will see more and more support for layer 2. It will be up to us developers to actually drive adoption and make this a reality. We have stayed comfortably on layer 1 together for too long.

Have you used xDai before? Maybe even on Mainnet? There are also grants opening again soon that you might want to check out. Or what other layer-2 solutions did you look at or would be interested to hear about next? Please let me know in the comments.




Join the conversation
Comments are hosted by Disqus and load only when you choose to enable them.