Block Lifecycle
An ALX Block moves through a small set of application-controlled steps. ALX Protocol defines the Block data and verification rules. Applications choose storage, transport, indexing, and optional commitment systems.
When to Use the Block Lifecycle
Use the lifecycle when an application creates, distributes, verifies, or optionally commits a Block across a workflow.
1. Create Content
Create JSON-serializable content for the application record. The application owns the content schema and content meaning.
2. Create the Block
Call the JavaScript/TypeScript package with the content and the direct parent hashes. A root Block uses an empty parent set.
import {createBlock} from '@alx-protocol/sdk';
const block = createBlock({type: 'example', value: 1}, []);
The package computes contentHash and blockHash from the protocol rules.
3. Validate the Block
Call validateBlock(block) before storing, publishing, indexing, or committing the Block. Validation recomputes both identities and checks the complete Block record.
4. Store or Distribute the Block
Store the complete Block in an application database, object store, file, or memory. An application may distribute the serialized Block through IPFS. A CID identifies retrieved bytes; blockHash identifies the ALX Block.
5. Validate Lineage
Load the parent Blocks required by the declared parentHashes. Validate each Block, then validate the graph. A missing parent produces incomplete lineage. Missing data does not prove global nonexistence.
Use Lineage Graphs for graph rules and Lineage and Attribution for trace results.
6. Add Optional Commitment Evidence
An application may commit one blockHash or a Merkle root hash to a blockchain. The commitment records deterministic evidence. The commitment does not store Block content or replace local Block validation.
Use Blockchain Commitments and Verify Commitment Inclusion for optional anchoring workflows.
7. Retrieve and Verify Later
When an application retrieves a Block, parse the bytes as JSON and run local validation again. Recompute the expected identity from the retrieved record. Compare the result with any stored or committed hash.
A successful lifecycle ends with an independently verified Block, a verified lineage graph when parent data is complete, and optional commitment evidence when the application selected a commitment layer.