Grant Application: Bao-Verified Streaming for Faster Wallet Recovery

Update: Chaos Testing Suite & Resume Demo

I’ve built two demonstration tools that prove Bao’s value for Zcash wallet sync:


1. Resume Demo (examples/resume-demo.ts)

Demonstrates what current gRPC can’t do - resumable, multi-server downloads with malicious server detection:

bash

npx tsx examples/resume-demo.ts

What it shows:

  • Download starts from Server A, fails at 50%

  • Resume from Server B using exported state (no re-download)

  • Server C sends corrupted data → Bao detects it instantly

  • Fallback to Server B, verification completes

Why this matters:

Current gRPC Bao Streaming
Connection drop = restart from 0% Resume from any server
Single server dependency Any mirror works
Malicious data accepted Corruption detected per-chunk

2. Chaos Testing Suite (examples/chaos-demo.ts)

Following Zooko’s suggestion to test “rare but difficult edge conditions”:

bash

npm run test:chaos

6 failure scenarios:

Scenario Real-World Equivalent
:satellite_antenna: Connection Drop at 99% Mobile tower handoffs, WiFi switching
:locked: Corrupted Final Bytes CDN compromise, bit errors
:stopwatch: Timeout on Last Chunk Server hangs, network black holes
:package: Partial Chunk Delivery Proxy interruptions, mid-transfer drops
:vertical_traffic_light: Rate Limiting (429) CDN throttling, server overload
:collision: Combined Stress All failures simultaneously

Implementation details:

  • Real Bao verification (PartialBao, not simulated)

  • Exponential backoff with 30% jitter (AWS best practice)

  • Performance metrics (retry times, latency, bytes transferred)

  • JSON output for CI: npm run test:chaos -- --json

All 6 scenarios pass with automatic recovery and cryptographic verification.


Why This Matters for Zcash Users

Mobile wallet sync currently fails completely if:

  • You lose signal mid-download

  • A CDN serves corrupted data

  • Server times out near completion

With Bao:

  • Resume from any mirror without re-downloading

  • Detect corruption instantly (per-chunk verification)

  • Retry automatically with backoff

  • Verify final data against root hash

This transforms wallet recovery from fragile all-or-nothing to resilient streaming with mathematical proof of integrity.


Try It Yourself

bash

git clone https://github.com/lamb356/zcash-bao-snapshots.git
cd zcash-bao-snapshots
npm install
npm run test:chaos          # Chaos testing
npx tsx examples/resume-demo.ts  # Multi-server resume

Docker (sandboxed):

bash

docker run --rm -it node:20-alpine /bin/sh
apk add git
git clone https://github.com/lamb356/zcash-bao-snapshots.git
cd zcash-bao-snapshots
npm install
npm run test:chaos

Repository: https://github.com/lamb356/zcash-bao-snapshots Tests: 86 passing CI: Green :white_check_mark:

Happy to answer any questions or add more scenarios.

1 Like