NIP-13 defines a proof-of-work system for Nostr events, requiring computational effort to create events as a spam prevention mechanism.

How It Works

Proof of work is demonstrated by finding an event ID (SHA256 hash) with a specified number of leading zero bits:

  1. Difficulty: Measured in leading zero bits (e.g., 20 bits = 2^20 attempts on average)
  2. Nonce Tag: Events include a nonce tag with the nonce value and target difficulty
  3. Verification: Relays and clients can quickly verify the work was done
{
  "tags": [["nonce", "12345", "20"]],
  ...
}

Difficulty Levels

BitsAverage AttemptsTypical Use
8256Minimal spam deterrent
1665,536Light filtering
201,048,576Moderate protection
2416,777,216Strong spam resistance

Use Cases

  • Relay Admission: Relays can require minimum PoW for event acceptance
  • Rate Limiting: Higher difficulty for actions like account registration
  • Spam Filtering: Clients can prioritize high-PoW events in feeds
  • Reputation Bootstrap: New accounts can demonstrate commitment via PoW

Limitations

  • Favors users with powerful hardware
  • Energy consumption concerns
  • Doesn’t prevent all spam, just raises the cost