Compare commits

...

13 Commits

Author SHA1 Message Date
Arc
2f14a303fc
Merge 2ec7833e8e into e942427f8f 2024-12-09 19:31:20 +00:00
ben
2ec7833e8e payment_hash needed to identify payment 2023-04-12 17:33:17 +01:00
ben
56c8556855 added some bits 2023-04-12 14:13:39 +01:00
ben
0bc0c7d317 rephrase 2023-04-12 14:11:21 +01:00
ben
91c2a8a8c9 removed shameless lnbits link 2023-04-12 14:08:16 +01:00
ben
db5b8c7d4a rephrase 2023-04-12 13:59:24 +01:00
ben
00218c6de9 Added BC to authors 2023-04-12 13:41:39 +01:00
ben
32bd6de504 Added permission example 2023-04-12 13:39:33 +01:00
ben
3a09d4aa7c typo 2023-04-12 13:34:26 +01:00
ben
459b10793a typo 2023-04-12 13:33:02 +01:00
ben
a8ea432727 typo 2023-04-12 13:31:28 +01:00
ben
3a1393a861 Cleaned json 2023-04-12 13:27:24 +01:00
Arc
5d4d79228a
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.
2023-04-12 13:24:27 +01:00

92
83.md Normal file
View File

@ -0,0 +1,92 @@
NIP-83
======
Wallet connect/bridge
--------------
`draft` `optional` `author:arcbtc` `author:blackcoffeexbt`
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.
## Motivation
All bitcoin lightning wallet clients connected to nodes use http, they should also be able to use nostr.
Simple plugins/middleware/libraries could be easily made for existing nodes and lightning wallet software.
## 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.
1. `funding source client`: Connected to the funding source.
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:
```json
{
"create_invoice":{
"amount":"int",
"memo":"<Optional[str]>",
"description_hash":"<Optional[bytes]>"
}
}
```
`funding source client` checks the pubkey has permission and sends `generated_invoice` event:
```json
{
"generated_invoice":{
"payment_hash":"<string>",
"payment_request":"<string>"
}
}
```
### Paying an invoice
`service client` sends `pay_invoice` event:
```json
{
"pay_invoice":{
"invoice":"<string>",
"note":"<Optional[str]>"
}
}
```
`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:
```json
{
"check_payment":{
"payment_hash":"<string>"
}
}
```
`funding source client` checks the pubkey has permission, checks the payment status and sends `payment_status` event:
```json
{
"payment_status":{
"payment_hash":"<string>",
"paid":"<bool>"
}
}
```