Block
An ALX Block is a verifiable data object containing application-defined content, deterministic identities, and declared parent relationships. ALX canonicalizes and hashes content without interpreting it.
Block Model
Every Block contains exactly five required protocol fields.
type Block = {
blockHash: string;
contentHash: string;
parentHashes: string[];
content: unknown;
protocolVersion: "1";
};
| Field | Description |
|---|---|
content | Application-defined ALX value. Canonicalization lists the supported values. |
parentHashes | blockHash values of the direct parent Blocks, normalized: lowercase, deduplicated, and sorted. An empty array marks a root Block. |
contentHash | Hash of the canonicalized content. |
blockHash | Hash of the canonicalized content together with the normalized parentHashes. |
protocolVersion | "1" in protocol version 1. Excluded from both hash calculations. |
Block Identity
ALX derives both hashes with domain-separated Keccak-256. Identical content produces the same contentHash under any parent set, and a different normalized parent set produces a different blockHash. Parent order and duplicate parent entries change neither hash. See Block Identity for derivation and hash format.
Block Validation
validateBlock(block) rejects a malformed record with an error: missing or extra fields, a protocolVersion other than "1", or a malformed hash. For a well-formed record, validateBlock() returns ok: true only when:
- the recomputed
contentHashandblockHashequal the recorded values; - the recorded
parentHashesare already normalized; and parentHashesdoes not contain the Block's ownblockHash.
Block validation does not establish parent availability or Graph validity. Validate Blocks lists the error identifiers, and Lineage Graphs covers Graph verification.
Parent Relationships
Each entry in parentHashes declares a dependency on a direct parent Block, and connected Blocks form a derivation Graph. See Parent Relationships for normalization rules and constraints.
When to Create a Block
Create a Block when application-defined content requires deterministic identity, declared dependencies, independent validation, or composition with other Blocks.