A Blog by Expatriotic

Lightning

Lightning - A Layer Two Solution

What is the Lightning Network?

The Lightning Network is a second-layer solution for Bitcoin that allows for faster and cheaper transactions. The Lightning Network operates on top of the Bitcoin blockchain and enables users to transact without having to wait for transactions to be confirmed by miners on the main chain. It achieves this by opening payment channels between two parties, allowing them to transact with each other without the need for every transaction to be broadcast to the main chain.

How Does the Lightning Network Work?

To use the Lightning Network, users need to create a payment channel with another user or node. This payment channel is essentially a smart contract that is executed on the Bitcoin blockchain. Once the payment channel is established, users can send and receive funds within the channel without incurring any transaction fees.

The Lightning Network uses a concept called HTLCs (Hash Time-Locked Contracts) to ensure that transactions are secure and cannot be reversed. HTLCs are smart contracts that lock up funds until certain conditions are met. For example, a transaction may be locked until a certain time has passed, or until a certain condition has been met. Once the conditions are met, the funds are released to the recipient.

Channel types

There are two types of Lightning channels: private and public. Private channels are more secure because the parties can establish the channel's terms and conditions, while public channels are open to anyone on the network, increasing the risk of interference. Private channels also offer greater privacy, while public channels offer greater liquidity and faster transaction times. The choice between the two depends on the parties' specific needs and preferences.

Challenges of the Lightning Network

The Lightning Network requires users to be online to use it. This means that if one party goes offline, the payment channel is closed, and the funds are returned to the users. This can be inconvenient for users who may not always be online. Some get around this by using custodial solutions or wallets like Phoenix, Breez, Blixt that can help facilitate receiving txs even if your phone node is offline.

Phone vendors make my life hell, yes.
What we're planning to do is instruct users with help of DOKI lib, that brings up https://t.co/EjIWYBAgIM so the user can fix their vendor's shenanigans.

In any case, Lightning Box is supposed to custodial if wallet is not online.

— Hampus (@hampus_s) February 27, 2023

Privacy

When a user receives a Lightning payment, the information about the transaction is more likely to be linked to their identity on the Bitcoin blockchain than if they were to send a Lightning payment. This is because the recipient's Lightning payment channel is linked to their on-chain Bitcoin transactions, which can be analyzed by anyone with access to the blockchain. To address these privacy concerns, users can use VPN or Tor to hide their IP address and route their payments through multiple nodes to obfuscate the payment's origin and destination.

From a privacy perspective, private channels offer greater privacy as the transaction details are only visible to the parties involved in the channel. This reduces the risk of doxxing and surveillance by third parties. In contrast, public channels are visible to anyone on the network, reducing privacy and potentially exposing sensitive information about the parties involved in the transaction.

pleb challenges the internet to trace their lightning history.

gets rekt

people have so many misconceptions about privacy on lightning network and drop their guard. Bitcoiners on social media are continuously doxx their bitcoin thinking they are perfectly protected. https://t.co/UBQQ4FvuYf pic.twitter.com/5cWIsUYxhN

— ᴜɴᴛʀᴀᴄᴇᴀʙʟᴇ 🧙🏻‍♂️ (@DontTraceMeBruh) March 26, 2023

Although it's above my level of understanding, it seems that there are methods to be more private with Lightning. Blixt dev Hampus is shown below proving that his setup with his mobile phone Lightning node/wallet has better privacy than the @BTCLiotta04 in the OP.

Not without more advanced tools, no 🙂

You seem to be using Blixt without any announced channels at all (good choice!) and the only route hints in the invoice are for the public Blixt node.

Also love this "hampz: Good luck" 😄

— Seth For Privacy (@sethforprivacy) March 27, 2023

My journey

For the longest time I've not used the second layer solution for Bitcoin known as the Lightning layer. This is mainly due to criticisms from communities like The Sovereign Bitcoiner telegram group channel and Samourai Wallet/Dev's opinions on it regarding privacy concerns (mostly as a receiver).

