Nostr Core Concepts
Master the fundamental building blocks of the Nostr protocol. Understand keys, events, relays, and NIPs to build robust decentralized applications.
What you'll learn:
What is Nostr?
Nostr (Notes and Other Stuff Transmitted by Relays) is a simple, open protocol designed to facilitate decentralized, censorship-resistant social networking. Unlike traditional platforms that rely on centralized servers, Nostr operates through a network of independent relays and clients, ensuring users have full control over their data and interactions.
Why Nostr is Revolutionary
Nostr eliminates single points of failure and censorship by design. Your identity is secured by cryptographic keys that only you control, not by any centralized platform. This means no entity can permanently ban you, delete your content, or restrict your communications.
- User Sovereignty: You maintain ownership of your identity through cryptographic key pairs
- Censorship Resistance: The distributed nature ensures content cannot be globally censored
- Protocol Simplicity: Emphasizes simplicity, making it reliable, efficient, and easy to implement
Self-Sovereign Identity
You control your identity through cryptographic keys, not usernames or emails
Decentralized Network
No single point of failure. Data flows through multiple independent relays
Simple Protocol
Minimal, extensible design that's easy to implement and understand
Cryptographic Keys: Your Digital Identity
In Nostr, your identity is defined by a cryptographic keypair. This is fundamentally different from traditional social networks where you're identified by usernames or email addresses.
Private Key (nsec)
Your private key is your secret identity. It's used to sign events and prove you authored them. Never share this with anyone!
Public Key (npub)
Your public key is your address on Nostr. Others use it to find you and verify your events. Safe to share publicly.
Security Best Practice
Always generate your keys locally and store your private key securely. Consider using hardware wallets or secure key management tools for production applications.
Events: The Building Blocks
Everything in Nostr is an "event" - whether it's a text note, a like, a profile update, or any other action. Events are JSON objects that contain your message and metadata.
{
"id": "abc123...", // Event ID (SHA256 hash)
"pubkey": "your-public-key", // Your public key
"created_at": 1693920000, // Unix timestamp
"kind": 1, // Event type (1 = text note)
"tags": [], // Metadata tags
"content": "Hello Nostr!", // Your message
"sig": "signature..." // Cryptographic signature
}
Kind 1: Text Notes
The most common event type for sharing thoughts, updates, and messages.
Kind 0: Metadata
Profile information like name, bio, and picture URL.
Kind 3: Contacts
Your following list and relay recommendations.
Relays: The Network Infrastructure
Relays are simple servers that store and forward events. Unlike traditional social networks, you can connect to multiple relays simultaneously, and anyone can run a relay. However, managing multiple relay connections adds complexity to client applications.
Shugur Distributed Relay Cluster
Shugur solves the multi-relay complexity problem with a distributed cluster architecture. Connect to a single endpoint and get automatic high availability:
- • Single Connection: Connect to one endpoint, access the entire cluster
- • Automatic Failover: If one relay fails, others seamlessly take over
- • Data Redundancy: Events replicated across multiple nodes in real-time
- • Simplified Development: No complex multi-relay management in your app
Multi-Relay Strategy
- Connect to 3-5 relays for redundancy
- Choose geographically diverse relays
- Include both public and specialized relays
Relay Types
- Public: Open to everyone (like wss://shu01.shugur.net)
- Paid: Subscription-based for better quality
- Private: Invite-only or personal relays
- Specialized: Topic or community-specific
Shugur Relay
Connect to wss://shu01.shugur.net
- a high-performance relay optimized for developers with excellent uptime and low latency.
NIPs: Nostr Improvement Proposals
NIPs are standardized extensions to the Nostr protocol. They define new event types, features, and behaviors that clients and relays can implement.
NIP-01: Basic Protocol
Core specification for events, signatures, and relay communication.
NIP-02: Contact List
Follow lists and relay recommendations for users.
NIP-04: Encrypted DMs
Private messaging using end-to-end encryption.
NIP-05: DNS Verification
Link your Nostr identity to a domain name for verification.
NIP-09: Event Deletion
Request deletion of your own events from relays.
NIP-11: Relay Information
Discover relay capabilities and policies.
Security Model
Nostr's security is built on cryptographic primitives and decentralized architecture. Understanding the security model is crucial for building robust applications.
What Nostr Protects Against
- Identity impersonation (via signatures)
- Message tampering (via cryptographic hashes)
- Censorship (via multiple relays)
- Account seizure (you own your keys)
What You Must Protect
- Private key security (your responsibility)
- Metadata privacy (relay can see IP/timing)
- Content moderation (relays can filter)
- Spam and abuse (protocol-level solutions needed)
Ready to Start Building?
Now that you understand the core concepts, it's time to start building your first Nostr application.