Introduction

Scalability refers to the ability of a system to evolve to meet growing demand. In computing, you can improve the performance of your equipment by upgrading its hardware to perform certain tasks faster. When we talk about scalability in blockchains, we are talking about their ability to handle a larger number of transactions.

Protocols like Bitcoin have many advantages, but scalability is not one of them. If Bitcoin were to run on a centralized database, it would be relatively easy for an administrator to increase transaction speed and throughput, but Bitcoin's value proposition (i.e., censorship resistance) requires many network participants to constantly synchronize a copy of the blockchain network.


The problem of scaling a blockchain network

Running a Bitcoin node is relatively cheap, and it can be done even on technically weak devices. But since thousands of nodes must be aware of each other's activities, there are certain limitations on their throughput.

Limits are placed on the number of transactions that can be processed on the chain, all in an effort to prevent the database from quickly growing to gigantic proportions. If it becomes too large and fast, the nodes will not be able to quickly interact with each other. Moreover, if the blocks are too large, they will not be able to be quickly relayed across the network.

The result is a complex situation with narrowly focused solutions. Blockchain can be thought of as a train that departs according to a precise schedule. The number of seats in each carriage is limited, and in order to receive a ticket, passengers must place a certain bid to reserve a seat. If everyone tries to board the train at the same time, the price of a seat will skyrocket. The same is true with a network clogged with pending transactions, in which case users are required to pay a higher fee in order to have their transaction added to processing in a timely manner.

One solution would be to increase the size of the carriages. This will offer more seats, higher capacity and lower ticket prices. But there is no guarantee that the seats won't start filling up like they did before. They cannot be continually expanded, just like blocks or gas limits within a block, which simply cannot scale indefinitely. The latter makes maintaining nodes even more expensive, since their owners will need more expensive equipment to synchronize with the blockchain.

Ethereum creator Vitalik Buterin coined the scalability trilemma to describe the problem blockchains face. He theorizes that protocols must make tradeoffs between scalability, security, and decentralization. These properties are somewhat at odds with each other, while mainly focusing on two properties, the third is left out.

For this reason, many view scalability as something that must be achieved off-chain, while security and decentralization must be maximized on the underlying blockchain.


What is off-chain scaling?

Off-chain scaling refers to methods that allow transactions to occur without increasing the number of blocks on the blockchain. Protocols that connect to the chain allow users to send and receive funds without transactions appearing on the main chain. We will look at two of the most well-known solutions in this direction: sidechains and payment channels.


Introduction to Sidechains

What is sidechain?

Sidechain, side chain (from English sidechain) is a separate blockchain. However, this is not a standalone platform, as it has some connection to the main chain. Mainchain and sidechain are interoperable, which in turn means that assets can move freely from one chain to another.

There are several ways to ensure the so-called porting of funds. In some cases, assets are moved from the mainchain by sending coins to a special address. In fact, they are not sent anywhere; instead, these coins are blocked at the sender’s address, and the corresponding amount is allocated on the sidechain. A simpler (albeit centralized) option is to send the currency to a participant in charge of custody and distribution of funds, whose task is to exchange the currency between chains.


How it works?

Let's say our friend Alice has five bitcoins. She wants to exchange them for five equivalent units on the Bitcoin sidechain, let's call them sidecoins. The target sidechain uses a two-way peg, which means that users can transfer their assets from the main chain to the side chain and vice versa.

Remember that a sidechain or sidechain is a separate blockchain. Thus, its blocks, nodes and validation mechanisms will be different from the main chain. To receive sidecoins, Alice sent five bitcoins to another address. It could belong to someone who would then credit her sidechain address with five sidecoins once they received payment. Alternatively, it could have some kind of minimum trust setup where sidecoins are automatically credited once the software detects the payment.


Sidechain scaling


Once Alice has converted her coins into sidecoins, she can reverse the process at any time. Now that she has entered the sidechain, she can freely perform transactions on the sidechain. Alice can send and receive sidecoins from other users, just like on the main chain.

For example, she could pay Bob one sidecoin for a Binance hoodie. When she wants to return to Bitcoin, she will need to send the remaining four sidecoins to a special address. Once the transaction is confirmed, the four bitcoins will be unlocked and delivered to the address it controls on the main chain.


What are sidechains used for?

You may be wondering what the point is in this? Why can't we just use the Bitcoin blockchain?

