How The Lightning Network Can Help a Sluggish Me

Nonse Odion
4 min readJan 22, 2019

It’s 7:45 in the morning, am in a hurry to work and I have not yet had my breakfast, today is going to be a bad day if I don’t. There’s no cash on me but I have some bitcoin in my wallet. Although the local restaurant does not accept bitcoins, imagine if they did. Well, I still wouldn’t be able to buy a breakfast I can take on the go because, I would have to wait for 10 minutes for my transaction to be added to the blockchain and another 60 minutes for 6 confirmations to show my payment is legit and maybe not a double spend. What can I do? Nothing, I just go hungry to work on an empty stomach and hope my boss does not get angry with me for being sluggish. Don’t blame me I love food a lot and when I don’t get it I get sluggish.

I thought about the new technology which would prevent me from going to work on an empty stomach it was the lightning network. Just as the name suggests it takes one thing from natural lightning which is what the blockchain needs at the moment this was its speed. You know how fast lightning is now, imagine that speed being exhibited by the blockchain it would be paradise at least in the speed of transactions.

Let’s call the storekeeper of my favourite local restaurant Alice, I just want a light breakfast nothing much it would do the job perfectly. We initiate our transactions with an opening transaction by sending funds to a 2-of-2 multisig address. This opens a payment channel between the two of us. We then start transacting. The price of a good meal for me is 1 bitcoin. I create a pre-image x, hash it to produce H(x). I include this hash in a transaction which sends 1 + all
of Alice’s initial funds to her address and the remainder to me. Alice does a mirror transaction with a diferent pre-image we then exchange our transactions and H(x)s.

When creating the transactions we make use of a special contract called a Hash Time Lock Contract (HTLC) it employs hash locks and time locks to protect and secure the funds of each participant. After I collect the breakfast I might still order for more. This will cause us to update the payment channel state by creating another transaction that sends 2 + Alice’s initial funds to her address and the remainder to me. But, before we do that we exchange the pre- images of the former transaction. Before leaving I or Alice can decide to broadcast any of our transactions which we have stored locally to the blockchain. I decide to broadcast it and I can’t claim my funds immediately I am constrained by the time lock from claiming my funds immediately but Alice can claim hers. The time lock makes use of to specify the period of time after which I can claim the funds but if she knows the pre-image of the transaction that I broadcasted to the blockchain she can claim my funds for herself. She can only do this during the time offered by the timelock. If I want to prove smart and send myself a higher quantity of funds than the current transaction state of the payment channel by sending an old transaction which ofers that, Alice can sweep all the funds since she knows the pre-image remember we have already exchanged them. I wouldn’t want to do that anyway I love my funds and can’t risk being sluggish tomorrow so I broadcast the current transaction. During the timelock she doesn’t know the pre-image so she can do nothing to my precious funds. The HTLC is the contract which makes this possible.

But, each payment channel can be linked together to form the lightning network. When I get to Alice’s shop I most probably would have a channel open with my workplace and she might also have one with my workplace. If this is the case there is no need for an additional channel between me and Alice we just employ the route connecting the two of us. Alice creates a hash H(x) from a pre-image, x and sends the hash to me. I then tell my workplace I’ll give 2 bitcoins in exchange for x. Let’s call the accountant over there Bob. Bob tells Alice he’ll give her 2 bitcoin in exchange for the pre-image. She gives him the pre-image and collects the bitcoin. Bob then shows me x and I believe it’s the real deal and give him the 1 bitcoin. All these interactions are done with HTLCs and the timelock decreases with each hop(intermediaries) along the route. This is to give Bob enough time to transact with Alice and give me the pre-image before the first timelock between me and Bob expires.

With this concept we can carry out micro transactions on the blockchain because of its speed and low cost to process transactions. The speed is attributed to the fact that no matter the number of transactions that occur in the payment channel we only broadcast 2 on the blockchain the opening and closing transactions of the payment channel. This reduces network congestion and gives the miners time to attend to more transactions.

The lightning network does not work for the Bitcoin blockchain alone but can also be present in any blockchain which employs the underlying code of the bitcoin blockchain. Even Ethereum has its own version called the Raiden Network. A company which has employed the lightning network in its services is Bitrefll, they offer the service of recharging your phone line with cryptocurrencies.

While I sit and recharge my phone line with bitrefll, I know these days of being sluggish at work would soon come to an end I could even pay for my bus fare with crypto and give the angry bus conductor a tip with it. Finally I would say a sluggish me exists no more.

--

--