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 01/12] 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 00000000..f8ce8049 --- /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": "" + } +} +``` From 3a1393a8613df26c1cebb9fd221e58f2f24f2d40 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 12 Apr 2023 13:27:24 +0100 Subject: [PATCH 02/12] Cleaned json --- 83.md | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/83.md b/83.md index f8ce8049..80484510 100644 --- a/83.md +++ b/83.md @@ -27,21 +27,23 @@ There are two simple clients sending json over [NIP04](https://github.com/nostr- `service client` sends `create_invoice` event: ```json -{ "create_invoice": { - "amount": int, - "memo": "", - "description_hash": "" -} +{ + "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": "" - } +{ + "generated_invoice":{ + "payment_hash":"", + "payment_request":"" + } } ``` @@ -50,10 +52,11 @@ There are two simple clients sending json over [NIP04](https://github.com/nostr- `service client` sends `pay_invoice` event: ```json -{ "pay_invoice": { - "invoice": "", - "note": "" -} +{ + "pay_invoice":{ + "invoice":"", + "note":"" + } } ``` @@ -62,18 +65,19 @@ There are two simple clients sending json over [NIP04](https://github.com/nostr- `service client` sends `check_payment` event: ```json -{ "check_payment": { - "payment_hash": "" - } +{ + "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": "" - } +{ + "payment_status":{ + "paid":"" + } } ``` From a8ea43272732a0e401a4570bc9a72d6b1fcf7ab6 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 12 Apr 2023 13:31:28 +0100 Subject: [PATCH 03/12] typo --- 83.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/83.md b/83.md index 80484510..4a003f30 100644 --- a/83.md +++ b/83.md @@ -12,7 +12,7 @@ Useful for clients wanting to intergrate non-custodal wallet features. ## 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. +We wanted [LNbits](https://github.com/lnbits/lnbits) to have a funding source that pay invoices/create invoices/check payment status, all over nostr DMs. Simple plugins/middleware could be made for funding sources, that any wallet software coul use over nostr. ## Examples From 459b10793ac913b736072f48b5dcdab48dd65050 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 12 Apr 2023 13:33:02 +0100 Subject: [PATCH 04/12] typo --- 83.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/83.md b/83.md index 4a003f30..feb91ac6 100644 --- a/83.md +++ b/83.md @@ -12,11 +12,11 @@ Useful for clients wanting to intergrate non-custodal wallet features. ## Motivation -We wanted [LNbits](https://github.com/lnbits/lnbits) to have a funding source that pay invoices/create invoices/check payment status, all over nostr DMs. Simple plugins/middleware could be made for funding sources, that any wallet software coul use over nostr. +We wanted [LNbits](https://github.com/lnbits/lnbits) to have a funding source that could pay invoices/create invoices/check payment status all over nostr DMs. Simple plugins/middleware could be made for funding sources, that any wallet software could use over nostr. ## Examples -There are two simple clients sending json over [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md). +There are two simple clients sending json over [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md). THese clients could be standalone or built into clients/services. 1. `funding source client`: Attached to the funding source, the other built into another service/client. From 3a09d4aa7cc17af0ca4e867f9b3284cea37d6852 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 12 Apr 2023 13:34:26 +0100 Subject: [PATCH 05/12] typo --- 83.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/83.md b/83.md index feb91ac6..7bfbba19 100644 --- a/83.md +++ b/83.md @@ -16,11 +16,11 @@ We wanted [LNbits](https://github.com/lnbits/lnbits) to have a funding source th ## Examples -There are two simple clients sending json over [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md). THese clients could be standalone or built into clients/services. +There are two simple clients sending json over [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md). These clients could be standalone or built into clients/services. -1. `funding source client`: Attached to the funding source, the other built into another service/client. +1. `funding source client`: Connected to the funding source. -2. `service client`: Built into a service. +2. `service client`: Built into service/client that wants wallet functions. ### Creating an invoice From 32bd6de5041535635342d9700c810ad17eb4cf3f Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 12 Apr 2023 13:39:33 +0100 Subject: [PATCH 06/12] Added permission example --- 83.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/83.md b/83.md index 7bfbba19..cace970c 100644 --- a/83.md +++ b/83.md @@ -22,6 +22,10 @@ There are two simple clients sending json over [NIP04](https://github.com/nostr- 2. `service client`: Built into service/client that wants wallet functions. +### Permissions + +In `funding source client` nostr pubkeys used by `service client` are given and permissions granted (such as `read`/`create_invoice_only`/`pay_invoices`) + ### Creating an invoice `service client` sends `create_invoice` event: @@ -60,6 +64,8 @@ There are two simple clients sending json over [NIP04](https://github.com/nostr- } ``` +`funding source client` checks the pubkey has permission and attempts to pay the invoice. + ### Checking a payment in/out `service client` sends `check_payment` event: From 00218c6de9088372c9587acf7bf27c1381b83d83 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 12 Apr 2023 13:41:39 +0100 Subject: [PATCH 07/12] Added BC to authors --- 83.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/83.md b/83.md index cace970c..d6eecf64 100644 --- a/83.md +++ b/83.md @@ -4,7 +4,7 @@ NIP-83 Wallet connect/bridge -------------- -`draft` `optional` `author:arcbtc` +`draft` `optional` `author:arcbtc` `author:blackcoffeexbt` Useful for clients wanting to intergrate non-custodal wallet features. From db5b8c7d4ade2b5c74392e05d4d065c09699291e Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 12 Apr 2023 13:59:24 +0100 Subject: [PATCH 08/12] rephrase --- 83.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/83.md b/83.md index d6eecf64..8ecd9c1e 100644 --- a/83.md +++ b/83.md @@ -6,7 +6,7 @@ Wallet connect/bridge `draft` `optional` `author:arcbtc` `author:blackcoffeexbt` -Useful for clients wanting to intergrate non-custodal wallet features. +Useful for clients wanting to intergrate wallet features, could be custodial or non-custodial or both. > Intended for use with bitcoin, but could be used with any invoice payment system that can pay invoices/create invoices/check payment status. From 91c2a8a8c92a7eae6c888c36ee12b451e5e2f93c Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 12 Apr 2023 14:08:16 +0100 Subject: [PATCH 09/12] removed shameless lnbits link --- 83.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/83.md b/83.md index 8ecd9c1e..e96f8bfb 100644 --- a/83.md +++ b/83.md @@ -12,7 +12,9 @@ Useful for clients wanting to intergrate wallet features, could be custodial or ## Motivation -We wanted [LNbits](https://github.com/lnbits/lnbits) to have a funding source that could pay invoices/create invoices/check payment status all over nostr DMs. Simple plugins/middleware could be made for funding sources, that any wallet software could use over nostr. +All bitcoin lightning wallet clients connected to nodes use http, they should also be able to use nostr. + +Simple plugins/middleware could be easily made for nodes. ## Examples From 0bc0c7d317b133ef8a8d7d89cbee06452f3239c5 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 12 Apr 2023 14:11:21 +0100 Subject: [PATCH 10/12] rephrase --- 83.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/83.md b/83.md index e96f8bfb..2d730257 100644 --- a/83.md +++ b/83.md @@ -14,7 +14,7 @@ Useful for clients wanting to intergrate wallet features, could be custodial or All bitcoin lightning wallet clients connected to nodes use http, they should also be able to use nostr. -Simple plugins/middleware could be easily made for nodes. +Simple plugins/middleware could be easily made for existing nodes. ## Examples From 56c8556855f25fc7df0f40873af6b7630c646182 Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 12 Apr 2023 14:13:39 +0100 Subject: [PATCH 11/12] added some bits --- 83.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/83.md b/83.md index 2d730257..dd6f3277 100644 --- a/83.md +++ b/83.md @@ -14,7 +14,7 @@ Useful for clients wanting to intergrate wallet features, could be custodial or All bitcoin lightning wallet clients connected to nodes use http, they should also be able to use nostr. -Simple plugins/middleware could be easily made for existing nodes. +Simple plugins/middleware/libraries could be easily made for existing nodes and lightning wallet software. ## Examples From 2ec7833e8ee35849bf468ca93cc6db51e641c91c Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 12 Apr 2023 17:33:17 +0100 Subject: [PATCH 12/12] payment_hash needed to identify payment --- 83.md | 1 + 1 file changed, 1 insertion(+) diff --git a/83.md b/83.md index dd6f3277..062a9f5b 100644 --- a/83.md +++ b/83.md @@ -85,6 +85,7 @@ In `funding source client` nostr pubkeys used by `service client` are given and ```json { "payment_status":{ + "payment_hash":"", "paid":"" } }