The answer is that sidechain can do things that Bitcoin cannot do. Blockchains are carefully designed systems of trade-offs. Although Bitcoin is the most secure and decentralized cryptocurrency, it is not the best in terms of throughput. While Bitcoin transactions are faster than traditional ones, they are still relatively slow compared to other blockchain systems. Blocks are mined every ten minutes, and fees can increase significantly when the network is congested.

Of course, small everyday payments do not need this level of security. If Alice buys coffee, she will not have the slightest desire to stand around waiting for the transaction to be confirmed. She will hold up the line, and besides, her drink will get cold before it arrives.

Sidechains are not bound together by the same set of rules. In fact, they don't even need to use the Proof of Work algorithm to function. Such systems can use any consensus mechanism, trusting one validator, or create a specific set of settings with any number of parameters. They also have access to carry out updates that do not exist on the main chain, create larger blocks and increase the speed of monetary settlements.

An interesting fact is that if critical errors occur, sidechains can operate without affecting the main chain. This allows them to be used as platforms for conducting various experiments and deploying new features that would otherwise require consensus from the majority of network participants.

Provided users are comfortable with the network's trade-offs, sidechains can be an integral step towards efficient scaling. Mainchain nodes do not need to store every transaction from the sidechain. Alice can enter a sidechain with one transaction on the Bitcoin network and perform a hundred different transactions using sidecoins, and then exit the sidechain. That is, in the Bitcoin blockchain, it will only perform two transactions - one for entry and one for exit.

Ethereum Plasma has similar features to a similar solution, but there are many differences between them. For more details, see the article: “What is Ethereum Plasma?”


Introduction to Payment Channels

What is a payment channel?

Payment channels serve the same purpose as sidechains, but they are fundamentally different. Like sidechains, they move transactions off the main chain to prevent blockchain bloat, but unlike sidechains, this solution does not require a separate blockchain.

The payment channel uses a smart contract that allows users to make transactions without publishing their transactions on the blockchain. This is achieved through a programming agreement between two participants.


How it works?

In models such as the popular Lightning Network, two parties first deposit a coin to an address they jointly own. This is a special multi-signature address in which funds can only be spent if two signatures are present. Thus, if Alice and Bob created such an address, then funds can only be transferred after the consent of both parties.

Let's say each of them deposits 10 BTC to the target address, after which the wallet balance will be 20 BTC. On the blockchain, it is quite easy to look at their initial balance, which can confirm to everyone that Alice and Bob each have 10 BTC. If Alice gives Bob one coin, she can update it to understand - Alice has 9 BTC, Bob has 11 BTC. They will not need to publish data on the blockchain since the overall balance on the address will remain the same.


how a payment channel works


However, there may come a time when Alice has 5 BTC and Bob has 15 BTC. They can easily create a transaction that will distribute the correct balances to their personal addresses after co-signing and transmitting the transaction to the network.

Alice and Bob could have ten, a hundred, or a thousand transactions on their balance sheet. But as far as the blockchain is concerned, they only made two transactions on the chain: one for the initial deposit and one after the funds were finally redistributed among themselves. Apart from these two, all other transactions are free and almost instantaneous as they happen off-chain. At the same time, Alice and Bob did not pay the miners and did not wait for confirmation of transactions in blocks.

However, the example above requires cooperation from both parties, which is not an ideal situation for strangers. However, with the help of special mechanisms, any fraudulent actions will be recorded, and the violator will be punished, so the parties can calmly, and most importantly safely, interact without trusting each other.


Payment routing

Obviously, payment channels are convenient for two parties who want to exchange a large number of transactions, but with the help of payment routing, their functions become even better. Let's say that the network of these channels can expand, which means that Alice can pay a party with whom she is not directly connected. If Bob has an open channel with Carol, Alice can transfer funds to her, provided there are sufficient funds. To do this, she gives the coins to Bob, who in turn gives them to Carol. If Carol is connected to another participant, such as Dan, then she can do the same.

Such a network evolves into a distributed network topology that contacts several peers at once. In such a network, there will often be several routes to a destination, and users can choose the most suitable and efficient one.


Conclusion

We discussed two approaches to scalability that allow transactions to occur without burdening the underlying blockchain. Both sidechains and payment channel technology have not yet matured, but they are increasingly used by users who want to circumvent the disadvantages of base-level transactions.

As time goes on and more users join the network, it is extremely important to maintain its decentralization. This can only be achieved by placing limits on the growth of the blockchain so that new nodes can easily join. Proponents of off-chain scalability solutions believe that over time the main blockchain will only be used to settle large financial transactions or to link incoming/outgoing sidechains and opening/closing channels.