Mirrors and witnesses#
Version 0.4 lets anyone serve Grantstamp's data, from hosts nobody has to trust.
The goal#
Anyone should be able to serve Grantstamp's data, so the project's own free-tier servers do as little as possible.
- No host is trusted.
- A client must be able to check everything a host sends.
- A host must not be able to read, change, hide or misuse the data it serves.
Availability is best effort. Integrity is guaranteed.
What runs today#
The software supports many witnesses and many mirrors. On grantstamp.io the project runs two witnesses and two mirrors, all its own. Checks through mirrors are experimental: the registry publishes the check map, and clients use it only when asked to. The architecture page keeps the current list. To add a witness or a mirror of your own, see Run a mirror or a witness.
What is guaranteed#
| Property | Guarantee | How |
|---|---|---|
| Integrity of records | Always | Owners sign their claims. The log is a Merkle tree, signed by the registry and cosigned by witnesses. A record must say what the log's latest entries say. |
| No hidden matches | Always, for a client that verifies | The check map is sorted and committed to by the log, so a missing token is proven absent. |
| Freshness | Bounded, 2 hours by default | The registry's token answer names its current map. A host must serve it, or a map made in the last 2 hours. A client never accepts a log older than one it saw. With witnesses, checkpoints must also be cosigned in the last 2 hours. |
| Availability | Best effort | Many hosts, tried in random order. The registry stands in when no host answers. |
| Hosts learn nothing about files | Yes | Hosts hold keyed tokens. Only the registry's token service can make them, and it counts every feature. |
| Deletion inside the system | Within the freshness bound | A withdrawn stamp leaves the next generation. A host may serve the one before for at most 2 hours. |
| Deletion of copies a host kept | Not possible | When the token key changes, those copies stop matching anything. |
The core idea is simple. Once all data is self-certifying, a host has one power left: silence. Everything else it could do is either caught with proof or limited to what it can observe about requests.
The pieces#
| Role | Run by | Holds | Trusted for |
|---|---|---|---|
| Registry (sequencer) | The project | All records, private data, the log key, the token key | Ordering writes. Lying is caught by witnesses. |
| Token service | The project (today on the registry) | The token key | Not answering more than its rate limits allow |
| Witnesses | The project's GitHub job, then independent operators | The last checkpoint they cosigned | Not colluding with the registry to sign a fork |
| Hosts and mirrors | Anyone | Copies of the log, public records and the check map | Nothing except availability |
| Clients | Everyone | A pinned log key and witness policy | Themselves |
A witness or a key holder must never also run a host. A host that is also a witness could hide its own misbehaviour.
The data, in tiers#
- The log. Entries hold commitments (digests), never the data itself. It is served as tiles in the C2SP format. Every host holds all of it.
- Public records. The records of listed stamps, as the stamp page shows them, with the owner's signed claims. Unlisted stamps are left out.
-
The check map. Per generation: sorted (token, file references) leaves in a Merkle tree, and small JSON files.
files.jsonholds per-file sample rates and sizes.stamps.jsonholds owners, policies, status and open cases. Titles appear only for listed stamps. Unlisted stamps appear under an alias.owners.jsonholds the verified-domain flag and identity label.
It holds no owner names, contacts or image hashes. Exact SHA-256 hashes are tokens too.
-
Private data. Identity records, private contacts, case files and the raw fingerprints never leave the registry.
How a check works through hosts#
- The client fetches the log checkpoint from a host. It must carry the pinned log key's signature. It must extend the newest checkpoint this computer accepted before. With witnesses in the policy, it must also carry a fresh quorum.
- It reads the newest
map.generationentry in that log. The entry commits to the generation's notice. - It fetches the notice and the JSON files from the same host and checks them against the entry.
- It asks the token service for the tokens of its file's features. Every feature counts towards the rate limit. The answer also names the registry's current map and its token key.
- The host's map must use that key. It must be the current map, or one made in the last 2 hours.
- For each token, it fetches the entry bundle where the token would be. The bundle must hash up to the notice's root, and its leaves must be sorted. A token in the bundle is a match. A token that falls inside the bundle's range without being in it is proven absent.
- The registry's own matching code grades the evidence on the verified rows. The client applies the owner's policy, including the rules for open cases and medium matches.
A host that fails any check, lacks a file or cannot be reached is skipped, and the client tries the next one. The registry is always last.
grantstamp check --via-hosts does all of this. It is experimental. The tests compare its answers with the registry's own for several builds and find them identical.
Why a host cannot cheat#
| What a host might try | What catches it |
|---|---|
| Change an entry, a record or a policy | The hash no longer matches the log, or the owner's signature fails |
| Hide a match (drop a leaf) | The bundle no longer hashes to the logged root |
| Add a match | Same |
| Rewrite a bundle and its tile together | Every tile must hash to its entry in the tile above it, up to the signed root |
| Serve an old map, for example one that still has a withdrawn stamp | The token answer names the current map. An older map made more than 2 hours ago is refused. |
| Serve an old log with its old map | A log older than one this computer saw is refused. The map rule above applies too. With witnesses, old cosignatures are refused. |
| Serve the map under another generation number | The notice names its own generation |
| Serve a map made with an old token key | The token answer names the key in use |
| Serve an old record, another stamp's record, or one signed with a key it made up | See "How a record is tied to the log" below |
| Show different histories to different people | Witnesses cosign only a history that extends what they saw |
| Read the data | It holds tokens. Making a token needs the token service. |
| Test files offline against the map | Same. Every test is a question to the token service, counted and rate-limited. |
| Refuse to answer, or answer slowly | Nothing can force an answer. The client tries other hosts, then the registry. |
How a record is tied to the log#
A mirror serves each listed stamp's record: what the stamp page shows, with the owner's signed claims. A record is checked against the verified log before a mirror keeps it, and again by grantstamp audit --from.
- The record must list exactly the log's entries for its stamp, and for its owner.
- The owner, title, policy, status and listing must be what the latest of those entries commit to.
- Every key that signed a claim must be one the log recorded for the owner, when it was created or replaced.
- The owner's name and identity label must be ones the log recorded.
The log holds only digests. So the registry keeps the payload behind each stamp entry, and serves it with the stamp's proof. A payload counts only when its digest is the logged one, so a host gains nothing by making one up.
For entries logged before 0.4 there is no payload. The client then recomputes the digest from what the record says now. That fails only for a stamp whose policy changed before 0.4. Its owner ties it again with grantstamp attest.
The log does not cover a stamp's description or the owner's verified domains. Checks never use them. grantstamp audit checks domains against DNS.
Deletion#
- The owner signs a withdrawal. The registry logs it and deletes the stamp's fingerprints.
- The next map generation leaves the stamp out. The registry builds it about 10 minutes after a change, while it is awake.
- The token answer tells clients which generation is current. A host may serve the one before for at most 2 hours after it was made. After that, it is refused.
- Tokens come from a key that changes every week. The key can also be rotated at any time with
grantstamp admin rotate-map-key. A copy kept by a host then matches nothing a client asks about. - The withdrawal record itself stays in the log, as before. For unlisted stamps, the log names them only by a hash of their id.
What we can promise: a host can show a withdrawn stamp for at most 2 hours after the next map is made. That is the default --max-age. A client that needs a tighter bound sets a smaller one, or asks the registry.
The same bound holds the other way: a host cannot hide a new stamp or a stricter policy for longer. Within a week, copies kept elsewhere are useless for new checks. We cannot make third parties erase what they copied.
Hosts joining, leaving and coming back#
Joining. A host is any static web host that serves a mirror folder (grantstamp mirror). It needs no key and no permission to be correct. It needs to be listed in the registry's GRANTSTAMP_LOG_MIRRORS before clients pick it on their own. Listing is by invitation at first.
Leaving gracefully. A host holds nothing that exists only there. Everything is a copy of data the log commits to, so there is nothing to hand over. The operator tells the project, the project removes the host from the list, and the host may stop after clients refresh the list.
Leaving abruptly. Clients move to the next host. Nothing is lost while any host or the registry still serves the data.
Witnesses. A witness saves its state before any cosignature leaves it. The GitHub job cosigns, pushes its state to a branch, and only then hands the cosignature in. So a failed save can never let it cosign a different history later.
A witness that leaves publishes its last cosigned checkpoint. The project changes the witness policy so the quorum can still be met. The policy is versioned in the package, so the change is visible.
Key holders (planned, stage 3b). When the token key is split among several holders, a holder leaves by resharing: the remaining and new holders get new shares of the same key, the leaver's share becomes useless, and the leaver destroys it (CHURP, Maram et al. 2019). Nothing is ever copied from one holder to another.
The project itself. If the project stops, hosts keep serving the log and records, and anyone can verify them. Checks through hosts stop when the token service stops. That is the price of hosts not being able to test files offline.
Coming back. A host that was offline pulls again (grantstamp mirror). It must verify a consistency proof from the last checkpoint it held, replay what is new, and copy the current map generation, before it serves anything. Clients check all of that again anyway.
Reaching hosts that are online now, and those that are offline#
Everything that changes how hosts serve data is an entry in the log: map generations and key rotations today, and in future protocol versions and host lists.
A host that is online picks the change up on its next pull. A host that was offline sees every change, in order, when it pulls again. A client never trusts a host's word about what is current. It reads the log.
Decisions#
- Hosts hold only exact-match tokens. Image hashes stay with the registry, because a blinded 16-bit band can be enumerated with 65,536 questions.
- Hosts hold no names or contacts. Owners appear by id. Policies are public by design, including the contact an owner puts in a policy for agents.
- A witness or key holder never runs a host.
- Hosts are listed by invitation first. Anyone can mirror. Being picked by clients automatically comes later, if there is demand.
- The token key changes weekly, with a day of grace, and can be rotated on request.
- Probing detection stays at the registry. The token service sees every caller's rate, as the check endpoint does today.
What is left, and how practical it is#
| Risk | Who could do it | Impact | Practical? | What limits it |
|---|---|---|---|---|
| A host refuses or slows down | Any host | Slower checks | Yes, easily | Other hosts, then the registry |
| A host sees which token ranges a client fetches | Any host | It can tell when the same file is checked again, and may guess which stamp matched | Yes | Small maps are fetched whole. Larger ones leak about as much as prefix lookups. OHTTP relays are planned. |
| A host counts how many stamps share a token | Any host | Learns structure, not content | Yes, low value | Shared features are already discounted |
| A client and a host test guessed files | Anyone with the files | Learns whether a file is registered | Only at the token service's rate | Rate limits count features. This is what a check reveals anyway. |
| A host keeps a withdrawn stamp's tokens | Any host | Could tell a colluding client that its file matched a withdrawn stamp | Until the key changes, at the token service's rate | Weekly key change, rotation on request |
| A host serves a map that lags | Any host | Answers up to 2 hours old | Yes | --max-age. The registry's own answers are always current. |
| A host links an unlisted stamp across key changes | Any host | Knows two aliases are the same unlisted stamp, from its creation time, owner and policy | Yes, low value | Its id, title and files stay hidden |
| A host changes a record field the log does not cover | Any host | A misleading description or domain flag on a mirror's page | Yes | Checks never use them. grantstamp audit checks domains against DNS. |
| The registry forks the log | The project | Different people see different histories | Only if the witnesses collude | Independent witnesses, Bitcoin timestamps |
| The registry refuses to log a stamp | The project | An owner is shut out | Visible to the owner | Witnesses do not help here. The owner can publish the refusal. |
| The token service is down | Its host | Checks through hosts stop | Yes, on a sleeping free tier | Move it to an always-on host (next step) |
| The token service lies about the current map | The project | Hosts refused, or stale ones accepted | Only the registry can | It is the registry's own answer, over HTTPS |
| Flooding with junk stamps | A spammer | Bigger maps | Low | Identity gate, quotas |
| A copied registry | Anyone | A rival with stale data | Yes, harmless | Copies cannot sign as the registry |
| The client software is tampered with | A targeted attacker | Verification skipped | Hard | Signed releases from CI, open source |
Not built yet#
- The token service on an always-on host. Today it runs on the registry, which sleeps when idle, so checks through hosts still need the registry awake. The service is one keyed hash, small enough for a free Cloudflare Worker.
- Threshold keys (stage 3b). An oblivious PRF (RFC 9497) split 2 of 3 among independent holders, so no single party, including the project, sees the features of a checked file.
- OHTTP relays (RFC 9458), so hosts and the token service cannot link a check to a caller's address.
- A match log for owners, so alerts survive when checks stop passing through the registry.
- Incremental maps. Generations are rebuilt whole. The web server builds maps of up to 400,000 features, which fits in 512 MB. It counts first and refuses a bigger map before loading it. A bigger map is built with
grantstamp admin build-mapon a machine with more memory. - Image hashes, owners' own procedures, publisher signatures and licence tokens through hosts. These still need the registry.
Prior work#
- Merkle tree logs: RFC 6962 and RFC 9162. Static tiled logs: c2sp.org/tlog-tiles. Checkpoints, signed notes, cosignatures and witness policies: c2sp.org.
- Fork consistency: Li, Krohn, Mazieres and Shasha, "Secure Untrusted Data Repository (SUNDR)", OSDI 2004. Witness cosigning: Syta et al., "Keeping Authorities Honest or Bust with Decentralized Witness Cosigning", IEEE S&P 2016.
- Verifiable maps and absence proofs: Tamassia, "Authenticated Data Structures", ESA 2003. Melara et al., "CONIKS", USENIX Security 2015.
- Keyed lookups with rate limits and key rotation: Everspaugh et al., "The Pythia PRF Service", USENIX Security 2015. Oblivious PRFs: RFC 9497. Threshold OPRFs: Jarecki, Kiayias, Krawczyk and Xu, "TOPPSS", ACNS 2017.
- Lookup privacy and its limits: Thomas et al., "Protecting accounts from credential stuffing with password breach alerting", USENIX Security 2019. Li et al., "Protocols for Checking Compromised Credentials", CCS 2019.
- Leakage from deterministic tokens: Naveed, Kamara and Wright, CCS 2015. Cash, Grubbs, Perry and Ristenpart, CCS 2015.
- Updates to many servers, some offline: Samuel et al., "Survivable Key Compromise in Software Update Systems" (TUF), CCS 2010.
- Changing who holds a shared key: Maram et al., "CHURP", CCS 2019.
- Why a single admission authority is needed against fake nodes: Douceur, "The Sybil Attack", IPTPS 2002.
- A cautionary tale for append-only networks without deletion: the 2019 SKS keyserver certificate flooding.
Source of this page on GitHub. Documentation for Grantstamp 0.4, licensed CC BY 4.0.