Nostr (Notes and Other Stuff Transmitted by Relays) is a simple, open protocol for decentralized social networking.
Unlike traditional blockchain-based systems, Nostr takes a different approach:
Everything in Nostr is an event. Events are signed JSON objects:
{
"id": "event_id",
"pubkey": "author_public_key",
"created_at": 1234567890,
"kind": 1,
"content": "Hello, Nostr!",
"sig": "signature"
}
Relays are simple WebSocket servers that:
Simplicity: No blockchain, no mining, no consensus Censorship resistance: Multiple relays mean no single point of failure Identity: Public/private key pairs instead of usernames
Setting up a basic relay:
func handleWebSocket(w http.ResponseWriter, r *http.Request) {
conn, _ := upgrader.Upgrade(w, r, nil)
defer conn.Close()
for {
var msg Message
conn.ReadJSON(&msg)
if msg.Type == "EVENT" {
if verifySignature(msg.Event) {
storeEvent(msg.Event)
broadcastEvent(msg.Event)
}
}
}
}
Nostr demonstrates that decentralized social media doesn't require complex blockchain infrastructure—simple protocols can be powerful.