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

Why It Matters

  • 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

The useful property is asymmetric cost. Creating many acceptable events becomes expensive for the sender, while checking the proof remains cheap for relays and clients.

Tradeoffs

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

PoW also shifts spam resistance from account identity to compute availability. That can help in permissionless environments, but it does not distinguish between a legitimate new user and a well-funded spammer.


Primary sources:

Mentioned in:

See also: