Skip to content

Prober: writeability via NIP-11 (pow/restricted) + ephemeral publish-test #37

@melvincarvalho

Description

@melvincarvalho

Determine which relays actually accept writes.

NIP-11 enrichment (no key/writes)

nip11Flags also reads min_pow_difficulty (→ requiresPow) and restricted_writes (→ restrictedWrites); stored on the relay doc. Refine the public filter to exclude pow/restricted.

Ephemeral publish-test (ground truth, opt-in)

With PROBE_PRIVKEY set (a dedicated throwaway key, never identity), the prober signs one ephemeral event (kind 20000 — relayed, not stored) and reads the ["OK", id, accepted, reason]. Records acceptsEvents + publishReason (parsed NIP-01 prefix: pow / auth-required / payment-required / restricted / rate-limited / blocked). Off unless the key is set. Tested only on online tracked relays; folded into the existing connection (one WS).

Changes

  • nip11Flags: + requiresPow, restrictedWrites.
  • checkRelay: optional testEvent → publishes on open, captures OK; returns publish:{accepted,reason}.
  • buildTestEvent, reasonCat; probeRelay records publish result; sweepOnce builds one test event/sweep when cfg.privkey.
  • proberConfig.privkey from PROBE_PRIVKEY. db public filter excludes pow/restricted.
  • tests + .env.example.

Acceptance

  • NIP-11 pow/restricted captured; public excludes them.
  • With PROBE_PRIVKEY: acceptsEvents + reason recorded from a real ephemeral write; off without it.
  • npm test green.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions