Closed meeDamian closed 6 years ago
This is a cool project. I've done some stuff around this before.
So current plan:
drop-in binary
a. to be run on the same user as LN node
b. binary figures out if it's lnd
, c-lightning
or eclair
(?)
c. attempts communication & some other checks (avail. capacity?)
Exposes <port-number-to-be-chosen>
a. ufw rule needed
b. add to uPnP port forwarding script
c. Tor Hidden Service(?)
Performs Basic Authentication (w/credentials generated on the 1st run)
a. fail2ban
integration here would be nice, so that abusers are cut short…
Exposes 3 endpoints:
/invoice
endpointGET /invoice?amount=<amt-in-satoshis>&desc=<invoice-description>&expire=<seconds>
Takes amount
, desc
and expire
only - all are optional. Default expiry
time is 3 minutes. Returns:
{
"error": "error message, if any",
"invoice": "bolt11 invoice, if no error",
"hash": "payment_hash, if no error"
}
/status
endpointGET /status/<hash>
Takes hash
(as returned by /invoice
endpoint), does long-polling(?) and terminates only when invoice expires or is paid with either:
"expired"
"paid"
"err: <err-description>"
All stings are quoted to be JSON-valid.
/connstrings
endpointGET /connstrings
Takes no arguments and returns an array of connstrings, ex:
[
"032260c3b64b471b7eb0630b4af5d07ca94ff4e759573cbbe1bfb25845c375ed6e@203.150.176.118:9735",
"032260c3b64b471b7eb0630b4af5d07ca94ff4e759573cbbe1bfb25845c375ed6e@o3s5j4j37nbyzgvbngn3ahpmttvviyensw34klhqzw7in7vfzz646lqd.onion:9735"
]
are we going to use satoshis for amount in our invoice endpoint?
Probably needs to be clearer:
Amount =
Using satoshis as int
of float
?
If int
, do we ignore milisats?
If float
, why not just use a much more common BTC where both sats and milisats are seamlessly handled?
float and millisats (because more "future proof") and is directly supported by the protocol so no conversion.
I’ve got my python code to the point where I can start developing against a live API.
Can you share something?
I should have stuff ready later today or tomorrow.
I edited the description above:
GET /status?hash=<hash>
is now GET /status/:hash
amount
for GET /invoice
endpoint is in satoshis&expire=
param for GET /invoice
endpoint is not yet workingcc. @AnotherDroog
TODO: move above description to lncm/invoicer/README.md
Also, with the creation of https://github.com/lncm/invoicer repo, all related issues should go there, and this one gets closed.
Create a simple service that uses underlying LN node to expose a simple basic-authenticated REST(?) API generating invoices for specified amounts and descriptions and informs about invoice status change (unpaid -> paid|cancelled|expired).
Ideally done as a part of #1, but can also be delayed for the next meetup, if doing it this way would delay things.
copied from notepad:
Desc: Somewhat related and complementing idea #1 - the service would run on Raspberry Pi, have basic authentication, ufw, fail2ban, and would generate invoices upon request. Can be used on personal website as a donation link, can be used by projects like satoshis.place to separate payment machine from code-running machine, can be run as a simple merchant PoS payment integration. Can be used as a vending machine backend, etc, etc
Needed: RBP running a LN node, internet connection and either public IP or Tor hidden service.