The Lightning Network is a 2nd layer application, meaning it runs ontop of the Bitcoin network. When using the Internet, you actually use multiple layers to connect to any service online. Some consider a seven layer model, while others combine layers and only acknowledge it being five layers. See the example below:
We don't really need to go deep into it, but the Bitcoin layer system could follow a similar path. This model took many years to perfect, but accurately describes how information flows from my web server all the way to your monitor.
So the general idea is that the Lightning Network will sit ontop of the Bitcoin network's already-existing platform.
How Does Lightning Work?
Without getting too technical, Lightning allows users to instantly exchange Bitcoin without it being recorded on the Blockchain until users decide to "settle" their debts officially. This is similar to how several people at a restaurant settle debt when each person may or may not owe money. Let's use a simple example outlined below:
Alice, Bob, Cindy and Dan have personal debts to each other:
- Alice owes Bob $5
- Bob owes Cindy $12
- Cindy owes Alice $4
- Dan owes Alice $6
- Dan owes Bob $13
- Cindy owes Dan $25
Instead of having each person make their transactions one after the other, we could instead calculate the minimum amount of money that needs to flow from one person to another. There is a much easier way to do this though. Alice, Bob and Cindy decide they would like to try and simplify their debt scenario. Since Alice owes Bob $5, Bob owes Cindy $12, and Cindy owes Alice $4, we could condense those three transactions with ease. Just between those three, we could consolidate the debt to minimize transactions. In this scenario, we see that Cindy does not have to pay Alice anymore, Alice only needs to pay Bob $1, and Bob only has to pay Cindy $7. In a group of three users with debts loosely connected, we were able to turn three transactions into two. On the Bitcoin network, we have eliminated a single transaction fee. And as an outside observer, Dan is still unaffected by the consolidation of these three individuals.
If Alice, Bob, Cindy and Dan were not friends, we could bring in another party who basically brings $100 cash to the table and says they will be the exchange facilitator in case anything goes wrong. This assures the four that there will be no "funny business" happening by deceptive mathematics.
But what if were were to do the consolidation with four members? While I won't do the calculations, we can be quite certain that at least one or two transactions could be eliminated. It turns out that the more participants in this network that we have, the greater opportunity to consolidate the number of transactions. Potentially, we could have thousands (or millions) of participants all willing to consolidate many, many transactions. This would open up the number of participants in the Bitcoin network to scale to demand.
On the Technical Side...
The general idea behind Lightning is to bring in many, many participants to act as Lightning Nodes. These nodes could interconnect with each other and facilitate transactions among themselves. An exchange of debt may occur that requires "hops" from one node to another, in a similar way that Alice, Bob and Cindy were able to connect some existing debts in order to eliminate needed payments. In a node, there would be a certain amount of Bitcoin "locked" for an hour, day, week, month, or any amount of time. This would guarantee that the money is sitting there as proof that the money exists and can be consolidated properly and without fabrication of extra money (a key value in the Bitcoin ecosystem). Once this happens, users can connect multiple nodes together to consolidate the debts and make a transaction happen almost instantaneously. At the end of the node's life, a single Bitcoin transaction would be placed to settle the actual debts. Since sufficiently-powered nodes can theoretically handle millions (maybe billions) of transactions per second, we could see a scenario where a node network settles as many transactions as needed in a 10 minute block period.
To make Lightning secure and trustworthy, the nodes require a user to "sign" a transaction and fully commit that amount of money to be spent, meaning that if the node were to close out at any point, that last known transaction would be good to place on the Bitcoin network, so the transaction would still take place. There is a very complicated process to this, but the goal of this post is to introduce you to the concepts as opposed to technical expertise.
To give people an incentive for running nodes, Lightning will most likely introduce a micro-fee system put in place where users pay tiny, tiny amounts of Bitcoin to each node used. Since it would be very rare for a user to find the perfect node to consolidate debts with specific parties, a massive network of nodes would be interconnected and the user would make "hops" from one node to another. If you have ever heard the phrase "Six Degrees of Separation", you know how most people can be connected just via their social connections. Using this as an idea for how many hops we might need, we could say 10 hops will most likely connect us to the desired user. These fees will be significantly smaller than a Bitcoin transaction. As of right now, the suggested Bitcoin transaction fee is less than $1. Imagine taking the $1 fee and splitting it among 100,000 transactions made in a 5 day period. Each user would end up paying 1/100,000 of the single Bitcoin transaction fee, and maybe another 1/10,000 of the transaction fee as a small tip to each node. In 10 hops you have the fee being around 1/1,000 of what it normally was.
Given the system described, Lightning should allow for very large scaling among Bitcoin users. Instead of being able to handle on average 7 transactions per second (source), the Bitcoin Network instead handles 7 consolidations per second, each with potentially millions (or maybe billions?) of transactions per second. If this works out ideally, we will see the Bitcoin network obtain scale larger than any other payment network in the world while still maintaining the trust model.
When Bitcoin gained the Segwit upgrade (BIP 141), also known as Segregated Witness, the Lightning Channel's feasibility grew tremendously. With Segwit, a Bitcoin transaction is technically split into two pieces. By re-structuring the transaction, many argue that a transaction size efficiency was discovered. Additionally, Segwit allows the Lightning Network to run more securely and efficiently.
This first video is by Andreas Antonopolous, an expert in the Bitcoin field. In this video, Andreas explains what Lightning is and how it can be applied to the Bitcoin network. The term "streaming money" is a very interesting way to look at Lightning.
This video discusses the payment channels that will most likely be made from the Lightning Network.
This is an interview with a Lightning developer who wants to share some key information about the pros and cons of Lightning, and what we can expect to see in the future.