There’s been a lot of discussion about whether ZSAs justify the complexity they add to Zcash. This is my contribution to that conversation — not an opinion, but working code with transparent research.
What I built: A block-level simulator for ZAI, an oracle-free CDP flatcoin on Zcash. No Chainlink, no external price feeds. The AMM’s TWAP is the only oracle. Fully compatible with shielded transactions. Every CDP locks ZEC as collateral, creating direct demand for ZEC.
Why it matters for coinholders: ZAI lets you hold stable value without leaving the shielded pool. Today, if you want to hedge ZEC volatility, you have to deshield, move to an exchange, and buy USDC losing your privacy. With ZSAs + ZAI, you open a vault, lock your ZEC, mint ZAI, and stay shielded the entire time.
The Key Finding
The conventional wisdom in stablecoin design is that better price accuracy equals better stability. MakerDAO uses Chainlink to get the “true” price. Liquity uses Chainlink + Tellor. Everyone assumes knowing the real collateral price is necessary for maintaining the peg.
The simulation discovered the opposite: price inaccuracy is the stability mechanism.
When ZEC crashes 60%, arbers try to reprice the AMM to match the external market. They exhaust their capital trying. When they’re depleted, the AMM freezes — it doesn’t know ZEC crashed. Vaults can’t be liquidated at fire-sale prices. No death spiral forms. The peg holds precisely because the system is blind to the crash.
I tested this directly by sweeping arber capital replenishment during a 43-day sustained bear:
∙ $0 replenished (arber exhausts) → 11.8% mean peg deviation (best result)
∙ $250K replenished → 16.3% (worse)
∙ $5M replenished → 32.6% (much worse)
∙ $50M replenished → 34.8% (worst result)
Every dollar of arber replenishment makes the peg worse. The system works because arbers run out of money, not despite it.
How ZAI Compares to Existing Stablecoins Under Stress
DAI, Black Thursday 2020: 12% peak depeg, $6M+ bad debt
∙ USDC, SVB Crisis 2023: 12.2% peak depeg, $0 bad debt
∙ UST, Luna Collapse 2022: 100% depeg (total collapse), total loss
∙ ZAI (simulated), Black Thursday equivalent: 4.2% peak depeg, $0 bad debt
Zero bad debt across all 13 stress scenarios. Zero liquidation cascades. The tradeoff is “zombie vaults” — positions that look healthy to the protocol but are underwater by external market price. These self-heal when price recovers (tested: 5/5 zombies resolved after V-shaped recovery, 0.43% residual gap).
The Honest Weaknesses (All Documented)
I’m not selling anything. Every weakness is in the repo:
Zombie vaults are real and inherent. During a sustained crash, TWAP says vaults are healthy while external price says they’re insolvent. This cannot be fixed without reintroducing an oracle, which defeats the purpose. (Findings F-017, F-023)
LP incentives are broken. Fee income is $3-$9 per $100K LP position. No rational LP stays. The system requires $2.5M in protocol-owned liquidity from the Coinholder-Controlled Fund — private LP liquidity drains to $77K in 2.5 days under stress. (F-025, F-027)
Demand shocks from large agents still overwhelm. A $1M agent against a $5M pool causes 19% peg deviation. The rule is: pool must be 10x the largest expected agent. (F-013, F-015)
CDP parameters don’t matter yet. With zero liquidations firing, collateral ratio and TWAP window have no effect on outcomes. The AMM layer does all the work. (F-019)
Deployment Prerequisites
∙ Minimum AMM liquidity: $5M (12/13 scenarios pass)
∙ Recommended AMM liquidity: $10M (all scenarios pass)
∙ Protocol-owned liquidity: $2.5M from Coinholder Fund
∙ Infrastructure needed: ZSAs (ZIP 226/227)
∙ Conservative parameters: 200% collateral ratio, Tick controller, 5-hour TWAP window
The Numbers
∙ 124 passing tests, 0 failures
∙ 31 documented findings (F-001 through F-031)
∙ 13 stress scenarios + 3 historical price proxies
∙ 7 agent types (arbers, demand, miners, CDP holders, LPs, IL-aware LPs, attackers)
∙ Stochastic Monte Carlo validation (50 seeds, stable verdicts)
∙ Full CSV data export on every HTML report for independent verification
∙ Death spiral defense confirmed robust at all tested liquidity levels up to $50M (F-031)
∙ System self-heals during V-shaped recoveries — all zombie vaults resolve (F-029)
Repo: GitHub - lamb356/zai-sim: Oracle-free CDP flatcoin simulator for Zcash — 124 tests, 31 findings, 13 stress scenarios
Run cargo test to verify all 124 tests. Run cargo test --test final_reports_test to generate interactive HTML reports with charts and CSV data download.
RESEARCH_SUMMARY.md has the full analysis. FINDINGS.md has every finding with methodology and implications.
What This Means for the ZSA Debate
ZAI answers Nate’s three criteria directly:
- Value funnels to ZEC — every CDP locks ZEC as collateral, every AMM pool pairs ZEC, stability fees are denominated in ZEC
- Censorship resistant — oracle-free, fully shielded, no external dependencies
- Fees proportional to balance — 2% annual stability fee on outstanding debt
ZSAs are the prerequisite infrastructure. Without them, there’s no way to represent a dollar-pegged asset in the shielded pool. This simulator is the demand signal — not “people say they want it” but “here’s the math showing it works, here’s where it breaks, and here’s what it costs.”
The simulation provides the data. The community decides the policy. I’m here to answer questions about the findings.