Skip to content

Instantly share code, notes, and snippets.

@storopoli
Created June 7, 2024 19:12
Show Gist options
  • Save storopoli/c67f01286da1312c34e0c418f8722ff2 to your computer and use it in GitHub Desktop.
Save storopoli/c67f01286da1312c34e0c418f8722ff2 to your computer and use it in GitHub Desktop.
LND - How to Create an Invoice just with a payment hash and amount

How to Create an Invoice just with a payment hash and amount

You can't do this in the CLI, the addinvoice requires a random 32-byte hex-encoded preimage. But you can do this with the REST API LND interface:

curl --insecure --request POST --data '{"r_hash": "<PAYMENT_HASH>", "value": <INT>}' --header "Grpc-Metadata-macaroon: <INVOICE MACAROON OR HIGHER>" --header "Content-Type: application/json" -v https://localhost:<LND_PORT>/v1/invoices

You need the --insecure flag since it is an https:// endpoint that we cannot validate the TLS certificate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment