Skip to content

docs: add Exchange Rates event (NIP-33 kind 30078)#38

Merged
grunch merged 2 commits intomainfrom
add-exchange-rates-event
Mar 26, 2026
Merged

docs: add Exchange Rates event (NIP-33 kind 30078)#38
grunch merged 2 commits intomainfrom
add-exchange-rates-event

Conversation

@mostronatorcoder
Copy link
Copy Markdown
Contributor

Overview

Add documentation for the new Exchange Rates publishing feature via Nostr.

Mostro instances can now publish Bitcoin/fiat exchange rates as NIP-33 addressable events (kind 30078) to provide censorship-resistant price data for clients.


What's New

Exchange Rates Event (Kind 30078)

  • Event kind: 30078 (NIP-33 addressable, replaceable)
  • d tag: "mostro-rates" (unique identifier)
  • Content: Full Yadio API format {"BTC": {"USD": 50000.0, "EUR": 45000.0, ...}}
  • Tags:
    • published_at: Unix timestamp (daemon time)
    • source: Rate source (e.g., "yadio")
    • expiration: NIP-40 tag (prevents stale rates)

Configuration

[mostro]
publish_exchange_rates_to_nostr = true  # default
exchange_rates_update_interval_seconds = 300  # default: 5 minutes, min: 60s

Why Nostr?

In censored regions (Venezuela, Cuba, Iran), HTTP exchange rate APIs are often blocked by governments.

Nostr's decentralized relay network provides:

  • Censorship resistance — impossible to block all relays
  • Zero scaling cost — relays distribute events
  • Geographic distribution — relays worldwide
  • No single point of failure

This aligns with Mostro's mission to provide censorship-resistant peer-to-peer Bitcoin trading.


Security

⚠️ CRITICAL for clients:

Clients MUST:

  1. Verify event.pubkey matches the expected Mostro instance pubkey
  2. Verify signature (NIP-01)
  3. Check expiration timestamp to avoid stale rates
  4. Fall back to HTTP API if Nostr fails

Without pubkey verification, a malicious actor could publish fake rates to manipulate prices.


Implementation


Documentation Changes

  • Added complete section "Exchange Rates (NIP-33 Kind 30078)" to src/other_events.md
  • Includes:
    • Event structure with full example
    • Tag explanations
    • Content format (Yadio structure)
    • Configuration options
    • Client usage guide
    • Security considerations
    • Use case explanation (censorship resistance)

Testing

  • Markdown renders correctly
  • JSON examples are valid
  • Links are correct
  • Formatting is consistent with existing docs

Related

This feature was motivated by the Venezuela censorship use case where government blocks access to exchange rate APIs, making it impossible for users to see real-time BTC prices for trading.

With Nostr, price data flows freely, enabling peer-to-peer Bitcoin trading even under authoritarian regimes.


Ready for review! 📖

Mostronator and others added 2 commits March 26, 2026 11:54
Add documentation for the new exchange rates publishing feature via Nostr.

## Overview

Mostro instances can now publish Bitcoin/fiat exchange rates as NIP-33
addressable events (kind 30078) to provide censorship-resistant price
data for clients.

## Key Features

- **Event kind**: 30078 (NIP-33 addressable, replaceable)
- **d tag**: "mostro-rates" (unique identifier)
- **Content**: Full Yadio API format {\BTC\: {\USD\: 50000.0, ...}}
- **Expiration**: NIP-40 tag (min(interval × 2, 3600))
- **Configurable**: Update interval (default 300s, min 60s)
- **Optional**: Can be disabled via config

## Why Nostr?

In censored regions (Venezuela, Cuba, Iran), HTTP exchange rate APIs
are often blocked. Nostr's decentralized relay network provides:

- Censorship resistance
- Zero scaling cost
- Geographic distribution
- No single point of failure

## Security

Clients MUST:
- Verify event.pubkey matches expected Mostro instance
- Verify signature (NIP-01)
- Check expiration timestamp
- Fall back to HTTP API if Nostr fails

## Implementation

- Daemon PR: MostroP2P/mostro#685
- Client spec: MostroP2P/app#36

Related to the Venezuela censorship resistance use case discussed in:
MostroP2P/mostro#684
@grunch grunch merged commit 23993d1 into main Mar 26, 2026
@grunch grunch deleted the add-exchange-rates-event branch March 26, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant