Back to all blog posts

In the last year there has been a lot of
talk about the lightning network and how about how it can solve Bitcoin’s
scalability problems, but what is the lightning network and how does it work?

The Lightning Network is a second layer
solution that operates on top of Bitcoin; It is created to allow tens of thousands
of transactions per second, instead of the approximately seven per second that can currently be done on the Bitcoin blockchain.

It all sound great, but how does it really
accomplish increasing the transaction capacity by a thousandfold?
Before we understand how Lightning network
works we have to understand why the Bitcoin Blockchain can only handle
7 transactions per second.

Bitcoin is what can be called a gossip
protocol, this means that every transaction has to be broadcast and verified by every single user that is part of the network; this allows everybody on the
network to have equal say, but it by design cannot allow high
speed or a high number of transactions. To increase capacity of the network we cannot directly change the Bitcoin protocol, because that would compromise it’s properties; but what we can do, is build on top of it.

The Lightning Network does not operate as a gossip
protocol. To make a transaction on the Lightning Network the information does not have to be broadcast to the whole network; it is sufficient for it to be sent only to the parties directly involved with the transaction.
The lightning network works very similarly
to an “IOU” system, with the main difference being that there is no way for these IOU’s to be falsified, and there is no way for an IOU to be refused once it
has been issued. The reason they cannot be falsified or refused is because they are enforced by cryptography; if someone tries to cheat you out of your IOU, you can just settle the issue through cryptography on the blockchain.

Here is a practical example:

Alice goes to a Bar and orders a $5 drink,
when she orders her first drink she decides to open a tab for $100 dollars.
The Bar gives Alice an IOU for $95.
Now let’s say Carol Walks into the bar,
orders a $5 drink and, as Alice did, opens a $100 dollar tab. Carols is also
given a $95 IOU; Carol then bets Alice $5 dollars that she
can beat her in a game of pool.

Carol wins the game, and is owed $5 by Alice;
at this point Alice can go to an ATM and pay the $3 transaction fee and pay
Carol her $5. This would cost Alice a total of $8. Alice has another option; she can just adjust her IOU with the bar, and have
the bar credit the 5 dollars on Carol’s IOU.

So the final IOU’s balance is:

Bar owes $90 to Alice

Bar owes $100 dollars to Carol

At this point Alice and Carol can close
their tab if they want to, but there really is no need since the IOU they have
is always valid.

Furthermore Alice’s and Carol’s IOU’s could
be used in any place where the Bar has an open tab.  Lets say for example that the Bar also has
a tab with the grocery store because it purchases some of its supplies from it.
Alice could go shopping at the grocery store and could just reduce the amount
the Bar owes her and increase the amount the Bar owes the grocery store.  and there would be no way for the Grocery
store to turn it down.

lightning network

Picture of the connections in the Lightning Network

The Lightning Network does not limit you to make transactions with people that have a direct connection with one of your connections; you could also transact with someone going through people you are not directly connected with.

This was a simple example of how the
lightning network works; if you just substitute the “tab” with a “lightning channel”, you will have a fairly accurate picture of how it works without
getting too technical.