Skip to content

reliqlabs/juodzekas

Repository files navigation

Juodžekas - Trustless Blackjack on Xion

Juodžekas [ˈjuːoˑd͡ʒɛkɐs] is a decentralized, trustless Blackjack game. It uses zkShuffle (Mental Poker) and optional smart contracts to ensure fair play and verifiable card dealing.

Project Structure

This is a Rust workspace consisting of multiple components:

  • contracts/juodzekas: CosmWasm smart contract (deployed to Xion testnet-2)
  • clients/tui: A terminal-based user interface for playing the game
  • clients/dealer: A simple daemon for automatically dealing cards against a smart contract
  • packages/zk-shuffle: ZK-based card shuffling using Mental Poker
  • packages/blackjack: Shared blackjack game logic and rules

Prerequisites

  • Rust (1.89.0 or later)
  • Cargo
  • C++ toolchain and GMP library (for rapidsnark native library):
    • Linux:
      # Ubuntu/Debian
      sudo apt install build-essential cmake libgmp-dev
      
      # Fedora/RHEL
      sudo dnf install gcc gcc-c++ cmake gmp-devel
    • macOS:
      xcode-select --install
      brew install gmp
    • Windows: Visual Studio Build Tools with C++ support

Getting Started

Clone with Submodules

This project uses git submodules for external dependencies (circomlib). Clone with:

git clone --recursive <repository-url>

Or if already cloned:

git submodule update --init --recursive

See SUBMODULES.md for more details.

Smart Contract

To compile and test the smart contract:

# Compile the contract
cargo build -p juodzekas

# Run contract tests
cargo test -p juodzekas

TUI Client

The TUI client is a terminal application built with ratatui.

To run the TUI client:

cargo run -p juodzekas-tui

Quick Start

  1. Choose game mode: [F]ast, [T]rustless, or [C]ontract (on-chain)
  2. Select number of spots (1-8 hands to play simultaneously)
  3. Use arrow keys or letter keys to play

For contract mode, build with --features wallet and see clients/tui/README.md for wallet setup.

For detailed controls and features, see clients/tui/README.md.

Development

  • Formatting: cargo fmt
  • Linting: cargo clippy

ZK Circuits

The project includes the ZK circuits required for trustless card games, located in the circuits/ directory. These circuits are based on the zkShuffle protocol and implement Mental Poker techniques using BabyJubJub and ElGamal.

See circuits/README.md for more details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors