ELI5 Explanation of the Ethereum 2.0 TestnetThursday, 23rd of May 2019 · by Mohamed Fouda
Early this month Prysmatic Labs team has launched the most-complete public testnet for the first phase of the Ethereum 2.0 network which uses the Prysm client. The launch was well-received by the Ethereum community. Many immediately started running the software and reporting issues to the Prysmatic Labs team. The number of validator nodes on the Ethereum 2.0 testnet quickly surpassed 800 nodes. This simply shows the exuberant desire of the Ethereum community to contribute to the Ethereum progress into the highly anticipated Ethereum 2.0 network upgrade.
To take this excitement even further, it is necessary to educate the wider Ethereum community about the Ethereum 2.0 testnet, why its launch is a crucial milestone and why it took a long time to reach this milestone. This article is an effort to fill this role by demystifying the technical details and articulating them in a simple language. It starts by discussing how Ethereum 2.0 is different from the current Ethereum protocol and then it goes into a high-level explanation of the functionality of the testnet.
Why is the Ethereum 2.0 upgrading taking so long?
To answer this question, let’s start with a simple but important fact:
Ethereum 2.0 is not an upgrade to the current Ethereum network. Instead, it is a complete overhaul and redesign of Ethereum.
Many are unaware of this fact, or may even disagree with this characterization. So it is important to clarify.
- The new Ethereum 2.0 network shifts away from PoW consensus and uses a completely new and innovative Proof-of-Stake (PoS) consensus mechanism known as Casper.
- In PoW chains, a simple way is used to choose how the blockchain progresses and which chain to follow in case of disagreements (forks). PoW blockchains build upon the chain with most accumulated work or, in other words, the chain that has used the most hash rate. As Ethereum 2.0 uses PoS, it introduced a set of fork selection rules, known as LMD GHOST, to identify the right chain to build on.
- The current Ethereum network uses a single chain (DAG) of blocks. The Ethereum 2.0 network will use 1024 parallel chains. This is the core of Ethereum’s ambitious plan to improve scalability which is known as sharding. These different chains (shards) can communicate together and all of them will be controlled and validated by a single master chain known as the Beacon Chain. This Beacon Chain resembles the stem of a plant that has 1024 identical branches.
- As a result of these radical changes, ETH holders will not be able to simply use their ETH coins on the new Ethereum 2.0 network. Instead, they will have to burn their current ETH and, in return, they will receive the same amount of ETH on the beacon chain. This transfer mechanism is handled by a smart contract on the Ethereum 1.0 chain that is monitored by the beacon chain.
While there are many differences between Ethereum 1.0 and 2.0, the ones discussed are the major points. This exemplifies the amount of work that is needed to deliver Ethereum 2.0.
Why is the Ethereum 2.0 Testnet Launch Important?
As can be seen from the discussed differences, Ethereum 2.0 design has many moving pieces that need to be combined together and tweaked to make the machine work. Many concepts of Ethereum 2.0 are completely new and have not been tested in any public blockchain before, such as Casper consensus mechanism.
Protocols that are trying to achieve similar goals like Cosmos and Polkadot required 2+ years to get to a working design while having the flexibility of starting from scratch. These projects did not have to worry about transferring assets like ETH and other ERC-20 tokens form the old chain to the new chain or worry about reducing the impact of changes on dApp developers. The Ethereum community needed to see actual steps in the Ethereum migration process to gain confidence in the roadmap execution.
What is Implemented in the Ethereum 2.0 Sapphire testnet?
Getting back to the previously mentioned four differences between Ethereum 1.0 and 2.0, the testnet implements #1, #2 and #4 and partially #3. In specific, Sapphire testnet has implemented the Casper PoS consensus mechanism with new fork selection rules, has implemented the maser Beacon Chain, and finally, implemented a mechanism to transfer ETH 1.0 tokens to ETH 2.0 tokens to be used on the testnet. The testnet has not implemented the 1024 shards yet or the mechanism for shards to communicate through (Cross-Shard Communication).
Another notable missing piece of the testnet is the implementation of the Ethereum smart contract functionality, which is scheduled for phase 2 of the roadmap. Smart contracts require the migration of the Ethereum Virtual Machine (EVM) or the implementation of a suggested alternative (WASM) in the Ethereum 2.0 protocol.
How does the Ethereum 2.0 testnet work?
Ethereum 2.0 is a PoS network that has validators who stake tokens to operate and produce blocks for the network. Hence, the first piece of the puzzle is to allocate tokens to the validators so that they can operate.
The Ethereum 2.0 network will eventually use the same valuable ETH tokens we have today, these tokens need to be transferred to the new Ethereum 2.0 network. To implement and test this transfer functionality, Prysmatic Labs devs have used an Ethereum 1.0 testnet called Goerli, where anyone can get as many fake ETH as they want, and developed a smart contract (called Deposit Contract) that indefinitely holds any ETH tokens deposited to it. After the deposit is completed, the Beacon Chain issues the same amount of ETH as ETH 2.0 tokens. For simplicity, we will call ETH 2.0 tokens: Beacon Chain ETH (bETH).
Diagram of how the transfer of ETH happens between Ethereum 1.0 and 2.0
The moving of ETH 1.0 to bETH is performed using the following steps:
- The validator first installs the Prysm software for the Ethereum 2.0 network and creates an account on Ethereum 2.0. The account creation will generate “Deposit Data” that is used to link the Ethereum 1.0 wallet to the Ethereum 2.0 generated account.
- On the Ethereum 1.0 Goerli testnet, the user sends 3.2 ETH (in reality it will be 32 ETH) to the Deposit Contract to participate in Ethereum 2.0 validation. This effectively burns the ETH 1.0 tokens.
- The Ethereum 2.0 Beacon Chain observes the desposit in the Deposit Contract and issues the same number of bETH tokens to the newly-created validator account. Now, the validator is ready to participate in the validation process once a security time delay passes. This delay is used to strengthen the security of the Beacon Chain.
- The validator client starts participation in the consensus mechanism and earns validation rewards for their work or get slashed if they do not follow the protocol rules.
What Exactly is the Job of Validators?
In Ethereum 2.0, a new block is generated every 6 seconds (down from ~ 15 seconds in the current PoW network). In every block, a validator from the validator pool proposes a block. A number of other validators check the proposed block and attest to its correctness. For each following block, a different validator proposes the block and a different group of validators attest to the block correctness.
Every period of 64 blocks (called epoch), all of the validators are shuffled to select new block proposers and attesters for each block within the new epoch. Assisted with random-number generation during the selection of validators, the shuffling essentially prevents validator collusion and enhances the security of the protocol.
Validators need to be online all the time to execute the tasks assigned to them. When they do these tasks in an honest way, they get rewarded with newly minted bETH tokens. If validators misbehave, collude or become offline, their staked tokens are slashed or leaked. When a validator’s balance decreases below the validation threshold (3.2 bETH in the testnet) they get kicked out from the validator pool and cannot participate in the validation process.
What is Next?
The Sapphire testnet is just one step in a long way to get to the Ethereum 2.0 destination. It implements Phase 0 of the Ethereum 2.0 roadmap. There are two more phases that need to be completed before Ethereum 2.0 becomes fully functional.
But even for Phase 0, there is still a lot of work ahead before Phase 0 can be launched in mainnet. First of all, we are in the early days of the testnet and there are a lot of issues, bugs and optimizations that need to be addressed. Secondly, this is a single client testnet, only the Prysm client can be used for the testnet. Other teams are working to implement other clients to the Ethereum 2.0 network such as Nimbus and Lighthouse. Compatibility between the different clients is a prerequisite to achieving a multi-client testnet. Thirdly, the specifications of Phase 0 allow the transfer of BETH between different accounts, this functionality is not yet available. Finally, there are still ongoing minor changes to the Phase 0 specifications by the Ethereum Foundation research team. These specs need to be finalized, completely implemented, and audited in the multiple Ethereum 2.0 clients before the launch of the Phase 0 mainnet hopefully before the end of 2019.
In conclusion, the launch of the testnest was a crucial step in the roadmap of delivering Ethereum 2.0. Its importance stems from the public participation from the Ethereum community to test the network, identify the issues and bottlenecks and, hence, guiding the Ethereum 2.0 devs to address them. The launch has significantly increased the community's confidence in the Ethereum 2.0 roadmap. In addition, the Ethereum Foundation announced that they are allocating $19 millions to support the development of the Ethereum 2.0 and other Ethereum scalability solutions. These resources would allow for a faster progress of development and testing efforts.