Repository navigation
Description
The problem
stamp certifies one digest. Stamp a document's v1, edit it, stamp v2 — the two tokens are unrelated. Nothing shows that v2 succeeded v1, that no version in between was withheld, that this is the last version, or that the author did not keep a divergent branch and reveal whichever suits. Verification must stay offline against a bundled trust base.
Provenance decomposes into six properties, and they have very different costs:
| Property | |
|---|---|
| a | Linkage — v2 is the successor of v1 |
| b | Order — the sequence is not a permutation |
| c1 | Interior completeness — no version hidden between two shown |
| c2 | Tip completeness — the version shown as last really is last |
| d | Non-forking — no divergent branch exists |
| e | Document identity — these are versions of this document |
| f | Authorship — who made each change |
The mechanism: deterministic salts
A mint's SMT leaf address is fully determined by (networkId, salt). Every input is derived:
TokenId.fromSalt(networkId, salt)—src/transaction/TokenId.tsMintSigningService.create(tokenId)gives the lock script, from a key its own docstring calls "reproducible by anyone holding the same token id" —src/crypto/MintSigningService.tsMintTransactionState.create(tokenId)=H(CBOR[tokenId, MINT_SUFFIX])—src/transaction/MintTransactionState.tsStateId = H(lockScript, sourceStateHash)—src/api/StateId.ts
So two mints sharing a salt on one network collide on one leaf: LeafExistsError in the SDK, STATE_ID_EXISTS from the aggregator.
Today MintTransaction.create defaults to salt = TokenSalt.generate(). That randomness, not the burn predicate, is what makes stamps unlinkable. Replace it with salt_n = HKDF(lineageSecret, lineageId, n) and slot n of a lineage admits at most one certified stamp, ever.
That yields (a), (b), (c1) and (d) from independent stamps — no spendable predicate, no key custody, no chained state, no history file. Stamps stay burn-locked and anonymous toward the service.
Non-forking is a trust assumption, not a proof
Worth stating plainly, because it is easy to oversell. The offline verifier checks that a leaf sits under a quorum-signed root. No rule checks that no other value for that key was ever certified, and none can:
ExclusionCert.VerifyreturnsErrExclusionNotImpl—aggregator-go/pkg/api/inclusion_cert.go:232- the non-inclusion path returns an empty payload: "Non-inclusion is not implemented yet" —
aggregator-go/internal/service/service.go:404 GetNoDeletionProofreturns the literal placeholdermock_no_deletion_proof—aggregator-go/internal/service/service.go:480
So "no fork" means "the certified SMT is append-only with one value per key" — an invariant of the aggregator, the same trust already extended to the reference time. A lone verifier can never detect a fork; two conflicting tokens together are the evidence. This also means querying whether a state is unspent returns an unproven null, so tip completeness cannot be established by asking the network either.
Tip completeness needs a seal
Nothing else closes (c2). A valid token truncated to a prefix is still a valid token, and the author can show v1..v5 while v6 is certified.
The two designs differ in how strong a seal they can offer:
- Slot stamps: a seal is a certified, signed statement at slot n+1 that the lineage ends. Slots are independent, so nothing physically prevents a later slot — but the author would then hold a stamp contradicting their own certified seal. Accountability, not impossibility.
- Document token: the final transfer goes to
Burn("sealed"). A burned state has no registered verifier, so a successor is impossible. Ledger-enforced.
Chronological order is not enforced
TokenVerifier verifies each transfer independently and never compares neighbours. The only time checks are against expiresAt and the transfer's own round timestamp. The aggregator's validator checks StateId and authorization, not the predecessor's proof, so states can be precomputed and certified out of order: a later link can carry an earlier reference time.
Either design must therefore verify that reference times increase along the lineage. This is a verification rule we have to add, not a property we inherit.
Design A — slot stamps
Keep the current token shape, burn recipient and anonymity. Payload carries lineageId, position n and prevDigest.
- For: no key custody, no state file, stateless and offline verification, anonymous toward the service, each stamp independently useful, closest to what the CLI already is.
- Against: the lineage secret must reach every verifier, so any verifier can squat a future slot. That is denial of service rather than forgery, provided payloads are identity-signed — but it rules this out for public documents.
Design B — document token
Genesis to a per-document spend key; one transfer per version carrying the version payload in data; final transfer to Burn("sealed").
- For: no squatting, and a hard seal.
- Against:
- Key loss freezes the lineage, indistinguishable from "the author stopped", and you cannot seal without the key.
- Key theft lets a thief append or seal; there is no revocation and first certified spend wins. Separate the per-document spend key from the identity key that signs payloads, so theft is a DoS rather than a forgery.
- Anonymity: the spend key appears in every certification request, so a reused key relinks every version for the service. Rotate per version or accept the linkage.
- The token file is the only copy. The service stores
txHash, not transaction bodies, so a lost file is unrecoverable from the network. A crash between certify and write leaves a stale state and the next revision is rejected; use deterministic masks for crash replay, as the split flow does. - Concurrency fails confusingly. Losers get
STATE_ID_EXISTS, which is absent from the SDK'sCertificationResponseenum, so proof-cli warns "unknown status" and then throwsTRANSACTION_HASH_MISMATCHinsidewaitInclusionProof. There is no multisig predicate. - Size: roughly 1.8 KB per certified step with no pruning; 10k versions is about 18 MB, verified sequentially.
Scope either way
- A new token type. Changing the recipient alone is not enough: the verification context is fail-closed to one type (
src/lib/verification.ts) andverifyrejects any token with transfers (src/lib/TimestampClient.ts). - A second issuance verifier and its own payload layout.
- Commands:
init,revise,seal,history. - A verification rule for monotone reference times.
- Separate spend and identity keys.
What neither design can manufacture
- Document identity (e). Nothing in-band binds a lineage to a real document. A deterministic token id derived from a public document name is squattable by anyone, because the minter key is universal. This needs a published binding — see Agent identity: offline-verifiable signers via nametag tokens, not an on-chain registry #10.
- Completeness of work. No oracle can show that an author recorded every edit they made. Provenance of committed versions is not provenance of all work.
Defensible claim
This is the certified succession of versions for this pinned lineage, through this stated endpoint, each certified at the stated time.
Not "every version", and not "the latest version" unless sealed.
Open question
Design A is cleverer and fits the CLI's character; Design B is the one to pick if squatting by verifiers is unacceptable, which it is for any public document. The choice turns on whether lineages are private artifacts shared with chosen verifiers, or public records.
Activity
ristik commentedon Oct 22, 2026
What can be done MORE given we have uniqueness proofs:
Assumption: initial version is known to verifiers, so they can track entire provenance chain from genesis to final version checking there are no forks, based on known final version.
Example: if there is a document management workflow requiring sequential approvals, and so that there can not be alternative shadow approved docs;
Example 2: supply chain, initial version certified by manufacturer, each step adds a transaction to digital twin token, and unlike plain signatures (plus timestamps) there can be no forks in supply chain.
How: document is part of token state, the state can be transacted only once (by mutating to new state which covers the next version of the tracked artifact). Specifically doc hash goes into 'auxiliary data' field. Split applies as well, so we can trace how many copies was created.
So the semantics can be:
ristik commentedon Oct 27, 2026
Sketch: document lineage token (fields per the Yellowpaper)
This makes the idea from my earlier comment more concrete. Section names refer to the Unicity Yellowpaper (execution layer and token appendix).
Token type. A new constant
ty = DOC_LINEAGE. Its type-specific verifier checksreasonandauxDataas described below.Genesis (mint),
D_mint = (α, recipient, salt, ty, reason, auxData):auxData = CBOR[0, H(doc_0), meta?]: version index and digest of the initial document. The document itself is not stored.reason: the issuer's signature over(id, ty, auxData), e.g. by the manufacturer or document owner. The mint key is public, so this signature is what makes an origin "accepted". Verifiers pin the origin byid = H(salt, α)or by the issuer key together withH(doc_0).salt: random.idstays unpredictable until genesis is certified, so the token id is published only after the mint.recipient: predicate of whoever may produce the next version. For sequential approval this is the next approver (P_sig/P_p2pkh), or ak-of-nP_tsigfor a committee.Version step (transfer),
D = (recipient, x, auxData):auxData = CBOR[i, H(doc_i)]. NoprevDigestis needed, because linkage comes from the state hash chainh_i = H(h_{i-1}, x_i).iis signed by partyi, not by a shared document key. The unlocking argumentuis a signature overH(h, txhash)under the predicate that stepi-1placed inrecipient. Partyi-1therefore chooses and authenticates its successor, and only the holder of that key can produce versioni. The chain of predicates is a chain of custody: verifiers learn who made each change (f), and that each party was named by the previous one.recipient: the key of the next editor or approver, which must be known to the current party. If verifiers are to check identities and not only key continuity, the key must be bound to a party, either as a known identity key or as a per-step key certified by one out of band. A fresh unlinked P2PKH key per step reduces linkability toward the service, but only parties who know the binding can attribute it.x: state mask, chosen by partyi. It can be derived asPRF(k_i, i)from that party's secret so that a crash between certification and writing the file can be replayed.Seal (terminal burn). Transfer to
P_burn(H(b_seal))withauxData = b_seal = CBOR[SEAL, i, H(doc_final)]. The burn predicate cannot be unlocked, so no successor can exist.Tip without a seal. A non-inclusion proof for
sid_n = H(P_n, h_n)at a recent round shows that versionnhad no certified successor as of that round's reference time.Authorized branching (n copies). This follows the split construction without the RSMST sums. Split itself is defined for fungible tokens only, so this is a type-specific analogue:
d_j = H(BRANCH_OUTPUT, id_src, α, recipient_j, salt_j, id_j, ty, auxData_j)with the same field set as split'sd_j.P_burn(H(b_M))withauxData = b_M = CBOR[BRANCH, [d_1..d_n]].reason. The verifier recomputesd_jand requires it to be inb_M. Each child id can be minted only once, so there are at mostncertified branches, each tied to that parent.Verification of a final token against a known origin. Run
VerifyToken. Then check the type rules: the genesisreasonsignature,auxDataformat,iincrementing by one, and the reference timeτ_inon-decreasing along the chain (as noted in the issue, this is not implied by the protocol). Finally, check either a seal or branch manifest at the end, or a fresh non-inclusion proof for the tip. Uniqueness of eachsidis enforced by BFT Core through the consistency proof of every round, so two conflicting successors of one state cannot both be certified.Claim: given this accepted origin, this document follows an authorized history, each step signed by the party the previous step named, whose continuations cannot conflict, except through explicitly authorized branches; it ends in a seal, or was the unspent tip as of round r.
Relation to Design B
This is Design B with these refinements:
P_tsigwith k-of-n keys mitigates both for a step that a committee controls."sealed"string.STATE_ID_EXISTSis still an open issue. Non-forking and tip proofs depend on aggregator-go implementing the consistency and non-inclusion proofs as specified. The current stubs are an implementation gap, not a limit of the protocol.MastaP commentedon Nov 5, 2026
Two points on the sketch that came up while reviewing #16, which implements it faithfully:
The issuer signature should cover the genesis recipient. As sketched,
reasonsigns(id, ty, auxData), so the issuer endorses the origin document but not who produces revision 1. The chain "each step signed by the party the previous step named" therefore starts with a link the issuer never named. In any delegated mint (the issuer signs, someone else submits), the minter picks the first producer freely, and verification still reports the issuer signature as valid. Adding the encoded recipient predicate to the signed message closes this. It changes the signed format, so it's free now and a breaking change once lineages exist.Pinning by issuer key +
H(doc_0)isn't unique. The salt is random, so an issuer can mint any number of geneses for the samedoc_0, each certified and each with its own fork-free continuation. This can happen innocently too: re-running an interrupted genesis mints a second one. A verifier who pins by issuer and first digest will accept a parallel lineage, which is exactly the shadow approved document the first example is meant to exclude. Onlyididentifies a single lineage, so verifiers have to get it through a trusted channel at genesis. The "or" in "verifiers pin the origin byid… or by the issuer key together withH(doc_0)" should go.Cover the genesis recipient with the issuer signature
Identify a lineage by its token id
ahtotruu commentedon Nov 10, 2026
Thanks, both points are addressed on the
revision-historybranch (#16).1. The issuer signature now covers the genesis recipient (556402d)
The genesis reason now signs
where
recipientis the mint's recipient predicate in its own tagged CBOR encoding (tag 39032), byte for byte as the mint carries it. The verifier takes the recipient from the mint transaction, so the reason's format (tag 39200 [1, issuer, signature]) is unchanged.2. Only the token id identifies a lineage (825e059)
verify --token-id <hex>checks which lineage the token is. A different id fails with "Token id mismatch", reported ahead of any hash mismatch. A newLineage idline saysmatches,differs, ornot checked; pass --token-id …, so a passing result that hasn't established which lineage this is says so. The JSON output gainsexpectedTokenIdMatches.stamp-revisionprints the token id marked "identifies this lineage; give it to verifiers".H(doc_0)isn't unique, and that verifiers need the id through a trusted channel.SHA-256(CBOR["unicity-document-lineage/salt", issuer private key, recipient, auxData]), like the state mask of later steps. We considered deriving it from public inputs instead (issuer public key andH(doc_0), with or without the recipient), which would make the issuer+H(doc_0)pin unique. We rejected that because the mint's state id depends only on the token id: anyone who has the document could pre-mint junk into that slot and permanently block the lineage. Keyed on the issuer's private key, nobody else can compute the id before the genesis is certified.