Skip to content

Commit 23993d1

Browse files
authored
Merge pull request #38 from MostroP2P/add-exchange-rates-event
docs: add Exchange Rates event (NIP-33 kind 30078)
2 parents 3f47ba2 + 6727b84 commit 23993d1

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

src/other_events.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,60 @@ The operator of a Mostro instance decides which relays the events from that inst
224224

225225
The `r` label indicates the relays through which the Mostro instance is publishing its events.
226226

227+
## Exchange Rates
228+
229+
Each Mostro instance publish Bitcoin/fiat exchange rates to Nostr relays as addressable events (kind 30078):
230+
231+
### Event Structure
232+
233+
```json
234+
[
235+
"EVENT",
236+
"RAND",
237+
{
238+
"id": "<Event id>",
239+
"pubkey": "<Mostro's pubkey>",
240+
"kind": 30078,
241+
"tags": [
242+
["d", "mostro-rates"],
243+
["published_at", "1732546800"],
244+
["source", "yadio"],
245+
["expiration", "1732550400"]
246+
],
247+
"content": "{\"BTC\": {\"USD\": 50000.0, \"EUR\": 45000.0, \"VES\": 850000000.0, \"ARS\": 105000000.0, ...}}",
248+
"sig": "<Mostro's signature>",
249+
"created_at": 1732546800
250+
}
251+
]
252+
```
253+
254+
### Tags
255+
256+
- **d**: `"mostro-rates"` — NIP-01 identifier that makes this event replaceable. Each new rate update replaces the previous one.
257+
- **published_at**: Unix timestamp when the daemon published the event (daemon time, not source timestamp).
258+
- **source**: Rate source identifier (e.g., `"yadio"`).
259+
- **expiration**: Unix timestamp for event expiration ([NIP-40](https://github.com/nostr-protocol/nips/blob/master/40.md)). Prevents stale rates from being served.
260+
261+
### Content Format
262+
263+
The `content` field contains the full rate response in JSON format matching the source API structure (Yadio format):
264+
265+
```json
266+
{
267+
"BTC": {
268+
"BTC": 1,
269+
"USD": 50000.0,
270+
"EUR": 45000.0,
271+
"VES": 850000000.0,
272+
"ARS": 105000000.0,
273+
"AED": 260491.35,
274+
"..."
275+
}
276+
}
277+
```
278+
279+
**Rate semantics**: Each value under `"BTC"` represents the price of 1 BTC in that currency.
280+
227281
# Development Fee
228282

229283
The development fee mechanism provides sustainable funding for Mostro development by automatically sending a configurable percentage of the Mostro fee to a lightning address on each successful order, this a regular event with kind 8383 which is expected to be stored by relays.

0 commit comments

Comments
 (0)