Hi, I'm a python developer (trainee) and I was looking for a way to generate lightning invoices in my script, I found out that @getalby has an api to interact with your wallet, but I was wondering if there would be more ways. Can you think of any ideas of banckends or methods to generate lightning invoices inside a python script? Use case: The app I'm designing is an event logger, where the user enters a series of parameters that at the end of the script are saved in a csv file, the idea is that each of these events has a price field and could be interpreted as an invoice that I would like to be able to generate with lightning.
I appreciate any guidance, thank you
If you'd like to generate a bolt11 invoice you'll either need to
  1. run a lightning node and request the invoice directly from the node
  2. run a lightning node and use some kind of service layer (like alby or a lnurl-pay service) that requests the invoice from the node for you indirectly
  3. if you don't mind custodial services, you can use a custodial service that has lnurl-pay support and get a bolt11 invoice that way
reply
Yes, I thought about using my node, but that's a solution for me only, I don't have a node for 'public' use at the moment. My idea is that once I have this script in production I can share the repository and others can use it without depending on having a node. Can you think of a custodial service that fits? So far the solution I can think of is to integrate it with lightning tip bot or lntxbot in telegram. The ideal would be an api that I could call inside my script and it would generate the invoice.
Pd thanks for replying, I really appreciate your guidance :)
reply
Ah, in that case I'd just use a lightning address! Whoever uses your script can just put in a new lightning address and begin making money with it; lightning addresses can be thought of as a human readable lnurl-pay code. Lots of custodial wallets support lightning addresses and lots of 3rd parties allow you to use them as a lightning address for non-custodial nodes.
reply
Yes, it seems to me a simple and customizable solution for each user to use the ln addrs they want, the problem is that I have not found a way to decode that lnaddrs to generate an invoice, I found this service https://lightningdecoder.com/, but it does not work properly, at least in its front end and I have not tried to build it myself .... I also discovered https://docs.bitnob.com/reference/decode-a-lightning-address but it is KYC and I don't like that. Then I tried to simply use a url for example: 'lightning:gzoo@stacker.news' but on phones no wallet reacts and just opens the browser, how do you do it here on stacker.news? it works fine.
why don't you just use https://lnbits.com/
some small lightning services are using it
reply
you mean for generate the invoices? yea, but I'm looking for a solution that everyone can use without needing to have an lnbits
reply
Did you solve this issue?
I'm also working with python and I would like to access a lightning wallet and pay and create invoice in python code. Is there a way to do this?
reply