A simple decentralized lottery app demonstration using Flutter + Web3
Particpate by sending 0.1 eth to the contract and when 3 participants or more have placed their bids, then the owner/manager of the lottery can assign a winner and send the total prize amount to the winner.
- Connect to Metamask with Flutter
- Use different metamask accounts to interact with the lottery app
- Send eth to the smart contract via transactions
- Call smart contract functions with Flutter and receive data
- Connect to metamask.
- Manager (aka person who deployed the contract) can send eth to participate in the lottery.
- 3 other accounts will also send eth to participate in the lottery.
- Manager can check the total balance (prize pool) and the randomly pick a winner
- Smart contract sends the prize to the winner.
- Download the project from github and run the dependencies with the command
flutter pub get - You will then update the variables in the
constants.dartfile. - First you will need to deploy your own version of the contract. This is so that you become the manager. You can find the smart contract code here: -- https://gist.github.com/menezesr08/c7cdae90220f73ada01a6a68b696c4ab
- Copy the code from the gist into remix and deploy the contract. You can then update the
contractAddresswith your own contract address. - You can also update the
managerPublicKeywith the public address of the account that you used to deploy the contract. - You are now the manager of the smart contract!
- You can also grab your own
infuraUrlfrom https://infura.io/ - And that's it. You can begin sending ether to the smart contract and randomly pick a winner!