Skip to content

feat: cryptographic proof-of-reserve verification module (#52) - #85

Merged
elizabetheonoja-art merged 1 commit into
Utility-Protocol:mainfrom
real-venus:feat/proof-of-reserve
Jun 25, 2026
Merged

feat: cryptographic proof-of-reserve verification module (#52)#85
elizabetheonoja-art merged 1 commit into
Utility-Protocol:mainfrom
real-venus:feat/proof-of-reserve

Conversation

@real-venus

Copy link
Copy Markdown
Contributor

Cryptographic Proof-of-Reserve Verification Module (#52)

Closes #52

What's included

File Responsibility
src/types/reserve.ts Commitment / audit / proof-input / range-proof / attestation types and bounds (Merkle depth 20 → 2^20 leaves, [0,2^64) range, 2 MB WASM, 5 s budget).
src/utils/porMerkle.ts SHA-256 Merkle tree — leaf = SHA-256(meterId ‖ u64LE(consumption) ‖ salt)buildTree/computeRoot/generateProof/verifyProof with odd-layer padding, via SubtleCrypto. Dedicated module so the existing WASM-backed merkleTree.ts (used by merkleWorker) is untouched.
src/utils/wasmLoader.ts Adds a generic loadWasmModule(url, {integrity, imports}) with fetch + SHA-256 integrity verification + caching, alongside the existing loadMerkleWasm.
src/services/proofOfReserve.ts Fetches commitment + audit, aggregates totals (bigint), solvency gate (throws InsolvencyError), builds 64-bit-bounded inputs, drives the prover, hashes + optionally submits the attestation; emits fetch→prove→submit→confirm progress. All I/O injectable.
src/workers/proofWorker.worker.ts Loads + integrity-checks the Bulletproofs WASM off-thread. Until the binary ships it uses a clearly-marked deterministic placeholder (integrity failures are still fatal — never silently downgraded).
src/hooks/useProofOfReserve.ts status/progress (25→50→75→100)/result + insolvency state.
src/components/panels/ReserveAttestationPanel.tsx Attestation hash, ledger, time-since-last-proof, and a red insolvency banner.
public/wasm/bulletproofs.README.md wasm-pack build + integrity/env wiring instructions.
tests/unit/* Merkle (root determinism, single/2-leaf, padding, proof verify, tamper, OOB index) and orchestrator (aggregation > MAX_SAFE_INTEGER, solvency abort, 64-bit bound, full-flow progress order).

…tocol#52)

Lets operators prove that on-chain liabilities are fully backed by off-chain
audited reserves via a Bulletproofs-style range proof, without revealing
individual meter readings.

- types/reserve.ts: commitment/audit/proof-input/range-proof/attestation types
  and bounds (Merkle depth 20, [0,2^64) range, 2MB WASM, 5s budget)
- utils/porMerkle.ts: SHA-256 Merkle tree (leaf = SHA-256(meterId||u64
  consumption||salt)) with buildTree/computeRoot/generateProof/verifyProof and
  odd-layer padding; dedicated module so the existing WASM merkleTree.ts is
  untouched
- utils/wasmLoader.ts: adds a generic fetch+SHA-256-integrity+cache loader
  (loadWasmModule) alongside the existing loadMerkleWasm
- services/proofOfReserve.ts: fetch commitment + audit, aggregate, solvency gate
  (throws InsolvencyError), build 64-bit-bounded inputs, drive the prover, hash
  + optionally submit the attestation, with fetch→prove→submit→confirm progress
- workers/proofWorker.worker.ts: loads/verifies the Bulletproofs WASM off-thread
  with a clearly-marked deterministic dev placeholder until the binary ships
- hooks/useProofOfReserve.ts: status/progress/result + insolvency state
- components/panels/ReserveAttestationPanel.tsx: attestation hash, ledger, time
  since last proof, red insolvency banner
- tests for the Merkle tree (root/proof/tamper/padding) and the orchestrator
  (aggregation, solvency abort, range bound, full-flow progress)
@elizabetheonoja-art
elizabetheonoja-art merged commit f38588e into Utility-Protocol:main Jun 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cryptographic Proof-of-Reserve Verification Module for Cross-Chain Asset Backing

2 participants