messaging: the price of writing to a listing rises as its queue fills

Flooding a listing's inbox now gets dearer with every envelope. Relays ask
more proof-of-work from half full on, the node tells browsers the current
price, and the browser mines to it (or says the listing is too busy).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
2026-11-18 20:59:11 +01:00
co-authored by Claude Sonnet 5.5
parent 13c82f8d59
commit 253eb6e75c
12 changed files with 379 additions and 35 deletions
+19 -1
View File
@@ -314,6 +314,20 @@ the browser had the data and cannot be forced to forget it.
ties); a newcomer with less work than everything queued is rejected. So
filling a queue costs more than the proof-of-work of the messages it
displaces.
**The price rises as a listing's owner queue fills**, so flooding gets
dearer with every envelope instead of locking honest senders out at a price
they cannot see. An envelope to the owner of a listing needs the node's
message difficulty while fewer than half of the queue is used, one bit more
from half full, two bits more from three quarters, and once the queue is
full one bit more than the weakest envelope waiting (so it displaces
something). It is a local policy, like the queue itself: a node refuses
(ignoring, without penalty) what is too cheap *for it*, and the sender's
gateway tells the browser the price (`GET /api/v1/messages/required`, and a
429 with `required_bits`). A browser mines up to 24 bits (about half a
minute); a listing that asks for more is being flooded, and the sender is
told to come back later. An attacker must out-work 200 envelopes to keep one
honest sender out, so the cost to hold a listing's inbox is about 200 times
what a sender pays to get in.
Invalid envelopes are rejected and the relaying peer loses score. Unknown
listing, wrong `rcpt` after a device change, and clock failures are **ignored
@@ -370,7 +384,11 @@ text rules below are enforced by endpoints.
`PUT|GET|DELETE /api/v1/listings/{id}/address` (the private address). A
reply body is `{type: "text"|"grant", text, address, phone, email, note,
valid_days}`; a grant without `address` uses the stored one.
- `GET /api/v1/status` reports `message_difficulty`, which the browser mines to.
- `GET /api/v1/messages/required?author=<64 hex>&id=<32 hex>` answers
`{"bits": n}`, the proof-of-work a message to that listing needs right now (see
relay validation, step 6). `GET /api/v1/status` reports `message_difficulty`,
the price of a quiet queue; a browser takes the larger of the two and asks
again if a 429 names a higher price.
- **Flags:** `--message-difficulty` (default 14) and `--max-new-threads`.
- A gateway sees the buyer's IP address and mailbox tag. Buyers can use any
gateway; nothing else about the conversation is exposed.