ICP Jackpot is a decentralized lottery on the ICP blockchain, offering transparency, security, and fairness. Users buy tickets, and winners are randomly selected through secure methods, ensuring trust.✨
Decentralized Lottery System This project is a decentralized lottery system built on the Internet Computer (IC), designed to handle ticket purchases, lottery draws, prize distribution, and resets. It ensures transparency, security, and fairness while utilizing the blockchain’s immutable properties.
Lottery Lifecycle: The lottery starts with an open state, allowing participants to purchase tickets. Once the specified duration ends, the lottery enters a closed state, and a winner is selected randomly from the pool of ticket holders. After a winner is selected, the prize can be claimed within a predefined deadline. Once the prize is claimed, the lottery is reset, and a new round begins.
Ticket Purchases: Participants can buy tickets during the open period. Each ticket purchase is securely associated with a unique encrypted ticket ID to ensure participant anonymity. There is a fixed price for each ticket, and participants can buy a limited number of tickets per lottery round.
Prize Pool: Every time a ticket is purchased, the prize pool is incremented by the ticket price, ensuring that the prize increases with each new ticket sale.
Winner Selection: After the lottery closes, a random winner is selected based on the tickets sold. The winner receives the entire prize pool in ICP tokens.
Prize Claiming: The winner has a specified period to claim their prize. If the prize is not claimed within the given timeframe, the pool remains unclaimed, and the lottery cannot be reset until the prize is distributed.
Lottery Reset: Once a prize has been claimed, the contract owner can reset the lottery for a new round, reinitializing the necessary parameters like the ticket pool, prize pool, and time frames.
Owner Control: The contract owner has exclusive control over certain actions, such as resetting the lottery, ensuring that only authorized users can make administrative changes.
Technologies: Calimero SDK: For building the application logic on the Internet Computer. Borsh Serialization: For efficient state management. SHA-256: For generating unique ticket IDs. ICRC-1 Token Standard: For interacting with ICP tokens. UnorderedMap: To store the tickets and their associated participants.
Example Events: LotteryOpened: Emitted when the lottery starts, signaling participants to purchase tickets. TicketPurchased: Emitted when a participant buys a ticket. LotteryClosed: Emitted when the lottery closes and no more tickets can be bought. WinnerSelected: Emitted when the winner is chosen randomly. PrizeClaimed: Emitted when the winner claims the prize. LotteryReset: Emitted when the lottery is reset for a new round.
Security & Fairness: The system uses cryptographic techniques to ensure fairness in ticket generation and winner selection. All ticket purchases and the winner selection process are recorded on the blockchain, ensuring transparency and immutability. This project enables users to participate in a decentralized and transparent lottery, using blockchain technology to ensure fairness, security, and accountability.
Decentralized Lottery System on the Internet Computer offers a transparent, secure, and fair environment for participants. By leveraging blockchain technology, it ensures the integrity of ticket purchases, random winner selection, and prize distribution, while allowing full transparency and immutability. This system provides a decentralized alternative to traditional lotteries, eliminating fraud and enhancing user trust.