In today’s post, we present a high-level overview of the Lightning Network. We’ll also walk you through making a lightning purchase using the Éclair wallet on Android.

Introduction

Bitcoin is more than a digital currency; it is a protocol for sending value over a peer-to-peer network. The protocol allows for on-chain transfers of Bitcoin between a single sender and single recipient. This is your straightforward “Alice pays Bob 1 BTC” transaction. Most Bitcoin users have sent simple on-chain transactions in order to pay for goods and services, or to move Bitcoin from an exchange account to a private wallet.

Sophisticated users may be familiar with more complex Bitcoin transactions, such as multi-signature (multi-sig) or time-locked transactions. Multi-signature wallets can be set up so that Bitcoin can only be spent if two specific signatures are used to sign a transaction. Think of a joint bank account, where both you and your spouse need to approve of a transaction before the funds can be released. Time-locked transactions also require special conditions to be satisfied before Bitcoin can be sent. For instance, a transaction may require a certain amount of blocks (or time) to pass before a transaction is considered valid. These special conditions are part of what makes Bitcoin “programmable money”.

While multi-sig and time-locked transactions may seem relatively simple, they actually allow for much more complex payment solutions than stated in the examples above. One such solution under development is the “Lightning Network”.

What is the Lightning Network?

The Lightning Network is a “second layer” payment protocol that operates on top of the Bitcoin blockchain and allows for near-instant, incredibly cheap Bitcoin transactions. The Lightning Network is a mesh of nodes connected through a network of bidirectional payment channels.

In order to transact on the Lightning Network, a user must open a payment channel by committing a funding transaction on the Bitcoin Blockchain. Once a channel is funded, the user can transact with other lightning nodes indefinitely, so long as their channel is funded. Once the user is finished with their transactions, they can close the channel by sending a close-out transaction on the main Bitcoin blockchain.

Let’s walk through an (imperfect) analogy. Lightning works a lot like a bar tab. If you’re planning to post-up at the bar and double-fist ice-cold crispies for a few hours, it doesn’t make sense to pay each time you get another round. If you’re paying in cash, this would require the server to get correct change for each transaction. Worse, if you’re paying with credit, the server would need to run your card and get a signature every time. You want to drink without interruption, but the bar owner wants to make sure you don’t run off with a free buzz, so what do you do? You open a tab.

When you open a tab, the bartender will keep track of what you’re drinking, and you won’t pay until you decide you’re done for the night. In order to prevent getting stiffed, the bartender may keep your credit card or even your identification. If you forget to close your tab, the bartender will charge your account for the drinks and likely give himself a fat tip, and you’ll have to take the walk of shame the following morning to pick up your cards and what is left of your pride.

When you start your tab and hand over your credit card, you are effectively opening a payment channel. The bartender keeps tabs on how much you owe, and updates the state of your payment channel every time you order another beer. When you’re done, the bartender swipes your card, you add your tip, and you close the tab and close your payment channel. In addition to being efficient, there is only a small amount of trust involved. Once the bartender has your card, the bar is more or less guaranteed to get paid. You can check the tab at the end of the night and ensure that you’re paying the correct amount. If the amount is wrong, you’d likely have to talk with the owner. If the two of you still disagree on the amount owed, you may need to take the complaint to your credit card company.

With the Lightning Network, you open a channel by sending a Bitcoin transaction on the Bitcoin blockchain, and commit a certain amount of funds to a lightning channel. Once funded, you can transact with anyone on the Lightning Network that shares an open channel with you. You can transact indefinitely until you are finished or out of funds, then post a closing transaction to the blockchain. The Lightning protocol uses a combination of smart contracts, time-locked transactions, multi-sig addresses, game theory, and more to ensure proper routing and payment. There are many great resources that explain the network in detail, but the main takeaways are as follows:

Lightning allows for instant, cheap transactions. Security is enforced by blockchain smart contracts, without creating on-blockchain transactions for individual payments.

The Lightning Network will not only save you a few bucks if you transact frequently, but it effectively allows for non-linear scaling of Bitcoin in general. If enough consumers/merchants use Lightning, Bitcoin will be capable of Billions of Lightning transactions per second. The implications of this statement are massive. Not only can Bitcoin scale better than traditional payment systems like Visa, Lightning will allow for “streaming money”, machine-to-machine micropayments, and other solutions that have no yet been envisioned.

So, can the average Joe buy stuff on lightning right now, or is it vaporware?

Using the Lightning Network

Joseph Poon and Thaddeus Dryja wrote the initial Lightning white paper a couple of years back. The specification was announced after the white paper, and it is currently under development by multiple parties (Elements Project, Lightning Labs, and ACINQ). For all intents and purposes, Lightning should be treated as Alpha or Beta-level software that is not ready for public release. If you decide to open a lightning channel, only aamount should be used at this time, and you should

That being said, Lightning is live on mainnet Bitcoin and you can fund a channel and make real-life purchases right now! In fact, Bitconsult just made a purchase from the Blockstream Store, and we’ll walk you through the process step-by-step.

Step 1 – Download the Éclair Wallet for Android

Step 2 – Create a Bitcoin Wallet on Éclair

