A Cardano smart contract implementation of the traditional Fan-Tan gambling game.
This smart contract enables playing Fan-Tan on the Cardano blockchain, with the following features:
- Secure random number generation through dealer input
- Automated bet handling and payout distribution
- Configurable parameters for minimum bets and timeouts
- Full on-chain validation of game rules
- GHC 8.10.7 or later
- Cabal 3.6.2.0 or later
- Cardano Node 1.35.4 or later
- Cardano CLI 1.35.4 or later
- Plutus Application Framework
- Clone the repository:
git clone https://github.com/yourusername/fan-tan-contract.git
cd fan-tan-contract
- Build the project:
cabal update
cabal build
- Install development dependencies:
cabal install --only-dependencies --enable-tests
- Run the test suite:
cabal test
-
Configure your network parameters in
deployment/config.json
-
Run the deployment script:
cd deployment
./deploy.sh testnet "<dealer-public-key-hash>" 5000000 86400000 fan-tan
- Verify the deployment:
cardano-cli query utxo --address $(cat fan-tan.addr) --testnet-magic 1097911063
fpDealerPKH
: Public key hash of the authorized dealerfpMinBet
: Minimum bet amount in Lovelace (1 ADA = 1,000,000 Lovelace)fpTimeout
: Time limit for betting phase in milliseconds
- The contract includes timeouts to prevent dealer manipulation
- All bets are locked in the contract until game completion
- Automated refund mechanism for expired games
- Full validation of all game actions on-chain
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Distributed under the Apache License 2.0. See LICENSE
for more information.
Your Name - @yourusername Project Link: https://github.com/yourusername/fan-tan-contract