Sidechains and Payment Channels Explained
Basics
In computing, scalability refers to a system's ability to accommodate increasing demand. To boost a machine's performance, you can upgrade its hardware. However, in blockchains, scalability refers to the capacity to handle more transactions. Bitcoin has many strengths, but scalability is not one of them. If Bitcoin were run in a centralized database, increasing speed and throughput would be relatively easy. However, due to its value propositions, such as censorship resistance, many participants must sync a copy of the blockchain.
The Blockchain Scalability Problem
Running a Bitcoin node is affordable, and even basic devices can do it. But, with thousands of nodes needing to stay in sync, certain capacity limitations exist. On-chain transactions have limits imposed on them, preventing the database from becoming too large too quickly. If it grows too fast, nodes will struggle to keep up. Additionally, blocks that are too large can't be quickly relayed across the network.
This creates a bottleneck, where a network flooded with pending transactions will force users to pay higher fees to ensure timely processing. One potential solution would be to increase the size of the blocks or carriages, which could improve throughput and reduce ticket prices. However, there's no assurance that the increased capacity wouldn't fill up again.
Ethereum's creator, Vitalik Buterin, introduced the Scalability Trilemma, which outlines the challenge faced by blockchains. It argues that protocols must balance scalability, security, and decentralization, which can sometimes conflict with each other. As a result, many believe that scalability should be achieved off-chain, while security and decentralization should be maximized on the blockchain itself.
Off-Chain Scaling Solutions
Scaling solutions exist that permit transactions to be processed without adding to the burden of the blockchain. These solutions, known as off-chain scaling methods, are made possible by protocols that connect to the chain, enabling users to send and receive funds without their transactions being recorded on the main chain. Two such solutions that are noteworthy are payment channels and sidechains.
Sidechains
Sidechains are alternative blockchains that are linked to the main chain in some way. These blockchains are interoperable, meaning that assets can be transferred freely between the main chain and the sidechain. There are different methods for transferring funds, one of which involves depositing assets into a special address on the main chain. These assets are not transferred, but rather locked into the address and a matching amount is issued on the sidechain. Another option, although more centralized, is to send funds to a custodian who will exchange the deposit for funds on the sidechain.
How Does It Work?
Let's say our acquaintance, Roman, has five bitcoins that he wishes to exchange for equivalent units on a Bitcoin sidechain called "sidecoins" using a two-way peg. The sidechain is a separate blockchain with different blocks, nodes, and validation mechanisms. To obtain sidecoins, Roman sends his bitcoins to another address, which either credits his sidechain address with five sidecoins once the bitcoins are received or the sidecoins are automatically credited after the software detects a payment.
Roman has now converted his coins to sidecoins, but he can reverse the process to reclaim his bitcoins. Being on the sidechain means that he can transact on this separate blockchain. He can send or receive sidecoins just like he would on the main chain. For example, he can pay Angela one sidecoin for a T-shirt, then return to Bitcoin by sending his remaining four sidecoins to a designated address. After the transaction is confirmed, four bitcoins are unlocked and delivered to his designated address on the main chain.
Why Use Sidechain?
Angela may want to use a sidechain to exchange her bitcoins for sidecoins, which are units on a separate blockchain that uses a two-way peg. This means that assets can flow freely between the main chain and the sidechain. While Bitcoin is highly secure and decentralized, it has its trade-offs, including slower transaction speeds and higher fees during network congestion.
Sidechains, on the other hand, can be customized with different consensus mechanisms, parameters, and features, making them more flexible and adaptable to specific use cases. Additionally, sidechains can be used for experimentation without affecting the main chain. Angela can perform hundreds of transactions on the sidechain and then exit back to the main chain with only two transactions recorded. Sidechains could play a crucial role in scaling and improving blockchain technology.
Payment Channels
Payment channels are a viable scaling solution and are similar to sidechains in their purpose. However, they differ significantly in their functioning. Payment channels do not require a separate blockchain and operate on a smart contract. By using a software-enforced agreement, two participants can transact without publishing their transactions to the blockchain. This prevents the blockchain from being bloated, just like in the case of sidechains.
How Does It Work?
Roman and Angela could use payment channels to make transactions without publishing them to the blockchain, just like in the popular Lightning Network model. To do so, they would deposit coins into a multi-signature address they jointly own, which requires both of their signatures for funds to be spent. They could update their balance sheet with each transaction, without publishing to the blockchain, until they decide to reallocate balances. At that point, they would create a transaction sending the balances to their addresses, sign it, and broadcast it to the blockchain. All other transactions are free and almost instant because they occur off-chain. Though this method requires cooperation, special mechanisms can be used to punish attempts to cheat, so strangers can interact safely without trust.
Payment Routing
Payment channels are useful for parties that expect a significant amount of transactions, but they can be even more beneficial when a network of channels is established. This means that Angela can make payments to parties that she isn't directly connected to. For example, if Roman has a channel with Sarah, Angela can pay Sarah as long as there is enough capacity. She would transfer funds to Roman's side of the channel, and he would transfer them to Sarah’s side. If Sarah is connected to another user, John, the same process could be followed.
This type of network creates a distributed topology where everyone is connected to multiple peers. There can be several routes to reach a destination, and users can choose the most efficient one.
Conclusion
To avoid overburdening the underlying blockchain, there are two approaches for scalability - sidechains and payment channels. While they are still developing, more users are using them to bypass the limitations of base-layer transactions. Decentralization is key to network growth, and blockchain growth must be limited for new nodes to easily join. Supporters of off-chain scalability solutions believe that in the future, the main chain will mainly be used for high-value transactions or for pegging in/out of sidechains and opening/closing channels.