R

Relic

Founder

How Zero-Knowledge Proofs Enable Private Trading

March 10, 2024

When Sarah first approached me about building a privacy-native prediction market, I thought she was crazy. Zero-knowledge proofs are notoriously complex, and integrating them into a high-throughput trading system seemed impossible. But after six months of research and prototyping, we've built something that actually works—and it's pretty elegant.

The Privacy Problem in DeFi

Most blockchain applications are completely transparent. Every transaction, every balance, every trade is visible to anyone with an internet connection. This is great for auditability but terrible for privacy. In prediction markets, this transparency creates serious problems. If I can see that a whale just bet $1M on "Yes," I can front-run their order or copy their position before the market moves.

Traditional solutions like mixing services or privacy coins don't work for prediction markets because you need to prove you have a valid position to claim winnings. You can't just hide everything—you need selective disclosure. That's where zero-knowledge proofs come in.

What Are Zero-Knowledge Proofs?

A zero-knowledge proof lets you prove a statement is true without revealing any information beyond the statement itself. The classic example: I can prove I know the password to a system without telling you the password. In VEIL, we use this to prove you have a valid trade without revealing the trade details.

We specifically use zk-SNARKs (Zero-Knowledge Succinct Non-Interactive Arguments of Knowledge). The "succinct" part means the proofs are small—just a few hundred bytes regardless of the computation complexity. The "non-interactive" part means you don't need back-and-forth communication. You generate a proof, submit it, and validators can verify it independently.

How It Works in VEIL

When you place a trade on VEIL, your wallet generates a zero-knowledge proof that demonstrates: (1) you have sufficient balance to cover the trade, (2) the trade parameters are valid, and (3) you're authorized to make the trade. The proof gets submitted to the network along with encrypted trade data.

Validators verify the proof without seeing your balance, position size, or trading strategy. They just check that the cryptographic proof is valid. If it is, the trade executes. The encrypted trade data gets stored on-chain, but only you have the decryption key. When the market resolves, you generate another proof to claim your winnings without revealing your original position.

The Technical Challenges

Building this system was incredibly difficult. zk-SNARKs require a "trusted setup" ceremony where multiple parties generate cryptographic parameters. If even one participant is honest, the system is secure. We ran a ceremony with 200+ participants from around the world to ensure no single party could compromise the system.

Proof generation is also computationally expensive. On a standard laptop, generating a proof for a complex trade can take 5-10 seconds. We optimized our circuits to reduce this to under 2 seconds and built a proof-generation service that can handle thousands of concurrent users. We're also exploring recursive proofs and proof aggregation to further improve performance.

Privacy vs. Compliance

One concern people raise is whether privacy enables illegal activity. Our view is that privacy is a fundamental right, but we've also built in mechanisms for selective disclosure. If required by law, users can prove their trading history to regulators without revealing it publicly. This is similar to how you can show your bank statements to the IRS without posting them on Twitter.

We're also implementing transaction limits and velocity checks at the protocol level. Large trades require additional verification, and suspicious patterns trigger automated reviews. Privacy doesn't mean lawlessness—it means giving users control over their financial data.

The Future of Private DeFi

VEIL is just the beginning. Zero-knowledge proofs are becoming more efficient, and new constructions like STARKs and Bulletproofs offer different tradeoffs. We're exploring how to extend our privacy guarantees to other DeFi primitives—lending, derivatives, even DAOs. The goal is a financial system where privacy is the default, not an afterthought.

If you're interested in the technical details, check out our GitHub repo. We've open-sourced our circuit designs and proof generation code. We believe privacy infrastructure should be public goods, and we want the whole ecosystem to benefit from our work.