Ropsten merge-testing with GethStar

The Ropsten merge is a significant milestone in Ethereum’s progress towards moving to proof-of-stake. It is the first pre-existing public testnet to be merged, making it an important test-case for merging Mainnet. It has already been entertaining because a naughty miner deployed a lot of hashpower to the network and brought the merge date suddenly much closer - so close that the merge data passed before a Ropsten Beacon Chain even existed. The client teams quickly posted fixes that pushed the trigger for the merge (TTD - terminal total difficulty) into the far future. Nodes that were sync’d to Ropsten halted because there was no Beacon Chain yet to take over the consensus and block gossip responsibility, but those functions were switched off in Geth.

I am writing this article on the day that the Ropsten Beacon Chain is supposed to go live and the client fixes that bump the TTD have already been released. The Ropsten merge itself will not happen for a few days so there is still time to participate by syncing a node and spinning up a validator.

update Ethereum Foundation notes on the Ropsten merge now available here.

It is important to make responsible choices for both the execution and consensus client. The correct choice will differ person by person, but using minority clients is strongly encouraged. I chose to use Lodestar for my consensus client in this tutorial as it is currently one of the lesser-used clients, being newer than some of the others. Increasing the adoption of minority clients is important for evening out the client diversity, which has security benefits for the network as a whole. I am, however, still using Geth as my execution client despite it being the majority client on the execution layer simply because I know Geth quite well and already have a Geth node sync’d to Ropsten. Readers are encouraged to experiment with minority execution clients.

This article will show how to do the following using the Geth-Lodestar combo known as Geth-Star:

  1. Install and run the execution client, Geth.
  2. Install and run the consensus client, Lodestar
  3. Deposit 32 ETH into the deposit contract and generate validator keys
  4. Spin up a a validator using Lodestar
  5. Attach a console to Geth and make some transactions

The instructions that follow are for a Linux OS - I am using Ubuntu 20.04. The instructions should be very similar for other distributions/OS’s.

1) Execution Client: Geth

Download the latest version of Geth from Github using the command line. Switch over to the unstable branch and build Geth. Switch into the project root directory, go-ethereum:

cd clone http://github.com/go-ethereum.git
git checkout -b unstable
make
cd go-ethereum

Now Geth can be started. The configuration is defined using a series of flags passed to Geth at startup. This will include defining the datadir where all the blockchain data will be saved (we will start a new directory called ropstendata and enabling the various communication channels that allow the consensus and execution clients to connect. The following command will start Geth, printing logs to the terminal.

./geth --ropsten --datadir ropstendata --authrpc.addr localhost --authrpc.port 8551 --http --authrpc.vhosts localhost authrpc.jwtsecret ropstendata/jwtsecret --http.api eth,net --override.terminaltotaldifficulty 50000000000000000

This terminal should then be left running. The client will start by syncing - this means downloading the historical blockchain data and verifying it - this may take a few days as Ropsten has been around for a while and has a substantial history. If the terminal is shut down then Geth will stop and will not continue syncing until it is restarted with the command above.

Geth syncing to Ropsten
Geth syncing to Ropsten

Lodestar Consensus Client

While Geth is syncing, the consensus client can be set up. Download Lodestar from the Chainsafe Github. Once downloaded, the client can be built using yarn. The following commands install and build Lodestar:

git clone https://github.com/chainsafe/lodestar.git
yarn install --ignore-optional
yarn run build

Once built, lodestar is ready to be started up. At this point, we want to start a Beacon node, not a validator. this is configured by passing beacon or bn to Lodestar on startup. It is also necessary to define the port to connect to the execution client and the location of an authentication token (jwt-secret) in the Geth data directory. These allow Lodestar to connect to Geth. In this example, the secret was saved to the same datadir as the blockchain data. The following command will start Lodestar, connect to the running Geth instance and start syncing the Ropsten Beacon Chain (once the Ropsten BC exists). The terminal must be left running in order for the sync to continue,

./lodestar beacon --network ropsten --eth1.providerUrls http://localhost:8551 http://localhost:8545 --jwt-secret /home/go-ethereum/ropstendata/jwtsecret terminal-total-difficulty-override "50000000000000000"

Adding a validator

It is now possible to run a validator connected to the consensus client. This requires at least 32 Ropsten ETH. Running a validator is optional - it is still useful to have the two clients running as described above as this gives private, permissionless, censorhip-resistant and fast access to the Etheruem blockchain, with Geth processing transactions and Lodestar tracking the head of the chain. However running a validator means participating fully in the security of the network.

I do not know of a functional Ropsten faucet that pays out anywhere close to 32ETH so unfortunately it is a case of begging and borrowing from Ropsten whales at the moment.

The easiest way to start a validator is to visit the Ropsten Launchpad. This page walks the reader through depositing their ether to the deposit contract and generating validator keys. Please read the various warnings and take the validator commitment statement seriously - this is a testnet but it is great practice for spinning up a Mainnet validator later.

Choose the Download Key Gen GUI app option
Choose the Download Key Gen GUI app option

Using the Key Gen GUI app is a very convenient way to generate the validator keys. Simply follow the instructions provided in the GUI. For this tutorial, the keys should be saved to ropstendata/keystore.

The launchpad will also give instructions for sending 32 ETH to the deposit contract. Follow the instructions. A successful deposit looks like this:

Once the keys are saved and the deposit made, a validator can be started in a third terminal. The following command imports the new validator keys into Lodestar:

./lodestar account validator import --network ropsten --directory ropstendata/keystore

A successful import will request a password. Keep this safe! A successful validator import looks like this:

The validator can then be started using the following command:

./lodestar validator --network ropsten --terminal-total-difficuly-override "50000000000000000"

There is a queue for validator activation, so there will be a period of a few days before the validator does anything interesting. Once it activates it will start logging something like this:

Tests

At this point, three terminals are running concurrently - Geth (execution client), Beacon node and validator (or just Geth and Beacon node if no validator was added). This setup is a private portal to Ethereum. Geth provides the tooling for interacting with the Ethereum network. Commands are sent to Geth in the form of JSON objects that conform to the JSON-RPC-API spec. This can be done directly by sending curl requests to Geth’s exposed http port. However, this is tedious and quite error-prone, so it is more common to use a convenience library such as Web3.js. Geth provides a Javascript console that exposes most of the Web3.js API. The console can be started by opening a new terminal and connecting using IPC:

./geth attach ropstendata/geth.ipc

The Geth Javascript console will open. Check the accounts that exist in the keystore using:

eth.accounts

Make a simple transaction using:

personal.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: 20000000000000), "yourpassword");

Also try some more complex interactions such as deploying and interacting with smart contracts. Much more information about using the Geth console is available at the Geth docs.

The Pandas of Justice

Watch the terminals around the time of the merge (expected to be 8-9 June). A successful transition to proof-of-stake will be indicated by the merge Pandas appearing on screen!

Success Pandas
Success Pandas
Subscribe to jmc
Receive the latest updates directly to your inbox.
Verification
This entry has been permanently stored onchain and signed by its creator.