Add NIP-42 authentication to relay discovery

This commit is contained in:
a1denvalu3
2026-07-23 18:56:25 +02:00
parent cf18649ee9
commit 554efcf174
4 changed files with 264 additions and 10 deletions
+5
View File
@@ -14,6 +14,9 @@ The repository contains three scripts that form a simple pipeline:
- Starts from a seed relay URL and connects to it via WebSocket (ws/wss).
- Breadthfirst searches follow lists (kind 3) and relay lists (kind 10002), extracting relay URLs from event tags (r/p tags).
- Tests each candidate relay for basic Nostr protocol responsiveness by issuing a REQ and evaluating responses (EVENT/EOSE/NOTICE).
- Responds to NIP-42 authentication challenges. An ephemeral Nostr key is
generated by default; set `NOSTR_PRIVATE_KEY` or pass `--private-key` with a
64-character hex secret when testing membership-restricted relays.
- Processes relays in concurrent batches and periodically saves progress to `relay_discovery_results.json`.
- Output: `relay_discovery_results.json` with:
- `functioning_relays` (array of ws/wss relay URLs)
@@ -42,6 +45,8 @@ Note: The geolocation step is IPv4only (the DBIP file used here is IPv4).
## Tips and caveats
- The discovery step uses timeouts and concurrent batches; tune `--batch-size`, `--timeout`, and `--max-depth` for your environment.
- NIP-42 authentication proves control of a key but does not bypass relay
membership or payment policies. Use a relay-authorized key when required.
- The BitChat filter posts a test kind 20000 event. Ensure `nak` is configured to publish (e.g., via its config or environment variables as per `nak` docs).
- Geolocation is an estimate based on DBIP and only for IPv4. Accuracy varies and may reflect the ISP/hosting POP rather than precise server location.
- `relays_geo_lookup.py` stops at the first IPv4 for which DBIP provides coordinates. Some hostnames resolve to multiple IPs.