Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper Nostr Zap Support #11

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ FROM python:3.12-alpine

WORKDIR /var/phoenixd_lnurl

RUN \
apk update && \
apk add \
# secp256k1 requirements
automake \
build-base \
libffi-dev \
libtool \
pkgconfig \
;

COPY ./requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

Expand Down
38 changes: 24 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# LNURL for phoenixd ⚡️

👾 Also available on the P2P Git forge, [Radicle](https://radicle.xyz) at `rad:z4G6sJdYgCqKswKnrBbYgn9QaHBqh`
👾 Also available on the P2P Git forge, [Radicle](https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z4G6sJdYgCqKswKnrBbYgn9QaHBqh) at `rad:z4G6sJdYgCqKswKnrBbYgn9QaHBqh`

**🚧 NOTE This is new software, loss of funds and other mishaps are likely 🚧**

A simple wrapper for [ACINQ/phoenixd](https://github.com/ACINQ/phoenixd) that supports basic [LNURL](https://github.com/lnurl/luds) so you can self-host your lightning address with near-minimum effort 💯.
A simple wrapper for [ACINQ/phoenixd](https://github.com/ACINQ/phoenixd) that supports basic [LNURL](https://github.com/lnurl/luds) and Nostr Zaps so you can self-host your lightning address with near-minimum effort 💯.

Supports **one** user with a human-readable LNURL like `lightning:satoshi@gmx.com`, as well as LNURL LUD-06 (the long Bech encoded `lightning:LNURL1blahblah` kind) *and* a snazzy [tip webpage at `/lnurl`](https://1f52b.xyz/lnurl):

Expand All @@ -20,7 +20,9 @@ Note that LNBits will support phoenixd [soon™️](https://github.com/lnbits/ln

## Compatibility

Developed against `phoenixd version 0.1.4-04bd430` (and `0.1.3-d805f81`); also note that phoenixd is also new software and future releases may break things.
Developed against [`phoenixd version 0.1.5-6845a31`](https://github.com/ACINQ/phoenixd/releases/tag/v0.1.5); also note that phoenixd is also new software and future releases may break things.

Versions of Phoenixd before `0.1.5` can be used for LNURL, but Nostr zaps won't work as description-hash invoices [added in 0.1.5](https://github.com/ACINQ/phoenixd/pull/50) are needed.

Currently tested on MacOS and Linux; YMMV on other UNIXes, and on Windows.

Expand All @@ -31,6 +33,11 @@ Currently tested on MacOS and Linux; YMMV on other UNIXes, and on Windows.
* [LUD-06](https://github.com/lnurl/luds/blob/luds/06.md): `payRequest` base spec.
* [LUD-16](https://github.com/lnurl/luds/blob/luds/16.md): Paying to static internet identifiers *(email-like addresses)*.

### Supported Nostr NIPs:

* [NIP-01](https://github.com/nostr-protocol/nips/blob/master/01.md) Basic protocol flow description
* [NIP-05](https://github.com/nostr-protocol/nips/blob/master/05.md): Mapping Nostr keys to DNS-based internet identifiers (as a NIP-5 server, optional)
* [NIP-57](https://github.com/nostr-protocol/nips/blob/master/57.md): Lightning Zaps (receive only)


## Docker Setup
Expand All @@ -42,6 +49,7 @@ Each of the settings in [`phoenixd-lnurl.env`](./phoenixd-lnurl.env.example) can
As you'll also need to run phoenixd and some sort of webserver, so using **Docker compose** is likely easiest way to get all of the required pieces running: [./examples/docker-compose.yml](./examples/docker-compose.yml):

```shell
# NOTE you'll need to change the config in docker-compose.yml for this to work properly!
docker-compose -f examples/docker-compose.yml up
```

Expand All @@ -64,10 +72,14 @@ docker run -p 8000:8000 \
-it phoenixd-lnurl:latest
```

### URLs:

* `localhost:8000/lnurl` Tip webpage as in the screenshot above
* `localhost:8000/.well-known/lnurlp/<USERNAME>` LNURL payRequest endpoint (LUD-16) for `<USERNAME>@<LNURL_HOSTNAME>`
* `localhost:8000/lnurlp/<USERNAME>` LNURL payRequest endpoint (LUD-06)
* `localhost:8000/lnurlp/<USERNAME>/callback?amount=<AMOUNT_MSAT>` LNURL payRequest callback (LUD-06 and LUD-16)
* `localhost:8000/lnurlp/<USERNAME>/callback?amount=<AMOUNT_MSAT>` LNURL payRequest callback (LUD-06 and LUD-16, NIP-57)
* `localhost:8000/.well-known/nostr.json` (Optional) Nostr NIP-5 server for `<USERNAME>@<LNURL_HOSTNAME>`
* **⚠️ INTERNAL ONLY** `localhost:8000/phoenixd-webhook` -- you need to add this to your `~/.phoenixd/phoenix.conf` for Nostr Zaps to work correctly. ‼️ DO NOT make this publicly accessible ‼️
* **Note** `localhost:8000/` and any other path will give you an `ERROR` -- that's supposed to happen, as it isn't a LNURL that **pheonixd-lnurl** understands 😉


Expand Down Expand Up @@ -98,6 +110,7 @@ chain=testnet
http-password=hunter2
http-bind-port=9740
auto-liquidity=2m
webhook=http://localhost:8000/phoenixd-webhook
```

For **production** use, you can *just* install and run `phoenixd` for the first time;
Expand All @@ -118,10 +131,14 @@ Now you're ready to run:
./run.sh
```

### URLs:

* `localhost:8000/lnurl` Tip webpage as in the screenshot above
* `localhost:8000/.well-known/lnurlp/<USERNAME>` LNURL payRequest endpoint (LUD-16) for `<USERNAME>@<LNURL_HOSTNAME>`
* `localhost:8000/lnurlp/<USERNAME>` LNURL payRequest endpoint (LUD-06)
* `localhost:8000/lnurlp/<USERNAME>/callback?amount=<AMOUNT_MSAT>` LNURL payRequest callback (LUD-06 and LUD-16)
* `localhost:8000/lnurlp/<USERNAME>/callback?amount=<AMOUNT_MSAT>` LNURL payRequest callback (LUD-06 and LUD-16, NIP-57)
* `localhost:8000/.well-known/nostr.json` (Optional) Nostr NIP-5 server for `<USERNAME>@<LNURL_HOSTNAME>`
* **⚠️ INTERNAL ONLY** `localhost:8000/phoenixd-webhook` -- you need to add this to your `~/.phoenixd/phoenix.conf` for Nostr Zaps to work correctly. ‼️ DO NOT make this publicly accessible ‼️
* **Note** `localhost:8000/` and any other path will give you an `ERROR` -- that's supposed to happen, as it isn't a LNURL that **pheonixd-lnurl** understands 😉

To deploy, you probably want something to manage **phoenixd-lnurl** as a service, rather than running it directly.
Expand Down Expand Up @@ -187,9 +204,9 @@ just serve
- [ ] Support `.onion` hosting (HTTPS is assumed in a few places), needed for self-hosting on things like Umbrel
- [ ] Support [LUD-18: Payer identity in `payRequest` protocol](https://github.com/lnurl/luds/blob/luds/18.md)
- [ ] Support configurable URL prefix for the app for people that might have collisions or don't want to host at `/` (or do this in nginx conf)
- [ ] Support actual Nostr Zaps [NIP-57: Lightning Zaps](https://github.com/nostr-protocol/nips/blob/master/57.md)
- [X] Support actual Nostr Zaps [NIP-57: Lightning Zaps](https://github.com/nostr-protocol/nips/blob/master/57.md)
- [ ] Support [NIP-47: Nostr Wallet Connect](https://github.com/nostr-protocol/nips/blob/master/47.md)

- [ ] Add optional auth on Phoenixd webhook endpoint

### Later Roadmap

Expand All @@ -200,13 +217,6 @@ just serve
- [ ] (maybe-scope-creep) auto-zap content you interact with/like on Nostr if funds are available


---

## Tips 😘

[`lnurlp:1f52b@1f52b.xyz`](lnurlp:1f52b@1f52b.xyz) (yes, I am dogfooding) or [tip page](https://1f52b.xyz/lnurl)


---

## License ⚖️
Expand Down
Loading