-
Notifications
You must be signed in to change notification settings - Fork 1
hyper nostr
Hyper-Nostr is a distributed Nostr relay that aims to synchronize your relay storage and real-time events using Hyperswarm, and Hyperbeedee. Read a more detailed introduction here.
npx hyper-nostr 3338 nostr
Where 3338 is the port and nostr is the topic
You will get ED25519 your public key
your key is 31e43770940ca86
echo '["REQ", "hyper", {}]' | websocat -n --ping-interval 20 ws://localhost:3338/nostr
Uses Websocat
Displays a stream of events
To start using Hyper-Nostr Relay, follow these steps:
- Install the package:
npm -g hyper-nostr
- Run the relay:
hyper-nostr [port [...starting topics]]
(default port: 3000) - Add your relay to your Nostr client:
ws://localhost:[port]/[topic]
(replace[port]
and[topic]
with your desired values) - The setup is complete!
Hyper-Nostr Relay is a powerful tool that behaves as a public relay for the Nostr network. It enables users to send and receive notes from their peers through a distributed and synchronized storage system.
The relay utilizes the following technologies:
- Hyperswarm: A decentralized network for peer discovery and communication.
- Hyperbeedee: A database loosely based on MongoDB.
Additionally, the project leverages the Hyper SDK to abstract the management of hyperswarm and cores.
Hyper-Nostr Relay supports several Nostr Improvement Proposals (NIPs):
- NIP-01 (mandatory Nostr implementation)
- NIP-02 (contact lists)
- NIP-04 (direct messages)
- NIP-09 (event deletion)
- NIP-11 (relay information)
- NIP-12 (generic tag queries)
- NIP-16 (event treatment)
- NIP-20 (command results)
- NIP-33 (parametrized replaceable events)
- NIP-45 (event counts)
- NIP-50 (search)
To interact with the Hyper-Nostr Relay programmatically, use the following code:
import * as SDK from 'hyper-sdk'
import createSwarm from 'hyper-nostr'
import goodbye from 'graceful-goodbye'
const yourStorageFolder = '.hyper-nostr-relay' // set to false to not persist
const theTopic = 'nostr'
const sdk = SDK.create({
storage: yourStorageFolder
})
goodbye(_ => sdk.close())
const {
subs, // a Map<subscriptionId: string, { filters: Filter[], socket: WebSocket }> object
sendEvent, // (event: Event, kind: 'regular' | 'replaceable' | 'ephemeral', socket?: WebSocket) => document: Object | Error; to send a Nostr Event to the peers and the local database. Optionally pass in the socket of the sender to filter them out in the broadcast
queryEvents, // (filters: Filter[]) => Promise<Event[]>; to query the database for the events that match the list of filters
update, // () => Promise<void>; to await the database to update, syncing with the connected peers
} = await createSwarm(sdk, theTopic)
https://github.com/blakejakopovic/hypercore-crypto/commit/669cfdfded913f290ce13b87556f484ab58adc46
Thank you for visiting our project's wiki! We hope you found the information useful. If you have any questions or suggestions, please feel free to open an issue or submit a pull request. We appreciate your contribution and support!