Scaling is one of the major issues of blockchain that needs to be solved quickly. The goal of cryptocurrency is to replace our current means of exchange in the future.
No decentralized project can succeed without a big community behind it. We need people to use the network. Not solving the scaling problem will lead to many complications in the future. As users of the network increase, the number of transactions goes up. Which means more a more blocks will be stuck in the Mempool and transactions fees will go up.
Bitcoin cash chose to increase the block size in order to solve the problem. But as I have explained in the previous post, this is not a long-term solution and can make the network centralized. Another way would be to decrease the block interval. this would increase the probability of having stale blocks because there is not enough time for the blocks to broadcast and reach the whole network.
The solutions I have just mentioned require a hard fork. It’s something we would like to avoid. For the rest of the post, I will describe another solution to scale the bitcoin network. This solution is called lightning network. but before I do that, I will first talk about transaction malleability and segregated witness (SegWit). Two concepts needed for the lightning network to work.
As emphasized in a previous post, a block in bitcoin contains transactions. But the biggest part of the transaction size contains the signature and public key of the sender. This information is used to verify the transaction. This structure leads to a small bug in the bitcoin software. It is possible to change slightly the signature data without altering the transaction itself. This malicious behavior could be done by the receiver. He could lie about receiving the funds. This might require the sender to send the funds twice because the signature has been changed and the sender cannot prove that he has already sent the funds.
Segregated Witness (SegWit)
This is an intriguing concept which solves the transaction malleability problem and improves the scalability of the network. Since the majority of the transaction contains signature data. The Idea is to remove this part and put on a different block called Segregated Witness. By doing that, the transaction size will be much smaller and a block will be able to contain more transactions. This will increase the transaction speed and lower the transaction fees. And since there is no signature data anymore, there is nothing to change. Which solves the transaction malleability problem.
The lightning network is this Idea to create a payment channel off-chain. If two individuals want to exchange money, they have to open a payment channel by making a certain deposit in BTC. They start to exchange coins as long as the channel is open. these micro-transactions are not recorded on the blockchain. When the channel is closed, the final balances are recorded on the main blockchain. There is no need to record each and every micropayment.
As we can see this solution removes a lot of pressure from the network. It lowers the transaction fees because miners are not involved and no electricity cost is spent.
Since the payment channel is open between two individuals using their signature data. Changing it will block the payment channel. That’s why SegWit is necessary for the lightning network to work.
Another thing to keep in mind is that you don’t need to open a payment channel with each and every individual in the network. The lightning network works as a routing network. So if A opens a payment channel with B and B with C, A can exchange value with C through B.
In this post, I have presented some interesting concepts about how to solve the scalability issue. In the next post, I will talk about network attacks.