{"id":18796413,"url":"https://github.com/ankitkataria/lottery-dapp","last_synced_at":"2025-04-13T15:42:50.282Z","repository":{"id":129233052,"uuid":"127680671","full_name":"ankitkataria/Lottery-DApp","owner":"ankitkataria","description":":moneybag: A block-chain based Lottery System ","archived":false,"fork":false,"pushed_at":"2019-01-29T15:19:23.000Z","size":322,"stargazers_count":40,"open_issues_count":1,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T06:44:52.670Z","etag":null,"topics":["blockchain","ethereum","truffle-framework"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ankitkataria.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-01T23:49:02.000Z","updated_at":"2025-03-07T16:09:55.000Z","dependencies_parsed_at":"2023-04-16T01:37:24.019Z","dependency_job_id":null,"html_url":"https://github.com/ankitkataria/Lottery-DApp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitkataria%2FLottery-DApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitkataria%2FLottery-DApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitkataria%2FLottery-DApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitkataria%2FLottery-DApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankitkataria","download_url":"https://codeload.github.com/ankitkataria/Lottery-DApp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248740221,"owners_count":21154248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","ethereum","truffle-framework"],"created_at":"2024-11-07T21:40:00.049Z","updated_at":"2025-04-13T15:42:50.276Z","avatar_url":"https://github.com/ankitkataria.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lottery DApp\n\n\u003e A block-chain based Lottery System made using [Truffle](truffleframework.com)\n\n### Features\n\n- The owner of the Lottery contract sets a SHA3 hash of the winning guess between 1 and 1'000'000\n\n- In order to participate a user sends required amount in ETH to the contract and gets 1 participation token per ETH in return\n\n- The users makes guess using the `makeGuess()` function of the contract, 1 token is deducted for each guess\n\n- The Lottery contract has a `closeGame()` function that the owner can invoke to stop any further guessing\n\n- The unused tokens are not reimbursed\n\n- A function `winnerAddress()` returns the address of the winner once the game is closed\n\n- Once the game is closed the winner can call `getPrice()` to collect 50% of the ETH in the contract\n\n- The `getPrice()` function sends the remaining 50% of ETH to the owner of the contract\n\n- The owner receives all the money that contract holds if there are no correct guesses\n\n### Setup\n\n- Clone repo: `git clone git@github.com:ankitkataria/Lottery-DApp.git`\n\n- Change directory to cloned copy and run: `npm install`\n\n- Install truffle: `npm install -g truffle`\n\n- Download [Ganache](http://localhost:9000/ganache/) AppImage\n\n- Run ganache AppImage\n\n![ganache](docs/ganache.png?raw=true \"Ganache Ethereum Blockchain\")\n\n- Set the winning guess in `migrations/2_add_lottery_contract.js`\n\n- Compile truffle contracts: `truffle compile`\n\n- Migrate truffle contract to blockchain: `truffle migrate`\n\n- Run server: `npm run dev`\n\n- Open `http://localhost:8080` in browser\n\n![dashboard1](docs/dashboard1.png?raw=true \"addToken and makeGuess\")\n\n![dashboard2](docs/dashboard2.png?raw=true \"closeGame and getPrice\")\n\n### Todo\n\n- [ ] Add current lottery state to local storage\n- [ ] Add functionality to reimburse tokens once game is closed\n\n### References\n\n- [Ethereum White Paper](https://github.com/ethereum/wiki/wiki/White-Paper)\n- [Truffle Docs](truffleframework.com/docs/)\n- [CrypotZombies](https://cryptozombies.io/) \n- [Bitcoin Paper](https://bitcoin.com/bitcoin.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankitkataria%2Flottery-dapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankitkataria%2Flottery-dapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankitkataria%2Flottery-dapp/lists"}