NIP-47 Add Hold Invoice Support#1913
Conversation
|
Implemented in Alby JS SDK: getAlby/js-sdk#382 |
Co-authored-by: Roland <33993199+rolznz@users.noreply.github.com>
Co-authored-by: Roland <33993199+rolznz@users.noreply.github.com>
Co-authored-by: Roland <33993199+rolznz@users.noreply.github.com>
|
Have you seen my reviews? I never get replies to these, i have a feeling github is shadowbanning me. |
|
I've implemented this PR for CLN in my nip47 plugin here daywalker90/cln-nip47#4 with the necessary changes to the library i use here rust-nostr/nostr#1019 and the necessary changes to my holdinvoice plugin here: daywalker90/holdinvoice#2 Everything looks good to me so far. Is there a client other than myself to test this with already? |
Implements nostr-protocol/nips#1913 Pull-Request: #1019 Acked-by: Yuki Kishimoto <yukikishimoto@protonmail.com> Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
You can try https://github.com/relaystr/ndk there is even a demo app .apk in the releases |
Semisol
left a comment
There was a problem hiding this comment.
LGTM. We should specify that all preimages and hashes are encoded as hex in the spec.
NIP-47 originally doesn't have such thing specified there. |
|
@vitorpamplona can we merge this? |
|
NIP-47 is getting very big. Can we do a review and make sure everything on the NIP is being actually used? A PR removing some rare stuff would be welcome. |
|
I think the only unused stuff is the |
varo0000000
left a comment
There was a problem hiding this comment.
{
"id": "df467db0a9f9ec77ffe6f561811714ccaa2e26051c20f58f33c3d66d6c2b4d1c",
"pubkey": "c04ccd5c82fc1ea3499b9c6a5c0a7ab627fbe00a0116110d4c750faeaecba1e2",
"created_at": 1713883677,
"kind": 13194,
"tags": [
[ "encryption", "nip44_v2 nip04" ],
[
"notifications",
"payment_received payment_sent"
]
],
"content": "pay_invoice pay_keysend get_balance get_info make_invoice lookup_invoice list_transactions multi_pay_invoice multi_pay_keysend sign_message notifications",
"sig": "31f57b369459b5306a5353aa9e03be7fbde169bc881c3233625605dd12f53548179def16b9fe1137e6465d7e4d5bb27ce81fd6e75908c46b06269f4233c845d8"
}
Rendered
This PR introduces support for hold invoices in the Nostr Wallet Connect (NIP-47) protocol.
Hold invoices enable more advanced payment workflows where the receiver must explicitly settle or cancel the invoice using the preimage. This allows for enhanced control and coordination in payment flows, such as conditional payments or escrow-like behavior.
Summary of Changes:
New RPC methods:
make_hold_invoice: Create a hold invoice using a pre-generated preimage and its payment hash.settle_hold_invoice: Settle a hold invoice by providing the original preimage.cancel_hold_invoice: Cancel a hold invoice using its payment hash.New notification:
hold_invoice_accepted: Emitted when a payer accepts a hold invoice (i.e., locks in payment).Extended example flow: A new section documents the end-to-end process for using hold invoices, including invoice creation, settlement, and cancellation.
Motivation:
Hold invoices are a key feature in Lightning-based applications that require more complex transaction logic, such as:
This addition expands the versatility and usability of NWC while maintaining backward compatibility with existing methods.
Implementations and usages: