Introduction
Scalability broadly refers to a systemâs ability to grow to accommodate increasing demand. In computing, you might boost your machineâs performance by upgrading its hardware so it is faster to perform certain tasks. When we speak of scalability in blockchains, we refer to growing their capacity to handle more transactions.
Protocols like Bitcoin have many strengths, but scalability is not one of them. If Bitcoin were run in a centrally-owned database, it would be relatively easy for an administrator to increase speed and throughput. But Bitcoinâs value propositions (i.e., censorship-resistance) requires that many participants sync a copy of the blockchain.
The blockchain scalability problem
Running a Bitcoin node is relatively cheap, and even simple devices can do it. But since the thousands of nodes need to stay up-to-date with each other, there are certain limitations on their capacity.Â
Caps are placed on the number of transactions that can be processed on-chain, so as not to allow the database to grow to unwieldy sizes. Should it become too large too fast, nodes will be unable to keep up. Moreover, if blocks are too big, they canât be rapidly relayed around the network.
As a result, we find ourselves at something of a bottleneck. A blockchain can be viewed as a train service that departs at set intervals. There are only limited seats in each carriage, and to obtain a ticket, travelers must bid to guarantee a place. If everyone is trying to get on the train at the same time, the price will be high. Similarly, a network clogged with pending transactions will require users to pay higher fees to see their transaction included in a timely manner.
One solution would be to make the carriages bigger. This would mean more seats, higher throughput, and cheaper ticket prices. But thereâs no guarantee that the seats wonât just fill up as they once did. The carriages canât be perpetually widened, just as blocks or block gas limits canât scale infinitely. The latter makes it more expensive for nodes to remain on the network, as they will need costlier hardware to remain in sync.
Ethereum creator Vitalik Buterin coined the Scalability Trilemma to describe the challenge faced by blockchains. He theorizes that protocols must make trade-offs between scalability, security, and decentralization. These are somewhat at odds with each other â by focusing too much on two of the properties, the third will be poor.
For this reason, many view scalability as something to be achieved off-chain, while security and decentralization should be maximized on the blockchain itself.
What are off-chain scaling solutions?
Off-chain scaling refers to approaches that allow for transactions to be executed without bloating the blockchain. Protocols that plug into the chain allow users to send and receive funds, without the transactions appearing on the main chain. Weâll dive into two of the most notable advances on this front: sidechains and payment channels.
An introduction to sidechains
What is a sidechain?
A sidechain is a separate blockchain. However, itâs not a standalone platform, as itâs pegged in some way to the main chain. The main chain and the sidechain are interoperable, meaning that assets can flow freely from one to the other.
There are a number of ways to ensure that funds can be ported across. In some cases, assets are moved from the main chain by being deposited into a special address. Theyâre not really sent over â theyâre instead locked into the address, and a matching amount is issued on the sidechain. A more straightforward (albeit centralized option) is to send funds to a custodian, who exchanges the deposit for funds on the sidechain.
How does a sidechain work?
Suppose that our friend Alice has five bitcoins. She wants to exchange them for five equivalent units on a Bitcoin sidechain â letâs call them sidecoins. The sidechain in question uses a two-way peg, meaning that users can transfer their assets from the main chain to the sidechain and vice-versa.Â
Remember that the sidechain is a separate blockchain. So, it will have different blocks, nodes and validation mechanisms. To get her sidecoins, Alice would send her five bitcoins to another address. It might be owned by someone who will then credit her sidechain address with five sidecoins once they receive the bitcoins. Alternatively, it might have some kind of trust-minimized setup where the sidecoins are automatically credited after the software detects a payment.
Alice has now converted her coins into sidecoins, but she can always reverse the process to reclaim her bitcoins. Now that she has entered the sidechain, she is free to transact on this separate blockchain. She can send sidecoins or receive them from others, just as she would on the main chain.
She could, for instance, pay Bob one sidecoin for a Binance hoodie. When she wants to return to Bitcoin, she could send her remaining four sidecoins to a special address. After the transaction is confirmed, four bitcoins would be unlocked and delivered to an address she controls on the main chain.
Why are sidechains used?
You might wonder what the point of this is. Why doesnât Alice just use the Bitcoin blockchain?
The answer is that the sidechain may be capable of things that Bitcoin canât do. Blockchains are carefully-engineered systems of trade-offs. While Bitcoin is the most secure and decentralized cryptocurrency, itâs not the best in terms of throughput. While Bitcoin transactions are faster than conventional methods, it is still relatively slow when compared to other blockchain systems. Blocks are mined every ten minutes, and the fees can grow significantly when the network is congested.
Admittedly, there probably isnât a need for this level of security for small day-to-day payments. If Alice is paying for a coffee, sheâs not going to stand waiting for the transaction to confirm. Sheâd be holding up the queue, and her drink would be cold by the time it was handed over.
Sidechains arenât bound by the same rules. In fact, they donât even need to use Proof of Work to function. You could use any consensus mechanism, trust a single validator, or tweak any number of parameters. You could add in upgrades that donât exist on the main chain, produce bigger blocks, and enforce rapid settlements.
Interestingly, sidechains could even have critical bugs without affecting the underlying chain. This allows them to be used as platforms for experimentation and to roll out features that would otherwise require consensus from the majority of the network.
Provided that users are happy with the trade-offs, sidechains could be an integral step towards effective scaling. There is no requirement for main chain nodes to store every transaction from the sidechain. Alice could enter the sidechain with a single Bitcoin transaction, perform hundreds of sidecoin transactions, and then exit the sidechain. As far as the Bitcoin blockchain is concerned, she has only performed two â one to enter and one to exit.
Ethereumâs Plasma is similar, but has some major differences. Read more about it: What is Ethereum Plasma?
An introduction to payment channels
What is a payment channel?
Payment channels serve the same purpose as sidechains on the scalability front, but theyâre fundamentally very different. Like sidechains, they push transactions off of the main chain to prevent the blockchain from being bloated. Unlike sidechains, however, they donât require a separate blockchain to function.
A payment channel uses a smart contract to enable users to transact without publishing their transactions to the blockchain. It does so by using a software-enforced agreement between two participants.
How does a payment channel work?
In models like the popular Lightning Network, two parties would first deposit coins into an address they jointly own. This is a multisignature address, one that requires two signatures for funds to be spent. So, if Alice and Bob created such an address, funds could only be moved out with consent from both of them.
Letâs say they each deposit 10 BTC to an address that now holds 20 BTC. It would be easy for them to keep a balance sheet that starts off saying Alice and Bob both have 10 BTC each. If Alice wanted to give Bob a coin, they could update it to read Alice has 9 BTC, Bob has 11 BTC. They wouldnât have to publish to the blockchain as they continue to update these balances.Â
When the time comes, though, letâs say that Alice has 5 BTC, and Bob has 15 BTC. They could then create a transaction that sends these balances to addresses owned by the parties, sign it, and broadcast it.
Alice and Bob could have recorded ten, a hundred, or a thousand transactions on their balance sheet. But as far as the blockchain is concerned, theyâve only performed two on-chain operations: one for the initial funding transaction, and one to reallocate balances when they are done. Apart from these two, all other transactions are free and near-instant because they occur off-chain. Thereâs no miner fee to pay and no block confirmations to wait for.
Of course, the example discussed above requires both parties to cooperate, which isnât an ideal situation for strangers. However, special mechanisms can be used to punish any attempt to cheat, so parties can safely interact with one another without trust.Â
Payment routing
Evidently, payment channels are convenient for two parties that anticipate a high volume of transactions. But it gets better. A network of these channels can be fleshed out, meaning that Alice could pay a party she isnât directly connected to. If Bob has a channel open with Carol, Alice can pay her provided there is enough capacity. She will push funds to Bobâs side of the channel, who will, in turn, push them to Carolâs. If Carol is connected to another participant, Dan, the same thing can be done.Â
Such a network evolves into a distributed topology where everyone connects to multiple peers. There will often be multiple routes to a destination, and users will be able to choose the most effective one.Â
Closing thoughts
We have discussed two scalability approaches that allow for transactions to be made without burdening the underlying blockchain. Both sidechains and payment channel technology have yet to mature, but theyâre being leveraged increasingly by users that wish to circumvent the shortcomings of base layer transactions.
As time goes on and more users join the network, itâs important that decentralization is upheld. This is achievable only by enforcing limits on the growth of the blockchain so that new nodes can easily join. Proponents of off-chain scalability solutions believe that, in time, the main chain will only be used to settle high-value transactions, or for pegging in/out of sidechains and opening/closing channels.