Commit Graph
42 Commits
Author SHA1 Message Date
nilsandClaude Sonnet 5.5 85e8b6cbd5 allmende-sim: run 100 real nodes in one process and measure spread, churn and cost
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 21:31:43 +01:00
nilsandClaude Sonnet 5.5 93921c14e8 SPECS.md: project brief for agents (idea, what exists, what is left, rules)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 21:25:11 +01:00
nilsandClaude Sonnet 5.5 0d5903be79 abuse reports in the browser: notice, visitor tips, operator form and queue
A listing page says when the node hides the listing and who flagged it. A
visitor can tip off the operator (proof-of-work, nothing is hidden by it); the
signed-in operator can sign or withdraw a report from the page and works
through the tips at #/mine/reports. e2e covers the real binaries.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 21:23:13 +01:00
nilsandClaude Sonnet 5.5 6d55222ac5 abuse reports: signed reports, gossip and sync, a local hide rule, visitor tips
A report is signed by a node operator (device key and certificate) and
gossiped on one global topic. Each node decides whose reports count: the
operator's own report hides a listing on that node, one trusted report of
illegal content hides it, and --hide-after trusted scam reports hide it
(--trust-reporter names others). Hidden listings stay stored and reachable.
Visitors can tip the node's operator off with a proof-of-work request that
hides nothing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 21:18:43 +01:00
nilsandClaude Sonnet 5.5 253eb6e75c 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
2026-11-18 20:59:11 +01:00
nilsandClaude Sonnet 5.5 13c82f8d59 messaging: owners can block a conversation
A blocked thread key is dropped unread (not announced, not counted against
the daily new-conversation limit). API, UI button with confirmation, and a
list with unblock.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 20:50:38 +01:00
nilsandClaude Sonnet 5.5 a54094ea35 p2p: anti-entropy, a periodic sync with one random peer
Repairs what gossip lost while two nodes stay connected; cheap because
matching digests end the round at once.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 17:33:06 +01:00
nilsandClaude Sonnet 5.5 11fd2a88c0 p2p: incremental sync with digests, inventory and fetch
Peers compare a short digest of revocations, listings and messages on
connect and transfer only what differs. Peers without digests are synced
the old way.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 17:28:22 +01:00
nilsandClaude Sonnet 5.5 e379065695 k8s: enable the Traefik IngressRoute
Listed in the kustomization now; the comments and README no longer call it
off by default.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 13:25:55 +01:00
nilsandClaude Sonnet 5.5 a598a0ba6b k8s: IngressRoute modelled on the gitea one
Same ingress class (traefik-internal), entry point and shape; the extra
Middleware and redirect routes are gone.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 13:20:24 +01:00
nilsandClaude Sonnet 5.5 81c789cc87 k8s: Traefik IngressRoute instead of an Ingress
Optional (off by default): IngressRoute for the UI with TLS (resolver or
Secret), a security-headers Middleware and an HTTP-to-HTTPS redirect.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 13:18:48 +01:00
nilsandClaude Sonnet 5.5 e2a095a5d4 k8s: pin the image by digest as well as by tag
The registry's digest for 0cfb59c, checked by pulling it from the registry
(the local digest differed from the one the registry stores).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 13:11:17 +01:00
nilsandClaude Sonnet 5.5 eafd3b7295 k8s: pin the image to 0cfb59c (has init --no-phrase and orderly shutdown)
The previous tag predates 'init --no-phrase', which the StatefulSet now uses.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 13:09:30 +01:00
nilsandClaude Sonnet 5.5 0cfb59c469 Orderly shutdown on SIGHUP too, forced exit when stuck; version in the image
SIGINT, SIGTERM and SIGHUP all shut the node down in order (SIGTERM is what a
Kubernetes pod termination sends). A second signal, or 20 seconds (below the
30 s Kubernetes grants), stops the process at once, so a stuck shutdown cannot
hang.

The binary knows its version (allmende version, and the 'node running' log
line); the image is built with the commit as version and 'make image' pushes it
tagged with that commit, refusing a dirty tree.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 13:08:14 +01:00
nilsandClaude Sonnet 5.5 7120959cb8 init --no-phrase: an identity without a recovery phrase
For bootstrap nodes and other unattended setups: nothing is shown or logged,
and the data directory is marked so later messages do not point to
'allmende recover', which cannot work. The identity lasts the certificate
lifetime (a year) and then has to be replaced; the node says so.

