This is a simple lottery system on a blockchain. Users can enter the lottery by purchasing lottery tickets with a certain fee. They have the option to purchase multiple tickets.
- Users can enter the lottery by paying the required fee.
- The owner of the lottery contract is responsible for starting and ending the lottery.
- Once the lottery is over, a random user will be selected as the winner.
Please install or have installed the following:
- Install Brownie, if you haven't already. Here is a simple way to install brownie.
Install brownie via pipx
pip install --user pipx
pipx ensurepath
# restart your terminal
pipx install eth-brownie
You will have to inject customtkinter to use the GUI.
pipx inject eth-brownie customtkinter
Set your environment variables
Set your INFURA_PROJECT_ID
, and PRIVATE_KEY
environment variables.
You can get a INFURA_PROJECT_ID
by getting a free trial of Infura. At the moment, it does need to be infura with brownie. You can find your PRIVATE_KEY
from your ethereum wallet like metamask.
You'll also need testnet Sepolia ETH and LINK. You can get LINK and ETH into your wallet by using the Sepolia faucets located here.
To compile the contract, run
brownie compile
If you want to run the deployment script on a specific network, you can specify the network name with the --network flag. For example, if you wanted to deploy to the Sepolia test network, you would use the command
brownie run scripts/deploy --network Sepolia.
Remember to replace Sepolia with the name of the network you want to use(ensure it is added to the networks list in brownie). This deploys our Smart Contract to the Sepolia network. We Will access this contract(or the latest deployed contract) in our GUI.
After the contract is deployed, the GUI can be access by
brownie run scripts/deploy --network Sepolia
LotteryProject is the active project.
Running 'scripts\deploy.py::main'...
Would you like to use the GUI?(Y/N): # Enter Y to use the GUI