FortunEther
A decentralized application for sports betting on the ethereum blockchain. This project implements moneyline betting. Make sure you know what it actually is to better appreciate the project.
Demo
The live demo can be found here. Read the guidelines for the demo to work as expected
Features
- Add Bet
- The admin of the system can add new bets to the system
- The admin is responsible for setting the betting odds
- After a bet has been added, the status of the bet is considered as Open meaning the users can bet on it now
- Bet
- Now, the users can bet Ethereum on a team of their choice
- The amount they bet is recorded on the blockchain
- Also the Ether they bet is stored in the smart contract
- My Bets
- The users can see all their bets along with the amount they earned/lost
- Close a bet
- The toss in the game can affect the outcome of the game
- So, the admin closes the bet before the toss
- The bet status is now Closed
- Start Payout
- Once the game has finished the admin can select the winner and start payouts.
- The winners will be listed and ethers will be sent out to them depending upon the amount of their bet.
- The ether stored in the smart contract earlier is released and used in the payout process
- Redeem
- Once the payout has finished, there are chances that the smart contract still has ethers left over
- Using this, the admin can get the ether transferred to his address.
Guidelines to test the demo
- Import this private key
ed6d7422eb57924e8b6d071ae87f226638f28cee56447a16f5cdfc39325b687b
into your metamask account. Using this key you can test the admin only features.
A few humble requests:
- Don't steal the fake ethers in the account
- Use only 1 ether while testing because there aren't many
- Whitelist the url of the website in metamask (as shown in the dependencies)
Dependencies
- Node.js
- Truffle
npm install -g truffle
- Ganache
- Metamask
- Once the account is ready, you will be connected to the Main Ethereum network. To connect to the local blockchain that was setup by Ganache, Click Main Ethereum Network and then go to Custom RPC.
- Set Network Name: "anything you like"
Set New RPC URL: http://127.0.0.1:7545
- Whitelist the localhost address in the settings
Executing the code
- Initialising Blockchain Ledger
truffle migrate --reset
- Running the Decentralised App(Server)
npm run dev
Credits
Shoutout to goodvibration and Rob Hitchens for answering my questions on Stack Exchange