A decentralized lottery game built on the OYL protocol.
Hashcash is a lottery-style game where users can stake an alkane (token) for a chance to win a portion of the pot. The game is designed to be fair, transparent, and self-sustaining through a unique liquidity provisioning mechanism.
- Blocklotto Alkanes: For each type of alkane that can be used in the game, a dedicated
blocklottoalkane is created. These are instantiated from ablocklotto-factory. - Entering the Lottery: A user sends a transaction with a specific quantity of an input alkane to the corresponding
blocklottoalkane. - Winning and Losing: The winner is determined by the last bit of the block hash.
- Winners receive a
conditional-tokenrepresenting their share of the winnings for that block. - Losers receive a "sad face emoji" token, also a
conditional-token, which has no value.
- Winners receive a
- Claiming Winnings: The winning token for a block can be redeemed in a subsequent block. The payout is proportional to the winner's stake in the total pot for that block. A winner is guaranteed to receive at least their initial stake back.
- Protocol Fee & Liquidity: If there are losing players in a block, 15% of the pot is used to create a liquidity pool (LP) on the OYL AMM for the
<input-alkane>/HASHCASHpair. The resulting LP tokens are sent to the mainhashcashalkane, controlled by the protocol's deployer. This mechanism helps to build liquidity for theHASHCASHprotocol token.
blocklotto: The main game contract for a specific input alkane.blocklotto-factory: A factory for creating newblocklottoalkanes.conditional-token: Used to represent both winning and losing outcomes.hashcash: The protocol's main alkane, which accrues LP tokens.
This project is built using the Metaprotocol and Rust. The test suite is designed to be similar to the one in the oyl-protocol.
- Clone the repository.
- Install the necessary dependencies.
- Run the tests:
cargo test