Parent Relationships
parentHashes lists the blockHash of each direct parent Block. ALX normalizes the list before computing blockHash, making the declared parent set part of deterministic Block identity. Connected Blocks form a directed derivation Graph.
Parent Normalization
ALX normalizes parentHashes in this order:
- Trims surrounding whitespace and converts each hash to lowercase.
- Validates each hash against
^0x[a-f0-9]{64}$. - Removes duplicate hashes.
- Sorts the remaining hashes lexicographically.
- Rejects more than 256 distinct hashes.
One invalid entry rejects the complete operation. Normalization never drops an entry or returns a partial parent set. createBlock() and hash derivation normalize the supplied list. validateBlock() does not normalize: a recorded Block whose parentHashes is not already normalized fails validation.
The following input and its normalized output produce the same blockHash for the same content:
{
"input": [
" 0x84EE19CABB89367925F79A27E0B7D43D075CB8842CE056A468DB6B7355663F5A ",
"0x2ea8df928f1a68f3fbbbbb2ae5938e817e1633a4066590cd2b22f6fa526aa8aa",
"0x84ee19cabb89367925f79a27e0b7d43d075cb8842ce056a468db6b7355663f5a"
],
"normalized": [
"0x2ea8df928f1a68f3fbbbbb2ae5938e817e1633a4066590cd2b22f6fa526aa8aa",
"0x84ee19cabb89367925f79a27e0b7d43d075cb8842ce056a468db6b7355663f5a"
]
}
Parent Normalization Constraints
| Input | Result |
|---|---|
Omitted parentHashes argument | Treated as an empty array |
Supplied value that is not an array, including null | Rejected with ALX_INVALID_HASH |
| Entry that is not a string | Rejected with ALX_INVALID_HASH |
Entry that does not match ^0x[a-f0-9]{64}$ after trimming and lowercasing | Rejected with ALX_INVALID_HASH |
| More than 256 distinct parent hashes after deduplication | Rejected with ALX_TOO_MANY_PARENTS |
Parent Selection
Applications declare direct parent Blocks through parentHashes.
- Root Blocks: Use an empty parent set (
[]). - Derived Blocks: List every direct upstream Block the new Block depends on.
Declare direct parents only. Earlier ancestors remain reachable through the derivation Graph when the required Blocks are available. See Block Identity for hash derivation.