In December 2017, CryptoKitties, the online game built on the Ethereum blockchain went viral and caused a major congestion in the Ethereum blockchain network. This brought the focus back on the scalability of blockchain in general, and Ethereum DApps (distributed apps) in particular. Industry watchers and blockchain enthusiasts wondered how will the blockchain networks cope with real-time business apps used by millions if an online game can congest the network so noticeably? So how to scale Ethereum dapps?
Most blockchain networks in general, including the Ethereum blockchain, face issues of scalability, transaction latency, and high transaction fees. Ethereum DApps are built on the Ethereum blockchain protocol, and the network uses the ‘proof of work’ (POW) consensus algorithm, requiring transaction validation by the majority of the participating nodes, resulting into scalability issues. Block size limitations and highly competitive POW mining result into delayed inclusion of transactions in the next block, and the users need to pay an increasing amount of fees to the miners to get their transactions included in the next block. Blockchain developer communities including Ethereum developers are experimenting with several solutions to address these issues.
Among several solutions being explored by Ethereum developers for scaling Ethereum DApps, a prominent one is sidechains for DApps, also commonly called ‘DAppChains’. The concept uses a basic premise that not all Ethereum DApps need the same level of security, for e.g. a DApp used for transferring thousands of Ether (ETH) will require complete security features a fully decentralized blockchain with POW consensus algorithm offers, but a DApp for microblogging wouldn’t attract hackers and hence can do with lesser security.
The DApps that require less decentralized security can be moved to ‘Sidechains’, which can have their own customized rule-sets, and these sidechains can be used to offload computation from the main chain. A paper published in 2014 by Adam Back and team, titled “Enabling Blockchain innovations with Pegged Sidechains”, first elaborated on the concept of sidechains. It describes a mechanism called “two-way pegged sidechains”, where the user can prove that she had locked some crypto tokens previously held by her, and based on that she can move some other tokens into a sidechain.
Sidechains can’t improve scalability limitlessly, because the concept is like increasing block size, thereby including more transactions in a single block. This improves scale for the time being, but it isn’t an automated scalability solution. However, sidechains allow the Ethereum developers to conduct more experiments. For e.g., a sidechain can define its own rules, optimized for DApps requiring very high speed, whereas DApps requiring very high security will still use the fully decentralized security of the main chain.
DApps running on its specific sidechain, also called “DAppChain”, can trade security and decentralization for more throughput. For e.g. a DAppChain may opt to implement ‘delegated proof of stake’ (DPoS) consensus algorithm in the sidechain, where specific nodes take responsibility of transaction validation. These nodes stake their crypto tokens for transaction validation and are called ‘stakers’. The more token a node stakes, and the longer is the duration of their stake, the higher is the likelihood that this node will be chosen for transaction validation. This increases scalability and transaction speed in that DAppChain since POW algorithm isn’t used and all nodes aren’t involved in the transaction validation process.
The developer of a DApp needs to conduct a threat modeling of the DApp, and choose the custom rule-set or consensus algorithm for her DAppChain. The likelihood of an attacker trying to hack a sidechain running a DApp with low economic value is less, hence a relaxed security model delivering high transaction throughput may be appropriate. However, if a malicious node gathers too much computing power in the DAppChain, and starts controlling it, the community always has the choice of hard fork. If the change proposed by the malicious node doesn’t gain community consensus, the community can thus take the state of the sidechain before dispute and keep working on that.
Loom Network is building a software development kit (SDK) that’ll allow the developers to build their DAppChain, which will use Ethereum as the base layer. The DAppChains built using Loom SDK will use Plasma technology, allowing transfer of assets back and forth from Ethereum. Plasma is a scaling infrastructure that allows decongesting of the root Ethereum network. It handles smart contracts just like Ethereum does, however, broadcasts only the completed transactions to the Ethereum public blockchain. It saves a significant amount of processing power and allows greater transaction speed, thus benefitting DApps.
Ethereum developer communities are also working on other solutions for scaling Ethereum DApps, for e.g.:
(1) ‘Raiden Network’, like Lightning Network for Bitcoin, provides an off-chain transfer network for crypto tokens built on Ethereum ERC20 standards. It’s currently under development and will use the payment channel technology, which enables off-chain transfer of on-chain tokens. The transactions will be secure, fast, and cheaper.
(2) Ethereum’s long-term development roadmap envisages a switch to proof of stake (PoS) algorithm, which will also enable implementation of sharding. It’s originally a database management concept, where sharding refers to partitioning the database into multiple server instances, thus improving performance. In case of blockchain, it will mean horizontal parts of blockchain will be stored in separate groups of nodes, instead of all nodes maintaining the entire transaction history of the blockchain. This improves scalability, however, since no node maintains the entire distributed database, the POW consensus algorithm involving all nodes in transaction validation can’t work, and PoS algorithm needs to be used.
Did you manage to scale ethereum dapps using other tools? Let us know your feeback in the comment section below.