diff --git a/83.md b/83.md new file mode 100644 index 00000000..062a9f5b --- /dev/null +++ b/83.md @@ -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":"", + "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":"" + } +} +``` + +`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":"" + } +} +``` + +`funding source client` checks the pubkey has permission, checks the payment status and sends `payment_status` event: + +```json +{ + "payment_status":{ + "payment_hash":"", + "paid":"" + } +} +```