Scaffold Allmende: identity, canonical JSON, signed listings
- internal/jcs: RFC 8785 canonical JSON (integers only) - internal/identity: ed25519 keypair, 0600 key file, no overwrite - internal/listing: signed listing record with PoW, validation, tombstones and supersede rules - docs/PROTOCOL.md: architecture and decisions so far Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
# Protocol (draft v1)
|
||||
|
||||
A distributed, free marketplace for buying/selling and renting. Listing requires
|
||||
running a node; searching is browser-only through any node's HTTP gateway.
|
||||
|
||||
## Architecture
|
||||
|
||||
- **Nodes** (Go, single binary): libp2p between nodes, HTTP gateway + web UI +
|
||||
search API on every node.
|
||||
- **Browsers** never join the P2P network. They fetch from any gateway and
|
||||
**verify signatures themselves**, so a gateway cannot forge listings.
|
||||
- **Sharding**: listings are gossiped per `geohash` region (precision 6, ~1 km)
|
||||
and category. Nodes subscribe to the regions they care about and index them
|
||||
locally.
|
||||
- **Launch scope**: one German state or metro area.
|
||||
|
||||
## Identity
|
||||
|
||||
An ed25519 keypair is the identity. No accounts. The public key (64 hex chars)
|
||||
is the `author`.
|
||||
|
||||
## Listing record
|
||||
|
||||
Canonical JSON (RFC 8785), integers only. See `internal/listing`.
|
||||
|
||||
| field | notes |
|
||||
|---|---|
|
||||
| `v` | format version, currently 1 |
|
||||
| `id` | 32 hex, stable across versions |
|
||||
| `author` | hex ed25519 public key |
|
||||
| `seq` | higher replaces lower for same `id` + `author` |
|
||||
| `created_at`, `expires_at` | unix seconds; lifetime <= 30 days, owner re-signs to renew |
|
||||
| `tombstone` | deletion marker: higher `seq`, no content, only routing `geohash` |
|
||||
| `kind` | `rent` or `sale` |
|
||||
| `category` | `apartment`, `house`, `room`, `commercial` |
|
||||
| `geohash` | precision 6 |
|
||||
| `price` | `{amount_cents, currency: "EUR", period: month|once}` |
|
||||
| `area_m2`, `rooms_x2` | rooms * 2 (2.5 rooms = 5) |
|
||||
| `features`, `title`, `description` | bounded text |
|
||||
| `images` | `{hash, thumb_hash}`, content-addressed, **no location** |
|
||||
| `endpoint` | owner's peer ID |
|
||||
| `delegate` | optional always-on host chosen by the owner |
|
||||
| `pow` | nonce; sha256 of the unsigned canonical bytes has N leading zero bits |
|
||||
| `sig` | ed25519 over the unsigned canonical bytes |
|
||||
|
||||
There is **no address, name, phone or email** in the record.
|
||||
|
||||
## Personal data (GDPR)
|
||||
|
||||
Only non-personal data is replicated. Exact address and contact details are
|
||||
released by the owner's node on request over an encrypted channel. Deletion =
|
||||
signed tombstone, honored by honest nodes, plus the owner's node ceasing to
|
||||
serve details.
|
||||
|
||||
## Images (illegal-content risk, e.g. CSAM)
|
||||
|
||||
- Images are **origin-hosted**: only the owner's node (or a host the owner
|
||||
explicitly delegates to) stores them. Third parties never replicate or
|
||||
persistently cache them. Gateways stream without storing.
|
||||
- Uploads are re-encoded, metadata stripped, size-capped, and checked against
|
||||
hash lists where access is available.
|
||||
- Signed abuse reports feed subscribable blocklists.
|
||||
- **Get a German lawyer's review before any public launch** (§184b StGB).
|
||||
|
||||
## Availability
|
||||
|
||||
Metadata (~2 KB) replicates regionally, so listings remain searchable while the
|
||||
owner is offline. Images and contact details need the owner's node or its
|
||||
delegate. UI shows an "owner offline" badge; listings expire if not re-signed
|
||||
within 30 days.
|
||||
|
||||
## Spam
|
||||
|
||||
Proof-of-work per listing plus subscribable blocklists. The format leaves room
|
||||
for vouching signatures later.
|
||||
|
||||
## Open
|
||||
|
||||
Buyer/seller messaging (E2E, store-and-forward), reciprocity rules, anti-
|
||||
discrimination (AGG) content rules.
|
||||
Reference in New Issue
Block a user