Recently I encountered some unpleasant lags and outages with some of the publicly available RPCs for xDai. So I looked up how to run my own node on a local machine and connect Metamask directly to this node.
Now I interface smoothly with the xDai chain. With some help from now you too can become a noderunner!
โก๏ธ How to upgrade from 3.0.1 to 3.2.5
Upgrading from OpenEthereum 3.0.1 to 3.2.5 entails a database upgrade which itself requires a bit of terminal work. The upgrade tool is and instructions is found at openethereum/3.1-db-upgrade-tool.
I might cover the upgrade path in more detail in a later update if need be. If youโre not comfortable with the steps of the upgrade tool you may find and delete the chain data and download it once more.
โก๏ธ How to upgrade from 3.2.5 to 3.3.0
The upgrade path to 3.3.0 should be as simple as gracefully shutting down the openethereum process (Ctrl-C) and replace version 3.2.5 with the version described below.
1. Get the binary
Find your build of openethereum
version 3.3.0
. (Though only a release candidate, this is the officially recommended version for anticipating the hardfork)
unfortunately there are no Windows builds at the time of writing
1.1 โฆor source for compiling yourself
2. Extract the files
Get it done.
3. Open up your terminal app
It may look like this one:
3. Locate the binary
Find the little guy.
4. Run it
Like so
./openethereum --chain xdai --jsonrpc-port=8545 --jsonrpc-cors=all --jsonrpc-interface=all --jsonrpc-hosts=all --jsonrpc-apis=web3,eth,net,parity --ws-interface=all --ws-apis=web3,eth,net,parity,pubsub --ws-origins=all --ws-hosts=all --ws-max-connections=10 --max-peers=100
If youโre on Windows your binary will be called openethereum.exe
instead.
5. Sync
Now wait for the ~30 GB of blockchain data to be downloaded.
The program may throw some errors, especially in the beginning, but these are mainly related to running a real validator node which weโre not doing here.
Once it starts syncing, itโll look like this:
Syncing #14889406 0x6a10โฆe8d8 42.97 blk/s 204.1 tx/s 34.6 Mgas/s 76+ 2566 Qed #14892053 4/25 peers 5 MiB chain 132 MiB db 41 MiB queue 8 MiB sync RPC: 0 conn, 3 req/s, 327 ยตs`
And once youโre completely sync, itโll look like this:
Imported #14892107 0x7963โฆ1c14 (7 txs, 2.59 Mgas, 48 ms, 3.73 KiB)
4/25 peers 6 MiB chain 131 MiB db 0 bytes queue 7 MiB sync RPC: 0 conn, 2 req/s, 278 ยตs```
6. Hook it up to Metamask
Now youโre ready to switch over to your brand new RPC. Fire up Metamask, go to Settings Networks, then Add Network.
Fill out the form like so:
Local xDai
http://localhost:8545
100
xDai
https://blockscout.com/poa/xdai/
Hit Save.
Make sure the new network is selected in the Networks dropdown.
7. See it in action
Your next transaction will pass through your node looking something like this:
Transaction mined (hash 0x0000000000000000000000000000000000000000000000000000000000000000)
8. Cheers, you made it
Notes
- Exit the openethereum process by pressing Ctrl+C.
- Keep your node synced before using it. The main drawback of running it on your own machine is that the chain state needs resyncing after, for example, system hibernation. The RPC will still work, but it will only show the last synced state.