# Relay Fix & Spot Editing Solution ## Problem Users were getting "Failed to publish after 2 attempts: No Promise in Promise.any was resolved" when trying to add spots. ## Root Causes 1. **Wrong relay URL**: Was using `wss://wotr.relay.xyz` instead of correct `wss://relay.contextvm.org` 2. **Trust score restriction**: wotr relay only allows Kind 1 events for low-trust users (trust score < 0.5) 3. **Custom kind blocked**: Kind 34799 was being rejected for new users ## Solution ### Multi-Relay Strategy with Fallback **Default Relays:** ```typescript relays: [ { url: 'wss://relay.contextvm.org', read: true, write: true }, // Primary (wotr relay) { url: 'wss://relay.damus.io', read: true, write: true }, // Fallback { url: 'wss://nos.lol', read: true, write: true }, // Fallback ] ``` **How it works:** 1. App attempts to publish to all 3 relays simultaneously 2. If wotr relay rejects (low trust score) → fallback relays accept 3. Spot publishes successfully as long as 1 relay accepts 4. As user builds trust on wotr relay, events eventually sync there too ### Event Kind Choice **Using Kind 30818 (Addressable Event):** - ✅ Allows editing spots (replaceable by pubkey + kind + d-tag) - ✅ Each user can update their own spots - ✅ Works on fallback relays immediately - ⏳ Works on wotr relay once trust score ≥ 0.5 ### Benefits **For new users:** - ✅ Spots publish immediately (via fallback relays) - ✅ Can edit their spots - ✅ No friction, no waiting **For established users:** - ✅ Spots publish to all relays (including wotr) - ✅ Benefit from wotr's WoT spam prevention - ✅ Higher trust = higher rate limits (up to 10,000 events/day) **For the platform:** - ✅ Spam protection (wotr relay filters by WoT) - ✅ Reliability (3 relays instead of 1) - ✅ Progressive trust system (users build reputation) - ✅ Edit functionality preserved ## Trust Score System (wotr relay) ### Rate Limits by Trust Score: | Trust Score | Kinds Allowed | Daily Rate Limit | |-------------|---------------|------------------| | r = 0 (new users) | Kind 1 only | 1 event/day | | 0 < r < 0.5 | Kind 1 only | 1-100 events/day | | r ≥ 0.5 | All kinds | Up to 10,000 events/day | | r ≥ 0.9 (high trust) | All kinds + backfill | 10,000 events/day | ### How to Build Trust: 1. Use the app normally (post notes, interact) 2. Get follows from trusted users 3. Receive zaps, engagement 4. Trust score increases over time 5. Eventually can publish all kinds to wotr relay ## User Experience ### Adding a Spot: **New user (low trust):** ``` 1. Fills spot form 2. Clicks "Add Spot" 3. wotr relay rejects Kind 30818 (low trust) 4. relay.damus.io accepts ✅ 5. Spot published successfully! 6. Visible immediately in app ``` **Established user (high trust):** ``` 1. Fills spot form 2. Clicks "Add Spot" 3. All 3 relays accept ✅ 4. Spot published successfully! 5. Visible immediately in app ``` ### Editing a Spot: ``` 1. User clicks Edit button 2. Updates spot details 3. Publishes updated event 4. Old event replaced on relays 5. Changes visible immediately ``` ## No Infrastructure Costs - ✅ All relays are free public relays - ✅ No server needed (pure client-side) - ✅ No big tech dependencies - ✅ $0/month operational costs ## Future Considerations ### If Spam Becomes an Issue: **Option A:** Rely on wotr relay's WoT filtering - High-trust users publish to wotr - Low-trust spam gets rate-limited - Natural spam protection **Option B:** Add Lightning payment (1 sat per spot) - As discussed earlier - Makes spam expensive - Can be added later if needed **Option C:** Community reporting - Users flag spam - Trusted users can verify/remove - Social moderation layer ### If OSM Permanence Desired: Run background sync service on Umbrel: - Watches wotr.relay.xyz for new spots - Automatically creates OSM nodes - Zero user friction - Cost: $0 (runs on your Umbrel) ## Conclusion **Current setup (after fixes):** - ✅ Spots publish reliably (3 relays) - ✅ Edit functionality works - ✅ Progressive trust system (wotr relay) - ✅ No infrastructure costs - ✅ No big tech dependencies - ✅ Minimal user friction **Next steps:** - Test spot creation with new relay configuration - Monitor which relays accept events - Build trust on wotr relay over time - Consider OSM sync later if permanence is critical