“Serenity is a realization of all of these different strands of research that we have been spending all of our time on for the last four years. This includes Casper, and not just Hybrid Casper: 100% organic, genuine, pure Casper. sharding, EWASM, and other protocol research ideas.”
Vitalik Buterin presented the new Ethereum roadmap at the opening of Devcon 4 in Prague this week. The first iteration of this conference took place in 2014 in Berlin and it was where the first visions of Ethereum were presented to core developers. Four years later, Devcon has become one of the most anticipated gathering for blockchain developers.
Buterin layed out what will eventually become Ethereum 2.0.
Ethereum has been divided by the community into four phases of release: Frontier, Homestead, Metropolis and now Serenity. it is last which is the most awaited. With Serenity, Ethereum will be its own “Ethereum Killer,” promising speed and scalability like no other project. “Hopefully 1,000 times higher scalability," according to Vitalik.
Casper is the biggest change. Vitalik even brought the idea of “blockchain rent,” where contracts can pay rent to be hosted online, like websites. With them, there’s an entire new set of terminology: Stakers, collators, shards, beacon chain, the CFG, block finality, etc. Here we attempt to explain these concepts.
The codename for Ethereum’s flavor of the proof of stake algorithm. It was based on GHOST (hence Casper), which was designed for proof of work, but repurposed by Ethereum for proof of stake. With Bitcoin and similar cryptocurrencies, the only way to agree between the different nodes maintaining the record of transactions is with “mining.” The process of mining is by trying trillions of computations until solving a cryptographic puzzle. The first node with its solution becomes the leader until the next puzzle, since by having a proof-of-work, he can be trusted to have invested resources.
With proof of stake however, the leader is selected at random among those who have “staked” a significant amount of value. Staking consists of locking aside Ether. Stakehokders can be releived from their ether if they act fraudulently, such as by lying about the record of transactions. Staking removes the energy waste of mining, but isn’t without its game-theoretic flaws and abuse mechanisms if implemented naively. One of such is the “nothing at stake” problem, affecting coins such as Peercoin and Blackcoin. A staker might not value his own stake if it is part of a fork he doesn’t believe in.
The Ethereum Foundation has joined up with researchers who have been working on distributed consensus for the last 30 years. Ethereum will not change its main chain to PoS any time soon (although it plans to). Instead they will implement it as a second layer on top of the current blockchain, the “beacon chain.” They will use complex Byzantine fault tolerant (BFT) algorithms to ensure an honest majority. These are mechanisms for making a decision in the face of conflicting information, such as malfunctions (fault tolerance), and even deliberate lies (named Byzantine, after a thought experiment using rogue Byzantine generals). Modern planes, for instance, implement BFT algorithms to remain in the air in the case of a malfunctioning sensors.
The consensus on this second layer will be achieved with Casper’s finality gadget (CFG). Finality refers to “finalizing” blocks proposed by the current proof of work mechanism, selecting which would be the correct (canonical) chain for other miners to follow. If attackers seize control of the block proposal mechanism, CFG protects against finalizing two conflicting chains. It also protects against “nothing at stake” by penalizing the bad actor on all possible forks. In proof of stake, security is based on the size of the penalty, which can be set to greatly exceed the gains from the reward.
Ethereum will not implement an “100% organic, genuine, pure Casper” soon, but rather a hybrid system consisting of the current blockchain, and a second layer based on proof of stake. Ethereum’s architecture will be divided into a core proof of work “anchor layer,” which is the current mainnet and which will be the block proposal mechanism as described above. On top of it will stand the beacon chain, which will act as the coordination layer. The third layer will be the data layer, divided by “sharding." And at the top is the “execution layer,” where virtual machines run smart contract code.
Among the many responsibilities of this coordinating layer are managing validators and their stakes, nominating the leader for each shard, organising committees to vote on the proposed blocks, applying consensus rules, rewarding and penalizing validators, as well as being the anchor points on which the shards register their states to facilitate transactions across shards. The beacon chain is a “sidechain” to the main blockchain, and is referred to as a second-layer scalability solution.
Sharding is a scalability solution for databases, and has been at the core of Ethereum’s scalability proposals. Currently, the entire blockchain is processed by all nodes, which surpassed 1 Terabyte in first half of 2018. Sharding divides the database into different logical sections, and different nodes can process different parts to spread the load. In it, blocks will be divided into “collations,” and each block proposer (miner or staker) will be a “collator.”
Currently, the unified database gives Ethereum a high amount of security and reliability, but at the same time it means that the entire blockchain is only as fast as its individual nodes, and not the sum of their parts. A major attack vector is the “Single-Shard Takeover Attack,” where an attacker takes over the majority of collators in a single shard to create a malicious shard that can submit invalid collations. With 100 shards, it takes only 1% of of network’s hash rate to dominate one shard. Ethereum plans to randomize each collator’s shard so as they don’t know which shard they are collating to mitigate this kind of attack.
With EWASM, the compiled code will run much “closer to the metal.” The code have the speed advantages of compiled languages while being portable. Also, by choosing a common and standardized architecture such as WebAssembly, the compiled code could run in multiple environments, and different languages can be compiled into it. Most functions of WebAssembly would be removed for Ethereum, and functions such as “metering” (gas counting), will be added.
However, Ethereum and the current EVM are still new, and even minor changes in it are painful. Old contracts would have to transcompiled to the existing EVM code to WASM. And the new compiler would need to be implemented in all official languages, such as Solidity and Vyper.
There are four expected phases. The first is the implementation of the Beacon chain with proof of stake. After that, the introduction of shards for the data chains. Thirdly, EWASM. And beyond that, iterating, improving and adding other smaller technologies. Ethereum will be realistically attempting a proof of stake chain on top of the current blockchain. The complexity of the system will increase by an order of magnitude and new bugs and failures are inevitable. Sharding and EWASM is something we’ll hear more details about in the future. The addition of a proof of stake chain and sharding are by necessity, Ethereum needs new foundations to manage its size.
Changes to the EVM, where smart contract code is executed, needs to be done carefully. On the one hand they need to place great value in backwards compatibility, as developers submitted smart contract were intended to be immutable and eternal. Any change in their immutability by obsolescence would be a breach of trust. Immutability is the only sales-pitch for Ethereum over much more efficient cloud computing platforms, like Amazon, Microsoft, Google and IBM. This immutability was compromised once when the Ethereum Foundation decided to hard fork over The DAO hack, while adamant supporters kept the original chain as Ethereum Classic.
On the other hand, a purge of inactive and buggy contracts would greatly trim the bloatedness of the Ethereum chain. Ethereum decided to take risks from day one, and if it doesn’t evolve something else will take its place. As the cryptocurrency community has greatly advanced and will continue doing so, striking the right balance of immutability and relevancy is the key.