-
Notifications
You must be signed in to change notification settings - Fork 47
Closed
Description
Problem
Currently, Mostro mobile clients rely on Yadio's HTTP API (https://api.yadio.io) for fetching Bitcoin/fiat exchange rates. This creates two issues:
- Censorship vulnerability — The API is blocked in Venezuela (and potentially other countries), preventing users from creating/taking orders.
- Scaling costs — HTTP APIs require infrastructure that scales with user count (more requests = higher costs for Yadio).
Proposed Solution
Publish exchange rates to Nostr relays using NIP-33 addressable events (kind 30078).
Benefits
- ✅ Censorship-resistant — Governments cannot block decentralized Nostr relays
- ✅ Zero scaling cost — Relays host events for free; Yadio (or Mostro) only publishes once every 5-10 minutes
- ✅ Better UX in censored regions — Venezuela, Cuba, and other restricted countries can access rates
- ✅ Backward compatible — HTTP API can remain as fallback
Technical Specification
Event Structure
Kind: 30078 (Application-specific data)
d tag: "mostro-rates"
Content: JSON object with all currency rates
Example Event
{
"kind": 30078,
"pubkey": "<yadio_or_mostro_pubkey>",
"created_at": 1732546800,
"tags": [
["d", "mostro-rates"],
["updated_at", "1732546800"],
["source", "yadio"]
],
"content": "{\"USD\": {\"BTC\": 0.000024}, \"EUR\": {\"BTC\": 0.000022}, \"VES\": {\"BTC\": 0.0000000012}, ...}",
"sig": "..."
}Client Integration (Mostro Mobile)
// Subscribe to exchange rates from Nostr
final subscription = nostrPool.subscribe([
Filter(
kinds: [30078],
authors: [yadioNostrPubkey],
tags: {'#d': ['mostro-rates']},
),
]);
subscription.stream.listen((event) {
final rates = jsonDecode(event.content);
// Update UI with rates['USD']['BTC'], etc.
});Fallback: If Nostr fetch fails, fall back to HTTP API.
Update Frequency
- Recommended: Every 5-10 minutes (same as current HTTP API polling)
- Publisher: Yadio (or Mostro daemon if Yadio doesn't adopt)
Recommended Relays
wss://relay.mostro.network(Mostro's relay, high availability)wss://relay.damus.io(public, widely used)wss://nos.lol(fast, good uptime)wss://relay.nostr.band(archives everything, good fallback)
Implementation Plan
Phase 1: Proof of Concept (Mostro Daemon)
If Yadio doesn't adopt Nostr publishing, Mostro daemon can:
- Fetch rates from Yadio HTTP API every 5 minutes
- Publish to
relay.mostro.network+ public relays - Sign events with Mostro's pubkey
Code location: src/exchange_rates.rs (new module)
Phase 2: Mobile Client Integration
- Update
ExchangeServiceto support Nostr as primary source - Add fallback to HTTP API if Nostr unavailable
- Cache rates locally (5-10 min TTL)
Related spec: EXCHANGE_SERVICE.md
References
- NIP-33: Parameterized Replaceable Events (https://github.com/nostr-protocol/nips/blob/master/33.md)
- Yadio API docs: https://yadio.io/api
- Related issue: Censorship in Venezuela (blocked API access)
Labels: enhancement, censorship-resistance, nostr, exchange-rates
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels