A Brief Overview of the Lightning Network and How it Will Help Bitcoin Scale
I currently have 0.2 bitcoins sitting in single wallet that I cannot move.
I accumulated these coins over the last few years through services like A-Ads and Freebitco.in, receiving many small payouts. Unfortunately, in order to move those coins, my wallet has to sign off on each one of those deposits before sending them where I want them to go. Each one of those signatures becomes data that must be included in the transaction. And since fees for the transaction are calculated based on how much information they pack in, the cost of moving these coins, currently valued at about 3,000 dollars, is nearly … 3,000 dollars.
Damn.
There sit. … Untouched.
Hopefully, one day the number of unconfirmed transactions will fall to a point where I will be able to sneak them out for ‘only’ a couple of hundred bucks. But until then, … there they sit.
The reason for this situation is that the current crew of Bitcoin’s developers have decided that it is better to keep the throughput of transactions small. They calculate that it is better to keep the amount of data included in each block of the blockchain small enough that it can be transmitted quickly. They believe this will ensure that the network can stay large and dispersed, improving Bitcoin’s ability to stay resistant to attack from governmental or other players who may want to attack it.
What this means is that Bitcoin will become either a largely untouched means of storing value (kind of like heavy gold bricks locked in a vault) or other ways of transacting will need to be built that don’t rely directly on the Bitcoin blockchain.
For a long time, I have been hearing about the development of the Lightning Network, if it works as promised, will return to Bitcoin the promise of being a daily currency as well as store of value. Being non-technical, though, I have been having a lot of trouble understanding how this works – and even it is supposed to work in a way that I want.
After trying to do a deep dive on this, here’s my current understanding of what Lightning is supposed to be and how it is supposed to work:
What is Lightning?
Basically, Lightning is a way of creating a prefunded wallet between two people (or to use the technical jargon, creating a payment channel).
Let’s imagine that a payment channel is like an envelope full of money. For example, if I know that in one month I spend about 300 dollars at my local coffee shop, I can put 300 dollars in an envelope and seal it with both the coffee shop and my signature over the seal. Then, the coffee shop and I can write any transactions we make on the back of the envelope. At the end of the month, the envelope will be opened and the money divided based on how many coffees I had.
Or, if I or the coffee shop choose, we can open the envelope at any time and the money will be automatically divided. In the case of the lightning network, all transactions need both my and the coffee shop’s signatures so no cheating is possible. But, either the coffee shop or I can choose to open the wallet at any time and have the money divided.
Since none of the transactions made on the back of the envelope need to be sent to the Bitcoin blockchain, only the opening and closing amounts, this can greatly lighten the load of transactions that need to be confirmed.
How is that a network?
If all Lightning did was create payment channels between two parties, it would hardly be useful, and based on many of the descriptions of the network, this is where I kept stuck based on all the descriptions of Lightning that I was seeing.
If I understand this correctly, when I create that envelope with the coffee shop, I can have them act as an intermediary with anyone else they are holding an envelope with. So, if while I’m having my morning coffee, I meet an aspiring musician selling her CDs and I decide to buy one, I can pay the coffee shop the ten dollars in my envelope and have them pay the musician ten dollars in hers. My envelope still has the original total, 300 dollars, and hers still has whatever amount it had when she created it with the coffee shop, but it will all even out when all the envelopes are opened.
This would all be happening automatically, of course. And it can happen over multiple hops: If the musician doesn’t have an envelope with the coffee shop, but she does one with another customer, then the payment will go from me, to the coffee shop, to the the other customer, to her.
Further, the coffee shop, or anyone acting as an intermediary, can set themselves up as nodes, or someone who holds and will transfer between many envelopes, for a small fee. The Lightning Network will automatically search for a payment route that will require the fewest hops and least fees.
How does this reduce the congestion on the Bitcoin blockchain?
In two ways. First, in order to get Bitcoin ready for Lightning, in August of last year a new feature called Segwit (segregated witness) was implemented. This innovation removes the necessity to include all those validating signatures in the Bitcoin blocks. They still exist and are necessary, but they are segregated, greatly lightening the amount that must be included in blocks. In fact, I was trying to move my 0.2 bitcoins from an old type of bitcoin wallet to a Segwit one when I discovered how much it was going to cost! If I consolidate payments to a single Segwit wallet, I will not have the same trouble.
Second, since none of the transactions that happen before the envelope is opened need to be confirmed by the Bitcoin blockchain, only the opening and closing amounts, then a tremendous number of transactions might not need to be broadcast at all. A lot of the transactions I received to build up that 0.2 were from just two sources, so using payment channels would be a great help.
What’s still to be done?
Lightning is already operational and has been used to send actual value on the Bitcoin network. Now that the basic functionality works, more testing needs to be done and user applications need to be created. This … may take some time.
But still, there is now light(ning) at the end of the scaling tunnel.