Scaling the Second Layer

Jun 9, 2020

Scalability is an ongoing field of research and a challenge in blockchain technology. Without scaling the speed of many blockchains today – Bitcoin achieves around 3-4 transactions per second, Ethereum about 15 transactions per second – widespread adoption of the technology by businesses and private individuals all around the world cannot happen. One often quoted reference for ideal throughput in payments is the capacity of the VisaNet, which handles about 1’700 transactions per second, but can process an order of magnitude more during peak times.

Blockchain Layers to Scale
There are two approaches to blockchain scaling – scaling the protocol layer (layer 1 scaling) or scaling using solutions on top of the protocol that do not require changes to the core code of the blockchain (layer 2, or L2 scaling). Scaling one of these layers offers multiplicative benefits when combined with the other one, meaning a 10x improvement in the first layer (or base layer) and a 100x improvement in the second layer could easily compound to an overall 1000x throughput enhancement.

Second layer scaling is different from sidechains that are linked to the main chain. The advantage is that for well-designed L2 solutions, the main chain has some information about what happens in the second layer and acts as the judge to resolve disputes that might occur on the second layer (e.g. relating to whether funds have been spent or not). Often, they also offer privacy features, which may or may not be desired.

One of the key questions for the design of L2 solutions is data availability: Is the data related to transfers on L2 available on the main chain? Some of the methods presented below store data on transfers off-chain (such as Plasma), which creates friction if users need to collect the data while they are online or download it after a period of offline time. However, there also exist methods in which the data is available on-chain (such as zk-rollups).

Illustration 1: Scaling solutions are available both for the first layer as well as the second layer, and advances in one area also benefit the other.
Source: Bitcoin Suisse Research

First Layer Scaling Approaches
While this article focuses on L2 solutions, some of the main approaches to scaling the base layer will also be recapped here. One attempt at scaling the first layer is through sharding, most famously planned for the upcoming Ethereum 2. Essentially, sharding means a “parallelization” of the blockchain and if successful, is expected to raise Ethereum’s throughput to about 10’000 transactions per second.

Another approach for incremental scalability gains is through optimization of the transactions themselves, mainly through more efficient signature algorithms. Ethereum 2 will use BLS signatures, and for Bitcoin, Schnorr signatures are in development, which would significantly reduce the requirements for block space coming from a subset of transactions.

Last, but not least, one straightforward solution to layer 1 scalability is to increase the block size limit. This is the approach chosen by Bitcoin SV, in which a single 370MB block that was recently mined contained about 1.3 million transactions. This corresponds to around 2’200 transactions per second.

Second Layer Scaling Approaches
Research efforts in the areas of various L2 scaling solutions have come more and more to fruition during this year and specifically the last two months. There are three main L2 scaling techniques which will be outlined below; one of them, zk-rollups, is sometimes also referred to as a “semi-L2” solution due to its strong data availability and validation guarantees on the main chain.

Payment and State Channels
One of the older concepts are payment channels, or their generalized form of state channels that allow not just transfer of value through the channel, but updates to the state of the blockchain in general. Examples of such projects include the Lightning Network for Bitcoin, Raiden and FunFair’s fate channels for Ethereum, and Aeternity with built-in protocol support for state channels.

At their core, channels allow two parties to exchange transactions only with each other instead of writing every transaction directly on the chain, which leads to a massive scalability gain and near-instant transaction settlement. Only the result is written onto the main blockchain – making this type of scaling ideal when it is known that two parties will need to transact between themselves a lot in the future. Protection against malicious attempts by either party need to be considered in channel design; usually, it is possible for either party to withdraw their funds from the channel back to the main blockchain. Despite their long history, these channel-based technologies have not been broadly adopted yet, perhaps due to high requirements for keeping channels open and payment routing challenges when more than two parties are involved.

Child Blockchains (Plasma)
Another proposal is to generate child blockchains that are attached to the main chain, and these child chains occasionally write a fingerprint of their state to the root chain (e.g. the current Ethereum blockchain). Users can enter the child (or Plasma) chain through a smart contract. The Plasma chain can operate at a different speed and under a different consensus mechanism than the main chain – in other words, it can be tuned to specific requirements of, for example, a payments network or of a decentralized application. If a user wishes to exit the chain again, this requires a certain “challenge period”, in which any potential attempts at fraud can be prevented.

This is also one of the problems of Plasma chains – in the case of congestion of the root chain accompanied by a mass exit from the Plasma chain, this challenge period might not be long enough for challenging all malicious behaviors that might occur. On the other hand, if the challenge period is made too long, this creates friction and opportunity costs for the users due to unavailability of their funds.

A Plasma chain was recently launched after years of development by the OMG Network (formerly OmiseGo). It allows for >1’000 transactions per second at one third of the cost per transaction, and has already been integrated with Tether, one of the main gas users on Ethereum.

zk-Rollups are perhaps one of the most promising scaling approaches yet. They are a form of transaction batching, where SNARKs or STARKs (succinct non-interactive/transparent argument of knowledge) are being used to achieve compression of multiple transactions (for example, a simple value transfer from address A to B) into one on-chain transaction. SNARKs are a cryptographic technique that has been used by Zcash for their privacy guarantees, but zk-rollups showcase the benefits that they may have for scalability purposes.

Users again enter the system through a smart contract, and incentivized relayers take care of bundling transactions and generating SNARK proofs, which is computation intensive and often the bottleneck of such systems.

The first deployment of such a system to the Ethereum mainnet was done by Loopring, a decentralized exchange. They achieved optimizations of the proof generation that allowed to bring down costs per trade to $0.000124. While originally, this system was designed to smoothen the operation of the decentralized exchange, it is also possible to use it for simple transfers of ETH or ERC-20 tokens between users. This feature was launched in June through Loopring Pay, scaling Ethereum capacity for transactions by 1000x – a remarkable achievement. Their token, LRC, reacted positively to this and rose by about 75% (at the time of writing) over the course of last week.

Additionally, StarkWare’s StarkEx demonstrated how large communities could be onboarded to the Ethereum mainnet without causing congestions using their zk-rollup technology based on STARKs. They managed to set up 1.3M accounts and seed them with an initial balance using just 2.5% of Ethereum’s capacity over 12 hours, at an average cost per transaction of $0.003. Without the zk-rollup, that process would have consumed the entire capacity of Ethereum for 4.5 days.

Second layer scaling is very close to succeeding, and significant achievements of scaling factors of up to 1000x have been achieved. Onboarding users to these systems is the next step for network effects to establish, but given the large savings on transaction costs, the economic incentives for users to do so are certainly given.

In the future, such L2 solutions could contribute strongly to blockchain adoption overall, since they lower cost, enhance speed and therefore improve usability of the chain. The last pieces of the puzzle are broad deployment of these solutions and user-friendly interfaces that do not require thorough blockchain knowledge – all that the end user will notice is that speed has increased, and costs have decreased.

Bitcoin Suisse