What’s the fuss about the Lightning Network?

Lightning Network is the next step in the evolution of Bitcoin -but how does it work and what are the benefits?

Niclas Gustafsson
9 min readFeb 13, 2018

First of all, a word of caution to anyone of you out there that are thinking about starting to transact on the Lightning Network at this time.

The Lightning Network (LN) is in its infancy. Some would probably even argue that it hasn’t even reached its infancy yet. There’s a lot of development going on and the fact that current available implementations will undergo changes, breaking changes that will probably leave you stranded. Before you use LN for real money, make sure you have a solid understanding of what you are getting yourself into. Support is scarce, and the “it’s not ready yet — don’t use it — if you do, don’t bother us when it breaks”-sentiment has been aired more than once.

(There’s a reason why the community is using the #reckless tag when talking about LN on Mainnet.)

But that is also the beauty of open source, especially in the context of distributed systems, that everyone is able to make their own informed decisions of when going live makes sense to them.

Recap: Why do we need the Lightning Network?

Over the years Blockchain technologies has reached an increased level of popularity, or hype if you will. Gartner Hype Cycle for Emerging Technologies still holds Blockchain high on the curve. A fact that I would argue is much due to the success of Bitcoin. However last couple of years the success has taken a hit by the fact that success feeds demand and the other way around. The limitation in the technology, in the form of maximum number of transactions per seconds, has been debated extensively. More specifically how to solve this to enable better scalability.

What started as a currency that was able to provide micropayments reached a level where companies such as Steam pulled the plug as transaction costs skyrocketed and became greater than the cost of products actually sold.

Artwork: Aurich Lawson / Getty

The use of Bitcoin as currency has become less viable as the core foundation, the 1MB blocks of the blockchain that has become a bottleneck which has led to increased fees.

During 2017 the development community was divided in what was most notably two camps. Both sides gathered around what they believed was the best solution for scaling bitcoin. The solution proposed by one party was to increase the 1MB limit, this resulted in a split into a new currency existing alongside Bitcoin: Bitcoin Cash.

The Bitcoin Cash solution has been labeled a quick-fix by some, meaning it doesn’t really fix scaling issues in the long run and may even contribute to centralisation.

Bitcoin cash fork

In the other camp, was the proponents of the Lightning Network.

Lightning Network — A Peer-to-peer payment network

With Lightning Network there has been some real innovation going on behind the scene. The LN whitepaper is dated early 2016 and since then people have been busy to take us to where we are today.

Some changes to the Bitcoin were needed to make LN a reality. Most notably a feature called Segregated Witness or SegWit for short. SegWit was activated on Mainnet on 27 august 2017 and made Lightning Network possible to realize. (See references below for a deep-dive in to SegWit)

One way to look at Lightning Network is as a peer-to-peer network of payment channels. Once you’re on the network you can transact with anyone else on it — instantly. With the added benefit of cryptographically security of the Bitcoin network.

Sounds good, right?

Let’s take an example. Let’s say you (Alice) have a friend Bob whom you trust a lot. I mean you grew up together, your parents know each other their friends know each other. You are really connected. You would probably trust Bob enough to let him use your house when you’re away. And eat your food.

The Usual Suspects

Then there’s Charlie. He’s a friend of Bob, but you don’t really know him that much. But hey, he’s a friend of Bob so he must be a nice guy, right?

Bob has a nephew Dave, that you knew of because you saw him making strange comments on Bob’s Facebook photos. Seems like a strange fellow. Would probably not leave him unattended in your house for that long.

So with this setup, would you in the real world give Dave $5000 to deliver to your good friend Bob? Probably not. Would you give Bob $5000 to deliver to Charlie, yes, no problem there.

(Now, for the sake of argument I assume $5000 to be a sum that’s significant If I dropped it, I’ll make a significant effort to find it), but not enough to sever all social ties and start a new life somewhere.)

Now in the world of lightning network. We talk about a concept of payment channels. A payment channel defines a set of boundaries for which payment can be done. It stipulates which endpoints (nodes) are connected, what capacity the channel can manage and some more technical properties which I won’t go in to detail about here.

