Liking cljdoc? Tell your friends :D

Identity

Your account namespace is the hash of a genesis record, not of a public key.

sender = hex(sha256("netz/peer-id/v2" || edn-hash(genesis)))     64 hex chars

That indirection is the whole design. In did:key, SSB and most of the self-certifying-identity family, the key is the name — so rotating a key means becoming somebody else. Here the key is one entry in a record, and the record's hash is the name.

Why it matters more here than elsewhere

Because in this ledger the namespace is in the attribute name of every datom you own. :<your-namespace>/note is your attribute. If the namespace were a public key, rotating it would not be a re-signature — it would be a database rewrite of every row you have ever written.

Measured on a key owning 300 rows:

ownership encoded asrotation cost
a ref to a key entity3 datoms, 1,415 bytes
a hex string on each row601 datoms, 84,537 bytes
the attribute namespacerewrite every datom

The genesis record

From netz.identity:

{:netz/version            "netz/identity/v2"
 :netz/rotation-keys      [...]        ; may replace the operational set
 :netz/rotation-threshold n
 :netz/operational-keys   [...]        ; may sign transactions
 :netz/revocation-commit  <hash>}      ; a commitment, fixed at creation

Two tiers, and the split is the point: operational keys are online — they sign every transaction — while rotation keys are not. Compromising the key on the server does not have to mean losing the identity.

The peer id is sha256 over hasch/edn-hash of the record rather than over its printed form, because map iteration order differs across platforms and a printed map would hash differently on the JVM and in a browser.

:netz/revocation-commit cannot be added later. A commitment published after a compromise is the attacker's commitment.

Authentication, in three parts

All three run before anything is priced.

  1. The account carries the genesis. :urd.account/genesis on the account entity, as EDN. Read it, and if there is none the sender is unknown — distinct from wrong, because the fix differs: "register your identity" versus "you signed with the wrong key".

  2. The genesis must hash to the sender, and must authorise the key. Both halves. Checking only the second would let anyone present any valid genesis.

  3. The signature must verify over the digest. The digest covers :sender explicitly, and that is not redundant: one genesis may authorise several operational keys, so the bytes must commit to the namespace the client actually signed for.

A trap this codebase hit three times: nil binds as UNBOUND in a Datalog value position. A query for an account by a nil key does not return nothing — it matches every account. An unknown sender resolved to somebody else's balance. The lookup is guarded before the query now.

The whole namespace, not a prefix

Namespaces are the full 64 hex characters. A 10-character prefix is 40 bits, which is hours of targeted key generation on ordinary hardware — and the prize would be the right to write another account's attributes.

Validity is checked on length and alphabet. A 64-character non-hex namespace is one no key can produce, and without the alphabet check it would read as user-owned.

Rotation: what exists

Rotation is not implemented, on either side. netz.identity says so directly — the genesis has room for it from the start, and the operation is not written. And skuld stores the genesis under :urd.account/genesis, which is beneath the urd.account protocol root, so no transaction of any kind can update it; only a direct write at genesis time.

What exists today is the structure that makes rotation a small change rather than a migration. That is worth having, and it is not the same as having rotation.

Funding an account that cannot yet transact

An account may hold a balance with no genesis. It can be credited and can never spend — every transaction from it refuses as :unknown-sender. That is deliberate: funding somebody before they have registered is a reasonable thing to want.

See also

Transactions for where these checks sit in the pipeline · Ownership for what a namespace entitles you to write

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close