The Kubernetes StatefulSet now initialises itself on first start with it,
so no manual exec step is left.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 12:25:54 +01:00
nilsandClaude Sonnet 5.5 4b6b3726af k8s: use the image pushed to git.stinnesbeck.com/nils/allmende
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 12:00:27 +01:00
nilsandClaude Sonnet 5.5 dbd95bb8ef run: --no-login-link keeps the sign-in link out of the terminal
The link holds the admin token. Where the terminal is a log (containers) it
would end up in log storage; the notice then only says where the token file
is. The Kubernetes manifest uses it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 11:56:29 +01:00
nilsandClaude Sonnet 5.5 819df6d512 Kubernetes manifests for a public node, and --announce
k8s/base (kustomize): StatefulSet with a volume, p2p LoadBalancer for 4001
TCP+UDP, ClusterIP for the UI, optional ingress; k8s/overlays/nodeport for
clusters without a load balancer. The pod waits for 'allmende init' so the
recovery phrase never goes to a log.

--announce makes a node that sits behind a router or in a container announce
the address others can dial (e.g. /dns4/name/tcp/4001), so a bootstrap node
behind a port forward works, and the DNS records it prints name the host.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 11:40:25 +01:00
nilsandClaude Sonnet 5.5 dd229895f4 init: remove --copy; the plain phrase line is enough
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 11:08:02 +01:00
nilsandClaude Sonnet 5.5 5551e7e151 init: also print the recovery phrase as one plain line
The numbered table pastes badly; a single line can be selected with a triple
click and pasted into a password manager or 'allmende recover'.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 11:07:03 +01:00
nilsandClaude Sonnet 5.5 548efdc87b init --copy: put the recovery phrase on the clipboard
Opt-in, as one line of words. Uses wl-copy, xclip, xsel, pbcopy or clip.exe,
and falls back to asking the terminal (OSC 52), which works over SSH. The
output says how it was copied and to clear the clipboard afterwards.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 11:05:27 +01:00
nilsandClaude Sonnet 5.5 6f15adb403 README: step-by-step instructions for running a node
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 10:57:05 +01:00
nilsandClaude Sonnet 5.5 6995364edc Place names for --region, an expiry reminder, and e2e checks through the UI
--region takes a place name as well as a code ("Bonn", "Köln", "cologne",
"name:dub" to force a name that looks like a code). The node uses the same
GeoNames list as the browser (internal/places), follows the place's cell plus
any cell within 40 km, and prints what each name became.

The node reminds the owner on its terminal, once a day per listing, about
every listing with 5 days or less left (the UI marks the same range). The
sign-in token is never in the line.

scripts/e2e/ui.ts drives the real bundle in jsdom against real nodes: a buyer
writes from a listing page, the owner reads and answers in their own page and
the buyer's page shows the verified answer; a node with no region gets its
first one by place name in the browser and keeps it over a restart. e2e.sh
also checks --region by name and the reminder, and keeps its scratch files in
the checkout's .tmp.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 10:51:56 +01:00
nilsandClaude Sonnet 5.5 e3d0c12e55 Choose even the first region in the browser; update Docker and Nix
A node now starts without any region (it only helps others connect, and
prints a hint). The owner's sign-in link leads straight to the Regions page
when none is followed, visitors get a notice instead of an empty search, and
status always lists regions as an array.

The Docker image no longer pins Bonn, the NixOS module no longer requires
regions, and the VM test now starts without any, chooses the first region
over the API and checks it survives a restart. README and the init hint
follow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 10:41:10 +01:00
nilsandClaude Sonnet 5.5 fd439710df Let the owner change regions by place name, without a restart
The p2p node can now add and drop regions while running (SetRegions):
topics, validators, subscriptions and per-region peer discovery start and
stop with them, and a newly followed region catches up by sync.

PUT /api/v1/regions (owner token) applies a change and the node saves it in
regions.json, which wins over --region from then on. The owner's browser
gets a "Regions" page: search a place by name (GeoNames cities, offline,
CC BY 4.0), follow its cell plus any cell within about 40 km.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
2026-11-18 10:28:16 +01:00
nilsandClaude Sonnet 5.5 e7bec4fb63 Add bootstrap nodes, DNS-based discovery, a DHT per region and NAT traversal
- Bootstrap: built-in /dnsaddr/allmende.stinnesbeck.com (TXT records at
  _dnsaddr.<name>), resolved at every redial with the last good answer kept;
  --bootstrap takes /p2p/ or /dnsaddr/ entries, --no-default-bootstrap drops
  the built-in one. Stopping never waits for a stuck resolver.
