A simple lottery application built with react, brownie and solidity. admins start up lottery and users can enter the lottery and after admins end the lottery the system chooses the winner. this project is deployed to the sepolia blockchain. get sepolia faucets to interact with it.
- Smart Contract: The application ensures security and transparency by using smart contract for storing data and collecting contributions.
- Decentralized Lottery Entry: The Admin i.e the person that deployed the contract to the blockchain start up a lottery, funds the lottery and users can enter the lottery with eth.
- User Friendly Interface: The application is built with react and it provides an intuitive and responsive user interface for easy interaction.
- Python
- Node Js
- Brownie (python)
- Solidity
- npm/yarn
Note: the smart contract can be deployed with brownie if user has experience with brownie or it could be copied from the contracts/contract folder and sent to remix for deployment and then replace the content of the abi.json file in the frontend/src folder with the abi and contract in an json format and seen in the abi.json file. The main contrat to be deployed is the CrowndFundFactory.sol with the CrowdFund.sol as its dependency.
Note: you can skip to no. 12 if you want to perform the actions specified by the previous note.
- Choose a folder for the project
- Open cmd or bash in the project directory
- Create a virtual environment (make sure you have python installed and virtualenv installed as a pip package)
virtualenv env
- if you dont virtualenv installed, you can install it by running
pip install virtualenv
- Activate the virtualenv, run
env\Scripts\activate
- Clone the project
git clone https://github.com/codebestia/BestiaLottery.git
- Go to the project directory
cd CrowdFundUs
- Install dependencies for brownie
cd contract
pip install -r requirements.txt
-
Create a .env file and add the following environment variables to the file
PRIVATE_KEY
- your wallet account private key that will be used to deploy the project -
Add network (for deploying to a blockchain not in brownie networks list e.g lightlink-pegasus) (optional)
brownie networks add lightlink-pegasus host=https://replicator.pegasus.lightlink.io/rpc/v1 chainid=1891 explorer=https://pegasus.lightlink.io/
Note: run the command below to see all the brownie network list
brownie networks list
- Compile the smart contract with brownie
brownie compile
brownie run scripts/deploy --network lightlink-pegasus
Note: if you want to deploy to other networks replace lightlink-pegasus with the name of the network. run
brownie networks list
to see all available network
- Install the dependencies for react
cd frontend # navigate into the frontend in the CrowdFundUs folder
npm install # or yarn install
- Start the react server
npm run start
- Access the application at http://localhost:3000 in your web browser.
- Connect your Ethereum wallet to the application.
- Enter Lottery if the lottery is open
- Create Lottery (for admins)
- End and Fund Lottery for admins.
This project is licensed under the MIT License.