Lightning Network: Solution to Bitcoin scalability problem

If you’re new to Bitcoin, then I recommend reading my blog Friendly Beginner’s guide to Bitcoins. In this post I wanted to write about the Bitcoin scalability issue and Lightning Network. If you do a quick google search, you will find that Bitcoin decentralised network can do a maximum transaction of 7 transaction per second whereas Visa centralised network can do 47,000 transaction per second. As more people are experimenting with Bitcoin there is/will be increase daily transaction volume and network fee(you check hourly transaction volume and network fee updates here). So how a decentralised trust-less open network like Bitcoin will scale? What is the road map of the community to the Scaling issue and rising network fees?

Existing Scenario:

Let’s see how transactions are done in bitcoin. In Bitcoin, when a transaction takes place it is broadcasted to the blockchain. Before transactions is validated by the nodes in the network by achieving consensus on the Blockchain, each node in the network must know every single transaction that has occurred globally. This puts a lot of load on the blockchain nodes to verify each transaction happening in real-time globally.

As a part of scalability solution, SegWit was proposed and implemented in 2017. SegWit helps to optimise the Bitcoin transaction speed and fix transaction malleability. However at a time of unprecedented surge of interest in bitcoin, exchanges like Coinbase, Blockchain.info are stalling SegWit implementation and has contributed to the Mempool being inundated with request. (Recently Brian Armstrong has confirmed that Coinbase will be implementing Segwit, Batching of transaction.) Although SegWit can alleviate the scalability and network fee problem, its not a proper 100% fix.

Work around:

Before I go into lightning network, I wanted to share some ways to circumvent high network fees. Bitcoin is fairly Anti-fragile as a ecosystem and you can try the below two ways to avoid paying high network fees.

a. Batching your Bitcoin payment can save upto 80% of the fees. Here is an excellent blog by David A. Harding .

b. Using Segwit enabled wallet can reduce the transaction fees. Hardware wallet like Trezor supports segwit by default and also enables users to select low fees(One caveat is that low fees transactions takes longer confirmation time).

Is there a Bitcoin Civil War?

Many click bait articles describe the Scaling divide as a Civil war. Although its tempting to see this divide through political lens, the divide is primarily a philosophical divide on how to scale Bitcoin and its future. There is two major outlook on how to scale Bitcoin. One is the off-scaling and the other is on-scaling.

5774303d1ad43.jpg

The term “on-chain scaling” is frequently used to exclusively refer to increasing the blockchain capacity by means of bigger blocks. If you are using “on-chain scaling” logic, you need to increase the block size to nearly 8GB to match visa transaction per second. However increasing block size will lead to centralisation of mining as only few actors will be able to afford to mine (which will lead to more centralisation problems and ecosystem will become more susceptible to different forms of attacks) and lose the decentralisation aspect of Bitcoin .

The term “off-chain scaling” refers to approaches that increase the utility of the network without touching the blockchain. It was the preferred approach to the scaling problem by the core developers since as early as 2010 (see post from Hal Finney below). Lighting network is “off-chain scaling” decentralised proposal where transfer of value(including micro-payments) occurs off-blockchain between untrusted parties.

DTBvSiNW4AAlg9m.jpg-large.jpeg

Lightning Network:

Lightning Network builds an additional layer on top of the Bitcoin network that enables instant off-chain transfer of the ownership of the Bitcoin. The transaction inside the lighting network are not broadcasted to the bitcoin network as long the channel is open(in order to reduce the load on the blockchain).

In some sense, Lightning Network is kind of smart contract where participants sign a contract the transactional balance in the multi-signature account.

Lightning Network utilises bi-directional payments channels that consist of multi-signature address. Meaning Bitcoin will be held in a multi-signature address where transaction will use a multi-sign address as their input and point at two different address as their output.

shutterstock_175229378-e1503589862779

Is Lightning network transaction same as Bitcoin transaction? Yes. Let’s get back to some basics. When transact with Bitcoin, you are not transferring any coins over the network. Technically you are using your private keys to digitally sign your transaction on the Blockchain. Likewise in Lightning network you use a double-signed message to transact which is eventually broadcasted to the bitcoin network when the channel closes.

How does it work?

Transferring fund to LN requires a confirmed transaction on the Blockchain. Let’s take an example of Alice & Bob where they transfer 1 BTC each other .
1. Both Alice & Bob transfer 1 BTC into a shared multisig address.
2. A “Balance Sheet” is created where 1 BTC is paid by Alice -> Bob and 1 BTC is paid by Bob -> Alice.
3. In the above transaction, Alice signs the transaction and gives to Bob and vice-versa.
4. Either Alice or Bob can sign their counterparts payout transaction and broadcast it to the blockchain at anytime.
5. Now Alice will update the “Balance Sheet”as 0.5 BTC to Alice and 1.5 to Bob and send the payout transaction to Bob to sign and vice-versa.
6. To ensure neither Alice or Bob revert to the old transaction, each will create an ‘anti-cheat’ transaction. This will invalidate the old “Balance Sheet”.
7. Alice and Bob can consensually close the channel and broadcast the transaction to the blockchain. Or if one of them becomes malicious, either party may immediately close out the channel and broadcast the most recent “Balance Sheet” to the blockchain.

Note: You can’t spend more than what is available in the open channel.

How to transfer to a new third party via Lightning Network?

Now imagine a scenario where Alice have to pay .1 BTC to Dave. However, Alice & Dave don’t have an open channel in Lightning so how do they transact? Opening a payment channel with everyone can be tedious and transferring via Blockchain may incur more network fees. Here Lightning Network makes use of existing payment channels using the idea of ‘Six degree of separation’ to make these types of transaction possible.

We already know Alice has an open payment channel with Bob. Suppose Bob has an open payment channel with Charlie who has an open payment with Dave, Lightning Network makes use these existing payment channel to make these transaction.

Alice -> 0.1.01 BTC -> Bob -> 0.101 BTC -> 0.101 BTC Charlie -> 0.101 Dave

What would happen if the transaction is failed from Bob to Charlie? These payments has to work either completely or the entire transaction will be reverted back.

Things you should know before you put your funds in Lightning Network:

  1. Lightning network is a “Hot Wallet” which means your wallet is constantly connected to the internet.
  2. Before you transfer your funds to the lightning network, make sure you keep a enough portion of your Bitcoins in cold storage. As your funds will be ‘locked up’ in the channel to enable to your day-to-day transactions.

What does Lightning Network mean to Bitcoin?

Lightning Network potentially opens a lot of new use cases for Bitcoin.

  1. Instant transaction: Yay! Its possible to pay for your coffee in milliseconds to seconds.
  2. Lower fees: Low network fees or nearly fee-free transactions.
  3. Micro-payments: You can pay literally in satoshi or one tenth of a dollar for your the service which you use. This can potentially open new avenues of services in the economy.
  4. Financial Smart contracts: By moving the transactions off the blockchain, it is possible to implement complex time-sensitive financial smart contract.
  5. Cross-chain payment: Alice has Bitcoin, Bob has Litecoin & Bitcoin and Charlie has only Litecoin. Alice can pay Charlie without understanding litecoin consensus rules.

Recommended
1. https://www.youtube.com/watch?v=rrr_zPmEiME

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

Bitcoin donations are accepted :

1LfRFcXacYdeB9efsn4B7F6Gh2RfWWq8WL

screenshot_20180111-214222_015800933409217051024.jpg

Advertisements