Skip to content

udit2303/Blockchain-Lottery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

How it Works

  1. Users can enter the lottery by paying the required fee.
  2. The owner of the lottery contract is responsible for starting and ending the lottery.
  3. Once the lottery is over, a random user will be selected as the winner.

Prerequisites

Please install or have installed the following:

Installation

  1. 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.

Compiling

To compile the contract, run

brownie compile

Deploying

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

GUI GUI2 GUI3

About

Lottery based on blockchain

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published