B

Bakachain

We built a fully-specced 6-deck Baccarat game on Astar zkEVM to show how we can leverage state-of-the-art rollup technology to create transparent, verifiable and unruggable games on the blockchain!

17
Built at ETHSeoul 2024
B

Bakachain

We built a fully-specced 6-deck Baccarat game on Astar zkEVM to show how we can leverage state-of-the-art rollup technology to create transparent, verifiable and unruggable games on the blockchain!

The problem Bakachain solves

The Baccarat contract is written in pure Solidity, and only costs ~110k gas to execute a round of Baccarat. That makes it insanely cheap for users to play (or for operators to sponsor). This is possible through our (mis)use of cryptographic algorithms that allows us to shuffle cards without touching storage slots. No need for fancy ZK here! ;)

The contract also keeps track of user wagers such that the operator cannot withdraw anything that isn't part of the operator's own balance or profits. Unruggable!

On our frontend, we create temporary session wallets that users deposit funds into. They only deposit the amount that they want to play with. Doing this allows us to programmatically submit bets without having to further prompt the user to sign transactions; thus giving users a really smooooooth experience, just like offchain apps.

Challenges we ran into

  1. It took several hours to bridge eth from sepolia to zkatana
  2. somehow one of our function reverts zkatana, but it doesnt on Sepolia
  3. Couldnt use VRF because we weren't whitelisted, build our own randomisation contract

Tracks Applied (2)

Astar zkEVM

Utilise low gas fees for the game Fast finality and transaction speed for smooth game play

Astar Foundation

Special Prizes & Potential Treasury Funding

Smooth UX through usage of custom written Session Keys! Fully functional game for end users

Astar Foundation

Cheer Project

Cheering for a project means supporting a project you like with as little as 0.0025 ETH. Right now, you can Cheer using ETH on Arbitrum, Optimism and Base.

Discussion