The Lightning Network has become one of the hottest topics of the year 2019. It is a scaling solution to Bitcoin, which has expanded fast behind the curtain during the bear market of 2018. Now, this technology has reached a level, where anyone can try it in practice. What is the Lightning Network and how does it work? This article is a beginner’s guide.
History of the Lightning Network
The Lightning Network is actually a pretty old concept. Its first steps can be traced all the way to 2009 when the first versions of Bitcoin code base were released. Satoshi Nakamoto wrote already back then about payment channels.
Nakamoto’s payment channel idea was developed further and to different directions between 2011 and 2015. Many different developers and fintech companies participated all around the world. However, no final consensus was reached. You can read more of the history of the payment channels from this article.
The Lightning Network concept was born in 2015. Thaddeus Dryja and Joseph Poon published the first Lightning Network white paper titled The Bitcoin Lightning Network: Scalable Off-Chain Instant Payments (Feb 2015).
The Lightning Network white paper presented an idea called Poon-Dryja payment channel. The concept made it possible to update a payment channel endless times to both directions. Hashed Timelock Contracts (HTLCs) were also an integral part of the Lightning Network.
At the same time, the discussion of Bitcoin’s scalability exploded. There were two major conferences held in late 2015 at Montreal and Hong Kong. Poon and Dryja presented their idea in these conferences and received lots of support from the Bitcoin community.
Lightning Network development in the recent years
The Lightning Network concept is open source, just like Bitcoin. Hence, different entities have developed their own versions of the Lightning Network. ACINQ, Blockstream and Lightning Labs have been the most important developers. They have also co-operated during the process and developed LN specifications together.
Blockstream started to develop the Lightning Network with a programming language called C. Hence, the Blockstream version is called c-lightning.
Lightning Labs is a tech company founded in 2016. Thaddeus Dryja and Joseph Poon, who we mentioned earlier, are the founders together with Elizabeth Stark and Olaoluwa Osuntokuni.
Many connect the Lightning Network technology to Elizabeth Stark, who has been an active speaker in multiple Bitcoin conferences in the past years. Stark is currently the CEO of Lightning Labs. She’s also active on Twitter with the handle @starkness.
The implementation of Lightning Network technology required also some changes to the Bitcoin program code. The most important of these was a soft fork called SegWit (Segregated Witness), which was implemented in 2017.
The Lightning Network started to transform from theory to practice in late 2017 / early 2018. One milestone was reached at 28th of December 2017, when Alex Bosworth (a developer at Lightning Labs) successfully paid his phone bill using the Lightning Network.
— Alex Bosworth ☇ (@alexbosworth) December 28, 2017
Blockstream and Lightning Labs published their first versions of the LN program code in early 2018, which made it possible for others to join the network and start testing it. The Lightning Network is a network of nodes running the required software, just like in the Bitcoin network.
Lightning Labs published a beta version of their LN implementation in March of 2018, which was a major step. The company also raised 2.5 million dollars of additional funding at the time. One of the investors was Twitter’s CEO Jack Dorsey, who is a known fan of both Bitcoin and the Lightning Network technology.
As mentioned above, Lightning Network is in practice a wordwide network of computers (servers). It has expanded rapidly in the past year and grows with a rate of 10% every month. There are over 8,400 nodes in the network when this article is being written with over 37,000 payment channels open. The Lightning Network has a capacity of over 1,000 Bitcoins.
You can check the LN stats at 1ML.com/statistics.
Let’s go through the technology behind the Lightning Network next. How are the transactions being sent?
Lightning Network is a layer 2 solution
The Lightning Network was developed due to scaling issues in the Bitcoin network has. This discussion has been going on for years – how to increase the capacity of the Bitcoin network? Bitcoin is over 10 years old technology and therefore it has its limitations.
The scaling debate has divided people into two camps.
1. The first option is to increase the block size of the Bitcoin blockchain. Bitcoin Cash supporters selected this option and forked their currency out of Bitcoin in August 2017.
2. The second option is to move the most of the transactions out of the Bitcoin network. This is called an off-chain or layer 2 solution.
The Lightning Network is based on the idea behind the second option. The architecture looks like this: (source)
As you can see, LN is only one of the protocols being added on “top” of the Bitcoin blockchain. This is called layer 2. The layer 3 is all about software and API for the end users, such as trading programs and wallets.
The idea behind the Lightning Network is to offer an alternative network for small transactions (also micropayments). These are currently overloading the network. In theory, one can also make large transactions in the Lightning Network, but that requires higher capacity than we have today.
LN enables two wallets to transact with each other without making any ledger entries to the Bitcoin blockchain. The Bitcoin blockchain has an average block time of 10 minutes. It is impossible to use it to buy a cup of coffee and wait for 2-3 blocks to confirm the purchase. In practice, the Bitcoin blockchain can handle less than 10 transactions per second.
When transactions are moved out of the blockchain, this 10-minute restriction is removed as well. Transactions sent in the Lightning Network happen almost in real-time.
What is the Lightning Network?
Let’s dig deeper into the actual network. How are transactions being sent? First, you have to understand how Bitcoin works. Please refer to this article for more information: Beginner’s guide to Bitcoin.
The Bitcoin network consists of tens of thousands of computers, which are called nodes. Each node runs the Bitcoin software, and anyone can set up a node any time by downloading it. Hence, the network is permissionless.
Bitcoin is using the gossip protocol to announce transactions to the network. It’s just like gossiping in real life: each node passes the information it has to every other node it’s connected to. As a result, all nodes store exactly the same information all the time.
The Lightning Network consists of nodes as well, but they run the LN software. This is also a permissionless network because the Lightning Network software is open source. Anyone can set up a node and join the network.
This is where the similarities end.
In the Lightning Network, each node is a bit different. The node owner decides the capacity he wants to offer. Each node has also set a price for each transaction, which goes through it.
If you set up a node in the Lightning Network, you must decide the number of channels the node has open. Next, the capacity is decided by staking Bitcoins. The node owner has to make a Bitcoin transaction to the wallet of the node. These Bitcoins will provide throughput.
This is the reason why LN has a limited capacity. If you’d try to send 100 Bitcoins through the network, you’d have problems finding enough throughput from the nodes.
The Lightning Network transactions are sent in a different way compared to the Bitcoin network and also compared to the internet. When you make an internet connection, the underlying protocol will transmit your request forward one server at the time.
The Lightning Network is using something called source routing and onion routing instead. When a transaction is being sent, an optimal route is calculated based on the network status. This means a route, which is the fastest and the cheapest.
After the route is being selected, it’s wrapped like layers in an onion. Hence, the name onion routing. When the transaction travels forward, each node only sees the top layer of the route. The rest of the layers are encrypted and hidden.
"People ask how many transactions are happening on the Lightning Network. The answer is a very comforting: we have no clue."
from LTB #389: https://t.co/uz8I8ElljK
— Andreas M. Antonopoulos (@aantonop) February 26, 2019
Andreas Antonopoulos has tweeted about this fact. Nobody knows how many transactions there are in the Lightning Network, and that’s great! Check also the link in his tweet.
Lightning Network payments
The Lightning Network is all about payment channels, which were mentioned earlier in this article. LN also adds smart contracts to the mix.
The video below explains Lightning Network transactions in a simple fashion.
Since the Lightning Network has thousands of nodes already, there are so many more channels than just one or two. The network is always taking advantage of existing channels. When a new node joins the Lightning Network, the owner can choose which nodes it opens channels to.
There is one big misconception here, we should clear. If you buy a cup of coffee with LN, you are not opening a channel between yourself and the coffee shop. In practice, your wallet software and the coffee house’s wallet software are both in the Lightning Network and connected already. Every single LN user is not a node. Just like you are not a node in the Bitcoin network either.
Transactions move from one node to another as presented in the following picture (source: achainofblocks.com).
If Laura makes a purchase from the juice stands, her Bitcoins are being sent to Alex first. Alex takes those Bitcoins to himself and then sends an equal amount of Bitcoins to the juice stand.
This is the reason you can’t make a 10 BTC transaction through a node with just 1 BTC capacity. The node takes the Bitcoin it gets and then forwards an equal amount of Bitcoins from its wallet. Therefore, each node has only the capacity it has Bitcoins staked for each channel.
Lightning Network from the end user’s point of view
Let’s take a look at the Lightning Network in practice. How do you actually use this network and send Bitcoins? Do you have to manually open and close connections and find nodes?
If you want to try the Lightning Network in practice, it can be done with an app Tippin.me. There are lots of guides available online, so we don’t go through the whole service in-detail here.
Next, you make a transaction from your Bitcoin wallet to the LN wallet. This is a normal Bitcoin transaction and requires usually 2-3 confirmations, meaning about 30-40 minutes. This transaction opens a channel to the Lightning Network. Some wallets are showing it and ask the user to close the channel when leaving the network.
After you have Bitcoins in your LN wallet, you can use them to make payments. In the image below, we have Tippin.me application installed and it’s visible on Twitter. By clicking the lightning icon, a popup window becomes visible with a QR code in it. You can send funds from your LN wallet to this LN wallet by scanning it.
The Lightning Network is all about satoshis. One satoshi is the smallest unit in the Bitcoin network – one hundred millionth of a single bitcoin (0.00000001 BTC). Instead of saying “This costs 0.000…. BTC” you say “This costs 3000 satoshi.”
The Lightning Network is almost free because so many nodes are being run without any fee requirements. Transactions to through in almost real time – we are only talking about a few seconds.
Receiving money is not difficult either. In the Lightning Network you create a lightning invoice, which includes your address and the correct amount. Hence, the receiver can’t pay too little (or too much).
The LN wallets are so good already that they don’t require any extra technical skills from the end user. You can send and receive LN payments as easily as you’d do in the Bitcoin network. The only difference is that the Lightning Network address is a much longer string of characters.
Below are some Bluewallet screenshots.
When you want to exit the Lightning Network, you simply make a transaction from the LN wallet back to your Bitcoin wallet. At this point, your LN ledger is updated to the Bitcoin blockchain. How many Bitcoins you moved to the network and how many came back. Simple as that.
It depends a bit on the software, how this exit is presented. In Eclair, your LN funds are automatically sent back to your Bitcoin wallet when closing the payment channel. Bluewallet is using a third-party solution for sending your funds back to the Bitcoin blockchain.
The future of the Lightning Network
The Lightning Network is here already, there is no doubt about it. The situation was totally different in early 2018, but we’ve seen massive development in the previous 12 months. There are also more and more wallets available. Not to forget the fact that the Lightning Network actually works as intended!
There are also sceptics, who don’t see LN as the ultimate solution. One of them is Roger Ver, who is the spokesperson of Bitcoin Cash. His cryptocurrency chose to solve the capacity issue by increasing the block size.
It is true, that Lightning Network nothing extraordinary. If you have tried Ripple’s XRP for example, you know the transaction is done in less than 10 seconds.
The Lightning Network brings Bitcoin’s capacity from 2009 to 2019… when it’s fully operational. The network is still in the beta mode with limited capacity.
Some sceptics are worried that the Lightning Network will be dominated by large institutions. What if the biggest banks join LN and open channels with high capacity nodes? Then all big transactions would go through their servers.
At the moment, it takes quite some time for the transaction to go through from the Bitcoin network to the Lightning Network. You get the best out of this solution only when you keep your wallet pre-funded.
If you walk to a store with an empty LN wallet, you have to wait 30 mins for the cup of coffee anyway. This issue will be probably solved in the future by wallet operators.
There is one more thing we must mention. Lightning Network protocol is not just a scaling solution for Bitcoin. Other currencies with similar code base can also take advantage of it. This is the case with Litecoin, which has also SegWit activated.
— Charlie Lee [LTC⚡] (@SatoshiLite) December 13, 2018
There are also other off-chain scaling solutions coming to the market, such as Ethereum Plasma and Raiden Network. Stellar is also developing their own Lightning Network solutions.
The Lightning Network is a very interesting technology, which has started to get some traction in 2019. Every crypto enthusiast should learn how it works and to try the network in practice! Download a LN wallet and make some transactions.
We also recommend watching the following video by Andreas Antonopoulos.
Photo by Pixabay from Pexels , Flickr / PICNIC Network, | More information from these sources: The History of Lightning: From Brainstorm to Beta, Bitcoin Lightning Network | Simply Explained & Illustrated, Payment Provider Bitrefill Runs Successful Lightning Transaction Test, Lightning Network