nips/83.md
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

1.7 KiB

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.

  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:

{ "create_invoice": {
        "amount": int,
        "memo": "<Optional[str]>",
        "description_hash": "<Optional[bytes]>"
}
}

funding source client checks the pubkey has permission and sends generated_invoice event:

{ "generated_invoice": {
    "payment_hash": "<string>", 
    "payment_request": "<string>"
  }
}

Paying an invoice

service client sends pay_invoice event:

{ "pay_invoice": {
        "invoice":  "<string>",
        "note": "<Optional[str]>"
}
}

Checking a payment in/out

service client sends check_payment event:

{ "check_payment": {
    "payment_hash": "<string>"
  }
}

funding source client checks the pubkey has permission, checks the payment status and sends payment_status event:

{ "payment_status": {
    "paid": "<bool>"
  }
}