2025-09-05 14:14:15 -04:00
2025-09-05 14:14:15 -04:00
2025-09-03 20:39:06 -04:00
2025-09-05 14:14:15 -04:00
2025-09-05 14:14:15 -04:00
2025-09-05 11:26:08 -04:00
2025-09-03 20:39:06 -04:00
2025-09-05 11:32:31 -04:00
2025-09-05 14:14:15 -04:00
2025-09-05 11:26:08 -04:00
2025-09-05 14:14:15 -04:00
2025-09-05 14:14:15 -04:00
2025-09-05 14:14:15 -04:00

A nostr relay in C with sqlite on the back end.

NIPs

  • NIP-01: Basic protocol flow implementation
  • NIP-09: Event deletion
  • NIP-11: Relay information document
  • NIP-13: Proof of Work
  • NIP-15: End of Stored Events Notice
  • NIP-20: Command Results
  • NIP-22: Event created_at Limits
  • NIP-25: Reactions
  • NIP-26: Delegated Event Signing
  • NIP-28: Public Chat
  • NIP-33: Parameterized Replaceable Events
  • NIP-40: Expiration Timestamp
  • NIP-42: Authentication of clients to relays
  • NIP-45: Counting results. experimental
  • NIP-50: Keywords filter. experimental
  • NIP-70: Protected Events

NIP-13: Proof of Work Configuration

The relay supports NIP-13 Proof of Work validation with configurable settings. PoW validation helps prevent spam and ensures computational commitment from event publishers.

Environment Variables

Configure PoW validation using these environment variables:

  • RELAY_POW_ENABLED - Enable/disable PoW validation (default: 1)

    • 1, true, or yes to enable
    • 0, false, or no to disable
  • RELAY_MIN_POW_DIFFICULTY - Minimum required difficulty (default: 0)

    • Range: 0-64 (reasonable bounds)
    • 0 = no minimum requirement (events without PoW are accepted)
    • Higher values require more computational work
  • RELAY_POW_MODE - Validation mode (default: basic)

    • basic - Basic PoW validation
    • full - Full validation with nonce tag requirements
    • strict - Strict anti-spam mode with committed target validation
    • disabled - Disable PoW validation entirely

Examples

# Basic setup - accept events with or without PoW
export RELAY_POW_ENABLED=1
export RELAY_MIN_POW_DIFFICULTY=0
export RELAY_POW_MODE=basic

# Anti-spam setup - require minimum difficulty 16
export RELAY_POW_ENABLED=1
export RELAY_MIN_POW_DIFFICULTY=16
export RELAY_POW_MODE=strict

# Disable PoW validation completely
export RELAY_POW_ENABLED=0

Behavior

  • min_difficulty=0: Events without PoW are accepted; events with PoW are validated
  • min_difficulty>0: All events must have valid PoW meeting minimum difficulty
  • strict mode: Additional validation prevents difficulty commitment gaming
  • NIP-11 integration: PoW configuration is advertised via relay information document

Testing

Run the comprehensive PoW test suite:

./tests/13_nip_test.sh

The test suite validates:

  • NIP-11 PoW support advertisement
  • Event acceptance without PoW (when min_difficulty=0)
  • Event validation with valid PoW
  • Configuration via environment variables
  • NIP-13 reference event validation
Description
No description provided
Readme 255 MiB
v1.0.0 Latest
2025-11-01 11:03:39 +00:00
Languages
C 79.6%
JavaScript 13.4%
Shell 6%
CSS 0.5%
HTML 0.3%
Other 0.2%