- Remembered peers in peers.json (saved every 5 min and on shutdown, redialled
  at the next start)
- Private Kademlia DHT (/allmende prefix), advertised and looked up per region
  with quick first attempts and a backoff; --no-dht turns it off
- NAT traversal: port mapping, hole punching, AutoRelay through bootstrap nodes
- --public: DHT server and relay for a bootstrap node; prints the TXT records
- Docker, NixOS module (public, defaultBootstrap, QUIC/UDP) and docs updated
- e2e: bootstrap node scenario, seed cache restart, and polling that really polls

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 22:14:34 +01:00
nilsandClaude Sonnet 5.5 a81595e9ee Announce incoming messages on the node's terminal
The node now checks for new messages every 10 s in the background (before,
only when the web UI asked), and Inbox.Collect reports newly filed visible
messages through OnArrivals. The CLI logs one line per conversation with the
listing title and a link to it, never the buyer's text. Hidden messages are not
announced, a backlog is capped at 5 lines, and a lock stops a background check
and a UI request from filing the same message twice.

The e2e checks that node A announces the message before its API is called.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 21:29:49 +01:00
nilsandClaude Sonnet 5.5 20ea9b32f7 Add e2e script to the repo, Dockerfile, and a Nix flake with a NixOS module
- scripts/e2e.sh (+ scripts/e2e/*.ts): the two-node end-to-end test, now
  self-contained and cleaning up after itself; `make e2e`, part of `make check`
- Dockerfile/.dockerignore: static Go build in a non-root alpine image, data in
  /data, defaults to region u1j; `make docker`
- flake.nix, nix/: package (buildGoModule), dev shell, NixOS module
  services.allmende (hardened systemd unit that waits for `allmende-admin init`),
  and a NixOS VM test run by `nix flake check`
- README: running a node with Docker and NixOS

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 21:21:21 +01:00
nilsandClaude Sonnet 5.5 dc690a72c9 Poll every 8 s while visible, pause in background tabs
Conversations and the owner screen refreshed every 20 s and 30 s. A shared
keepFresh helper now checks every 8 s while the tab is visible, pauses when
it is hidden, catches up at once when it returns, never overlaps runs, and
stops when the screen is gone or the owner token is. The latter also stops
the sign-in form being redrawn under someone typing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 20:58:45 +01:00
nilsandClaude Sonnet 5.5 71e6dc8658 Send messages with Ctrl+Enter
Ctrl+Enter (Cmd+Enter on a Mac) submits the buyer's and the owner's message
boxes through the normal form, so the usual checks apply. Plain Enter still
adds a line. The empty box hints at the shortcut. Not added to the publish
description or the address-release note, where it could submit by accident.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 20:55:30 +01:00
nilsandClaude Sonnet 5.5 19fea7f524 Rename the binary to allmende, add a Makefile with Bonn as default region
- cmd/node -> cmd/allmende; usage, messages and docs use the new name
- Makefile: build, init, run (REGION defaults to u1j, Bonn), vet, test,
  web, web-test, check, clean

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 20:49:55 +01:00
nilsandClaude Sonnet 5.5 d021989f09 Publish, edit, renew and delete listings from the web UI
- Form at #/mine/new and #/mine/<id>/edit: coordinates pasted and encoded
  to a precision-6 geohash in the browser (about 1 km, OSM link to check, no
  map tiles), euro price parsing, optional exact address saved on the node only
- Region guard: refuses places the node does not follow; region fixed on edit
- Owner view: days left with a warning under 5 days, manual Renew (30 days),
  Edit, Delete with confirmation
- Tests (jsdom and pure logic), docs, rebuilt web/dist

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 20:18:08 +01:00
nilsandClaude Sonnet 5.5 7348067350 Add email to address release and an address hint
The release sheet gets an optional email field, prefilled from the saved
address and kept with it. A conversation suggests releasing the address
when the buyer's latest message contains words like "address" or "wo
genau" (a keyword guess, German and English, only ever a suggestion).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 20:04:10 +01:00
nilsandClaude Sonnet 5.5 8edae3ae56 Add owner inbox UI with address release
Web: "My listings" (listings, requests of a listing, conversation) in
three panes on wide screens and one at a time on phones, and a sheet or
dialog to release the exact address. Sign-in uses a link printed by
`node run` (token in the URL fragment, kept in sessionStorage only).

API: GET /api/v1/mine (own listings with request counts and whether an
address is saved); inbox rows gain last_dir, needs_reply, preview,
effort and grant_until, and can be filtered by listing.

Docs: PROTOCOL.md and README describe the owner UI and login.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 20:02:51 +01:00
nilsandClaude Sonnet 5.5 3b0351c774 Implement end-to-end encrypted buyer/seller messaging
Wire format (internal/message): sealed boxes to the listing's device key
(X25519 + HKDF + ChaCha20-Poly1305), padded, proof-of-work stamped, with
signed owner replies and address grants. Relay validation, bounded queues,
gossip on per-region message topics and sync (store, p2p).

Owner side (internal/inbox, API): inbox with hidden link messages and a
per-day new-thread limit, replies, grants, and a private per-listing
address. Public POST/GET /api/v1/messages for buyers.

Browser: noble-based sealing and reply verification checked against a Go
fixture, contact form, conversation view, message list, de/en strings.

Docs: PROTOCOL.md messaging section matches the implementation.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 19:44:59 +01:00
nilsandClaude Sonnet 5.5 b9e1b0c058 Specify end-to-end encrypted buyer/owner messaging
Draft wire format: anonymous sealed envelopes gossiped per region, signed
owner replies, structured address grants, relay validation and endpoint
rules (link ban, rate limits).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 19:08:05 +01:00
nilsandClaude Sonnet 5.5 3fd40241bc Add browser UI with in-browser signature verification
Every node now serves a search and listing-detail UI at GET /. It is
vanilla TypeScript, bundled unminified into web/dist (committed) and
embedded with go:embed, so `go build` is enough to run a node.

The browser verifies each listing itself (certificate, binding, validity,
signature, proof-of-work) with pure-JS ed25519, so a gateway can withhold
listings but not forge them. Unverifiable results are hidden and their
content is never shown. Listing text is only inserted via textContent and
the UI is served with a strict CSP.

Canonical JSON is reimplemented in TypeScript and tested against a golden
fixture signed by the Go code. /api/v1/status now reports difficulty.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 18:29:40 +01:00
nilsandClaude Sonnet 5.5 918e16ed37 Add runnable node, HTTP API, all-devices revocation and reconnect sync
- cmd/node: init (recovery phrase onboarding), run, recover
- api: public reads of canonical signed records, token-protected writes
- identity: RevokeAll voids every device certified before a cutoff, so
  recovery works with only the phrase; store purges by certificate age
- p2p: redial bootstrap peers, sync on every new connection (in-flight
  guard only), validate bootstrap addresses up front
- docs: API, recovery semantics, peer-ID change on recovery

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 18:03:46 +01:00
nilsandClaude Sonnet 5.5 d3efe5a3a7 Add device keys, revocation and libp2p gossip with sync
- identity: 12-word recovery phrase, device certificates, revocations,
  device key storage; the identity key is never stored on a node
- listing: signed by a device with an embedded certificate, domain-separated
  signatures, ErrTimeWindow for clock-related failures, region helpers
- store: revocations purge a device's listings; keyset-paged Since for sync
- p2p: gossipsub topic per geohash region plus a global revocation topic,
  validators run before relaying, /allmende/1/sync catch-up protocol,
  bootstrap peers and mDNS
- docs: key model, replication and conflict rules

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 17:43:25 +01:00
nilsandClaude Sonnet 5.5 08f6441f03 Add SQLite listing store with deterministic conflict rules
- Put verifies listings and keeps only the newest version per
  (author, id); equal seq resolves to the smaller hash so replicas converge
- Tombstones are stored so old versions cannot be resurrected
- Search by geohash prefix, kind, category, price, area, rooms
- Expire removes listings and tombstones past their lifetime

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 17:15:28 +01:00
nilsandClaude Sonnet 5.5 45abfdb03c Add AGPL-3.0 license and README
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 17:05:32 +01:00
nilsandClaude Sonnet 5.5 cdc9c3d20b 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>
2026-11-17 17:02:50 +01:00