Bitcoin's Lightning Network, Simply Explained!

in #crypto7 years ago

 Many people believe that Bitcoin is the future for our financial system. But there is a big issue standing in the way of this goal and that is scalability. Let me give an example:  


 


The payment provider VISA processes on average around 4000 transactions per second and scale up to a maximum of 65,000. Bitcoin on the other hand can handle up to block size of 1MB. Not tens of thousands, but just 7! Clearly the main blockchain isn’t very scalable. But it doesn’t have to be! The community has come up with a new technique called the Lightning network to solve the scalability issue’s.


The key idea is that small, everyday transactions don’t have to be stored on the main blockchain. This avoids the 7 transactions per second limit and is also called the off-chain approach. So how does it work? 


Well let’s take a look at an example, let’s say that every morning Bob buys a cup of coffee on his way to work. Creating a transaction on the blockchain for a simple coffee is really overkill. He might end up paying more fees than the actual price of his coffee. However, with the lightning network Bob can setup a payment channel with the coffee shop. To do that, both the coffee shop and Bob deposit a certain amount of Bitcoin in what is called a multi-signature address. Let’s assume that Bob deposits 0.05 BTC and the coffeeshop deposits nothing, because they don’t offer refunds. This multi-signature address is basically like a safe that can only be opened when both parties agree. When we open the payment channel we also make a balance sheet that says how the funds in the address should be distributed. So right now it says: “Bob will get 0.05 BTC and the coffee shop will get 0 BTC.” The same as they deposited. Opening the payment channel happens on the main blockchain so that there is full transparency. 


The coffee shop owner can see that Bob has deposited 0.05 BTC and they can rest assured that they will get their money once the channel closes. Now that the channel is open, Bob can order his morning coffee! Lets say that a coffee costs 0.001 BTC. To pay for it, Bob simply changes the balance sheet. He subtracts the cost of the coffee from his balance, and adds it to the coffeeshop’s balance. So now it says that “Bob gets 0.045 BTC and the coffee shop gets 0.005BTC”. Bob and the coffeeshop now sign the updated balance sheet with their private keys, they then each keep a copy of it but they don’t do anything else with it. Bob can keep ordering coffee’s for as long as he has a balance in the payment channel. Both of them can make hundreds of thousands of transactions between them. There is really no limit because this happens away from the main blockchain. 



But all good stories come to an end. The payment channel can be closed at anytime by either Bob or the Coffee shop. All they have to do is take the latest balance sheet, which was signed by both parties and broadcast it to the Bitcoin network. Miners will then validate the signatures on the balance sheet and - if everything checks out - release the funds according to the balance sheet. This will create a single transaction on the Bitcoin blockchain. So the lightning network can significantly reduce the load on the main blockchain. It only requires two transactions on the blockchain: one to open the payment channel and another one to close it. It’s also very safe. The system ensures that only the latest signed balance sheet can be used to unlock the money. And because both parties have a signed copy of the balance sheets, they can release the funds at anytime, even if the other doesn’t want to cooperate anymore. So for example: Bob cannot hold the money hostage that belongs to the coffeeshop and vice versa. It doesn’t end there. You don’t need to open a direct payment channel with everyone you want to send bitcoins to. You can simply use the network to pass your coins around.


Here is Alice, she’s a friend of Bob. They’ve exchanged money on the lightning network before, so they have an active payment channel. Now let’s say that Alice wants to buy a coffee. Instead of opening a direct channel to the coffeeshop, she can transfer the money to Bob, who will then transfer it to the coffee shop. No need to create a payment channel with everyone! In the lightning network, your payment tries to find a route from person A to person B. It tries to do this with the least amount of intermediates and the least amount of fees. This further reduces the strain on the blockchain but it requires the intermediates to have enough money in the payment channels. So, now you know what the Lightning network is and how it works, but when will it actually go live? Well right now there is a proof-of-concept implementation running on the Bitcoin testnet. We don’t know yet when it will go live for everyone, but chances are it happening.

Sort:  

Today first transaction on lightning network has been made.

realy? but lighting is not peer to peer

Upvote plz