With this recent high fee environment where people are paying 500-2000 sats/vB to get their transactions confirmed within the next block, 400,000+ unconfirmed transactions, 1 GB+ mempool, mempool purging transactions with "only" 16 sats/vB miner fees, "BRC-20" token minting, ordinals, taproot etc. I thought I might need to rethink my position.

Now, in this journey, there are a few heroes. They are: RoboSats, Tor Browser, Phoenix Wallet, and Blixt Wallet (with dev Hampus at the helm. Congrats on receiving $25,000 from the HRF!!), and even a brief appearance by Wallet of Satoshi (more on that later).

Grant #9: $25,000 to Hampus Sjöberg (@hampus_s) for @BlixtWallet, a non-custodial open-source Bitcoin and lightning wallet

Funding will support Sjöberg’s efforts to improve the user experience and performance of the Blixt Wallet on iOS and Android⚡

— Alex Gladstein 🌋 ⚡ (@gladstein) May 9, 2023

Now as a proponent of buying your bitcoin without giving up personal information to an exchange (KYC) such as passport, social security number (USA) etc., I first started out with Peach Wallet. In fact I avoided RoboSats because I had no interest in Lightning. Mind you this was in a low-fee environment where I could send an on-chain tx for less than 10¢.

Now please don't get me wrong, I'm not suggesting that during high fees, Lightning is perfect. Even staunch ⚡️ proponent and dev Hampus understands this.

Lightning completely ceases to work if in a high fee env.

Because HTLCs below the dust limit won't be possible settle onchain. So if the txfee is $100, it means every payment under $100 will be trusted & insecure.

We need to talk about scaling. Not playing around with ordinals. pic.twitter.com/b8BwWMZ8sK

— Hampus (@hampus_s) May 2, 2023

However, when people are paying 500-2,000 sats/vB (virtual Byte) to get onto the block, I'd definitely rather be transacting on the second layer.

My experience thus far has been to use RoboSats. I've used it via the Tor browser on a MacBook, as well as recently on their android app on a LineageOS OnePlus T. Both experiences were excellent. The order book is intuitive and easy to use. I simply selected my payment method and locked some sats in a contract. Now, since I didn't have any Lightning sats, I actually had a friend in TSB telegram group lock them for me. I then paid him back double towards his project that he's developing once I got the sats.

Once I had 2% of the tx locked, I needed to take a Lightning app and make an invoice for the amount of sats I was purchasing. I used Phoenix Wallet for this (although their spambot somehow blocked me from speaking in their tg chat), but in the future I'm looking to switch to Blixt Wallet as it allows for more control over your channel management. Something that I admit actually scares me, but I want to learn.

Since starting I've had 5-6 P2P txs utilizing RoboSats over Tor and for each of them Phoenix Wallet had to open a new channel for me, costing around 10,000 sats a piece. So keep that in mind, that while Lightning txs are cheap, opening channels on the fly in a high fee environment isn't.

There was one dud moment where I spent 2 hours trying to get the unlocked funds into my wallet. I tried with Phoenix, Breez, and even Wallet of Satoshi.

I worked with the maintainer of 🤖RoboSats⚡️ Reckless Satoshi and he was able to identify the problem. It appears that the default fee wasn't sufficient for the wallets and I had to tick the advanced box and up the fee from 1,000 ppm to 1250 ppm. He confirmed in a DM over telegram that the funds finally went through to WoS at 1120 ppm. I then of course removed them from Wallet of Satoshi into my Phoenix Wallet.

And that concludes my shenanigans with Lightning for now. There's a lot to learn, and I can't wait to dive in. Luckily as I write this, the fee environment for the mempool is already cooling off. You can get into the next block for only 35 sat/vB (as opposed to 500 sat/vB or more during the initial craziness of the BRC-20 minting). ___

Subscribe (check your spam!) | RSS feed | Twitter | Donate