arcbtc / M5StackSats

A bitcoin point of sale terminal using the ESP32 based M5Stack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Room77: On-Chain & Lightning

rootzoll opened this issue · comments

The POS should also offer bitcoin-onchain payments. Can be Button B.

Cool idea, but the question is how can a new address be generated for a payment and how can the pos get a confirmation. I assume it's appropriate when the tx is in the mempool, right? I saw this PoS behavior at Paralelni Polis in Prag. Not good, but better then nothing.

The next question is, what is the best backend? BTCPay Server? A small PoS app on a Raspiblitz?
@rootzoll do you have an idea regarding an interface?

We can start very simple by just adding a fixed "Bitcoin Address" (you add while config) and then add better solutions later. Having a fixed address would also make it easier to "identify" all POS transactions when taking a look at the on-chain payment history (for book keeping). We can improve later on if needed. To get his fixed address you just call on your RaspiBlitz a new Funding Address and copy-paste that.

From the backend side ... it should work with the read-macaroon the POS already has .. just call the "GET /v1/transactions" on the LND REST API -- see https://api.lightning.community/rest/index.html#response-27

Its also a bit suboptimal because it delivers "all the on-chain transactions" which needs to be filtered for a recently incomming tx with that exact given amount etc and could grow quite big and slow when polling it again and again. But thats what LND offers for on-chain transactions.

Implementation Idea: Before showing the QR code to let the user pay ... the POS should one time call that transaction list and remember the timestamp of that latest incomming tx. Then show the QR code (with destination address, exact amount and a description). Then polling in the background and checking if a new transaction that is matching this profile is coming in. For a prototype just seeing it incomming should be fine - no confirmation needed.

Working with plain LND on the backend should be the setup to work with, because thats what we have running at the Room77 at the moment. In the future that might change and we can use a better implementation