Send event to nostr with data of APIs. Easly access and don't disturbe to APIs multiples times.
- Oracle get data from APIs.
- Oracle create event with the data and publish to Nostr each X time.
- You subscribe with a filter to Nostr.
- You get the data from the event and use it.
Copy .env.example to .env and fill the NOSTR_PRIVATE_KEY with random private key for sign events
The public key is used to filter events.
cp .env.example .envUse correct node version
nvm useInstall the dependencies
pnpm ipnpm devAre two types of events:
- Remplazable data: are parameterized replaceable, the relay must save the last event with the last update of the oracle. The oracle updates these events in a short period of time. For example: every 1 minute.
- Historical data (WIP): are regular, the relay save all events. The oracle updates these events in a long period of time. For example: every 1 hour.
{
"id": <32-bytes lowercase hex-encoded sha256 of the serialized event data>,
"pubkey": <32-bytes lowercase hex-encoded public key of the oracle>,
"created_at": <unix timestamp in seconds>,
"kind": 30021,
"tags": [
[
"d",
<string, information of the event data>
]
],
"content": <string JSON enconde, data>,
"sig": <64-bytes lowercase hex of the signature of the sha256 hash of the serialized event data>
}KIND: 30021, parameterized replaceable event. More info in NIP-01.
-
About: Bitcoin price in USD from yadio.io.
-
Content:
"price": "<string>"
- About: Bitcoin block height.
- Content:
- About: Bitcoin fees in satoshi per byte.
- Content:
- About: Bitcoin mining difficulty.
- Content:
{
"id": <32-bytes lowercase hex-encoded sha256 of the serialized event data>,
"pubkey": <32-bytes lowercase hex-encoded public key of the oracle>,
"created_at": <unix timestamp in seconds>,
"kind": 3021,
"tags": [
[
"d",
<string, information of the event data>
]
],
"content": <string JSON enconde, data>,
"sig": <64-bytes lowercase hex of the signature of the sha256 hash of the serialized event data>
}KIND: 3021, regular event. More info in NIP-01.
- Function to get data from APIs
- Function to create event
- Function to send event to Nostr
- Improve README
- Filter examples
- Use nostr-tools for conect to relays
- Fix conection to multiple relays
- Historical events (regular nostr events)
- Other data events
Ideas for names:
- Noracle
- Nostracle
Made with 👐 by Rapax
Tips are welcome through Lightning Zap to ⚡rapax@lawallet.ar.