zkVerify blog

From Lag to Winnings: How We Solved ZK Proofs for a Better On-Chain Gaming Experience

an ad for zk verify shows people playing slot machines
a man in a suit and white shirt is smiling for the camera .
John Camardo

The last demo we discussed was a technical milestone but a user experience nightmare. I had built a provably fair blackjack game, but the video clearly showed a less-than-ideal user flow, especially around proof verification, zkVerify’s core competency. This verification is essential for starting a game; players need cryptographic certainty that the deck began perfectly ordered, was complete, and was then shuffled correctly.

The problem? Since we were using a blockchain for verification (zkVerify), the feedback wasn't instant. Several nodes had to process the proof before it was finalized. This took about 30 seconds—an eternity in a fast-paced game like blackjack and a non-starter for creating an engaging virtual experience. While I was proud of the technical achievement, my product management instincts were screaming: we needed a much better user experience.

A Pivot: The Slot Machine

Rather than sink more time into a demo that had already served its purpose, I decided to pivot. Every good product manager knows when it's time to iterate on a new idea. I wanted to remain focused on the world of on-chain gambling, a space where I have a great deal of domain knowledge and personal interest.

This time, I chose slot machines.

Despite their high negative expected value (EV) at casinos, I've always enjoyed playing them. When I travel to regions where online casino gambling is permitted (unlike my home base in New York, which is probably for the best), I find myself drawn to online slots. My sessions often follow a familiar pattern: I start with a few quick wins, get excited, increase my bets, and then lose it all back, plus half my bankroll.

This experience gave me a personal mission: I wanted to design a game where I could prove to myself that the outcomes were genuinely random and trustworthy, and that my losses weren't the result of a system designed to hook you with early wins.

Building a Provably Fair—Yet Still Unprofitable—Game

With a new goal in mind, I got to work. Building the new circuit in Circom was significantly easier than the complex card-shuffling circuit. With the help of Gemini to streamline the process, I quickly had another working demo.

But this time, I wanted to go a step further. I wanted to integrate a real on-chain economy and demonstrate to my team at Horizen Labs how developers could build games that actually generate profit. To keep things simple and fast, I chose Base to host the economy. Gemini walked me through deploying a basic ERC−20 token contract, which we named ZKST. Players could use testnet ETH on Base Sepolia to buy these tokens and power their gameplay.

Here’s how the demo works:

  1. Connect & Buy: You connect your Ethereum wallet and purchase ZKST tokens.
  2. Spin to Burn: To spin the reels, you "burn" a set amount of your ZKST tokens in a transaction.
  3. Generate the Proof: Once the transaction is confirmed, a cryptographic proof is generated. This proof allows our server (the "Prover") to prove to you (the "Verifier") that the slot machine's result came from a fair, predictable algorithm—all without revealing the server’s secret random seed. At the end of the day, a slot machine is just a fancy, attractive, and fun random number generator.

The Millisecond Breakthrough: Optimistic Verification

The true innovation here is in how we handle the spin verification. Instead of waiting on-chain, I tapped into another Horizen Labs tool: a blockchain API interface.

This API takes the proof and returns an "optimistic verification result." Think of it as a receipt—a near-instant guarantee that your proof is valid and will be finalized on the blockchain in a future block.

The best part? This happens in milliseconds.

This is a game-changer. By moving from a 30-second wait to an instant response, we can finally build the kind of fast-paced, seamless on-chain games that users expect. We get the ironclad security of blockchain without sacrificing the user experience.

Try It For Yourself

Experience the difference firsthand. Check out the live demo and let us know what you think!