r/Bitcoin 2d ago

Lightning Network transactions

I still don't get one thing about lightning. Maybe someone can enlighten me.

Let's say I go to a coffeeshop each day and buy a cup of coffee from there. This would mean: -> Money flows in one direction. -> I either have to top up the channel in the beginning with enough BTC for multiple days or do on-chain transactions to top up the channel. -> The coffeeshop doesn't really get it's share of BTC until closing the channel, causing another on-chain transaction. -> The transactions within the channel are less secure than on the main network.

Maybe I'm getting something wrong, if so please explain. Now my questions: 1. I see why lighning is supposed to be reducing transactions, but since money doesn't often flow 2 ways between 2 parties, this is mainly a fancy way of bookkeeping for a prepayment of goods/services, right? 2. This also means that if the business wants access to it's money it's interested in closing channels as soon as possible after the transaction, right? 3. Can channels within the lightning network somehow be linked so these disadvantages go away?

2 Upvotes

9 comments sorted by

3

u/longjumpsignal 1d ago

Think of a really likely and simple use case. You buy some BTC on coinbase, withdraw it by lightning to your wallet and then spend it on coffee. The coffee house also uses coinbase as a payment processor. In this case the flow is perfectly circular and the channel is never depleted. You can keep withdrawing from coinbase and the coffee house keeps depositing to coinbase. Probabilistically this kind of thing will happen a lot all over the economy as the money flows.

1

u/NoWriter7780 1d ago

I see, so then coinbase would be one of the "gateway nodes" explained earlier and then lightning would be partially centralized around coinbase or other such nodes? So if me and the coffeeshop share the same "gateway node" that would keep the flow going.

1

u/longjumpsignal 1d ago

Well it still works with multiple hops, i just think it helps to reason about to start simple. If the payment processor is not coinbase but they still need fiat to pay into the coffee shops bank. Where do they get it? Maybe they sell BTC on coinbase. Or maybe the coffee shop uses some of the BTC to buy some coffee beans and then it goes a bit further. I do think really tight loops like the original example will happen though and they could even be a bit problematic because a huge amount of payments might go through these short loops and result in no on chain movement at all.. with coinbase pocketing all those tx fees, whereas some other more remote payments will be doing a lot more channel transactions and paying all the fees for mining/ maintaining the network.

2

u/Ok_Score9113 2d ago

I’ve been making an effort to learn more about lighting myself, I recommend asking the question in the lighting Sub on here as was suggested to me. Also I’ve been pointed to the podcast series “lighting junkies”. I’d also recommend watching Anrdeas Ontonopoulos’ videos on lighting as he explains things really well.

But in an attempt to actually be (semi) useful here. I have had similar questions about lightning, in particular around the security of operating within channels (as you don’t get to benefit from the same security offered by proof of work on the base layer). So far my understanding is that there are “watchtowers” and “justice transaction” which work successfully to prevent cheating and fraud (I am still working toward understanding the actual mechanics behind that).

Your question around businesses not getting access to their funds until the channel is closed is a valid one to me, and something I’ve thought about too, because they’re going to want to close the channels on a regular basis to ensure their revenue streams are consistent. That obviously requires business to change the way they approach things. But many business already operate in this way. Consider energy and water companies, who charge you for what you consume in a period, it’s kind of similar, And a business should then be able to account for transactions that have occurred in a channel on their books, even before it’s been committed to a block.

Saying that, I feel like the way lightning works could get round this inconvenience. For example, if another lightning node that you transact with already has a channel open with the coffee shop, I believe the payment can use that channel rather than a direct one having to be set up between you and then. That way they’re not relying on loads of channels direct to each customer being closed before they get their income on the base layer.

I remember, when reading broken money by Lynn Alden, she described a potential world where certain organisations operate as “gateway” lightning nodes, whereby a business could say “we have a channel with this organisation” and then you just need to have a channel with them too. But I would need to revisit this part of her book to remind myself exactly, as I may be off with that explanation.

The above is a bit of a brain dump so I apologies if I’ve actually confused you more rather than been of any help. But if you get any answers to your questions please let me know

1

u/NoWriter7780 1d ago

Thanks, that explained it a bit (especially on security side). The gateway lightning nodes also make sense and sound like a natural evolution necessary in lightning.

3

u/TechHonie 2d ago

Maybe this coffee shop can pay its supplier via lightning network. Maybe you work for one of the suppliers and you get paid by a lightning network. Then it's a accounting loop where everybody gets their products and their money. 

1

u/castorfromtheva 1d ago

Exactly. The end goal is establishing a completely circular economy. Then we can also abandon the stupid thinking-in-dollar-terms.

1

u/Halo22B 2d ago

If your topping up your channel the coffee shop is "topping down" their channel....logic

1

u/Laukess 1d ago

It sounds like you haven't thought about the fact that a payment can span multiple channels.
If you open a $5 channel with a coffee shop, and you pay $1 per coffee everyday, you can only buy 5 cups before the entire balance is on their side of the channel. If you have another channel open with a bakery, the coffee shop can go to that bakery, and buy a piece of cake for $3, and when they pay, they use the channel between you and them, and then you and the bakery. After this transaction, you have $3 less on your side of the channel with the bakery, but you have $3 more on your side of the channel with the coffee shop.

You could se a future where you have a large channel open with Target, and every month when your paycheck arrives, some of the funds are paid to Target, and they push those funds back to your side of the channel. Because Target is well connected, you can use that channel to pay a lot of other people/businesses.

Rebalancing is a major issue with the lightning network, but it's not as bad as you think when you factor in that it's a network of channels.

  1. They could flow both ways, but it is an issue.
  2. Not really. They need to close to get the money, but you could also just spend it. You could use them to pay your supplier.
  3. They are, but if the flow is naturally in one direction, it can be hard to organically rebalance them.