Last updated on December 19th, 2017 at 12:46 pm
While the Lightning Network is extremely promising as a cryptocurrency game-changer, it’s also pretty complicated. But don’t worry! As always, we’re here to translate this fascinating aspect of Bitcoin into plain English.
Since Lightning Networks are anchored to “traditional” blockchains, a solid understanding of the basic workings of blockchain technology is helpful in understanding them. If you lack this foundational knowledge, we recommend that you first review our video guides of the Bitcoin blockchain, before continuing with this guide to Lightning Networks.
In a nutshell, the lightning network is an upgrade to the current Bitcoin system (i.e., the protocol) that will allow users to create instant and feeless transactions.
Lightning Network Origins
In his original Bitcoin design, Satoshi Nakomoto included some of the building blocks for fast transactions—which are unlimited by block times or transaction fees, and arranged between cooperating users:
The possibilities of Satoshi’s idea have long been discussed, refined, and extended by numerous developers. These ideas coalesced into a whitepaper authored and presented by Thaddeus Dryja and Joseph Poon back in 2015.
These two young developers significantly advanced Satoshi’s original design by proposing a decentralized network of lightning-fast transactions. Simply put, this network element is capable of connecting any and all users to this “fast and feeless” system, through a routed series of transactions.
It’s important to note that there are various implementations of the Lightning Network protocol in active development. There are at least 6 Lightning Networks. In order to ensure compatibility among these various Lightning Networks, testing is ongoing. The goal of this testing is a cohesive, seamless network.
The Motivation for a Faster Network
For a variety of reasons, bitcoin is great. It puts us in control of our own money, gives us transactions that are not censorable, provides a dependable store of value, and allows us to transact with any connected person on the planet. But like everything else in life, Bitcoin’s blockchain has limitations.
If you’ve ever tried to send a transaction during a particularly busy time, you’ve probably noticed that Bitcoin transactions can be slow and/or expensive. Supporters of various Altcoins will argue that this reason is enough to switch to their preferred coin, but there are some obvious problems with this suggestion:
- Their altcoin might be a total scam.
- No coin is as widely accepted, trusted, or valuable as Bitcoin.
- If their coin ever becomes as popular as Bitcoin, it’ll probably run into exactly the same limitations.
Bitcoin transactions are (almost) never as slow or expensive as traditional fiat systems, such as bank wires or credit cards. However, it’d be great if we could have perfect, instant, and free (or nearly free) transactions. That’s where the Lightning Network comes in, and with SegWit now implemented on Bitcoin, there are no more technical issues to obstruct it.
As a distinct network, Lightning Networks (or LNs for short) are built on top of existing blockchains. They’re primarily designed for lower-value transactions (i.e., micropayments). LNs enable an unlimited number of near-instant and virtually feeless transactions.
The chains of Bitcoin and other cryptos constitute the underlying Layer 1 networks. (Litecoin, Vertcoin, Ethereum and others are all working on their own LN implementations.) As Layer 2 networks, LNs will function on top of these regular blockchains. The security of these secondary “off-chain” layers ultimately depends on the Layer 1 blockchain.
Lightning Network Benefits
In theory, LNs will provide all the security, value, and wide acceptance of Bitcoin (once the ecosystem upgrades). However, it will have none of its drawbacks, such as slow transaction times and high fees.
As an additional bonus, by offloading the bulk of small transactions to LNs, the transactional load on the underlying Level 1 blockchain should be greatly reduced. This extra will improve the transaction times and fee costs of the regular blockchain.
Lightning Network Explained (Part 1): Payment Channels
The basic idea behind the Lightning Network is payment channels. In other words, if I want a transaction with my friend, we open an “off-chain” payment channel between us, which is accomplished by an “opening transaction” on the main blockchain.
From then on, the payment channel is open, and any number of transactions can directly occur between me and my friend—without payments ever touching the main blockchain. Funds can be transferred as quickly as the users’ wallets can communicate over the net.
Once we want to conclude our business, we conduct a “closing transaction” on the main blockchain, and basically settle all of our previous transactions.
The magic of payment channels occurs between these opening and closing transactions on the blockchain. The primary reason that the blockchain remains necessary is that it’s used to both open and close Lightning Network payment channels.
Now let’s take a look at how a Lightning Network transaction comes to life.
Note: In the following explanation, we pretend that each character is manually performing each step. In reality, they only make the high-level decisions, and the actual work is performed by their Lightning Network wallets.
Step 1: Funding
Let’s consider a case where two parties, Cat and Dog, plan to conduct a lot of trades with each other. They’re playing chess online for Bitcoin. Rather than making numerous payments over the blockchain, they decide to save fees and time by setting up a payment channel. As they’ll be making Bitcoin payments back and forth, they require a bidirectional (two-way) payment channel.
Let’s say that Cat and Dog wish to establish a channel with a total value of 1 BTC. In other words, Cat and Dog don’t think that the overall transactions they’ll conduct will surpass 1 BTC. So both animals send an amount of 0.5 BTC over the blockchain to a multi-signature (aka multisig) Bitcoin address.
A multisig address is a Bitcoin address that acts like a lock, which is only unlocked if enough keys—out of a set of predefined ones—decide to unlock it. For example, you can release payment from an address if 2 out of 3 address owners sign off on it.
Multisig addresses start with a “3” (instead of a “1,” for a standard Bitcoin address). In this case, both signatures (derived from the private keys of both Cat & Dog) are required to spend any BTC from this address.
Miners process Cat & Dog’s payment on-chain as usual.
A total of 1 BTC is now locked up in this special multisig address, and the funding process is complete.
Step 2: Setup
Cat creates a transaction, which states that 0.5 BTC is payable to Cat’s own regular Bitcoin address, and that 0.5 BTC is payable to Dog’s address. Dog creates a transaction, stating the exact same thing. However, both transactions are incomplete, as they lack the other’s signature. Remember, both signatures are required to make either transaction valid!
A time constraint is also put in place. It states the following: If nothing further happens, both parties get their 0.5 BTC back at an arbitrary, future point—for instance, 30 days from when the address is set up. This situation prevents one party from vanishing, which would leave the other with permanently locked-up funds.
Cat & Dog exchange these incomplete transactions with each other over the net. Now, if Cat wishes to back out, she only needs her signature on the incomplete transaction from Dog, stating that 0.5 BTC should be sent back to her. She then broadcasts the complete transaction to the miners.
The addition of Cat’s sig validates the transaction, and causes it to be executed. The result is that Cat gets her 0.5 BTC back. Likewise, Dog can cancel the channel out in the same manner.
The only asymmetry here is that whoever adds their signature to the other’s incomplete transaction will have to wait for 1,000 blocks (or about a week) before their funds are returned. However, their counterparty’s funds will be returned immediately. This delay discourages unnecessary cancellations and prevents cheating.
Step 3: Exchanging
Let’s say that Dog wins the first round of chess. The stakes were 0.1 BTC per game. To reflect the updated state of their account, both parties create a new, incomplete transaction. It says that of the 1 BTC total, Dog now owns 0.6 BTC, and Cat owns 0.4 BTC. This new contract is set to expire in 29 days, so it’ll execute before the original contract’s 30 days.
This fresh exchange of incomplete transactions permanently cancels out the initial, establishing exchange (which declares an equal balance of 0.5 BTC on each side). This exchange is achieved by each party, who also signs and exchanges a fraud-protection proof. This proof states the following: Should either attempt to broadcast an outdated or falsified version of the channel’s balance of funds, the entire balance will be paid to their counterparty.
For instance, Cat gets sneaky and broadcasts the old 0.5 BTC. Then she establishes a channel state to wipe out her 0.1 BTC loss. Then Dog has one week to notice Cat’s cheating. Dog can disprove Cat’s fraud, simply by showing miners the most recent (0.6 / 0.4 BTC) transactions. Remember that Cat has signed her copy, so there’s no way that she can deny it…
Dog will then be awarded the full 1 BTC, and Cat will lose all her remaining money. Anyone else observing the matter may also catch Cat out, and receive a small bounty from the total balance for doing so.
Knowing that such a harsh penalty awaits her if caught, Cat is very unlikely to cheat in the first place.
As before, neither animal broadcasts the updated state to the blockchain to be mined, as they intend to keep playing. However, either side has the option to “cash out” the channel at its current account balance whenever they wish—provided they’re willing to wait a week to get paid.
Step 4: Closing
Cat and Dog may continue in this fashion—until they wish to stop playing, and agree to close the channel. Once there’s an agreement between them, a final exchange of transactions occurs, and neither side experiences any delay in the settlement.
If at any time only one side opts to close the channel, they experience the 1,000-block delay, as explained above.
Finally, a channel will also be closed when it reaches the end of the duration that’s set for it.
In any event, the current state of the payment channel is then broadcast to miners. Each party receives a payout to their standard Bitcoin address. No matter how many transactions Cat and Dog have made in-between, only a couple of transactions will appear on the Bitcoin blockchain: the opening and closing.
Note: While the above system is fairly complex (even without getting into the technicalities), the upside is that participants can exchange an unlimited number of transactions as rapidly as they can transmit them—for zero cost, and only 2 on-chain transactions.
Here’s a short video that summarizes all that we just went through:
Lightning Network Explained Part 2: Networked Channels
While bidirectional payment channels are really cool for specific-use cases between cooperating parties, combining multiple channels is what makes Lightning so powerful.
Let’s say Dog & Cat still have their chess-game payment channel open. Dog is getting hungry. So he wants to order a pizza, but doesn’t have a payment channel open with the pizzeria owner, Bird. Cat does have a channel open with Bird. Instead of opening a new channel to Bird, Dog can pay Bird via Cat’s channel.
Dog first asks Bird for a secret. Then he tells Cat to pay Bird the cost of the pizza (let’s say 0.001 BTC) in exchange for the same secret from Bird. Cat then shows this secret to Dog. If it matches the secret that Dog got from Bird, Dog knows that Cat really paid Bird, so it’s safe for him to pay Cat.
This system of chained, conditional payments can be extended out to any number of parties, provided they all share channels with a value greater than the payment being routed. There are also safeguards in place, which ensure that a secret cannot be exchanged without the correct number of coins also being exchanged.
Therefore, the Lightning Network is globally scalable. In order to transact with anyone, you just need to find a path to that someone via other participants in the network. (In other words, it doesn’t matter if that channel goes through a hundred other intermediaries.)
Future Possibilities of Lightning Networks
Under Lightning, all sorts of new payment models will become possible. For example, your smartphone could use Lightning to make automatic micro-transaction payments to WiFi hotspots that it connects to, and you will be able to only pay for a partial video you’ve watched. Then, for example, you can only pay workers for the number of minutes (or even seconds) they’ve worked.
These automated, machine-to-machine transactions for tiny amounts become possible with sufficiently cheap transfers.
An even more tantalizing prospect held out by Lightning is its suitability to retail trade. At the best of times, Bitcoin confirmation times take minutes. And while this feature is great for international payments, it’s simply too slow for paying the cashier at the supermarket.
At least in theory, instant and near-feeless Lightning payments would allow Bitcoin to replace cash, credit cards, and other payment methods for such person-to-person transactions. While Bitcoin has proven extremely useful in the digital realm, Lightning may enable it to make the jump into evermore real-world applications.
Still not understanding the Lightning Network completely? You’re not alone. At the moment, it’s one of the more technical, complex subjects to explain. Here’s a video by Andreas Antonoplos, which offers another very good explanation about the whole system:
Have more questions about the Lightning Network? Let us know in the comment section below.
I’m a former futures trader. My keen interest in matters financial, economic and political eventually led me to conclude that the current, debt-based fiat system is broken. It was a natural step from there to investing in gold and, in early 2013, Bitcoin. Although I’m not very technical, I’ve learnt about Bitcoin through study, asking questions, running ecommerce and marketing sites and working as a journalist. I’ve always loved writing and my current focus is on creating guides which inform others about Bitcoin’s advantages.
Latest posts by Steven Hay (see all)