Lightning Network at the End of the Tunnel

April 2018
As blockchain technology becomes increasingly popular and it is investigated for use in numerous solutions, especially for the internet of things, there exists a need for methods of adapting the technology to serve a much larger market than it was originally intended for. As discussed in a previous blog post, current blockchains are not yet proven viable for mass adoption but one method of scalability that is now being put into effect is the ‘Lightning Network’. Under this solution, much of the work will be carried out off-chain in private channels to avoid burdening the blockchain with too much data.

With a Lightning Network, blockchains would be able to process transactions at an unprecedented rate and for negligible fees, which would be of particular importance when examining their viability for IoT uses and micro-payments. Another effect of the Lightning Network would be to make payments nearly instant, as on-chain confirmation times would not be required to provide the security of the transaction. It is estimated that this method would enable millions to billions of transactions per second, minimal fees and millisecond processing times.

This type of solution, initially being investigated for the bitcoin blockchain, utilises something that the original blockchain is not known for: smart contracts. Whilst more limited in implementation than platforms such as Ethereum which were created to enable them, the bitcoin blockchain can run smart contracts. In the case of the lightning network it would involve using time locks and multi-signature addresses that could update balances in a network running off-chain.

Implementing a lightning network would require two parties to open an account between each other with an amount of bitcoin distributed between the two of them. The amount and its distribution is not particularly important although both parties will obviously need to have the funds available and it should be enough to cover the transactions they anticipate carrying out. For example, if I was purchasing train tickets I might allocate enough funds to cover a month of my expected train fares or, if it was between a friend I might deposit enough for a few rounds in a pub (although if I was in London that might end up being as much as my previous train fare sum).

Regardless of what the funds are used for, they are stored in a two-party, multi-signature channel, the opening of which is recorded on the blockchain. Following this, the balance is kept off-chain and updated between the two parties who sign off on the new balance whenever a new transaction between the two of them takes place. The only time that the blockchain will need to be involved again is when the participants, or one of them, wishes to close the channel and claim the balance they are due (with safeguards in place to ensure that only the latest, correct balance is submitted).

This, in and of itself would have been a good way of removing some of the strain that the blockchain experiences, but the real power of the lightning network lies in its ability to connects these multi-signature channels off-chain. The idea behind this lies in the ‘Six Degrees of Separation’ theory, which states that everyone can trace a path to any other person via (supposedly six) steps that go through acquaintances. Whilst the number of steps may not be the same for every person, research has shown that the average number of links it would take is between six and seven, and this fact will leveraged to allow users of the lightning network to make payments via a chain of other multi-signature channels. This means that payments should be able to be made off-chain with anyone in the network and would reduce the need for the blockchain to be updated from every transaction to only when a channel was closed - drastically increasing the scalability.

One group that is working on this new technology is Lightning Labs, developers of open-source Lightning Network Daemon (lnd), which has recently released the lnd 0.4 beta. With this version, Lightning Labs has provided a lightning network which is able to be run on the Bitcoin mainnet - a solution that can be used in the real world. Serving as a starting point for using the lightning network, the developers hope that people who want to create lightning-based decentralised apps and technical users will use the network, but have cautioned that only small amounts of currency should be used in this early version.

One particularly interesting feature of the ldn that is set to provide increased functionality is called ‘Atomic Multipath Payments’ (although if it isn’t nicknamed ‘Forked Lightning’ I’ll start a riot!). This would allow a user’s transaction to be split into smaller transactions and routed through various different paths to be combined at the final destination, reducing the amount of currency that the multi-sig channels would need to have available to be part of the path and therefore reducing the strain put on the intermediaries.

Such potential to scale blockchain technology is gathering a lot of interest: Bitcoin, Litecoin, Stellar and Ethereum (in Ethereum Raiden) are all looking to introduce a version of the lightning network with Bitcoin seemingly ahead of the game at the moment. 2018 is likely to see a general release of a lightning network and the related benefits to cryptocurrency and blockchain solutions, but further down the line, cross-blockchain functionality is a major goal so improvements and developments on one blockchain could benefit all.

- By Matthew Warner