English

What Is Lightning Network And How It Works

When Bitcoin was first proposed by Satoshi Nakamoto in 2008, the very first public comment on the system made by James A. Donald contained the following line: “the way I understand your proposal, it does not seem to scale to the required size”. Ten years later, scalability is still the biggest problem for Bitcoin as well as other veteran cryptocurrency systems.

What exactly does scalability mean? Well, throughout its existence Bitcoin has only been capable of processing around 7 transactions per second. While this was enough at the very beginning, the system has been congested for a few years now. As a result, transactions take a long time to process and transaction fees are extortionate.

If Bitcoin is ever to become a fully-fledged alternative to currently existing payment systems, it will obviously need to be able to compete with them. As of now, it’s not even close. To understand the magnitude of the situation, simply compare Bitcoin’s minuscule 7 transactions per second to Visa’s average of 24,000, and its peak capacity of around 50,000 transactions per second.

Over the years, Bitcoin’s community came up with various proposals on how to improve Bitcoin’s scalability, but an overall resounding consensus is yet to be reached. That’s why we currently have several Bitcoin-like networks branching out from the original one. There is, however, one proposed solution currently being tested that might just work. It’s called the Lightning Network.

What is the Lightning Network?

At some point in history, sending a telegram was the quickest and most efficient way of long-distance communication. To do so, you had to go to your local post office, fill in a form and pay for your message based on how many letters it contained. Then, the message would get telegraphed to the nearest telegraph office for transmission to the distant end. A postman would then deliver the telegram to its destination.

Basically, there were a lot of people involved in sending a simple short message and you had to pay quite a bit of money for it. That’s pretty much the current state of the Bitcoin network. In this analogy, the Lightning Network is essentially like having a person you want to talk to on speed-dial: you just need to press ‘1’ and your friend’s phone is already ringing.

To put it simply, the idea behind the Bitcoin Lightning Network might’ve sounded something like this: we really don’t need to keep a record of every single transaction on the blockchain.

Instead, the Lightning Network adds another layer to Bitcoin’s blockchain and enables users to create payment channels between any two parties on that extra layer. These channels can exist for as long as required, and because they’re set up between two people, transactions will be almost instant and the fees will be extremely low or even non-existent.

How does it work?

Enter Danny and Jon. They may be working together, they might be relatives or a couple, the point is they need to send money to each other rather often, quickly and with minimal fees. Thus, they set up a channel on the Lightning Network.

Firstly, they need to create a mulitisignature wallet, which is a wallet that they can both access with their respective private keys. Then, they both deposit a certain amount of Bitcoin - say, 3 BTC each - into that wallet.

From then on, they can perform unlimited transactions between the two of them. Essentially, these transactions are redistributions of the funds stored in the shared wallet. For instance, if Danny wants to send 1 BTC to Jon, she will need to transfer the ownership right of that amount to him. Then, the two of them use their private keys to sign for an updated balance sheet.

The actual distribution of funds happens when the channel gets closed. The algorithm uses the most recently signed balance sheet to determine who gets what. If Danny and Jon would decided to close the channel after that one transaction, Danny will get 2 BTC and Jon will receive 4 BTC.

Only after the channel is closed, the information about it’s initial and final balance is broadcasted to the Bitcoin blockchain. So, the way the Lightning Network works is it enables users to conduct numerous transactions outside of the main blockchain and then record them as a single one.

The most exciting thing here is that once the technology is widely adopted, you won’t necessarily even need to set up a dedicated channel to send funds to a certain person. Instead, you will be able to send payment to someone using channels with people that you are already connected with. The system will automatically find the shortest route.

This is how the Lightning Network might eventually provide an answer to the never-ending debate about buying a cup of coffee for Bitcoins. By the looks of it, doing so through the network of Lightning channels may just work, as it will be an almost instance purchase that won’t incur any fees.

Security. However, it is worth noting that the concept of the Lightning Network means that the system will work on top of the blockchain, but won’t actually have its security behind itself. Thus, it’s very likely that it will be mostly used for small or even relatively microscopic transactions. Larger transfers that require decentralized security will most likely still be done on the original layer.

Finally, another fascinating feature of the Lightning Network being tested at the moment is cross-chain atomic swaps, which are transfers of tokens between different blockchains. Simply put, it’s a way of swapping any given cryptocurrency to a different one without using cryptocurrency exchanges.

Ultimately, this technology might make unsafe centralized cryptocurrency exchanges as well as the hassle associated with trading on them obsolete. The first test of exchanging tokens between the Bitcoin and Litecoin test blockchains has already proved to be a success.

Who developed it?

Lightning Network was first described in a white paper by Joseph Poon and Thaddeus Dryja in 2015 - the current version of the white paper can be found here. There are currently three teams collectively carrying out most of the work on the development of the Lightning Network: Blockstream, Lightning Labs and ACINQ, with input from other members of the Bitcoin community.

Each of the startups mentioned above is working of their own implementation of the Lightning Network Protocol written in different programming languages.

Blockstream works on LN version in C.

Lightning Labs is developing a Lightning Network Daemon (lnd) written in Golang.

ACINQ is responsible for a Scala implementation.

Moreover, there are other implementations currently in development. The full list is available here. Finally, it is important to mention that the recent tests have proven that the three major implementations are fully interoperable, which means they can seamlessly work with one another.

Where, when and why will it be used?

