[AH6] - 0xFable 🏅

A fully on-chain trading card game, using zero-knowledge proofs to enable private game elements. This has never been done before!

Challenges

#BUIDLathon 2023 NFTs + Metaverse + Gaming Track

Pool 15,000 USDC

Yes, it's a game.

Deploy your smart contract on Scroll

Pool 10,000 USDC

Not done yet, but will do!

Connect the world with Chainlink

Pool 10,000 ETH

Yes, we use it for on-chain randomness.

Applied ZK, with a side of Scroll

Pool 3,000 USDC

We use zk-proofs to prove the private state of our game, including proving we drew the correct card according to on-chain randomness, and that we correctly updated the merkle roots representing the player's hands and deck contents.

Build on Base 🔵

Ranked 15,000 USDC

Not done yet, but will do!

Project details

No video added

0xFable is a trading card game in the style of Magic the Gathering, where players summon creatures to battle each other in a fight for survival.

The game logic lives entirely on-chain. This enables developers to fork the contracts and implement new game modes using the cards.
Developers can also create their very own card collections.

Because blockchains are transparent by default, we need to use zero-knowledge proofs to enable the private elements of the game. In particular, we need to hide the cards in the player deck's and hands, as well as ensure that cards are drawn randomly from the deck.

To do this, we implemented three ZK circuits:

  • proof of draw: proves that the correct card was drawn using on-chain randomness, and that the merkle roots commiting to a player's hand and remaining deck content are updated correctly

  • proof of play: proves that the player played a card that was indeed in his hand

  • proof of setup: proves that the player drew an initial hand of card according to on-chain randomness (basically an iterated proof of draw)

Our frontend allows players to create, join and play games. The art for the cards was AI-generated using MidJourney.

Video: https://www.loom.com/share/c5b6e1033a184ff681c727d811bfead3