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.
artifactHash is a cryptographic commitment to the exact bytes of a KB’s off-chain artifact. It is stored alongside the kbHash (contentHash) in the registry contract, giving any verifier a way to confirm that artifact bytes retrieved from IPFS or another store match what the publisher committed to at registration time.
artifactHash and kbHash are independent hashes. kbHash commits to the logical envelope (type, domain, payload structure, lineage), while artifactHash commits to the raw bytes of the serialized artifact file — including formatting whitespace and the embedded kbHash string itself. A mismatch between retrieved bytes and the stored artifactHash signals corruption, replacement, or incorrect retrieval.
Signatures
artifactHashFromPayload
canonicalize() and then computes Keccak-256 over the resulting canonical JSON string. This is a convenience wrapper for the common case where the artifact bytes are derived from the payload object.
artifactHashFromBytes
Parameters
For
artifactHashFromPayload: a typed payload object that conforms to one of the ALX Protocol payload schemas (e.g. { type: "practice", rationale: "...", contexts: [], failureModes: [] }). The object is canonicalized before hashing, so key order in the input does not matter.For
artifactHashFromBytes: the raw bytes of the artifact. This is typically the UTF-8 encoding of the pretty-printed artifact JSON file including its trailing newline, as described in the implementer guide.Return value
A
0x-prefixed 64-character lowercase hex string representing the Keccak-256 hash of the input. This value is passed as the artifactHash field when building an envelope and is stored in the registry contract.Computing the artifact hash for a published file
The implementer guide specifies that the artifact file is a pretty-printed JSON object with thekbHash embedded and a trailing newline. To compute artifactHash for that file, use artifactHashFromBytes over the UTF-8 encoding of that exact string:
Verification pattern
After retrieving a KB artifact, recompute its hash and compare it with what the registry stored:Notes
artifactHashFromPayloadcallscanonicalize()internally, so it rejects the same invalid inputs (null,BigInt, non-finite numbers).- When building an envelope to pass to
buildDerivedEnvelope, omitartifactHashfromDerivedEnvelopeInputand the builder will callartifactHashFromPayload(payload)automatically. artifactHashuses Keccak-256, not SHA-256. Do not confuse it with thecidV1computation, which uses SHA-256 over the canonical JSON bytes.