---
# System prepended metadata

title: xdai dapp migration
tags: [' Posts', Rangers]

---

---
tags: Rangers, Posts
---

# xdai dapp migration

## Purpose

Gas prices are an existential threat to coordination. When we launched DAOhaus last year at EthBerlin, summoning a DAO was around $2.50 in gas. Today it can be anywhere from $50-150 to summon a DAO. Coordination cost is the main purpose of a DAO, so we've begun migrating to xDAI. 

## Why xDAI?
Ready now (we need to coordinate now and are not interested in testing)
Aligned with Eth 2.0 roadmap
Availability of dev tooling (theGraph, bridges, etc )
Liquidity
Trusted network of validators (Eth community)


## Steps to Migrate

### deploy contracts to xdai

The first thing we did was experiment with deploying some contracts to the xdai chain. to do this we just used Remix and connected metamask to the xdai rpc. We had already bridged a little dai over for our testing. Plesantly surprised that the Moloch V1/V2 contracts deployed without any problems. And really pleasently surprised that it cost only about .1 xdai to deploy a MolochV2, in comparison on mainnet with 100+ gas prices the deploy would cost over $100.00

Many of our DAOs use weth as an internal token because the erc20 functionality is required. On xdai we have the same issue, so what to do to let people use the native token in daos? Well we just updated the naming and deployed a copy of the weth contract on xdai. Again through remix, totally seemless. Yay, now we have wxdai. See the verified contract here 

https://blockscout.com/poa/xdai/address/0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d/contracts

Last we had a few factories to deploy for the daohaus dapp. Again, straight copy. no problemo.


### verify on blockscout 

So next we wanted to verify all these contract. If you are familiar with the process on etherscan it is pretty much the same on blockscout. Just search for your contract on blockscout and there will be a big button to verify. I did have a problem getting one contract verified but that was because i put in the wrong pragma. Seems I do that every time on etherscan too though. Once i got that right everything was smooth.

### Deploy the subgraph

Just had to update a few contract address and in the manifest

`network: xdai`  

Yup, that's it.

### 3box

3box just works, because EOAs are the same on both networks, no changes needed.


### Frontend web3

We use web3Modal, which usually just works, and it does here to, we were able to update a couple .env variables and everything went pretty smooth. The .env variables we updated was a chain id (100) and the infura end point and key. Not using infura on xdai so we ended up just updating to https://xdai.poanetwork.dev both eth_sendTransaction and eth_call worked.

At first we tried using nodesmith but got some errors but when we switch to the rpc above, all good.

The last thing we did was update some .env variables that point to our factory contracts, with the new adders from our deployments above.

The last thing we did was update another project to support xdai https://wrapeth.com/ so that our users could easily wrap/unwrap their xdai.

### links change to blockscout from etherscan.

Because xdai uses a different block explorer we had to have some logic that would change any links to see transaction status to blockscout instead of etherscan.

### TODO: Update help content

last thing to do is update some of our help content and documentation

### Other things

When multi token bridge is ready and people are bridging all their erc20s for dao use. Getting price feeds on bridged tokens may be harder, might have to check the bridge mediator for the bridged token address and get any meta from that address on mainnet.

## conclusion

Super easy. go for it. Migrate your dapp, what are you waiting for?

## links

daohaus: https://xdai.daohaus.club/
wrap eth: https://wrapeth.com/
multi token bridge (coming soon)


