Transactions in the Bitcoin network take pretty long to be processed (at least 10 minutes, but sometimes days), so Bitcoin users have to wait for a considerably long time before the other person sees money on their account.
So, how can one say that in near future everybody will buy a cup of coffee or a T-shirt with Bitcoin on their way to work? There is no way anybody would wait an hour for a simple transaction! To solve this problem, Lightning Network was created as a safe and fast way to support millions of transactions per hour.
How Lightning Network works (in simple terms):
In a few words, Lightning technology is a way to exchange transactions outside the Bitcoin blockchain, avoiding long and costly mining queues, while having the ability to send all these off-blockchain transactions to the Bitcoin blockchain at any time by any of the participants.
For example, imagine two businesses exchanging signed paper contracts saying, “Business A business owes to business B $300,” instead of sending money to each other via bank. At any given moment, any of the two parties can go to the bank and cash out all the signed contracts at once (forcing another party to do the same). There is still a waiting period for a banking transaction, but only once for all the time of doing business.
Now more detailed version:
Suppose Alice wants to send Bob 0.1 BTC every month for home cleaning services. To do so, Alice creates a BTC wallet with two keys – one of which belongs to Alice, and the other to Bob. In order to perform any actions with a common wallet, consent from both key holders is necessary.
Once the wallet is created, Alice decides to send 1 BTC there, since she plans to send money several times. But before Alice sends money to the common wallet, Bob must sign and send Alice a refund transaction of 1 BTC from the common wallet to Alice’s account (imagine a contract that the other party has already signed and given to you and you can sign the contract at any time and it will become valid). This refund transaction is a guarantee for Alice that if Bob becomes uncooperative, she can simply refund all the money back to her private wallet. Bob’s signature is already in the refund transaction, so Alice can sign it at any moment if needed.
Having received a guarantee for the refund, Alice puts 1 BTC to the common. This transaction actually happens on the Bitcoin blockchain and is called the opening transaction.
Now Alice asks Bob to sign another refund transaction – 0.9 BTC from a common wallet to her private wallet. Remember that Alice only wants Bob to get 0.1 BTC, while the other 0.9 BTC remain on the common wallet and Alice should be able to pull them back. Once Bob signs a new refund transaction, the old refund transaction becomes invalid. It is important to keep in mind that there is ALWAYS 1 BTC on the common wallet. Funds do not move! But the parties exchanged transactions that secure their funds.
After receiving a new refund transaction for 0.9 BTC, Alice signs and sends Bob the transaction to transfer 0.1 BTC to his personal wallet from the common wallet.
Please note that none of these transactions have reached the Bitcoin network! They are all just in the hands of Alice and Bob. But at any time each of the parties is able to send the transactions to the Bitcoin blockchain. It’s just that while things are going well, using Bitcoin blockchain makes no sense.
But if suddenly Bob acts in bad faith and Alice decides not to send any more money over to Bob, Bob isn’t able to independently write off funds from the common wallet. And Alice will be able to use the refund transaction to pull out all the remaining funds from the common wallet without any risk.
The technology described is called a “one-way payment channel”.
It’s easy to imagine a two-way payment channel. Bob also puts money in the same common wallet, getting signed refund transactions from Alice as a guarantee. That is, Bob also does not take risks at all and can pull out his share from the common wallet at any time.
After Alice and Bob exchange signed refund transactions, they can exchange Bitcoins using a common wallet. Now they can make millions of transactions between themselves, and transactions will take place instantly, not hitting the Bitcoin network.
However, when they both want to close this payment channel, they can easily do it. One single transaction is created (who gets how much from the common wallet), then signed by the two parties and sent to the Bitcoin system. So instead of sending millions of transactions, only one is sent.
As a result, in order to use the Lightning Network protocol, only two funding transactions on the Bitcoin blockchain are needed (Alice and Bob’s refill of a common wallet), allowing to conduct millions of transactions instantly for as long as parties have the agreement. And in case of disagreement – any party can submit all the accumulated obligations of the counterparty to the blockchain. Just imagine how much time and fees it saves!
Lightning Network protocol is the future of Bitcoin, and several companies already make their implementations of this protocol: Lightning, Blockchain.com and Blockstream. As soon as Lightning Network is released, the use of Bitcoin for daily needs will flourish, which means deeper integration of Bitcoin in all spheres of our lives.