So, using the Lightning Network, you could set up a payment channel towards Bob for let’s say $10 000. This means you have the possibility to send Bob $10 000. To Charlie you might set up a channel of, let’s say $500.

Bob sets up a channel to you (Alice) for the same amount ($10 000) and $1000 to Charlie.

Charlie knows Dave and sets up a channel to him for $2000.

Now of course for the Lightning Network everything is done in Bitcoins and fractions thereof, but I’ve chosen $ here to illustrate.

Now, here’s the kicker. The Lightning Network understands that not everyone knows everyone. But just like the internet where routing of packets is done by intermediates. The same (sort of) applies to the LN. We can send a payment to Dave if the network can find a valid route to him.

In this example you (Alice) can pay Dave up to $500 and the network would find the following two ways to get the funds through. If we would like to transfer, let’s say $1000 however there would only be one possible route as the channel from Alice to Charlie would be too small to handle the amount.

So, the channels need to be able to carry the funds the whole way through, i.e. there needs to be sufficient capacity in each and every channel for the whole amount in the route.

An important concept to understand about channels are that they are directional in a sense. The capacity of the channel is defined by who owns what balance. Lets take the Channel between Alice and Charlie as an example, it starts out with Alice funding the channel with $500 as in the picture (the whole amount is owned by Alice). Then Alice want to pay Dave say $300 and the network chose the route Alice<->Charlie<->Dave (shortest path) we end up with the following:

$500/0 Capacity changed to $200/$300

Two things happened here, the capacity for Alice towards Charlie has decreased by the transacted amount, down to $200. Any further transaction above that amount to Dave would need to go through the $10 000 channel and through Bob. Secondly, a new possible route has opened up for Charlie towards Alice with the capacity of $300 — as Charlie now owns the $300. (Technically the route was already in place but with no capacity and therefor quite useless).

And a key feature of LN channels is that they are trustless. I don’t need to trust that Bob and Charlie will do the right thing. You could replace Dave with Bob in the above picture, it doesn't matter simple because trust is not used by the Lightning Network.

Cryptography will guarantee that intermediates won’t take your funds and run away, cryptography and the concept of Hashed Timelock Contracts (See references below for details regarding HTLC).

So, what’s so different compared to the original Bitcoin payment network? After all you could transact directly with anyone using Bitcoin without the use of intermediate nodes and channels.

Lightning Features

Well Lightning Network may or may not be the best thing since sliced bread. However some features that makes it exciting are:

  1. Only the first and last transaction gets transmitted to the global Bitcoin blockchain. The first, the funding transaction, tells (and proves to) the world that you committed the initial capacity to the channel. The last transaction can be transmitted if you decide take down the channel and divide the funds according to some (past or present) agreement with your channels target.
  2. All transactions except the first and last are known only by the two transacting participants (Alice & Dave in one of the examples above). This has implications on privacy as transaction are not broadcasted in public and are not stored on the global public blockchain. This feature enables Bitcoin to scale massivly.
  3. Payments are instant. Compared to payment on the Bitcoin blockchain where you need to wait for confirmations, which can take up to one hour for six confirmations.
  4. All transactions are made in fractions of a bitcoin. Recall that in the same way that a USD is dividable in 100 cents, a Bitcoin is made up of 1e+8 (100 000 000) satoshi. The LN takes the concept of micro-transactions a step further and handles its transactions in milli-satoshi, i.e. the least transferable amount is 0.00000000001 bitcoin.

The current state of the Mainnet (production) Lightning Network is still in its infancy: channels are being setup up and torn down as early adopters experiment and verify solutions. Nodes are taken offline and brought back online for the same reason. As of early February the network consists of somewhere around 650 nodes and 2000 channels.

In closing

Even in its infancy the Lightning Network is evolving fast. A lot of exciting projects and development ambitions are in the works. Channel Factories, automatic channel management systems and more.

2018 is going to be an exciting year for bitcoin and the Lightning Network.

Some Links & References:

https://lightning.network/lightning-network-paper.pdf

Scalable Funding of Bitcoin Micropayment Channel Networks

--

--

Niclas Gustafsson

Entrepreneur by heart. IT by profession. Photography by passion. Founder of https://bytesafe.dev/