-

Buy giftcards with crypto

What is the Lightning Network?

profile pic
gingerbreadfork
·
5 min read
What is the Lightning Network?

Discover why everyone is talking about this layer 2 technology aiming to help scale bitcoin to new heights.

···

Bitcoin has changed how many of us look at exchanging value and even finance in general to a degree. However, anyone that has used bitcoin knows that the security of bitcoin transactions comes at a cost, both financial and in time itself. Does the Lightning Network solve this and open the doors to making cheap and instant micro-payments with bitcoin?

What is Lightning Network?

The Lightning Network is an attempt to solve issues with scaling and micro-transactions on the bitcoin network. It does this by not changing the underlying protocols of bitcoin and instead operating on top of the existing foundation provided and, as such, is considered a "layer 2" payment protocol.

It is not a blockchain, side chain, or any kind of chain; it is instead a form of peer-to-peer (P2P) network that works by overlaying itself on top of the bitcoin blockchain and using on-chain transactions to finalize the opening and closing of payment channels and the funds within.

How Does the Lightning Network Work?

Transactions performed on Lightning are conducted primarily off-chain, outside of opening and closing payment channels. This approach works as when a channel is opened with someone else, a form of multi-signature address is created where both sides hold a balance to begin. As funds are sent through the channel, transactions are signed by the owners of the channel, with the most recent transaction considered the final state if the channel is closed.

For example, if two people open a channel containing two bitcoin on each side, one party sends 1 BTC to the other then decided to close the channel; this would be finalized on-chain, and one person would end up with 3 BTC the other just one. However, this example is not an ideal situation as an on-chain transaction would need to occur to both open and close the channel, so ideally, a channel would be used for high volumes of transactions where balances can move quickly and inexpensively to only be finalized and recorded on the bitcoin blockchain once the channel is closed.

Things get more interesting because as the network grows, more channels start to open with other people, and a more extensive network forms; this is where the real magic of Lightning starts to come into play. If a path can be found from one user to another user, then a transaction can still occur even if it requires moving through multiple different payment channels. Instead of only allowing for a high volume of transactions to occur between two parties, network participants from around the world can route payments to each other through open payment channels. Being able to route payments using the shorted path via multiple channels allows you to make Lightning payments without having to open a channel with every person with whom you may want to transact. This flexibility makes the entire process far more scalable. At the time of writing, there are already over 10,000 nodes operating with over 45,000 channels active.

Can You Buy a Cup of Coffee with Bitcoin?

Using bitcoin to exchange goods and services when the provider accepts bitcoin has always been possible, and it will continue to be going forward. However, as the average bitcoin block takes 10 minutes, this means that if a vendor or service provider wants to confirm that payment has indeed occurred, you could be waiting at least a few minutes, and that's only if they are willing to accept your payment after a single confirmation. There are also fees to consider. On-chain fees can be higher than the cost of an average cup of coffee. For many transactions, this is perfectly fine, but for lower value items like this, it makes sense to look to an alternative such as the Lightning Network.

Using the Lightning Network for smaller purchases like this is just one example of a great potential use case and why this technology is taking off in countries like El Salvador, where bitcoin was recently made legal tender in a historic move. While bitcoin will always be exceptional for remittances, where on-chain fees and the time required can typically dwarf competing options like Western Union or Swift wire transfers, it's worth remembering that not all remittances are large. For smaller remittances, even the smallest amounts can matter or even be life-changing.

Is the Lightning Network Safe?

The Lightning Network was first mentioned in a white paper created by Joseph Poon and Thaddeus Dryja back in 2015, and although this means that it isn't brand new, there are still some concerns when it comes to security. An example of a potential exploit includes a "Flood & Loot" attack described in a paper by Aviv Zohar and Jona Harris.

There have been several forms of theoretical attacks proposed, including some that put funds at risk, which is one of the reasons that Lightning is preferred for smaller transactions even as the network has started to grow more in recent years. Thankfully, many attempts to attack the network would be costly for the attacker, reducing the risks in many cases.

Nonetheless, work is being done to find potential flaws in the network and strengthen Lightning’s security. While finding flaws seems like a valid concern, and of course, it can be, the community of developers and supporters working towards bringing Lightning to the forefront seem to be placing a strong emphasis and commitment to improving security and creating the best possible layer two solutions for bitcoin.

Privacy on the Lightning Network

Another benefit of using Lightning is that while it's easy to see that a transaction likely was opening or closing a channel, that's about the extent of what can be quickly learned by looking at a bitcoin block explorer. While many choose to make their channels public, you can opt instead to open a private channel, and the only thing that will be shared is a transaction showing that a channel was opened with a certain balance and once closed the balance at this point. Thousands of transactions could occur with an open channel that wouldn't be shared in the same way that on-chain transactions are when it comes to bitcoin.

Opening and Closing Channels

When a channel is opened, a multi-signature address is created requiring signing by both parties to spend the funds contained, which would be necessary to close the channel. However, this could result in one of the parties abandoning the channel for any number of reasons or them just straight-up refusing to cooperate. This problem has a solution called hash timelock contracts (HTLCs) which provide an out if any type of situation like this occurs; it just requires, as the name suggests, time. A HTLC creates a condition where even if both parties don't sign to spend the funds locked in the address at a specific time or block height, they can do so anyway.

How Much Can I Send with the Lightning Network?

While there was previously a limit on channel size, this was removed more recently. The channels you are using will limit the maximum amount of bitcoin you can send with the Lightning network. You experience essentially no limitations on the lower end, and you can send a single satoshi with ease.

Lightning is an exciting way to take bitcoin to new heights. If you're interested in this approach to scale bitcoin beyond the base layer, there's plenty more to learn about this interesting topic and much more when it comes to the world of bitcoin and blockchain technology.

Get freshly mined articles straight to your inbox!
No spam, pinky promise!