From 5d4d79228a3c8e1caa139971b9b70da1dfeed49c Mon Sep 17 00:00:00 2001 From: Arc <33088785+arcbtc@users.noreply.github.com> Date: Wed, 12 Apr 2023 13:24:27 +0100 Subject: [PATCH] NIP-83 Wallet connect/bridge Useful for clients wanting to intergrate non-custodal wallet features. > Intended for use with bitcoin, but could be used with any invoice payment system that can pay invoices/create invoices/check payment status. --- 83.md | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 83.md diff --git a/83.md b/83.md new file mode 100644 index 0000000..f8ce804 --- /dev/null +++ b/83.md @@ -0,0 +1,79 @@ +NIP-83 +====== + +Wallet connect/bridge +-------------- + +`draft` `optional` `author:arcbtc` + +Useful for clients wanting to intergrate non-custodal wallet features. + +> Intended for use with bitcoin, but could be used with any invoice payment system that can pay invoices/create invoices/check payment status. + +## Motivation + +We wanted LNbits to have a funding source that pay invoices/create invoices/check payment status, all over nostr DMs. Simple plugins/middleware coud be made for lightning nodes that connect to the funding source. + +## Examples + +There are two simple clients sending json over [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md). + +1. `funding source client`: Attached to the funding source, the other built into another service/client. + +2. `service client`: Built into a service. + +### Creating an invoice + +`service client` sends `create_invoice` event: + +```json +{ "create_invoice": { + "amount": int, + "memo": "", + "description_hash": "" +} +} +``` + +`funding source client` checks the pubkey has permission and sends `generated_invoice` event: + +```json +{ "generated_invoice": { + "payment_hash": "", + "payment_request": "" + } +} +``` + +### Paying an invoice + +`service client` sends `pay_invoice` event: + +```json +{ "pay_invoice": { + "invoice": "", + "note": "" +} +} +``` + +### Checking a payment in/out + +`service client` sends `check_payment` event: + +```json +{ "check_payment": { + "payment_hash": "" + } +} + +``` + +`funding source client` checks the pubkey has permission, checks the payment status and sends `payment_status` event: + +```json +{ "payment_status": { + "paid": "" + } +} +```