We will be looking at Decentralized Scalability of Smart Contract Platforms, some of the projects in the crypto space that are looking to solve this dilemma, namely – Lightning Network, Raiden, Plasma, and Lumino. Scalability is the key solution when it comes to blockchain. If cryptocurrencies are to become mainstream, then they must be as fast as centralized alternatives – if not faster. In this guide, we will look at the main issues that are stopping cryptocurrencies from processing faster transactions.
A brief history of Decentralized Scalability problems
The blockchain’s scalability problems have been well documented. Bitcoin and Ethereum are the two most popular cryptocurrencies in the world, however, the former can only manage 3-7 transactions per second, while Ethereum can only handle 15-20 transactions per second. This is really abysmal when compared with institutional solutions like PayPal and Visa. The reason why decentralized cryptocurrencies have lagged in the speed department is because of the way they’re designed.
Design issues hampering scalability
There are two main issues that we will be looking into:
- Time is taken to put a transaction in the block.
- Time is taken to reach consensus.
The Time Taken To Put A Transaction In The Block
Both Bitcoin and Ethereum follow a proof-of-work (POW) consensus model. In a POW model, there are certain participants called miners who use their computational power to solve cryptographically hard puzzles. If they successfully mine these blocks, then they get a block reward for their trouble.
So suppose Alice wants to send 4 BTC to Bob, this transaction data will queue up with the rest of the other pending transactions inside the mempool. Miners who successfully mine the blocks pick up pending transactions from the mempool and put them inside the block. The moment this happens, the transaction goes through and the miner collects some transaction fees for their services. The problem with this system is that the miner becomes a bottleneck for this entire operation. So whenever the size of the mempool increases, the amount of time taken for an average transaction to go through significantly increases. Also, keep in mind that in a Bitcoin blockchain, the blocks are limited by a 1 MB block size. In other words, there are only so many transactions that they can put in their blocks.
Ok, so what about Ethereum?
While blocks don’t have Bitcoin’s 1 MB size limit, they are limited by a 6.7 million gas limit. A simple Ethereum transaction can cause around 21,000 gas. However, a complicated smart contract can cost a lot more.
Speaking of which, gas is the amount of computational power needed to process that particular transaction or smart contract. Since each block has a gas limit, miners can only add transactions whose gas requirements add up to something equal to or less than the total gas limit of the block.
Time Taken to Reach Consensus
While this is Ethereum’s:
The nodes of the network are spread across a wide area and have equal privileges. There is no central authority and nor is there any hierarchy. It is a flat topology.
However, since there is no central authority, how does a decentralized network make its decisions? The answer – consensus mechanisms.
Once a miner successfully mines a block, they need to propagate it throughout the network. A supermajority of the network (>⅔) must approve the legitimacy of the block. Unfortunately, what it means is that as more and more people enter the network, it becomes more time-consuming to reach a consensus.
Layer 2 Decentralized Scalability – Comparison of Smart Contract Platforms
So, if the innate architecture of the blockchain is flawed, then it makes sense to create a layer on top of the blockchain, which can allow us to adopt methods to scale up transactions. The techniques that we will be talking about today – Lightning Network, Raiden, Plasma, and Lumino are all examples of layer-2 scalability solutions. To understand how these solutions work, you need to understand the concept of payment channels.
A state channel is a two-way communication channel between participants which enables them to conduct interactions, which would normally occur on the blockchain, off the blockchain. What this will do is that it will decrease transaction time exponentially since you are no longer dependent on a third party like a miner to validate your transaction.
So what are the requirements to do an off-chain state channel?
- A segment of the blockchain state is locked via multi-signature or some sort of smart contract, which is agreed upon by a set of participants.
- The participants interact with each other by signing transactions among each other without submitting anything to the miners.
- The entire transaction set is then added to the blockchain (in Lumino & Raiden not all transactions are stored on the blockchain).
The state channels can be closed at a point that is predetermined by the participants, according to Slock.it founder Stephan Thual. It could either be:
- Time lapsed, eg. the participants can agree to open a state channel and close it after 2 hours.
- It could be based on the total amount of transactions done eg. close the chain after $100 worth of transactions have taken place.
A payment channel is a state channel that deals exclusively with payments and micropayments between parties. Remember, all the interactions on the channels are things that could happen on the blockchain but are happening off it. While there are many different types of payment channels out there, the most popular kind, by far, are hashed timelock contracts or HTLCs.
The HTLC enables opening up of payment channels where funds can get transferred between parties prior to a pre-agreed deadline. These payments get acknowledged via the submission of cryptographic proofs.
Fine, so till now, we have gained a basic understanding of the background behind these solutions. Now let’s tackle them one-by-one.
#1 Lightning Network
The lightning network is an off-chain, HTLC style, micropayment system which is designed to make transactions work faster in the blockchain. It was conceptualized by Joseph Poon and Tadge Dryja in their white paper, which aimed to solve the block size limit and the transaction delay issues.
Let’s take a hypothetical example to understand how it works. Imagine Alice has to send some funds to Charlie via Bob.
- Alice opens a channel with Bob and Bob opens a channel with Charlie.
- Suppose Alice declares that she wants to interact with Charlie.
- Charlie declares a random number and generates its SHA256 hash and hands it to Alice. Basically, if Charlie chooses a number A then he will give the hash of the number H(A).
- Alice sends 0.1 BTC to Bob with the condition that only someone who can submit the data required to get the same hash can retrieve the payment. For Bob to misuse the funds, he will need to have the data, aka the pre-image required to generate that hash. Basically, Bob will have to give “A,” which he doesn’t have.
- Bob now hands over the funds to Charlie using the same condition. Charlie finalizes the payment from Bob by handing him over the pre-image “A.”
- Bob finalizes the payment from Alice by handing her “A.”
The following is an infographic of how the entire process works.
The benefits of the lightning network are as follows:
- Fast payments: Payments are almost instantaneous.
- Not dependent on miners: Transactions don’t need to be approved and verified by miners for it to go through.
- Micropayment friendly: Earlier micropayments were extremely inconvenient on the bitcoin blockchain. Now they are possible thanks to the lightning network.
- Multi-signature friendly: The transactions will go through if and only if everyone present in the channel approves.
- Reduces blockchain load: With so many transactions happening of the chain, it greatly reduces the load that the main chain has to take.
- Decreases waiting time: Since the transactions are happening off-chain and without miner intervention, there is little to no waiting time.
- It helps in scalability since it will increase the number of transactions happening per second.
Raiden is a layer-2 solution for Ethereum. While it is pretty similar to Lightning Network, what makes it different is that along with transaction details, its state channels transfer smart contract details as well. The biggest issues hampering Ethereum transactions are as follows:
- Block Interval Time: It takes 15 seconds to mine blocks in Ethereum.
- Gas Price: Whether a transaction gets included in the block or not is also directly related to the gas price of each transaction. Usually, miners accept transactions with higher gas prices and give them special preference by allowing them to “cut in line” so to speak.
- Orphan Blocks: Sometimes, the miners mine empty blocks. These blocks are also called “orphan blocks.” Even the best mining pools currently have a 1–2% orphan block rate.
Raiden will allow two users to transact between them, as many times as they want, without having to interact with a miner or the blockchain. It will be structured like a mesh-type structure running on top of the ethereum main chain:
Advantages of the Raiden Network?
- Usable and simple application programming interface (API).
- Enables Ethereum scalability.
- It can be used to send any ERC20 token.
- Enables fast and simple transfer of money.
- Will decrease the load on the Ethereum blockchain.
#3 Plasma Chain
Plasma, along with lightning network/Raiden, will introduce a whole new layer to the Ethereum architecture:
Plasma is a series of contracts that run on top of the root chain (the main Ethereum blockchain). If one were to envision the architecture and the structure, then think of the main blockchain and the plasma blockchains as a tree. The main blockchain is the root while the plasma chain aka child blockchains are the branches.
This greatly reduces the load on the main chain. Periodically the branches keep sending reports to the main chain. In fact, you can view the Root Chain as the supreme court and all the branches as the subordinate courts which derives its powers from the main court.
All the branch chains can issue their own unique tokens which can incentivize chain-validators to take care of the chains and to ensure that it is fault-free. Each branch has its own independent data and when it does need to submit some data to the main chain, it doesn’t dump all its contents, it just submits the blog header hash to the main chain.
Not only does plasma save up a lot of space in the main chain, but it also increases the transaction process speed exponentially. If implemented properly, this could be one of the most revolutionary changes ever made to Ethereum and cryptocurrency in general.
OmiseGo, one of the most promising Ethereum-based projects, is currently building a Plasma-based product for enabling fast and seamless payments.
#4 RIF Lumino
Before we talk about RIF Lumino, let’s get a better understanding of RSK and RIF. Rootstock (RSK) is a smart contract platform that is connected to Bitcoin’s blockchain through sidechain technology. Rootstock allows you to create applications compatible with Ethereum (the web3/EVM/Solidity model) while still enjoying the security provided by Bitcoin´s blockchain. At its very core, Rootstock is a combination of:
- A Turing-complete resource-accounted deterministic virtual machine (for smart contracts) is compatible with the Ethereum’s EVM.
- A two-way pegged Bitcoin sidechain (for BTC denominated trade) based on a strong federation.
- A SHA256D merge-mining consensus protocol (for consensus security relying on Bitcoin’s miners) with 30-seconds block interval. (for fast payments).
If you want to know more about RSK, then you can read our guide here.
Rootstock will also be using its tech stack – the Rootstock Infrastructure Framework Open Standard (RIFOS) to help build a healthy economic system on top of Bitcoin. It’ll facilitate the use of blockchain technology by making it as simple for everyone as possible. One can think of RIFOS as the third layer on top of the Bitcoin blockchain since it is constructed on top of a sidechain (RSK) that is existing on top of Bitcoin.
Keep in mind the following features when it comes to RIFOS:
- As long as a product is compatible with the underlying protocols, developers can seamlessly integrate it within the RIFOS ecosystem.
- All the individual components of RIFOS have been designed to maximize the potential benefits for those who want to offer their infrastructure services within the protocol’s ecosystem.
- All the components are protected by the security provided by the Bitcoin Network.
- Its protocols will include mechanisms to trigger network effects and economies of scale.
- Most of the services running in RIFOS will be consumed utilizing a single token (RIF).
One of the areas where RIFOS is currently working on is “payments” with its Lumino project. Lumino is pretty similar to Raiden since it sends transactions and smart contract details over the state channels. However, the difference is that while Raiden has been built for Ethereum, Lumino has been built of RSK, and by extension, Bitcoin. The Lightning Network and Lumino may appear as competitors, however, the reality is that they complement each other and are working together to provide the best service possible to Bitcoin users.
Conclusion- Decentralized Scalability
Via the implementation of layer-2 mechanics, it will be possible for cryptocurrencies to achieve hundreds and thousands of transactions per second. Scalability has always been one of the biggest problems in the crypto space. However, projects like Lumino, Lightning Network, Raiden, and Plasma have shown us that we finally have the means to solve this problem once and for all and achieve real mainstream adoption.