How does the lightning network works ?
One of the biggest problems Bitcoin is facing nowadays it’s quite slow. Bitcoin can handle 7 transactions per second while credit card companies can handle a couple of thousands transaction within a second.
The transaction verification can go up to longer then 1 hour. That wouldn’t work if you would like to buy somewhere with your Bitcoin. You and the other person would need to wait till transaction is verified.
But to increase the block size isn’t an option also as it will create the same problem in the future.
Thats why the developers of Bitcoin came up with a solution “The lightning network”.
The main idea is that small transaction don’t need to be on the main blockchain this avoids the transactions per second limit and is also called “the off-chain approach”.
Basically the lightning network makes it able to create multi signature addresses. Simply said, multiple parties can use a same bitcoin address.
For example, I’m shopping often at a supermarket. So I’m opening a payment channel with the supermarket. The payment channel you could compare with a safe deposit box.
I’m sending let’s say 0.3 BTC to our payment channel. The supermarket will have a small amount inside 0.05 for possible returns.
Opening the payment channel happens on the main blockchain so that there is full transparency. The supermarket can see I successfully deposit 0.3 BTC and so is the supermarket ensured that it will get the money as soon as the payment channel closes.
Now that the payment channel is open, I can go to the supermarket and buy my groceries. Let’s say on my first visit I will buy things worth of 0.02 BTC. To pay for it I just simply give a order to the payment channel that 0.02 BTC of my account has to go in to the supermarkets account. which leaves me on 0.28 BTC and the supermarket at 0.07 BTC.
Now the supermarket and me are signing this with our private keys. We then each get a copy of it but don’t do anything else with it.
I can do my groceries for as long as I have balance inside my payment channel.
There is no-limit in the transactions between us. I can make thousands of transactions at the supermarket without that it has any influence on the main blockchain.
The payment channel can be closed at any time by either me or the supermarket. Al we would have to do is take the latest copy of the balance sheet signed by both parties and broadcast it to the bitcoin network.
Miners will then validate the signatures on the balance sheets and if everything is okay it will release the funds according to the balance sheet. This creates a single trans action on the blockchain.
therefor the lightning network can extremely reduce the load of the main blockchain. Eventually it only requires then 2 transactions on the blockchain. One to open payment channel and one to close it.
Next to that it’s very safe, the system ensures that only the latest signed balance sheet can be used to unlock the bitcoins from the main blockchain. And because both parties always have a signed copy, they always can close the payment channel even if one party wouldn’t want it. None of the parties can hold any bitcoins hostage.
You don’t have to open a payment channel with everyone you want to send bitcoins to. U can use the lightning network to send your coins to other addresses.
An example, my friend Tom also would like to do his groceries at the supermarket I have a payment channel with. Me and Tom already had a payment channel because we have made transaction on the network before.
So instead of opening a payment channel with the supermarket, Tom can send his payment to me and I will send it to the supermarket. So you don’t need to create payment channels for every payment or place.
In the lightning network your payment tries to find his route from location A to location B. And it will try to do this with the least amount of stations before it’s at his end location.
The lightning network is already live in the bitcoin test net.