What is the Lightning Network?
Lightning Network is a payment protocol that operates on the top of the Bitcoin network (“Layer 2” solution). It’s a network of decentralised nodes that allows for sending a huge number of transactions exteremly fast and for a negligible fee (even sub-satoshi level). The Lightning Network facilitates micropayments, making the existence of a completely new type of applications possible.
To illustrate how the Lightning Network works, let’s imagine ordering drinks in the pub. The first option is to pay for every single drink separately, this means you have to pay each time you want to order a drink. Each of these transactions will be settled with the pub separately. If we imagine these are Bitcoin transactions, each of them would have to be settled (mined) on the Bitcoin blockchain.
The second option is to open a bar tab. Now, you can order as many drinks as you want without having to settle each transaction separately. At the end, you can just pay once, settling the whole bill in one transaction. This is similar approach to how the Lightning Network works and it’s consider a Layer 2 solution as not every transaction is settled on the blockchain.
Not settling every transaction on the blockchain allows for achieving a dramatic increase in both transaction speed and throughput and makes Bitcoin scalable to the level necessary to become a viable mean of payment for the whole world.
The Lightning Network was first described by Joseph Poon and Thaddeus Dryja in February 2015. You can find a link to the whitepaper here/below.
Lightning Network is built on the concept of payment channels that can be established between two parties. We are going to dive into it later in this post. Before we do that let’s understand why do we even need the Lightning Network in the first place.
Why does Bitcoin even need the Lightning Network?
Okay, this all sounds really cool, but why does Bitcoin even need the Lightning Network?
The quick answer is – scaling. Concerns about Bitcoin’s scaling problems were raised multiple times and they became obvious during the end of 2017 bull run. In Bitcoin, every single transaction has to be broadcast to every single node in the network. Broadcasted transactions have to be included in a block to be mined and settled on the blockchain. As Bitcoin’s blocks are created every 10 minutes on average and each block has a limited size, it creates a natural bottleneck on the number of transactions that can be processed.
When it comes to fixing Bitcoin’s scalability problems, developers came up with a few different approaches, mainly increasing the block size (Bitcoin Cash approach) or moving part of the transactions off-chain (Bitcoin approach). Both of the approaches come with their own tradeoffs, but the Lightning Network tries to increase the network throughput and speed by processing some of the transactions in the second layer.
Currently,
Payment Channels
Now as we went through the necessary overview, let’s get into the nitty-gritty details of the Lightning Network. We cannot talk about the Lightning Network without mentioning payment channels which are the basic building blocks of the network. Payment channels are examples of state channels which represent an off-chain state alteration which is secured by eventual settlement on the blockchain.
In order to open a new payment channel, two parties – Alice and Bob, have to commit funds to a 2-of-2
After the channel is established, two parties can start signing and exchanging transactions (called commitment transactions) that alter the initial state and are not broadcast to the Bitcoin network. This allows for exchanging thousands of transaction without having to interact with the underlying Bitcoin network and makes the whole solution scalable.
When Alice and Bob at some point decide they want to close their payment channel, they can sign a closing transaction. This transaction will be mined and it will resolve the final balance between the two parties. In the whole lifetime of a payment channel, there are only two transactions that have to be mined and these are the opening and the closing transactions.
The Lightning Network is built on the concept of multiple payment channels connected end-to-end that allow for routing transactions to any of the network participants. In the Lightning Network, a transaction can be sent through the network of payment channels without trusting any of the intermediaries leveraging a mechanism called Hash Time Lock Contract (HTLC).
Every time a node wants to send a payment to another node, it must first construct a path. It does so by connecting channels with enough capacity using possibly the shortest route. It also takes into account fees of the intermediate nodes.
The communication between LN nodes is encrypted point-to-point. The Lightning Network achieves that by implementing an onion-routed protocol (similar to TOR) which ensures that intermediate nodes can verify and decrypt only their portion of the route and they cannot identify the length of the payment path or their own position in the path.
To deal with the bad actors the Lightning Network leverages a lot of game theoretical elements that incentivise nodes to act honestly. These are mostly timelocks, asymmetric revocable commitments and HTLC.
This was only a quick overview of the payment channels and we are going to cover more details in the following post.
Possible applications of the Lightning Network
The beauty of Bitcoin and the Lightning Network is that it can not only provide a better alternative to the already existing systems but also facilitates the creation of the completely new types of applications.
Have you ever realised you kept paying a subscription fee, even though you barely used a service? What if the service instead of a monthly fee was charging you by a minute or maybe even by a second? A good example would be a movie streaming service which actually charges you a small fee for every second of watched content. This type of business is currently not a viable option due to high fees for processing card transactions.
How about receiving your salary every hour (or even every minute) instead of once or twice per month. This is where the Time Value of Money comes to play. With the
Lightning Network and other cryptocurrencies
Lightning Network although mostly discussed as a Bitcoin Lightning Network is not only limited to Bitcoin. In fact, most of the cryptocurrencies supporting basic constructs like timelocks or HTLC can make use of the Lightning Network to exchange value off-chain. There is also a possibility of exchanging one coin to another via Lightning Network in a process called atomic swap. This concept can power Decentralized Exchanges and allow people to exchange coins without losing control of their private keys.
BOLT, Lightning Wallets and current state of the Lightning Network adoption
As the Lightning Network continues to grow at a very high rate, it’s important to make sure that different implementations can communicate with each other. To achieve that, the community came up with a BOLT (Basis of Lightning Network) standard which specifies guidelines which allow for seamless interoperability between different implementations. This also allows different teams to work on their own Lightning Network implementation at their own pace which speeds up innovation. The most popular implementations with the highest number of developers are c-lightning, LND and Eclair.
When it comes to wallet apps supporting Lightning Network there are already a few good solution, but we have to remember that most of them are still in beta stage and they can contain bugs, so it might not be the best idea to deposit a lot of money into them. The most popular wallets are Blue Wallet, Wallet of Satoshi, and Zap.
As we mentioned before, the Lightning Network grows at a very hight rate. These are some of the current network statistics:
Number of nodes: 7991 (+8.35%)
Number of channels: 38707 (+2.3%)
Network capacity: 1066 BTC (+9%)
If you’re curious about more Lightning Network stats, check a link to a website that tracks them in the description box below.
Summary
The Lightning Network is currently one of the most exciting projects in the crypto industry and it has a big chance of bringing a scalable second layer solution to Bitcoin which will enable micropayments and create a new way of building financial applications.
We need to remember that the Lightning Network is still a very new technology and despite its potential, it is also facing a lot of challenges. Some of them are: lack
The Lightning Network recently started attracting more and more attention from the broader community with people like Jack Dorsey (Twitter CEO) endorsing the technology.
Extras
Lightning Network Whitepaper ► https://lightning.network/lightning-network-paper.pdf
Mastering Bitcoin by Andreas M. Antonopoulos ► https://amzn.to/2Lr4iS0 (affiliate)