# swaprelay.smesh.lol The Blake Swap relay: a second torly instance, next to the general relay on 3336, because the two serve different write policies and neither should be able to affect the other's limits. | file | where it goes on the host | |---|---| | `swaprelay.env` | `/etc/torly/swaprelay.env` (0644 root:root) | | `swaprelay.json` | `/etc/torly/policy/swaprelay.json` (0640 root:mleku, the service runs as `mleku`) | | `policy.NOTE` | `/etc/torly/policy/README` | | `set-gateway.sh` | `/etc/torly/policy/set-gateway.sh` (0755) | | `torly-swap.service` | `/etc/systemd/system/torly-swap.service` | | `swaprelay.caddy` | appended to `/etc/caddy/Caddyfile` | ``` install -m 0755 torly-swap /usr/local/bin/torly-swap install -d -o mleku -g mleku /home/mleku/.local/share/torly-swap systemctl daemon-reload && systemctl enable --now torly-swap caddy validate --config /etc/caddy/Caddyfile && systemctl reload caddy ``` Deployed 2026-10-24: relay on `127.0.0.1:3337`, public at `wss://swaprelay.smesh.lol/`, relay identity `2bfb69d16a4a199003ab4043b655b87c044666d9b51b552f2bed153632e0e465`, data dir `/home/mleku/.local/share/torly-swap`, Caddy site with automatic TLS and its own access log. ## The gateway key The three gateway-only rules (`30333`, `23197`, and the `blake-swap-market` listings) carry an all-zeros placeholder so they fail closed until a real gateway is registered: ``` /etc/torly/policy/set-gateway.sh ``` The relay publishes `blake@smesh.lol` as its NIP-11 contact; that is the address a back-end operator writes to with the public key, which is the one `nostrino-bridge` prints in its URI (`nostr+chaindata://?chains=…`). The script replaces the placeholder, restarts the service, checks it came up, and restores the previous policy if it did not. ## What it accepts The policy file is the authority; in summary: gateway presence and gateway frames and the market listings are gateway-only (NIP-42 + the registered key); wallet frames (23196) are open but rate- and byte-limited; directed swap coordination (kind 1 with a `d` tag) and market takes, cancels and matches are rate-limited; deletions need authentication. Everything else is refused. Inbound is capped by a relay-wide byte ceiling (`TORLY_INBOUND_BYTES_PER_SEC`), requests by `TORLY_QUERY_PER_SEC`/`BURST`, and delivery is left at line rate (`TORLY_OUTBOUND_BYTES_PER_SEC=0`) so a wallet's sync is bounded by the host's uplink.