Éclair is a Bitcoin + Lightning wallet developed by ACINQ. For this demo, Bitconsult is using a Google Pixel running Android 8.1.0. To get the app, head on over to the Google Play store and search “Éclair Wallet” by ACINQ. There’s a Testnet version available, but we want mainnet for this demo.

The Éclair app serves as a Bitcoin wallet and also allows you to create Lightning channels. If you’ve created a Bitcoin wallet before, you’ll be familiar with the process. Follow the on-screen instructions to create a wallet. You’ll be given a 24 word phrase. This phrase is used to recover your on-chain Bitcoin funds. You’ll also be asked to create a 6 digit pin to and access your wallet in the future. Write the recovery seed and password down and store them in a safe place. As always, don’t take screenshots of the recovery phrase or store it on a computer. Once you’ve written the phrase down, you’ll be asked to confirm some of the words.

Step 3 – Fund your Bitcoin Wallet

Step 4 – Open Lightning Channel

Click the “Your Bitcoin Address” tab to see your address (segwit, yay!) and QR code. Fund this wallet with Bitcoin. I’d suggest funding the address with .01 BTC (about $80) or less. Again, be prepared to run into an issue and potentially lose all of your funds when using this BETA software.

After a few confirmations, your Bitcoin will appear in your Éclair wallet. You’ll see your BTC balance update at the top of the screen and the transaction should appear on you “transaction history” tab. All on-chain Bitcoin transactions will appear with the Bitcoin “B” symbol in orange on the left side of the screen. Once your funding is confirmed, head to the “Lightning Channels” tab and click the plus sign. Here, you’ll have to designate the lightning node that you’d like to open a channel with. In order to transact on Lightning, your channel needs to be connected to the node you are trying to pay. You can head over to a lightning explorer to find a well-connected lightning node. However, for this tutorial, you should use the Blockstream Store’s node. To do this, select “Scan a node URI” and use the code below:

This is really the only semi-difficult part. I searched google and the Blockstream site for the Blockstream Store URI but couldn’t find it for my life. So, I opened channels with some well-connected nodes but was not able to get my payment to Blockstream. So, I resorted to twitter, where @notgrubles was kind enough to send me the information and QR code.

If you want to connect to a different node, check out a lightning explorer like #recksplorer. Don’t forget to stop and admire the network.

Step 5 – Checkout on Blockstream

After a couple of confirmations, the channel should show “Normal” in the Éclair app. Note that you’ll need to pay a BTC transaction fee and commit funds to open this channel.

Now that your channel is open and funded, head on over to the Blockstream Store and fill your cart with goodies! The Blockstream Store accepts Lightning payments. In fact, it’s the only way to currently pay for items at the store. Once your cart is full, proceed to checkout and you’ll be given a QR code to scan for payment.

Step 6 – Close the Channel (optional)

Scan the code and BAM! Your browser and Éclair app will update in a fraction of a second showing that your payment has been made. You can now see the lightning transaction on the Éclair “transaction history” tab next to a cool lightning icon. You can click on the transaction for some more info, including the routing fee. My transaction had zero fees!

Now, you can decide to close the channel or keep it open. Obviously, it doesn’t make much sense to post on-chain transactions to open and close a lightning channel so that you can make a single lightning payment. But if you wish to, you can click your channel on the “Lightning Channels” tab and click “close channel”. After a few confirmations, you’ll see a new Bitcoin transaction in your “Transaction History”. Your BTC wallet balance will update, minus a miner fee.

Alternatively, you can leave the channel open and receive payments, or spend your remaining BTC on VPN or other services!

Considerations and Drawbacks

The Lightning Network is currently front and center in the Bitcoin scaling debate. Big-blockers are convinced that Blockchains can scale simply by increasing the blocksize when more capacity is needed. Small blockers are convinced that more elegant solutions like SegWit, Schnorr Signatures, MAST and Lightning Network will allow for exponential scalability that can truly compete with and ultimately outperform legacy payment rails.

Those who argue that LN is too complicated for ordinary users are being short-sighted. When the Lightning Network went live in December, it was too difficult for many users (including me) to use, even with a guide. However, in just a couple of months, ACINQ has put out this incredibly easy to use Eclair wallet. While the software and protocol are certainly not ready for mass adoption at this time, developers are working around the clock on UI and user improvements.

Is Lightning the end-all-be-all solution for Bitcoin? No. I like to think of lightning as a complementary payment option. With fiat, I’ve got cash in investments, checking accounts, and my wallet, all with varying degrees of liquidity and security. I see Lightning serving more as the cash in your wallet for the short term. You can hit the ATM, pay a fee, and have a wallet full of cash for small purchases in the physical world. Online, you’ll open a lightning channel, pay a fee, then transact with little to no fees until you need to top up your wallet again. Eclair has already made the wallet pretty seemless, putting the BTC wallet and lightning channels in the same app. I wouldn’t be surprised if Bitcoin wallets are soon available which totally hide the lightning back end from the user.

Conclusion

The Lightning Network is an incredible idea that is just getting started. The inner workings are beautiful and complex, and you should certainly learn more about exactly how LN works, beyond this quick intro. If this article helped you pick up those beautiful stickers, leave us a comment below.

As always, contact us if you have any questions about Bitcoin, Lightning, and more!

Share this: Twitter

Facebook

