master-zapier-plan-draft/docs/02-architecture/tree-nodes.md
George Lambert f3dc0e6eee
Some checks are pending
offline / test (push) Waiting to run
Add Zapier interface simulator, tree-node Merkle lookups, and user docs
In-process trace console validates hops, faults, recoveries, and
suggested changes before zapier-platform push. User guide covers
signup through central-chain and bulk-summary tree-node hash lookup.
2026-09-11 12:58:03 -04:00

44 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Tree nodes: bulk Merkle summaries vs itemized chain seals
The main Verae chain stores **hash + time + block + certificate**. A Zap that timestamps one document writes that documents SHA-256 as its own seal.
A **batch** of many documents is different: middleware builds a Merkle tree of the item hashes, seals **only the Merkle root** on the chain, and writes each **leaf proof** to external tree-node NATS archives. A later lookup of a member hash will **miss** on the central chain unless the Zap also queries tree nodes.
```text
Zapier HTTPS zappier-edge HTTPS middleware
|
Merkle root | verae.archive.put kind=tree
(chain seal) | (leaf proof, sharded)
v
tree-node-east/west/central
bloom miss = silence
^
hash lookup includeTree | verae.archive.query
| kinds=["tree"]
aggregator merges proof + root seal
```
## When to use which Zapier search
| Search | Hits |
|--------|------|
| Find Timestamp by SHA256 | Hash was registered as its own chain seal |
| Find Hash (tree nodes + central chain) | Chain first, then `includeTree=true` broadcast |
## Receipt shape for a bulk leaf
```json
{
"sha256": "<leaf>",
"exists": true,
"itemizedOnMainChain": false,
"merkleRoot": "<root sealed on chain>",
"proofOk": true,
"receipts": [
{ "kind": "seal", "of": "merkleRoot", "sha256": "<root>", "certificate": "…" },
{ "kind": "tree-leaf", "archiveId": "tree-node-east", "proof": [], "leafIndex": 1 }
]
}
```
Validate this path in the simulator (`packages/verae-zapier-simulator`) before pushing the Zapier app.