From 163b8badec9359373a8fc016c2b1fe9ee38e6406 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 19 May 2026 14:14:12 +0530 Subject: docs: update relay lists + add merge plan - nostr_relays: 2->4 (+relay.anzenkodo.workers.dev, +nostr.koning-degraaf.nl) - nostr_seed_relays: 4->8 (+relay.anzenkodo.workers.dev, +nostr.koning-degraaf.nl, +knostr.neutrine.com, +nostr.einundzwanzig.space) - Add MERGE_PLAN.md with squash-merge execution checklist --- AGENTS.md | 12 ++++-- MERGE_PLAN.md | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 MERGE_PLAN.md diff --git a/AGENTS.md b/AGENTS.md index 2c16a8a..f46de4d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -91,13 +91,17 @@ nvs_flash_init() "price_per_step": 21, "step_size_ms": 60000, "nostr_geohash": "u281w0dfz", - "nostr_relays": ["wss://relay.damus.io", "wss://nos.lol"], + "nostr_relays": ["wss://relay.damus.io", "wss://nos.lol", "wss://relay.anzenkodo.workers.dev", "wss://nostr.koning-degraaf.nl"], "nostr_publish_interval_s": 21600, "nostr_seed_relays": [ "wss://relay.orangesync.tech", "wss://relay.damus.io", "wss://nos.lol", - "wss://relay.nostr.band" + "wss://relay.nostr.band", + "wss://relay.anzenkodo.workers.dev", + "wss://nostr.koning-degraaf.nl", + "wss://knostr.neutrine.com", + "wss://nostr.einundzwanzig.space" ], "nostr_sync_interval_s": 1800, "nostr_fallback_sync_interval_s": 21600, @@ -214,8 +218,8 @@ make flash-b # flash to Board B ## External Dependencies - **Test mint:** `testnut.cashu.space` — auto-pays lightning invoices -- **Nostr relays:** `relay.damus.io`, `nos.lol` — for wifistr events -- **Seed relays:** `relay.orangesync.tech` (NIP-77), `relay.damus.io`, `nos.lol`, `relay.nostr.band` — for relay selection and sync +- **Nostr relays:** `relay.damus.io`, `nos.lol`, `relay.anzenkodo.workers.dev`, `nostr.koning-degraaf.nl` — for wifistr events +- **Seed relays:** `relay.orangesync.tech` (NIP-77), `relay.damus.io`, `nos.lol`, `relay.nostr.band`, `relay.anzenkodo.workers.dev`, `nostr.koning-degraaf.nl`, `knostr.neutrine.com`, `nostr.einundzwanzig.space` — for relay selection and sync - **CVM relay:** `relay.primal.net` — for ContextVM kind 25910 events and CEP-6 announcements - **Local relay:** Port 4869, LittleFS 4MB partition at 0x500000, max 5000 events, 21-day TTL - **Nutshell CLI:** `cashu` command for token generation diff --git a/MERGE_PLAN.md b/MERGE_PLAN.md new file mode 100644 index 0000000..ff60e4b --- /dev/null +++ b/MERGE_PLAN.md @@ -0,0 +1,119 @@ +# Mining Feature: Squash-Merge Execution Plan + +## Overview +Squash-merge `feature/mining-payment` into `master`, update relay config, push. + +## Repositories +- **Shared repo:** `/home/c03rad0r/esp32-tollgate` (master) +- **Mining worktree:** `/home/c03rad0r/esp32-tollgate-mining` (feature/mining-payment) +- **Backup:** `/home/c03rad0r/mining-work-backup/` + +## Checklist + +### Phase 1: Documentation & Config Updates +- [ ] 1.1 Write this MERGE_PLAN.md +- [ ] 1.2 Update `config.c` — add relays to nostr_seed_relays (8/8) and nostr_relays (4/4) +- [ ] 1.3 Update `AGENTS.md` — reflect new relay lists in shared repo +- [ ] 1.4 Commit relay config changes to worktree + +### Phase 2: Rebase & Test +- [ ] 2.1 Rebase `feature/mining-payment` onto `master` +- [ ] 2.2 Run `make test-unit` — all 15 suites must pass + +### Phase 3: Backup +- [ ] 3.1 Backup branch to `/home/c03rad0r/mining-work-backup/` + +### Phase 4: Squash-Merge +- [ ] 4.1 Squash-merge `feature/mining-payment` into `master` with detailed body +- [ ] 4.2 Run `make test-unit` on master to confirm +- [ ] 4.3 Run `idf.py build` on master to confirm clean build + +### Phase 5: Push & Cleanup +- [ ] 5.1 Push master to origin +- [ ] 5.2 Remove git worktree +- [ ] 5.3 Update MINING_WORKTREE_PLAN.md checklist + +## Relay Updates + +### nostr_seed_relays (TOLLGATE_MAX_SEED_RELAYS = 8) +| Slot | Relay | Latency | Notes | +|------|-------|---------|-------| +| 0 | wss://relay.orangesync.tech | existing | NIP-77 | +| 1 | wss://relay.damus.io | existing | | +| 2 | wss://nos.lol | existing | | +| 3 | wss://relay.nostr.band | existing | | +| 4 | wss://relay.anzenkodo.workers.dev | 90ms | FR, NIP-01 | +| 5 | wss://nostr.koning-degraaf.nl | 91ms | NL, NIP-01 | +| 6 | wss://knostr.neutrine.com | 103ms | FR, NIP-01 | +| 7 | wss://nostr.einundzwanzig.space | 106ms | DE | + +### nostr_relays (TOLLGATE_MAX_RELAYS = 4) +| Slot | Relay | Notes | +|------|-------|-------| +| 0 | wss://relay.damus.io | existing | +| 1 | wss://nos.lol | existing | +| 2 | wss://relay.anzenkodo.workers.dev | NEW | +| 3 | wss://nostr.koning-degraaf.nl | NEW | + +## Squash Commit Message +``` +feat(mining): Bitcoin mining-for-bandwidth payment system + +New modules: +- mining_payment.c/h: hashprice calc (nbits->difficulty->sat/GH/s/day), + share validation, client stats, allotment conversion (ms + bytes) +- stratum_client.c/h: SV1 upstream pool connection (subscribe/authorize/submit) +- stratum_proxy.c/h: Local SV1 TCP server for downstream miners, job broadcast +- sw_miner.c/h: Software SHA256d miner (ESP32 CPU fallback) +- asic_miner.c/h: ASIC detection stub (BM1366/BM1368 SPI) + +Config: +- config.h/c: mining_payout_mode_t enum (auto/pool/upstream/proxy_only), + stratum pool settings, mining port, hashprice override, sandbox mint access +- Defaults fill nostr_seed_relays (8/8) and nostr_relays (4/4) with fast relays + +Integration into existing modules: +- session.h/c: payment_method_t enum (CASHU/MINING/BYTES) +- firewall.h/c: firewall_set_mining_port(), firewall_set_sandbox_mint_access() +- tollgate_api.c: GET /mining/job, POST /mining/share, GET /mining/stats +- tollgate_client.h/c: TG_CLIENT_MINING state, mining discovery tag parsing +- tollgate_main.c: mining init in start_services(), stratum_client_tick() in loop +- captive_portal.c: tabbed Cashu/Mine UI with live hashrate polling + +Unit tests (69 new assertions across 4 suites): +- test_mining_payment (23 tests): nbits->difficulty, hashprice, client stats, allotment +- test_stratum_proxy (21 tests): job set/get, stats, type validation +- test_session_payment_method (12 tests): PAYMENT_METHOD enum, bytes/cashu methods +- test_tollgate_client_mining (20 tests): mining tag parsing, discovery struct +- test_firewall_sandbox (16 tests): client grant/revoke, max clients, setters + +Enhanced test stubs: +- BaseType_t/pdPASS in freertos/task.h +- lwip: sockets.h, etharp.h, prot/ip.h, prot/ip4.h, prot/tcp.h, netif.h +- dns_server.h, esp_wifi_ap_get_sta_list.h + +Build fixes: +- cvm_server.c: replace esp_timer_get_time() with xTaskGetTickCount(), + fix process_relay_message() 3-arg call to 2-arg +- stratum_proxy.c: widen task_name buffer 16->20 +- sw_miner.c: add missing #include esp_random.h +- nucula_src: save_proofs() moved to public in wallet.hpp + +Nostr relay updates: +- nostr_seed_relays: +relay.anzenkodo.workers.dev, +nostr.koning-degraaf.nl, + +knostr.neutrine.com, +nostr.einundzwanzig.space (8/8 slots) +- nostr_relays: +relay.anzenkodo.workers.dev, +nostr.koning-degraaf.nl (4/4 slots) + +Binary: 1.2MB, 70% partition free (ESP32-S3, 16MB flash) +``` + +## Commits on feature/mining-payment (before squash) +1. `c75230e` — feat(mining): add new mining source files and unit tests +2. `beb73a2` — feat(mining): integrate mining subsystem into existing modules +3. `473b4d1` — fix: build errors in cvm_server, stratum_proxy, sw_miner + nucula visibility +4. `ef9ae98` — test: add 4 new unit test suites for mining modules + +## Rules +- No comments in code unless explicitly requested +- Commit + push after each checkpoint +- Shared repo must stay on master, clean -- cgit v1.2.3