VeriSolv: Confidential Cross-Chain Solvency & Threshold Attestation Engine
Midnight Network Hackathon, Cross-Chain Track
Proving financial health and liquidity across blockchains with Zero-Knowledge proofs, without ever doxxing your balances, transaction history, or wallet address.
Inspiration
The inspiration for VeriSolv came from a personal frustration I’ve experienced in both the traditional financial world and Web3: the total loss of privacy required just to prove you are financially capable.
A while back, when applying for an apartment lease, I was forced to email unencrypted PDF bank statements, tax returns, and pay stubs to a property manager I’d never met. Those documents contained my exact account balances, transaction habits, salary, routing numbers, and home address. In an era of constant corporate data breaches, handing over your entire financial life just to prove you have a few months of rent in reserve felt absurdly unsafe and outdated.
When I looked to DeFi, I realized public blockchains suffer from the exact opposite extreme: radical, dangerous transparency.
On public networks like Ethereum, Base, and Arbitrum, every transaction and balance is visible to the entire world. If you want to prove to a lending protocol that you hold $200,000 in assets across your wallets to qualify for lower interest rates or higher borrowing tiers, you have to publicly link or bridge those addresses. Doing so paints a giant target on your back for MEV sandwich bots, phishing scammers, and competitive surveillance. The only alternative today is locking capital into bridge contracts, paying heavy gas fees, and taking on smart contract bridge risks.
I kept coming back to one core question:
"Why should proving you can afford something require revealing everything you have?"
When I discovered the Midnight Network and its Compact language for private smart contracts, the solution clicked. What if I could use Midnight as a shared, confidential computation engine? A user could mathematically prove that Assets - Liabilities >= Threshold or Collateral Coverage >= 2.5x in private witness space, publish a one-time cryptographic nullifier to the Midnight ledger, and relay that verification to consumer smart contracts on EVM chains—without revealing a single dollar figure, transaction, or wallet link.
That vision drove me to build VeriSolv.
What VeriSolv does
VeriSolv is a decentralized, privacy-preserving cross-chain solvency and threshold attestation engine built on the Midnight Network using Compact smart contracts and Zero-Knowledge proofs (ZK-SNARKs).
It allows users to prove financial health, collateral adequacy, or threshold compliance from assets held across external networks without ever exposing raw balances or linking wallet identities, and then consumes those proofs cross-chain on EVM protocols (Ethereum Sepolia, Base Sepolia).
THE VERISOLV ARCHITECTURE
+-------------------------------------------------------------------------------+
| PROVER CLIENT (BROWSER) |
| - Connects EVM Wallet (MetaMask) + Midnight Lace Wallet |
| - Signs EIP-712 Balance Attestation (Assets, Liabilities, Salt) |
| - Executes Local Proof Generation via Midnight Proof Server Client |
+---------------------------------------+---------------------------------------+
|
| Private Witness (Raw Balance, Nonce, Sig)
v
+-------------------------------------------------------------------------------+
| MIDNIGHT NETWORK (Compact Contract) |
| - Circuit: proveSolvencyTier / proveSolvencyMultiplier |
| - Evaluates: (balance - liabilities >= threshold) in ZK Circuit |
| - Emits: One-time Nullifier Commitment (Hash of Signer, Salt, Tier) |
| - Records: Zero-Knowledge Attestation on Public Ledger (NO PII/Balances) |
+---------------------------------------+---------------------------------------+
|
| Verified Cross-Chain Attestation Packet
v
+-------------------------------------------------------------------------------+
| CROSS-CHAIN RELAY & ORACLE LAYER |
| - Verifies Midnight Ledger Inclusion Proof & State Root |
| - Signs EIP-191 Attestation Packet: (User, Nullifier, Tier, Timestamp) |
+---------------------------------------+---------------------------------------+
|
+-----------------------+-----------------------+
| |
v v
+-------------------------------+ +-------------------------------+
| VeriSolvLendingBoost.sol | | VeriSolvRentalGate.sol |
| - Up to 300 bps APR Discount| | - Verified Tenant Passport |
| - Up to $250k Limit Bonus | | - Instant Lease Approval |
| - No Collateral Bridging | | - Zero Bank Statement Dox |
+-------------------------------+ +-------------------------------+
Key Capabilities & User Flows
Confidential Prover Studio:
Users select their target solvency tier (Bronze: $10k+,Silver: $25k+,Gold: $100k+,Whale: $500k+) or custom collateralization multiplier (2x,3xcoverage). After signing an EIP-712 message containing their private asset figures and random blinding salt, the dApp invokes Midnight's local proof engine to generate a ZK-SNARK proof directly inside the browser.Zero-Leakage On-Chain Settlement:
The Compact circuit executes the solvency inequality check (balance >= liabilities + minThreshold) in private witness computation. It generates an anonymous, one-time nullifier commitment usingpersistentHashand records only the verified status and tier counter on the Midnight public ledger.Cross-Chain Execution on EVM:
A cross-chain relay service listens for the confirmed Midnight transaction, constructs a cryptographically signed attestation packet, and delivers it to destination EVM smart contracts:VeriSolvLendingBoost.sol: Grants immediate interest rate discounts (up to 3.0% APR reduction) and expands credit borrow limits (up to $250,000 bonus liquidity) on EVM money markets without requiring the user to bridge their underlying capital.VeriSolvRentalGate.sol: Issues a verified on-chain Tenant Solvency Passport, allowing renters to prove reserve adequacy to landlords without sharing bank accounts or PII.VeriSolvOTCDesk.sol: Provides threshold-gated access to private whale OTC liquidity pools and dark rooms without public identity disclosure.
"What The Chain Saw" Privacy Inspector:
An interactive side-by-side verification tool built directly into the UI. It contrasts what the user entered privately (exact balances, secret salt, wallet addresses) against what the blockchain saw (nullifier hashes, proof bytes, boolean stamps), giving users and verifiers tangible visual proof of zero data leakage.Protocol & Verifier Dashboard:
A live protocol observer interface where liquidity pool managers and landlords can monitor real-time verified attestations, track aggregate protocol solvency metrics, and verify cryptographic nullifiers without seeing private user data.
How I built it
As a solo developer, bringing VeriSolv to life required orchestrating a full-stack, multi-chain architecture spanning Midnight's ZK smart contract toolchain, EVM Solidity protocols, cryptographic relayer services, and an ultra-responsive cyber-dark glassmorphism frontend.
1. The Midnight Smart Contract (SolvencyAttestation.compact)
I authored the core zero-knowledge circuit logic in Compact (v0.23+), Midnight's domain-specific language for confidential smart contracts:
- Private Witness Model: Ingests private values (
balance,liabilities,salt, andsigner) off-chain through client witness functions. - ZK Circuit Constraints:
compact assert(tier >= 1 && tier <= 4, "Invalid solvency tier level"); assert(balance >= liabilities, "Liabilities exceed total asset balance"); const netSolvency = balance - liabilities; assert(netSolvency >= minThreshold, "Net solvency below minimum tier threshold"); - Blinded Nullifier Derivation: Utilizes Midnight's cryptographic primitives (
persistentHash) to produce a 256-bit nullifier binding the signer, salt, and tier:compact const nullifier = persistentHash<Vector<4, Bytes<32>>>([ pad(32, "verisolv:nullifier:"), signer, salt, tier as Field as Bytes<32> ]); - Dual-State Public Ledger: Updates public ledger maps (
attestations) and increments public tier-specific verification counters (tier1Count,tier2Count,tier3Count,tier4Count,totalVerifiedCount) while keeping the underlying witness data strictly private.
2. Destination EVM Smart Contracts (Solidity ^0.8.20)
I engineered a suite of EVM consumer contracts deployed to Base Sepolia and Ethereum Sepolia:
IVeriSolvConsumer.sol: A standard interface defining theapplySolvencyBoosthook andSolvencyVerifiedevent.VeriSolvLendingBoost.sol: Implements dynamic risk-adjusted lending parameters, granting tiered APR reductions (50–300 bps) and borrow limit expansions ($10k–$250k).VeriSolvRentalGate.sol: Manages verified rental passports with issuance timestamps and tier badges.VeriSolvOTCDesk.sol: Enforces strict whale solvency tier requirements (Tier 3+) to unlock high-ticket OTC deal execution.- Replay Protection: Every EVM contract verifies the cryptographic relayer signature via
ecrecover, checks proof expiration (7-day validity window), and tracks consumed nullifiers in an immutablemapping(bytes32 => bool) public usedNullifiers.
3. Cross-Chain Relay Service
I built a TypeScript relay engine that bridges Midnight and EVM:
- Listens to confirmed transactions and events on the Midnight ledger.
- Packages the attestation receipt (nullifier, tier, timestamp, chain ID, and recipient address).
- Signs the EIP-191 digest using the relayer oracle private key to create a tamper-evident payload ready for single-transaction EVM execution.
4. Frontend & Interactive User Experience
I designed and built the web application using React 18, TypeScript, Tailwind CSS, and Framer Motion:
- 5-Stage ZK Pipeline Visualizer: Animates each step of the cryptographic lifecycle:
Step 1: EIP-712 Wallet Signature →Step 2: Witness Packing →Step 3: Local Proof Server ZK-SNARK Proving →Step 4: Midnight Ledger Settlement →Step 5: Cross-Chain EVM Consumer Minting.
- Interactive Synapse Network: Dynamic canvas particle effects and responsive cyber-dark aesthetic.
- Multi-Wallet Connection: Seamless dual-wallet support connecting EVM providers (MetaMask via Viem/Ethers) and Midnight Lace.
Challenges I ran into
Mastering the Compact Dual-State Mental Model:
Coming from the EVM paradigm where all state transitions are public and synchronous, learning Compact required shifting to a dual-state architecture. I had to carefully separate what computations occur inside the off-chain private witness space versus what gets proven in arithmetic circuits and recorded on the public ledger. Navigatingdisclose()semantics, vector hashing (persistentHash<Vector<4, Bytes<32>>>), and strict type boundaries betweenField,Uint<64>, andBytes<32>was a steep but rewarding learning curve.Cross-Chain Replay & Front-Running Protection:
A primary security vector in cross-chain attestation is replay attacks: preventing a malicious actor from copying someone else's verified Midnight nullifier and submitting it to an EVM contract under their own address. I solved this by cryptographically binding the user's destination EVM address, the attestation tier, the unique nullifier, the issuance timestamp, and the target EVMblock.chainidinto both the Midnight circuit nullifier preimage and the relayer oracle signature digest.Orchestrating Local ZK Proving in Dev Environments:
Running a complete local Midnight development stack (Proof Server Docker container, Indexer, Node, and Wallet RPCs) while ensuring sub-second response times in the browser required careful optimization. I created robust proof-server client adapters with deterministic cryptographic fallbacks to guarantee seamless, rock-solid demo execution during offline or variable network conditions.Demystifying Zero-Knowledge UX:
ZK cryptography often feels like an intimidating "black box" to end users and evaluators. If the UI simply shows a loading spinner and a success checkmark, the true technical magic of zero-knowledge privacy is lost. I dedicated significant effort to building the "What The Chain Saw" Privacy Inspector, engineering an interactive side-by-side breakdown that visually proves that confidential numbers never cross the client boundary.
Accomplishments that I'm proud of
- True Zero-Data-Leakage Architecture: Successfully built and tested a complete, working Zero-Knowledge circuit that verifies financial thresholds without disclosing raw balances, liabilities, or wallet linkages.
- Multi-Contract EVM Consumer Ecosystem: Created three distinct, working EVM destination contracts (
LendingBoost,RentalGate, andOTCDesk) rather than just a single mock consumer, demonstrating diverse real-world utility across both DeFi and real-world assets (RWA). - Production-Quality Compact Codebase: Wrote clean, well-documented Compact v0.23+ contracts following Midnight Network standards, complete with multi-tier solvency thresholds and collateral coverage multiplier circuits.
- The "Privacy Inspector" Component: Built a standout UX feature that makes zero-knowledge computation tangible, accessible, and verifiable at a glance.
- Comprehensive End-to-End Test Suite: Implemented rigorous automated testing across Compact circuit assertions, EVM contract execution, relayer signatures, replay-prevention guards, and end-to-end integration flows.
What I learned
- The Power of Selective Disclosure: Working with Midnight reinforced why privacy-first blockchains are the missing link for mainstream Web3 adoption. Selective disclosure enables compliance, identity verification, and financial credit scoring without compromising individual privacy.
- Compact DSL & Midnight Tooling: Gained deep, hands-on mastery of Midnight's Compact language, proof server client architecture, and dual-state state machines.
- Practical ZK System Design: Learned how to construct collision-resistant nullifiers, structure efficient circuit constraints, and minimize on-chain computational footprints.
- Cross-Chain Architecture Patterns: Understood the mechanics of bridging non-EVM privacy execution environments with high-liquidity EVM settlement layers.
What's next for VeriSolv
- Trustless State-Root Oracle Integration (VIA Labs & EffectStream):
Upgrade the balance ingestion pipeline from self-attested EIP-712 witnesses to trustless cryptographic state-root reading, directly verifying Ethereum/Base historical account balances inside Midnight witness scripts via storage proofs. - Cross-Chain Multi-Wallet Aggregation:
Allow users to prove aggregate solvency across multiple disparate chains simultaneously (e.g., Ethereum + Arbitrum + Cardano + Solana) inside a single unified Midnight ZK proof. - Time-Weighted Average Balance (TWAB) Solvency Circuits:
Introduce multi-epoch time-weighted balance proofs to mathematically prevent flash loan attacks or temporary balance pumping before attestation. - Mainnet Deployments & Protocol Integrations:
Deploy VeriSolv contracts to the Midnight Mainnet and partner with EVM lending markets (Aave, Compound forks) to pilot under-collateralized and risk-adjusted credit boost programs. - Enterprise Web2 Identity & Rental SDK:
Package VeriSolv into a drop-in widget for Web2 property management platforms and FinTech apps to verify tenant solvency without ever handling sensitive financial documents.
Built With
- base-sepolia
- compact
- cross-chain
- docker
- eip-712
- ethereum
- ethers.js
- github
- hardhat
- lace
- metamask
- midnight
- node.js
- openzeppelin
- smart-contracts
- solidity
- typescript
- viem
- wagmi
- web3
- zk-snark
Log in or sign up for Devpost to join the conversation.