This Ethereum-based decentralized lottery smart contract allows participants to enter by depositing a specified amount of Ether. Once a sufficient number of participants have registered, the contract manager can initiate the lottery, randomly selecting a winner who will receive the entire Ether prize pool.
This smart contract project aims to provide a transparent and decentralized way to run lotteries. It ensures fairness by randomly selecting a winner from the pool of registered players and automatically sending the prize Ether to the winner.
-
Decentralized: The lottery is run on the Ethereum blockchain, eliminating the need for centralized intermediaries.
-
Fairness: The winner is selected randomly from registered players, ensuring fairness.
-
Transparency: All transactions and lottery results are publicly visible on the blockchain.
Before you begin, ensure you have met the following requirements:
- Node.js and npm installed (for running tests and scripts).
- An Ethereum wallet with test Ether for deploying the contract on the Sepolia test network.
- Ganache installed (for local development and testing).
-
Clone the repository:
git clone https://github.com/Cannon07/Smart-Lottery.git
-
Change into the project directory:
cd Solidity-Test-Project
-
Install project dependencies:
npm install
To deploy the contract on the Sepolia test network, follow these steps:
-
Update the deploy.js file with your wallet mnemonics and Sepolia network configuration.
-
Deploy the contract:
node deploy.js
To run the Mocha tests, use the following command:
npm run test
Contributions are welcome! If you find any issues or have improvements to suggest, please open an issue or create a pull request.