Join 96,426 users already on read.cash

Payment Channels

4 118
Avatar for TomZ
Written by   368
2 weeks ago

There are several really cool ideas from decade-old discussions on Bitcoin which have not lost their power and deserve to get attention every now and then to see if someone is willing to make an actual product out of them.

One of those is the old fashioned payment-channel. A lot of people think that this implies LN, but payment channels precede LN by several years, although the original tended to be simpler and one-directional. But that is just fine for many actual products.

The usecase

My user is touring around the country in his EV or plug-in-hybrid and typically charges while parked at shopping malls or similar.

The problem he hits is that for each of the companies owning those charging-poles he has to get a subscription and sign up his credit card on their not very professional looking websites.

Apart from being a person that prefers paying in cash, the idea of giving so many online services his credit card details is scary.

The ideal solution is one where he can pay with crypto currency where the charging company doesn't have to have all his details for their safety (should he drive away without paying). Ideally my user would not have to trust that the website listed on the pole is a real one but a scammer that steals his deposit.

Basically there the ideal is for there to be nothing but an anonymous customer.

Electric charging

Most companies that run this service have two costs, a fee for every minute your car is taking the spot and a fee for every KWH you charge. There are chargers that change the fee based on time of day and in these high-priced energy times I would not be surprised that energy prices are changed monthly, if not weekly.

Often to find those prices you have to actually go search online. Or wait until after charging is completed and you get the bill.

Additional complexity is intermediate companies like Shell providing a charging card that provides you access to a lot of 3rd parties, but for a fee that comes on top of the above fees.

All this is to say that the current setup is heavy in favor of the infrastructure provider. Shopping around is made difficult by not having pricing info on the 'pump' and accidental errors of online pricing end up being paid by the customer, never the supplier.

At this point it is also useful to mention that charging poles can be provided by homeowners, payment details operated by some company but the income (minus fees, I'm sure) go to the homeowner.

What is a payment channel?

Ok, this article talks about payment channels and how they can be useful. But lets first take a step back and understand the basic concept of one.

The simplest way of looking at a payment channel is one of replacing your transaction. You can send a transaction to the company for 2 cents. And then a minute later you double spend this exact transaction and instead make it pay 4 cents to the same company, and you give them this new transaction. A minute later you repeat this but pay them an higher amount.

This means you basically keep on giving the company a new iteration of a transaction that is ever higher in value. You implicitly both agree to keep the transaction between yourselves until you are done, at which point the transaction is sent to the miners for inclusion in the blockchain.

For payment channels to be less risky some more details are needed, but nothing overly complex to distract this page with. Look up Spillman-style payment channels for one algorithm.

The simple way to look at this is that we compress hundreds of micro payments into one gradually increasing payment.

Applying payment channels to electric charging

My user that wants to charge his car can have an app which includes a Bitcoin Cash light wallet.

After finding a charging point and connecting his car with his own cable he has to somehow provide means of payment before charging starts. This is no different than today.

In our case he can scan a QR code on the machine and find the provider online. Talking to the providers internet server via his phone-app he opens a payment channel. He deposits €40 into the channel.

Putting money into the channel simply allows you to pay that later, that money is still fully yours. If you walk away now it just takes the pre-decided timeout before that money is made available to spent again.

The server provides the current prices and an estimated price of the first minute of charging (based on charging speed of the actual car). You decide that this is OK and pay. The machine starts charging your car.

We repeat this dance every minute, getting a sub-total of total used and estimated next-minute usage, which you pay by replacing the previously paid amount with a higher one.

Should you stop paying, the service stops providing electricity. If the machine shuts down for whatever reason, you stop paying. Simple, no?

What did we accomplish?

What we accomplished is that you can drive up to any charging point and without needing to depend on a bankcard, or even sharing any legal details, you can start using the charging pole.

Neither side has to trust the other, no need to trust that I won't drive away without paying because I'm paying before I'm getting anything. I don't need to trust the machine won't flake out on me because I just stop paying if it does. I lose maybe 2 cents in that case.

And we avoid requiring middle-men. No need for Shell to handle the money while I buy from a private person. No need to depend on some deposit or reservation the bank made.

Just a simple person to person (or, if you will, machine to machine) commercial transaction that both parties profit from.

5
$ 4.80
$ 3.30 from @TheRandomRewarder
$ 1.00 from Anonymous user(s)
A
$ 0.50 from @ErdoganTalk
Avatar for TomZ
Written by   368
2 weeks ago
Enjoyed this article?  Earn Bitcoin Cash by sharing it! Explain
...and you will also help the author collect more tips.

Comments

Wow. Now, I have already learned about payment channels and useful they can be. Thank you for this, Sir. Stay safe and see you around.

$ 0.00
2 weeks ago

I'm hung up on two things in this post...

First:

an app which includes a Bitcoin Cash light wallet.

This is different than an app being a BCH wallet.

Second:

He deposits €40 into the channel.

Whether the channel is part of the light wallet or a concept supported by the light wallet (where the funds already reside), this makes it sound like funds move, which sounds custodial (or at least like it would require more trust than should be necessary). To the extent that I'm misinterpreting, can you help me understand where I'm off?

My current line of thinking in trying to bridge that gap is that maybe the light wallet in the app supports payment channels while the user has the private keys. However, I'm also thinking that even then it may require multiple apps for multiple vendors, and regardless of that, it sounds like the user may also need to trust the (or each) app provider's channel implementation.

When I try to really drill down on the concept, I can see how moving the funds to something custodial or smart may be necessary so they can't be double-spent (because otherwise the latest replacement transaction not broadcast by the provider could be nullified via the broadcast of a conflicting transaction by the wallet owner), but that doesn't seem like it would get rid of trust so much as move it, which circles me right back up to trusting channel implementations i.e. "not your keys, not your coins" until/unless the expected transaction is broadcast.

$ 0.00
2 weeks ago

this makes it sound like funds move, which sounds custodial

Custodial means that someone else holds the keys to moving it and you are not able to move it without their permission. That is a rather different situation and the basic concept would break. We can't use any custodialness here. It would completely break the idea.

The setup of a channel is one party supplying the funds and then both agreeing on a multi-sig setup which means that the funds can't simply be double spent. Additionally the locking script has an escape route that allows the owner to get everything back, but that is only allowed to be mined after a certain timeout. Can be days.

The ever-increasing payment is from this multisig locking address and the receiver can at any time sign his side of the multisig and submit it to the blockchain in order to close the channel. Naturally they should take care to take latest transaction with the highest payment.

This is different than an app being a BCH wallet.

The app is supposed to actively communicate with the charging infrastructure in order to create a new transaction every minute. It would be best for the app to run on the in-car computer system, but for practical reasons it likely will be a specialized car app.

$ 0.00
2 weeks ago

Thank you for elaborating. I was thinking multi-sig, but I was also thinking it didn't solve the problem the concept sets out to solve. I was missing the script component and thinking trust was required there. I still feel like you have to trust the manufacturer re: an in-car app, but maybe the infrastructure could communicate directly with compatible wallets via an API or something so that the user still has one wallet that works everywhere regardless of how the vehicle and charger achieve their requirements.

$ 0.00
2 weeks ago