The Lightning Network Electrifies Bitcoin
When Bitcoin was first made known to the world, its design of being a new circulating currency to replace fiat was its most alluring aspect. It spoke to those who were looking at ways to "stick it to the man" every opportunity they got. It wasn't until much later that this idea was overshadowed by the narrative of a fixed supply, which gave rise to the stored value theory. In fact, of the many faults often pointed out by skeptics, not living up to its initial purpose of being a medium of exchange is its greatest sin. This is where it has Bitcoin supporters tearing their hair out and acting all blustery when confronted with it. "Someday," they said. "Someday, you'll see what it's really capable of."
That day came quietly, with nary a trumpet blaring, on December 27, 2017, when the first transaction made using the Lightning Network was made on the Bitcoin mainnet. This is a Layer-2 solution for the Bitcoin blockchain that promises to unshackle the chains of scalability it faces and empower it to live up to its true purpose: as a medium of exchange widely adopted by every sentient being on Earth.
In this article, we scrutinise this technology purporting to save Bitcoin's bacon in this realm. Follow us as we familiarize ourselves with its workings, the benefits it brings to Bitcoin, the risks and drawbacks and where it could lead us, perhaps with Twitter in tow, in the not-so-far future.
The Lightning Network (LN) was born to address Bitcoin's scalability problem. Faced with the blockchain trilemma of decentralisation, security and scalability, Bitcoin compromised on the last one in favour of the other two. Choosing this path gave Bitcoin the granite-solid foundation the project needed towards credibility in the technology itself. If I were to stack these three in order, decentralisation is the heaviest on the bottom, followed by security in the middle and scalability on the top. I imagine it would be far more difficult to improve on decentralisation versus scalability.
Currently, Bitcoin processes 5-7 transactions per second, about 10 minutes per block written to the chain, and that's just sad. Not only that, one has to pay more in transaction fees during busy periods and still wait for the transaction to go through. I won't even favor Visa or Paypal with a comparison on transaction speed. It's awful enough as it is. However, it won't be long when Bitcoin catches up with the LN charging ahead as its front.
What Is the Lightning Network?
The Lightning Network is a Layer 2 scaling solution that processes transactions away from the main chain, known as off-chain using smart contracts called channels. It sits on top of the main chain, hence the name Layer 2. By introducing this enhancement, its goal is to maximize transaction speed while also minimising the transaction fees involved. This technology works on any platform supporting smart contracts and multi-sig wallets, not just on Bitcoin! How can do that?
How It Works
Do you remember attending school assemblies? Every kid in school would file into the school hall and listen to what the principal has to say. Usually it's to make announcements, and maybe give out awards too. These assemblies can run on for quite a while and there will be a few of us that would be bored quickly. We'd then whisper or maybe text each other while the principal drones on and on.
The above scenario illustrates the relationship between the main Bitcoin blockchain and the Lightning Network. The school assembly is the main chain and the side conversations is what's happening on LN. Basically, not all transactions are written onto the main chain, because that's what's causing the slow speed. Instead, the LN processes the "smaller" transactions on their own, and informs the main chain the outcome of the process. Let's see how it would potentially work in real-life.
Whenever I move to a new neighbourhood, the first purchase I make is usually at the grocery store. Since I plan to be a regular customer with them, I will need to set up a payment channel with the store. This entails both parties having a multisig wallet. There are two components to it:
- public address - the digital location of the Bitcoin, kinda like an email address.
- private keys - the password for the public address, used to sign a transaction.
Both pieces of information are needed to complete a transaction. By setting a payment channel, I have become a node on the LN. This will be further explained later.
After sorting out the wallet, I deposit some Bitcoin into it, however much I think I will be spending there for the coming month. The payment channel is now established after the funds have been deposited. This is known as the funding or anchor transaction. This transaction is recorded on the main chain by the LN.
The subsequent purchases I make throughout the store will be deducted from the initial deposit amount each time I pay for something. These are microtransactions that happen within the channel and are processed instantly. It's like opening a bar tab, showing you have money to pay, but not paying until actual spending occurs.
When I move away from the neighbourhood, I'd stop being a customer at the grocery store. On the day I make my final purchase, I close the channel in a settlement transaction. That's when the LN will submit the final balance to the main chain. Therefore, all the transactions I've had throughout the entire period is processed on the LN instead of the main chain. Pretty nifty, right?
Well, the biggest drawback though is that the merchant can't touch the money in the channel until it's closed. I can't imagine the grocery store being happy to have a channel open with me for 5 years and not be able to use any of it during that time. The store will probably have some conditions like a timelock. It's an upper time limit on how long the channel can remain open. This is one of the LN's security feature to ensure both parties are available to transact with each other throughout the entire period. If one of the party is missing, the other side won't need to wait forever to get their money.
Sometimes, it's not very practical to set up a payment channel for every payment made. Say you got invited to a dinner party in which the only person you know is your friend James who invited you. When it comes time to pay the bill, Mary, one of the people in the group, says she's happy to pay the bill on behalf of everyone because she gets an employee discount. Each of us pay her back their share of the meal. It would be a bit of a pain for me to set up a channel with Mary because I might not see her again. However, James meets up with her regularly. Since I have a channel with James, I can pay Mary through him. In other words, a direct connection is not necessary as long as there is a mutual connection somewhere along the chain. James, I and Mary are all nodes on the LN.
It's almost like the 3rd degree connections on LinkedIn except in the form of making payments. P2P lending will never be the same! Aside from that, there are other possibilities too like:
- Affiliate linking to a whole new level. You could use the influencer as a node to pay for the product they're advertising. Perhaps the influencer can get a clip for each transaction done through them. This would greatly enhance the influencers' social media reach. It would also save the companies having to do the paperwork to pay them back too.
- Visiting tourists can pay for items through a payment channel set up by the tourism board for participating merchants. The board can earn a clip of each transaction in the process. The revenue can then be put back into the industry to promote tourism without touching taxpayer's money.
These are really pie-in-the-sky thinking because the transaction fees on the LN isn't a lot to begin with. Currently, it doesn't pay to be a node on the LN to make money because the amounts are miniscule. More importantly, there isn't mass adoption yet. In the future though, who knows?
The People Behind It
Before I get all starry-eyed thinking about the amazing changes it could bring to the future, let's backtrack a bit into the past and look at the teams working on it.
This project was first proposed by Thaddeus Dryja and Joseph Poon back in February 2015 in a whitepaper. The first transaction made on the LN was actually on the Litecoin network on May 10, 2017 by Christian Decker, from Blockstream. There are currently three teams working on the project, each coming out with their own version of a Lightning Network node written in different programming languages. Nevertheless, interoperability is considered in the design with potential for all these versions to co-exist peacefully with each other with no additional headaches for users.
Headed by Elizabeth Stark (no relationship to Tony Stark :P), Lightning Labs develop technology to enable the usage for the LN in the real world. The Lightning Network Daemon is their version of a LN node. Their other products are also geared towards the usage of LN in a variety of ways.
Since its inception in 2014, BlockStream has built itself up to be one of the major players in the blockchain technology and cryptographic sphere. They invest heavily in building crypto-financial infrastructure based on the Bitcoin blockchain. Their version of the LN is called c-lightning. The products they offer are extensive and slightly skewed towards the entreprise-level as that is their main target.
Unlike BlockStream, ACINQ puts the development of the LN as their primary focus. ACINQ node, based on the Eclair stack, is listed on their website as "the largest node on the Lightning Network". As recent as Oct 2019, they raised a total of USD10 million to grow the company and further their R&D in the LN.
LApps - what are they?
All three of the companies above are actively developing a series of apps on the LN to facilitate adoption for it. These LApps can be divided into three main categories:
Dev Tools and Integration
These are targeted at developers leveraging on the Bitcoin network to create metrics and APIs. The most well-known is Bitrefill, an app for refiling prepaid phone cards and gift cards for gaming, entertainment and travel with BTC and LTC.
E-commerce Plugins and Payments
If the wallets are a passive way to get people interested in the LN, the LApps in this section makes it easy for people to get hooked without even realising it. The most prominent LApp in this category is Strike. The start-up company was instrumental in getting El Salvador to adopt Bitcoin as legal tender and handles the Tip Jar in Twitter to transfer BTC or fiat from point A to B anywhere in the world using the LN. Strike's role with these two entities succeeded in generating interest for the LN, promoting adoption at the same time.
Security Measures and Risks for the LN
As mentioned earlier, the timelock is a security measure introduced to prevent channels being opened indefinitely with no activity. Aside from that, there's also:
- Asymmetric Revocation Commitments - when the channel is open, it is assumed that both parties sincerely want to transact with each other for the duration of the open channel. However, if one of them tries to cheat by leaving the channel suddenly without prior agreement from the other party, the cheater's balance can be claimed by the cheated user through this security measure. This is done by setting some conditions early on when establishing the channel.
- Fee attachment to node - it's possible to attach a fee to each node that gets passed through so that the complete payment will only be made when it reaches its final destination. This is to prevent transactions getting hijacked in the middle by unsavoury characters. I haven't managed to find a working example for this yet but it could become reality.
Despite these security measures in place, there are still risks inherent to the nature of the LN.
- The network can become too centralised - if people can pay through nodes without having to open a direct channel, then it's easy to imagine a handful of players worldwide letting 7 billion people be connected to each other indirectly. Scary, isn't it?
- Assymmetric Revocation doesn't work offline - it's only effective when the user is online on the network.
- No support for offline payments - it seems pretty reasonable at first glance but actually, there are times that the user might not have access to the network if they are in an area with poor Internet connectivity. When that happens, sorry, you can't pay using the LN.
- Good for small and mid-size transactions, iffy for large-scale transactions - most of the transactions on the LN are microtransactions. If it's a big one, it may require a bit of a wait, whereby both parties need to be online at the same time. The minute one of the party leaves, the transaction gets cancelled.
Taproot and the Lightning Network
There's another risk involved but it's more on the Bitcoin blockchain side rather than on the LN side.
We mentioned earlier that the LN works with multi-sig wallets. When it opens and closes a channel on the blockchain, this information is visible. These transactions show up differently than a single-sig transaction. This is a vulnerability because these LN transactions are easily identified, thus susceptible to bad things happening to it, not to mention taking up space on the blockchain.
Recently, Bitcoin underwent an upgrade to the blockchain software, commonly known as Taproot. This upgrade included three proposals, one of which, BIP341 aka BIP-Taproot, specifically deals with this situation. With the implementation of this proposal, the multi-sig transactions are masked to look like single-sig ones. The difficulty in identifying them helps to secure the safety of the transactions done via LN.
However, this proposal itself cannot be implemented unless BIP340 aka BIP-Schnorr is completed beforehand. This proposal allows the Bitcoin blockchain to aggregate multi-sig transactions into single-sig ones, reducing the transaction size. It also allows for transactions to be verified in batches.
Lightning Network is truly a game-changer for the Bitcoin project. While we're nowhere near having a crypto currency be used in place of fiat, projects like the LN bring Satoshi's vision of a decentralised currency in circulation one step closer to reality. Despite the risks currently present, I believe that with further development and research, it can only get better.
Disclaimer: These are the writer’s opinions and should not be considered investment advice. Readers should do their own research.