talaia-labs / rust-teos

The Eye of Satoshi - Lightning Watchtower
https://talaia.watch
MIT License
128 stars 62 forks source link

Tower payments pay endpoint: WIP #257

Open orbitalturtle opened 2 months ago

orbitalturtle commented 2 months ago

This PR begins to add payment support to TEOS. I'm realizing I have a lot of thoughts and the project is a bit bigger than I expected. So figured I'd try to see if I can get a little feedback on the approach I'm taking before I get too far along. 🤞🏻

Approach so far:

I've started by creating a new "pay" endpoint. This will be used to grab an invoice to pay when a user needs to register or top up their account (maybe a more accurate name would just be "get_invoice" to then pay after).

The steps for a user to make a payment (for initial registration or for a top up) are:

On the tower side, once a user hits the pay endpoint for the first time, the tower associates the user's provided uuid with the invoice, and stores it in memory and in the db. IMO the advantages of "one-invoice-per-user" model are that:

Future stuff: This will come in future PRs

The above all takes the endpoint logic into account. After that, we'll need to build some other things:

aruokhai commented 2 days ago

In the description laid out, an implicit assumption is made, which is that a user should have an existing channel with a route of payment to the said watch tower. Such assumptions might not be expected by all users, who may prefer to use normal bitcoin transfers. Such example would be in the case of private channels amongst known participants. I implore the consideration of normal Bitcoin transfers and also the consideration of Silent Payments which help in the case re subscription without explicitly asking for an invoice from the said watchtower.