It seems that the cryptocurrency community is eagerly anticipating the launch of the Lightning Network. Originally, it was designed specifically for Bitcoin, but the technology is currently being developed for an array of other cryptocurrencies, such as Stellar, Litecoin, Zcash, Ether and Ripple.

Real Bitcoin has actually already been sent and nearly always received using Blockstream’s, Lightning Labs’ and ACINQ’s implementations, proving that all three of those are interoperable. Moreover, the first version of the lightning specifications outlining the rules of the network has been published.

Those specifications are a huge step forward for the network, as they can be used by developers of applications and the implementation of the Lightning Network in other programming languages.

However, the network is still very much in its infancy. As of yet, there’s no software with which real-life casual users of the network can make transactions. Moreover, the current implementations are still quite buggy. Lightning Network developers have urged users to learn about the network using Bitcoin’s testnet and not send any real money.

The developers are also advising users to stay patient, as the network’s code is very complex and requires rigorous testing. To be fully adopted by the Bitcoin community, the Lightning Network will need to prove itself to be safe and usable. With that and many other factors in mind, experts predict that a fully working Lightning Network can be from several months to a couple of years away.

As to the reason why the network will be used, the answer is simple: scalability. If the network will actually provide a solution to Bitcoin’s main issue, it will most likely be adopted by other cryptocurrencies.

If that happens, there is a possibility of cross-chain atomic swap technology being developed further, thus marking a first step towards building truly decentralized cryptocurrency exchanges.

Pros

As it was mentioned before, the Lightning Network is only making its very first steps. It’s still very much in development, and whether it will actually work as the developers imagine it still remains to be seen. If it does, here are some of the most important advantages of the Lightning Network you can benefit from:

Transaction speed. Once the network is live, you won’t have to wait for several confirmations of every transaction you’re trying to make. The transactions will be almost instantaneous no matter how busy the network is. If this happens, the cryptocurrency market will make huge steps towards being able to compete with traditional payment systems like Visa, MasterCard and PayPal.

Transaction fees. As the transactions will actually take place within the Lightning Network channels and outside of the blockchain, you will only need to pay the tiniest fees, if any at all. This is one of the main advantages of the Lightning Network, as this will fully enable Bitcoin to be used as a form of payment in shops, cafes, bars and so on.

Scalability. The Lightning Network is said to be able to take the transactions per second figure of Bitcoin and other cryptocurrencies to unprecedented heights of at least 1 million transactions per second.

Cross-chain atomic swaps. The first tests of cross-blockchain transactions worked, and this is all very exciting. As long as the two blockchains share the same cryptographic hash function (and most major one do), the users will be able to send money from one chain to another without having to trust a third-party intermediary, such as an exchange. This technology has a truly revolutionary potential.

Security and Anonymity. The vast majority of cryptocurrencies out there are not fully anonymous. The transitions can still be traced from one wallet to another. When it comes to the Lightning Network, though, most of the transactions happen outside of the main blockchain, so all the micropayment made via Lightning channels will be almost impossible to trace.

Cons

Not fully operational. Perhaps the main disadvantage of the Lightning Network at the moment is the fact that’s it’s not fully operational yet, so there’s no way of fully asserting how good it actually is. Moreover, it’s concept looks great on paper, but as of yet it’s impossible to find out whether it’ll look as great once realized.

Complexity of channels. The Lightning Network is conceptualized as sort of a web of channels which, once established, should theoretically allow for seamless transactions. However, there is no telling what will happen if the payment will have to take too convoluted a route. Surely, if your transaction will need to go through dozens of intermediate channels, the fees will add up.

Channel caps. Another drawback of the network is the fact that in its current version the channels are capped. That is, the amount of Bitcoins stored in the wallet by the two users upon establishing a channel is the maximum amount of funds in that channel. This setup creates a situation where some users might need to choose between having liquidity within the Lightning Network channels and having liquidity outside of them, on the main blockchain. This is far from ideal, especially for those with rather limited resources.

Hubs. Moreover, there have been concerns voiced over forming of ‘hubs’ - a sort of nodes with a lot of capital that the majority of transactions will go through. Many Bitcoin enthusiasts see this as further centralization of the network. But, it is unlikely that such hubs will be able to make any significant profit of transactions fees.

Again, it is worth pointing out that at the moment both the advantages and drawbacks of the Lightning Network listed above are very speculative.

Should I use the Lightning Network?

Well, as a matter of fact, if you’re not an advanced user, you can’t use Lightning Network just yet. So, the best - if not the only thing you can do right now is wait and see whether the lightning network lives up to the hype, whether it can actually function and described and whether it’s safe.

Bear in mind, the Lightning Network is not the only scaling proposal out there, and it’s by no means an undisputed leader in that race, with Bitcoin Cash (BCH) being its main rival. The debate between the BCH adepts and the Lightning supporters is fierce and there’s no end in sight. It could be that one of those proposals comes out on top, they could potentially coexist, or there can be an entirely different solution.

The Lightning Network sounds exciting. If it actually delivers, consider what you actually use your Bitcoins for. If you use the tokens as a long-term investment and nothing else, you might not even need the Lightning Network, as currently it doesn’t seem entirely safe to entrust it with handling big transfers.

But, if you view Bitcoin as an alternative form of payment, the Lightning Network, provided it lives up to the expectations, will be essential for you. Instant micropayments, increased anonymity, almost non-existent fees - it really seems to offer solutions to most of the Bitcoin’s problems.

Follow us on Facebook