Feature: Price Feed via Nostr (Relay Mode) for Blocked Regions
Problem
A Mostro node operator in Venezuela cannot fetch prices from the price API (api.yadio.io) because it's DNS-blocked by Venezuelan ISPs.
PR #685 solved this for mobile users — the daemon publishes kind 30078 price events to Nostr, and the app subscribes instead of hitting the blocked API.
But the node operator still needs to fetch prices. If the operator is in a region where the price API is blocked, they cannot publish prices.
Proposed Solution
Allow the node operator to subscribe to price events from trusted Mostro nodes via Nostr instead of fetching from the API directly.
Prices are always published to Nostr. This setting only controls the source.
Settings (settings.toml)
Add to [mostro] section:
# Price source configuration
# Options:
# "api" - fetch directly from price API (default)
# "nostr" - subscribe from trusted nodes via Nostr
# "api_nostr" - price API first, Nostr as fallback
price_source = "api"
# Trusted Mostro node pubkeys for price feed (hex, one per line)
# Only used when price_source = "nostr" or "api_nostr"
trusted_nodes = [
"00000235a3e904cfe1213a8a54d6f1ec1bef7cc6bfaabd6193e82931ccf1366a",
"82fa8cb978b43c79b2156585bac2c011176a21d2aead6d9f7c575c005be88390",
]
Relays are not reconfigured — the node uses existing relay configuration from [nostr] section.
Behavior
price_source |
Source |
Publish to Nostr |
api |
Price API |
✅ Always |
nostr |
Nostr from trusted nodes |
✅ Always |
api_nostr |
API first, Nostr fallback |
✅ Always |
Technical Details
Kind 30078 (NIP-33)
The daemon already publishes kind 30078 events for price data:
{
"kind": 30078,
"tags": [
["d", "mostro-rates"],
["published_at", "1234567890"],
["source", "yadio"],
["expiration", "1234568190"]
],
"content": "{\"BTC\":{\"USD\":50000.0,\"EUR\":45000.0}}"
}
The subscriber subscribes to kind 30078 from trusted_nodes pubkeys with d = "mostro-rates" tag.
Implementation
- Add
price_source and trusted_nodes to MostroSettings config struct
- Create
NostrPriceSubscriber that subscribes to kind 30078 from trusted nodes
- Cache prices from Nostr subscription
- Modify
BitcoinPriceManager to use either API or Nostr based on price_source
- Relay configuration from
[nostr] section is reused
Example: Venezuela Node Config
[mostro]
price_source = "nostr"
trusted_nodes = [
# Negrunch's node (outside blocked regions)
"82fa8cb978b43c79b2156585bac2c011176a21d2aead6d9f7c575c005be88390",
# Mostro Cuba node
"00000235a3e904cfe1213a8a54d6f1ec1bef7cc6bfaabd6193e82931ccf1366a",
]
[nostr]
relays = [
"wss://relay.mostro.network",
]
Open Questions
- Staleness: If trusted nodes go offline, prices become stale. Should we log a warning?
- Cache TTL: Should we reject Nostr prices older than X minutes?
- Bootstrap: On first start with
nostr, should we do one API fetch as bootstrap?
- Multi-node merge: If multiple trusted nodes publish different prices, which wins?
Reference
Feature: Price Feed via Nostr (Relay Mode) for Blocked Regions
Problem
A Mostro node operator in Venezuela cannot fetch prices from the price API (
api.yadio.io) because it's DNS-blocked by Venezuelan ISPs.PR #685 solved this for mobile users — the daemon publishes kind 30078 price events to Nostr, and the app subscribes instead of hitting the blocked API.
But the node operator still needs to fetch prices. If the operator is in a region where the price API is blocked, they cannot publish prices.
Proposed Solution
Allow the node operator to subscribe to price events from trusted Mostro nodes via Nostr instead of fetching from the API directly.
Settings (settings.toml)
Add to
[mostro]section:Relays are not reconfigured — the node uses existing relay configuration from
[nostr]section.Behavior
price_sourceapinostrapi_nostrTechnical Details
Kind 30078 (NIP-33)
The daemon already publishes kind 30078 events for price data:
{ "kind": 30078, "tags": [ ["d", "mostro-rates"], ["published_at", "1234567890"], ["source", "yadio"], ["expiration", "1234568190"] ], "content": "{\"BTC\":{\"USD\":50000.0,\"EUR\":45000.0}}" }The subscriber subscribes to kind 30078 from
trusted_nodespubkeys withd = "mostro-rates"tag.Implementation
price_sourceandtrusted_nodestoMostroSettingsconfig structNostrPriceSubscriberthat subscribes to kind 30078 from trusted nodesBitcoinPriceManagerto use either API or Nostr based onprice_source[nostr]section is reusedExample: Venezuela Node Config
Open Questions
nostr, should we do one API fetch as bootstrap?Reference
d = "mostro-rates"{"BTC": {"USD": 50000.0, ...}}