Every Knowledge Block has a single stable identifier:Documentation Index
Fetch the complete documentation index at: https://docs.xandrlabs.ai/llms.txt
Use this file to discover all available pages before exploring further.
kbHash. It is not assigned by a registry, generated randomly, or tied to who published the KB. Instead, it is derived entirely from the KB’s content and lineage. This means you can compute kbHash yourself from any canonical envelope and verify whether it matches a published value — no trusted party required.
The derivation formula
kbHash is computed using Keccak-256 (the Ethereum-compatible hash function, not NIST SHA3-256) over the UTF-8 bytes of the domain tag "KB_V1" concatenated with the canonical JSON of the normalized hash-scoped envelope:
0x prefix — a 66-character string of the form 0x followed by 64 lowercase hex digits.
What is included in the hash
ThenormalizeForHash step projects the envelope down to a fixed set of keys. Only the following fields are included in the hash preimage:
| Field | Included when |
|---|---|
type | Always |
domain | Always |
sources | Always (empty array [] if no parents) |
artifactHash | When present in the envelope |
tier | When present in the envelope |
payload | Always |
derivation | When present in the envelope |
What is excluded from the hash
The following fields are never part of thekbHash preimage:
- The top-level
kbHashfield itself (stripped before hashing) curatorandcreatedAtsignatureenvelopeCidand other indexing or transport metadata
kbHash.
Computing kbHash in code
UsekbHashFromEnvelope from @alx/protocol to derive the identifier from an envelope object:
kbHashFromEnvelope internally calls normalizeForHash to project and sort the envelope, then canonicalize to produce the deterministic JSON string, then hashes the result under the KB_V1 domain tag.
The
sources array is sorted lexicographically by normalizeForHash before hashing. You can pass parents in any order — the resulting kbHash will always be the same as long as the set of parent values is identical. See Lineage for details.artifactHash and cidV1
In addition tokbHash, the protocol defines two other identity-related values:
artifactHash is a cryptographic commitment to the exact bytes of the off-chain artifact associated with the KB. It is computed as the keccak-256 hash of the artifact bytes and stored in the registry alongside kbHash. When you retrieve an artifact, you should hash its bytes and compare against the published artifactHash to confirm you have the correct content.
cidV1 is a CIDv1 content identifier derived from SHA-256(canonical_bytes) using the raw codec (0x55). It is not the same as kbHash — it uses a different hash function and a multihash encoding. cidV1 is used when storing or referencing the canonical envelope on IPFS.
On-chain synonyms
The registry contract and indexing surfaces use different field names for the same value. All of the following refer to the same 32-byte value askbHash:
| Name | Where you encounter it |
|---|---|
kbHash | Protocol documentation and SDK |
contentHash | Registry contract (Solidity) |
kbId | Registry events and indexer output |
bytes32 field storing the identifier is named contentHash in the contract ABI. It holds the same bytes as kbHash.
Determinism guarantee
Identical inputs always produce identicalkbHash. This is a core protocol invariant. It means:
- You can verify any published KB by recomputing its
kbHashfrom the envelope. - Independent implementations that conform to the protocol specification will produce the same
kbHashfor the same envelope. - Caching, deduplication, and cross-system references all rely on this property.
kbHash that does not match a published value, either the envelope you have is different from the one that was published, or one of the implementations is not conformant.