As you may know, there are differences between horizontal and vertical scaling in distributed systems which we have covered in another article (Horizontal Scaling versus Vertical Scaling in Distributed Systems). So in this article, we take the next step by learning how to scale up Ethereum blockchain applications.
We will also review different scaling solutions for Ethereum blockchain applications. To follow and understand the concepts discussed in this article, we are assuming you have a basic understanding of blockchain technology and Ethereum.
Like Bitcoin, the main reason for the Ethereum scalability problem is the network protocol that each node in the network has to process each transaction. Ethereum 1.x implements a slightly modified version of the Proof-of-Work (PoW) consensus mechanism.
In Ethereum, miners have to race to find the nonce to meet the target difficulty. Every node needs to verify that the miners' work is valid and keep an accurate copy of the current network state. This greatly limits the transaction process capability and throughput of the Ethereum blockchain network. Currently, it can only process 12-15 transactions per second.
Blockchain scalability trilemma
First used by Vitalik Buterin, the scalability trilemma is a concept in blockchain regarding its capability to address scalability, decentralization, and security, without compromising any of them. The trilemma claims that it is almost impossible to achieve all three properties in a blockchain system:
The key challenge of scalability is finding a way to achieve all three at the base layer. The design choices of Bitcoin and Ethereum favor decentralization and security while making a sacrifice in scalability.
Ethereum scalability solution is one of the most active topics in the Ethereum community. The following are a few areas of concern the community is trying to tackle:
Solutions being implemented or proposed, fall into three categories: on-chain solution, off-chain solution, and consensus mechanism protocols. There are some obvious or theoretical ones, like increasing block size or slicing one blockchain into many independent altcoin chains. Due to the nature of peer-to-peer, a traditional horizontal scaling approach may not work.
Specific to the Ethereum network, some consideration was also given to stateful or stateless smart contracts contributing to scalability issues. We will go over high-level concepts of all those solutions, and then delve deeper into some of the promising ones.
Block size
This is similar to the vertical scaling approach. Some of the altcoins, like Bitcoin Cash, Ethereum Core, and so on, are implementing a larger block size to gain overall transaction performance. The theory behind this approach is that since PoW mining is the main bottleneck in the entire process, by increasing the block size we can have more transactions processed per mining. It may take a little bit longer to create a directed acyclic graph (DAG) for stash-based mining, but the average time to complete the mining may not get any worse, since most of the Ethereum clients cache the DAG anyway.
However, like vertical scaling, in general, this solution demands that network nodes have better computing capacity in order to process large-sized blocks. This may lead to a scenario where a network is concentrated into a few rich hands and, thus, may ultimately compromise decentralization and security, the main tenets of the blockchain.
Altcoins
Another solution is not to have one gigantic blockchain, but to have many smaller blockchains and altcoins. This may eventually be the case since many vertical industries are creating or plan to create industry-specific chains. This will reduce user activity on each individual blockchain and, thus, should allow for a more scalable ecosystem.
However, there are a few issues with this option. One is security concerns. It is a common belief that the network is more secure if more network nodes participate in the transaction processing in the blockchain. With the wider distribution of altcoin chains, fewer nodes will operate on any given blockchain. This may make the blockchain less secure, since a smaller altcoin network may be more vulnerable to network attacks. Let us say, we have about 10,000 nodes on the larger network, it will require at least 5,001 nodes (or called 51%) to be compromised to launch an attack on the network. If we slice 10,000 nodes into 50 smaller chains, each chain comprises 200 nodes, and it only requires 101 nodes to take down any smaller chain, which is what we call a 1% attack problem.
Another issue is cross-chain integration. Although there are some solutions for handling cross-blockchain integration, the overall complexity of integrating smaller chains and altcoins will increase drastically.
On-chain solutions, sometimes also called layer 1 solutions, are to look for solutions to address scalability and performance issues at the base layer of the Ethereum blockchain network. One such solution is sharding. Sharding is not a new concept as traditional RDBMS and new big data platforms have been using sharding as a way to improve scalability and performance for many years.
With the Ethereum network, the purpose of sharding is to group the network nodes, the blockchain, and global states into different shards, and each shard will reach a consensus on the shard-wide transaction state among those nodes within the group. At the conceptual level, this may not be much different from Plasma, the layer 2 side-chain approach, but the technical difficulty, implications, and network efforts are quite different. We will go into detail about sharding in the Ethereum sharding and Casper article.
Another layer 1 or on-chain solution is the shift to a Proof-of-Stake (PoS) consensus mechanism, which is one of the most active research areas addressing scalability and performance issues in Ethereum. There are many debates in terms of the advantages and disadvantages of a PoW-based consensus mechanism. It is quite effective in securing the blockchain in the decentralized network, but it is also a major bottleneck in blockchain performance.
Similar to the rationales for an on-chain solution, the Ethereum community is also actively looking for off-chain solutions, sometimes called layer 2 solutions. One is a side-chain solution with Plasma. Instead of putting all transactions in the main chain, Plasma allows anyone to create side chains and bond side chains into the global blockchain. This is similar to the lighting network solution in Bitcoin.
Another one is a state channel solution with Raiden, similar to payment channels in Bitcoin. The hypothesis behind this approach is that many interparty transactions only need to be validated by the parties involved, and there is no need to have all transactions to be validated by the entire network. Along with off-chain solutions, the choice of cloud provider and architecture of your API for communications between on-and-off data exchange plays an important role in the scalability and availability of your blockchain application.
For example, Hyperledger has a powerful library called Hyperledger Avalon that allows developers to move most heavy-duty on-the-chain transactions securely to the off-the-chain processing machines. A good grasp of on-and-off chain solutions is essential for doing blockchain consulting and development.
ZK-SNARK
One of the Bitcoin limitations is the privacy issue. Zcash is the first and perhaps the most popular cryptocurrency to implement Zero-Knowledge Succinct Non-Interactive Argument of Knowledge, or abbreviated as ZK-SNARKs, as a means of addressing privacy issues in the public blockchain.
It maintains strong privacy by allowing the transaction to be fully encrypted on the blockchain, and encrypted transactions can still be verified as valid with ZK-SNARK proofs. Under ZK-SNARK consensus rules, one, as the prover, can let others, as the verifiers, know that it possesses certain knowledge without revealing the specific knowledge and without any interaction between them.
Ethereum community is incorporating ZK-SNARK into the Ethereum blockchain implementation too, with an intention to use ZK-SNARK to mass-validate transactions, thus improving the Ethereum scalability dramatically.
In this article, we discussed the challenges for scaling an Ethereum blockchain application along with reviewing 5 practical solutions like block size, on and off-chain solutions.
This article is written by Matt Zand (leading author of "Hands-On Smart Contract Development with Hyperledger Fabric V2" book by O’Reilly Media) in collaboration with Brian Wu who is a leading author of “Learn Ethereum: Build your own decentralized applications with Ethereum and smart contracts” book.
Portions of this article also published on: