Explainer
HomeTruth Resources
Trust, audit, and cost control for transactional data

Blockchain, but practical

HomeTruth Blockchain & Ledger Strategy

Only transactional evidence is anchored on-chain. We batch events into Merkle roots on Polygon for low cost, optionally anchor to Ethereum for finality, and keep documents plus PII off-chain but cryptographically bound.

On-chain: Merkle roots, tx hashes, minimal metadata Off-chain: documents, PII, full ledger rows Polygon first; optional Ethereum anchoring Built with Foundry/Hardhat toolchain

Cost control

One Polygon tx stores the Merkle root for hundreds of ledger updates; anchor to Ethereum only weekly or on demand.

Privacy by design

Full docs and personal data stay in the database/object store; hashes and proofs provide verifiability without exposure.

Verification UX

Every ledger item keeps its Merkle proof, with a “Verify on chain” check against the stored root and tx link.

What goes on-chain vs stays off-chain

Attest to integrity, not content. Keep sensitive data under HomeTruth control while making tamper evidence public.

On-chain (Polygon, optional Ethereum)

  • Merkle root per batch (daily/hourly) of ledger rows.
  • Batch ID, source chain ID, and optional content URI to public summary.
  • Tx hash and block number (available from chain for linking).
  • Event emission for easy indexing and UI links.

Off-chain (DB, object store)

  • Full ledger records (home improvements, inspections, boiler checks, repairs).
  • Documents and media; encrypted at rest with stable hashes.
  • Merkle proofs per item + batch metadata (root, tx hash, block).
  • PII and business data; normalized before hashing to avoid collisions.

Batching with Merkle trees

Reduce gas by committing one root for many updates while keeping per-item proofs for verification.

1

Build tree off-chain

Normalize each ledger item (stable order of fields) and hash it; assemble into a Merkle tree.

2

Submit root to Polygon

Call the registry contract with root, batchId, period, chainId, and optional URI.

3

Persist proofs

Store each item’s Merkle proof, the on-chain tx hash, and block number alongside the ledger row.

4

Optional anchoring

Batch Polygon roots into a higher-level tree and anchor that root to Ethereum weekly for stronger immutability.

Data flow for a HomeTruth ledger event

Capture

Ledger entry created (e.g., “Boiler service”, £180, timestamp, property/user IDs, doc hash).

Hash

Normalize record → hash; add to batch queue; upload doc to storage and store doc hash.

Commit

Batcher builds Merkle tree, submits root to Polygon; receives tx hash and block number.

Persist

DB stores ledger row, proof, root, tx hash, block; doc stays off-chain.

Verify

UI shows “Verify on chain”: recompute root from proof, compare to on-chain value, link to block explorer.

Contract shape (Polygon-first, Ethereum optional)

Minimal surface area: store roots, emit events, keep roles tight.

pragma solidity ^0.8.20;

contract LedgerRootRegistry {
  event BatchStored(bytes32 indexed batchId, bytes32 indexed root, uint64 chainId, string period, string uri);
  mapping(bytes32 => bytes32) public roots;

  address public admin;
  modifier onlyAdmin() { require(msg.sender == admin, "auth"); _; }

  constructor(address _admin) { admin = _admin; }

  function submitBatch(bytes32 batchId, bytes32 root, uint64 chainId, string calldata period, string calldata uri) external onlyAdmin {
    roots[batchId] = root;
    emit BatchStored(batchId, root, chainId, period, uri);
  }
}
Access control: Use simple admin for PoC; swap to OpenZeppelin AccessControl in prod.
Explorer links: Expose tx hash + block in UI for jump-out verification.
Events: Primary source for indexers; avoid heavy on-chain storage.

Environment plan

Dev / PoC

Local anvil (Foundry) or Hardhat node; instant resets; no cost.

  • Deploy registry; seed sample ledger + proofs.
  • Use John Doe dataset to demo verification UI.

Test

Polygon Amoy; optional Sepolia if trialing L1 anchoring.

  • Run batcher via CI or cron; monitor confirmations.
  • Store explorer links in DB for every batch.

Prod

Polygon PoS for daily batches; weekly Ethereum anchor if required by partners.

  • Use stable gas oracles; alert on failed submissions.
  • Keep the ability to pause anchoring if gas spikes.

Cost, privacy, and UX notes

Cost envelope

Polygon: fractions of a cent per root. Ethereum anchoring: a few dollars depending on gas; do it weekly/when needed.

  • Batch hundreds of items per root to amortize gas.
  • Use calldata-efficient structs; avoid per-item writes.

Privacy

Hash normalized data; never upload PII or docs on-chain. Encrypt storage; keep salts/keys off-chain.

  • Hash(doc bytes + stable metadata) to bind content to ledger.
  • Document deletions remove storage objects; hashes remain as evidence only.

Verification UX

Show tx hash, batch ID, root, and a “Verify proof” button on the ledger row (e.g., John Doe’s property view).

  • Client recomputes root from stored proof; compares to chain value.
  • Link to PolygonScan/Etherscan for human-friendly confirmation.

Demo script (use John Doe ledger)

1) Show ledger table: John Doe’s last 18 months (repairs, boiler checks, electrical tests) with doc links.
2) Highlight blockchain fields: Batch ID, Merkle root, tx hash, block number, and “Verify on chain”.
3) Click verify: UI recomputes the proof client-side and compares to on-chain root; open explorer link.
4) Explain scope: Only transactional evidence is on-chain; documents and PII stay private but cryptographically bound.
5) Cost story: One Polygon tx covered hundreds of events; optional weekly Ethereum anchor for partner-grade finality.