Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LN invoice generating service #5

Closed
meeDamian opened this issue Aug 10, 2018 · 10 comments
Closed

LN invoice generating service #5

meeDamian opened this issue Aug 10, 2018 · 10 comments
Assignees
Labels
BUIDL Ideas for things that can be build ideas Suggestions for things to build/research/discuss during events

Comments

@meeDamian
Copy link
Member

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.

@nolim1t
Copy link
Member

nolim1t commented Aug 10, 2018

This is a cool project. I've done some stuff around this before.

@meeDamian meeDamian added ideas Suggestions for things to build/research/discuss during events BUIDL Ideas for things that can be build labels Aug 12, 2018
@meeDamian meeDamian self-assigned this Aug 27, 2018
@meeDamian
Copy link
Member Author

meeDamian commented Aug 27, 2018

So current plan:

  1. 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?)

  2. Exposes <port-number-to-be-chosen>
    a. ufw rule needed
    b. add to uPnP port forwarding script
    c. Tor Hidden Service(?)

  3. Performs Basic Authentication (w/credentials generated on the 1st run)
    a. fail2ban integration here would be nice, so that abusers are cut short…

  4. Exposes 3 endpoints:

/invoice endpoint

GET /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 endpoint

GET /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 endpoint

GET /connstrings

Takes no arguments and returns an array of connstrings, ex:

[
	"032260c3b64b471b7eb0630b4af5d07ca94ff4e759573cbbe1bfb25845c375ed6e@203.150.176.118:9735",
	"032260c3b64b471b7eb0630b4af5d07ca94ff4e759573cbbe1bfb25845c375ed6e@o3s5j4j37nbyzgvbngn3ahpmttvviyensw34klhqzw7in7vfzz646lqd.onion:9735"
]

@nolim1t
Copy link
Member

nolim1t commented Aug 27, 2018

are we going to use satoshis for amount in our invoice endpoint?

@AnotherDroog AnotherDroog mentioned this issue Aug 27, 2018
7 tasks
@AnotherDroog
Copy link
Member

Probably needs to be clearer:

Amount = <amt-as-0.00000000>

@meeDamian
Copy link
Member Author

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?

@nolim1t
Copy link
Member

nolim1t commented Aug 27, 2018

float and millisats (because more "future proof") and is directly supported by the protocol so no conversion.

future proof

@AnotherDroog
Copy link
Member

I’ve got my python code to the point where I can start developing against a live API.

Can you share something?

@meeDamian
Copy link
Member Author

I should have stuff ready later today or tomorrow.

@meeDamian
Copy link
Member Author

meeDamian commented Aug 29, 2018

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 working

cc. @AnotherDroog

TODO: move above description to lncm/invoicer/README.md

@meeDamian
Copy link
Member Author

Also, with the creation of https://github.com/lncm/invoicer repo, all related issues should go there, and this one gets closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUIDL Ideas for things that can be build ideas Suggestions for things to build/research/discuss during events
Projects
None yet
Development

No branches or pull requests

3 participants