Skip to content

Add decode invoice and offer RPCs#164

Open
benthecarman wants to merge 2 commits intolightningdevkit:mainfrom
benthecarman:decode-inv
Open

Add decode invoice and offer RPCs#164
benthecarman wants to merge 2 commits intolightningdevkit:mainfrom
benthecarman:decode-inv

Conversation

@benthecarman
Copy link
Collaborator

Adds a new DecodeInvoice endpoint that parses a BOLT11 invoice string and returns its fields (destination, payment_hash, amount, timestamp, expiry, description, route_hints, features, currency, etc.), similar to lncli's decodepayreq needed for thunderhub and zeus. Does the same for bolt 12 offers as well.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Mar 20, 2026

👋 I see @wpaulino was un-assigned.
If you'd like another reviewer assignment, please click here.

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @wpaulino! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

benthecarman and others added 2 commits March 22, 2026 23:01
Adds a new DecodeInvoice endpoint that parses a BOLT11 invoice string
and returns its fields (destination, payment_hash, amount, timestamp,
expiry, description, route_hints, features, currency, etc.), similar
to lncli's decodepayreq needed for thunderhub and zeus.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a new DecodeOffer endpoint that parses a BOLT12 offer string and
returns its fields: offer_id, description, issuer, amount (bitcoin or
currency), issuer_signing_pubkey, absolute_expiry, supported_quantity,
blinded paths, features, chains, metadata, and expiry status.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm personally not the biggest fan of LND's approach of cramming everything into an RPC, so not quite convinced adding this via RPC is the right way to go? Why would we send an invoice we got from the server back to the server (via network/RPC) to then have the server send the decoded data back?

Alternative approaches we could consider:

  • Offer local invoice utilities as a cli tool that allows invoice/offer decoding and manipulation. Could be nice for UNIX-style comparability of tools.
  • Have server endpoints return more comprehensive responses that give immediate access to all important fields.

Did you consider any of these before?

@wpaulino wpaulino removed their request for review March 23, 2026 16:01
@benthecarman
Copy link
Collaborator Author

I'm personally not the biggest fan of LND's approach of cramming everything into an RPC, so not quite convinced adding this via RPC is the right way to go? Why would we send an invoice we got from the server back to the server (via network/RPC) to then have the server send the decoded data back?

Alternative approaches we could consider:

* Offer local invoice utilities as a `cli` tool that allows invoice/offer decoding and manipulation. Could be nice for UNIX-style comparability of tools.

* Have server endpoints return more comprehensive responses that give immediate access to all important fields.

Did you consider any of these before?

Yeah I agree but sadly seems like a lot of applications find this endpoint useful.

Offer local invoice utilities as a cli tool that allows invoice/offer decoding and manipulation. Could be nice for UNIX-style comparability of tools.

Considered this but doesn't really solve most usecases. Something like thunderhub or zeus don't use the cli, they call the RPC so wouldn't really be helpful. (maybe it is worth shortcutting in the cli tho?)

Have server endpoints return more comprehensive responses that give immediate access to all important fields.

Did a little of that with #163 but that only works for the receive case. Seems like applications are using this for the send case.

@tnull
Copy link
Collaborator

tnull commented Mar 24, 2026

Seems like applications are using this for the send case.

Hmm? Presumably then to validate the invoice before paying? Rather than exposing an RPC for decoding, would it make sense to add more validation before sending on our end? Or maybe I'm misunderstanding what they're looking for?

@benthecarman
Copy link
Collaborator Author

Hmm? Presumably then to validate the invoice before paying? Rather than exposing an RPC for decoding, would it make sense to add more validation before sending on our end? Or maybe I'm misunderstanding what they're looking for?

more so to get the amount, destination, expiry, etc

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants