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.
@alx/protocol is the TypeScript reference implementation of ALX Protocol. It exports the canonicalization functions, hash utilities, and registry ABI you need to compute Knowledge Block identities, verify artifacts, and interact with the on-chain registry. This page walks you through installing the package, confirming your environment, and running a smoke test.
@alx/protocol requires Node.js 20 (>=20 <21). Using a different major version may produce environment-specific behavior that breaks conformance with protocol test vectors.Install the package
Choose your package manager and run the corresponding command.Import the core exports
After installing, import the functions you need from@alx/protocol. The three most commonly used exports are:
canonicalize— serializes any value to deterministic RFC 8785 / JCS JSONkbHashFromEnvelope— derives the domain-separatedkbHashfrom a Knowledge Block envelopeREGISTRY_ABI— the ABI for the on-chain registry contract, used with ethers or viem
Verify your setup
Run the following smoke test to confirm the package is installed correctly and that canonicalization works as expected in your environment.Next steps
Compute a Knowledge Block identity
Use
kbHashFromEnvelope to derive a kbHash from a full KB envelope. See the compute identity guide for the complete envelope structure and requirements.Publish on-chain
Register your Knowledge Block in the Base mainnet registry using
REGISTRY_ABI and ethers. See the publish on-chain guide.Verify an artifact
Confirm that a retrieved artifact matches its published cryptographic commitment. See the verify artifact guide.
The registry contract is deployed on Base mainnet (chain ID
8453) at 0xD1F216E872a9ed4b90E364825869c2F377155B29. Publishing a Knowledge Block requires a minimum stake of 0.001 ETH.