TAGS :Viewed: 29 -
Published at: a few seconds ago
[ What is the Lightning Network? {Diagramatic Explanation} ]
This was originally written on shivendramisra.com/blog
It has almost been a decade since the inception of Bitcoin, however, as the cryptocurrency marks its presence in the market, it faces criticism pertaining to its scalability.
The main reason why it is hard to scale Bitcoin is that it is programmed to handle around 3–7 transactions per second (TPS) with a block size of 1 MB.
Now this is not very feasible when we compare it with other payment gateway services like Visa and Mastercard, which can handle thousands of transactions per second (the Visa network can scale upto almost 65,000 TPS).
Problems begin to rise as Bitcoin becomes much more mainstream and individuals and institutions begin to give it worldwide acceptance.
This will directly have an impact on the number of transactions executed each second on the Bitcoin blockchain network, which in turn is directly proportional to the memory required to store all the transactions in a block.
One of the solutions could be to increase the block size but that would require the users to wait for a hard fork consensus.
Though increasing the block size may seem correct initially, however, in the long-term we would have to increase the block size again and again to cater to the increase in transactions.
Apparently, it would not help us solve the root cause of the problem.
This is where Lightning Network comes into picture
It takes the off-chain approach as a way to handle transactions and solve the scalability issues concerning Bitcoin.
According to proponents of off-chain approaches, not all small transactions need to be broadcasted on to the main blockchain.
Regular day-to-day transactions such as paying a retailer for purchase of clothes or buying grocery from your local grocery store with Bitcoin do not really need to be uploaded on the network every time a transaction takes place.
If not on the main blockchain, then where do we record it?
The answer is, that we record it off of the main chain.
The working of the Lightning Network is based on Payment Channels which are opened on the Blockchain.
In the Lightning Network, the main chain comes into picture only two times:
While opening a payment channel and,
While closing the payment channel by Broadcasting it to the main chain.
Let’s go through the process step by step;
So, let us assume a simple payment channel between you and your local dairy shop from where you buy your dairy on a daily basis.
In non-technical terms, Lightning Network in this case will be a situation wherein you deposit let’s say 1000 bucks with the shop and every time you make a purchase, the balance keeps on reducing. When it becomes 0, you either deposit more money or stop buying from the shop.
In technical terms, you would open a payment channel with the Diary Shop wherein you make deposits in terms of Bitcoin, say 0.5 BTC, in what is known as the “Multi Signature address” (see image for reference).
The Multi Signature address is just like a locker, which opens on the agreement of both the parties. This locker contains a Balance Sheet-like statement, which has a record of the balances of both the parties.
Let us assume that you buy items from the shop worth 0.005 BTC. When the transaction is complete, the balance from your account gets reduced and that of the dairy shop increases by the same amount. All of the funds are stored in the Multi Signature Address itself.
After every transaction you and the shop will sign the Balance Sheet with your respective private keys.
The transaction goes on for as long as the parties want or until you have a balance in the payment channel.
One thing to be noted here is that although the balance sheet has to be signed by both the parties with their private keys, the broadcasting of the payment channel to the main blockchain is not dependent on the approval of both the parties.
If this would have been the case then, you would not have the freedom to get your deposits released and your bitcoins will be at the mercy of the Diary Shop.
What is the way out then?
Since both the parties have a copy of the latest signed Balance Sheet, any one of them can broadcast the payment channel to the main blockchain at any point of time.
When any one of the parties decide to broadcast the payment channel to the main blockchain, miners verify the transaction and check for valid signatures (private keys) of both the parties on the main blockchain.
After successful verification, the funds are released as per the latest signed Balance Sheet to both the parties and this gets recorded as a single transaction on the main blockchain.
This saves a lot of time and requires very less fees as compared to the traditional way of doing transactions on the blockchain, since each and every transaction is not required to be uploaded on the blockchain.
There is definitely much more to be said and explained about the Lightning Network and I will come up with easier explanations for further concepts like Onion Routing, Segregated Witness etc.
Clap, Clap, Clap 👏 🙌 !!