All Projects → msusur → krypto-lottery

msusur / krypto-lottery

Licence: other
A lottery game implementation on Ethereum blockchain using Solidity

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to krypto-lottery

README.1ST
The starting point of Laclede’s LAN on GitHub.
Stars: ✭ 48 (+9.09%)
Mutual labels:  charity
donate-button
A free donate and p2p fundraising button so nonprofit websites can accept cryptocurrency, stocks, and cash - credit, debit, bank, PayPal, Venmo, Apple Pay, Google Pay.
Stars: ✭ 24 (-45.45%)
Mutual labels:  charity
advanced-solidity-lottery-application
This is an advanced lottery example smart contract on solidity Ethereum. It has CRUD examples required to create an application on solidity Ethereum.
Stars: ✭ 49 (+11.36%)
Mutual labels:  lottery
helpafamily
Impactful ways to help families in need through donated meals, hygiene kits, and more. By Margarita Humanitarian Foundation.
Stars: ✭ 41 (-6.82%)
Mutual labels:  charity
lottery2
大转盘抽奖 canvas版[请手机上预览哦]
Stars: ✭ 34 (-22.73%)
Mutual labels:  lottery
purpose
Purpose and DUBI, ethereum tokens aiming to make the world a better place
Stars: ✭ 35 (-20.45%)
Mutual labels:  charity
foot
foot是一个集足球数据采集器,简单分析的项目.AI足球球探为程序全自动处理,全程无人为参与干预足球分析足球预测程序.程序根据各大指数多维度数据,结合作者多年足球分析经验,精雕细琢,集天地之灵气,汲日月之精华,历时七七四十九天,经Bug九九八十一个,编码而成.有兴趣的朋友,可以关注一下公众号AI球探(微信号ai00268).
Stars: ✭ 96 (+118.18%)
Mutual labels:  lottery
hydracodegenerator
Generate Hydra code randomly. Livecode it
Stars: ✭ 22 (-50%)
Mutual labels:  randomness
Random-Number-Generator
A clean, simple random number generator for Android. Downloaded 180,000+ times and rated 2,000+ times on Google Play with 4.7+ average rating.
Stars: ✭ 30 (-31.82%)
Mutual labels:  lottery
sanabil
A platform to organize the work of charity in Algiers City
Stars: ✭ 16 (-63.64%)
Mutual labels:  charity
dubiex
A fully decentralized, no fees, ethereum exchange for tokens, unofficial website
Stars: ✭ 23 (-47.73%)
Mutual labels:  charity
awesome-charity-ideas
A collection of ideas to raise money for charities.
Stars: ✭ 34 (-22.73%)
Mutual labels:  charity
taiwanlottery
🇹🇼台灣樂透爬蟲🐛(台灣各類型樂透爬蟲)😄
Stars: ✭ 18 (-59.09%)
Mutual labels:  lottery
coverd
Coverd Donation Bank Management App
Stars: ✭ 14 (-68.18%)
Mutual labels:  charity
almost-components uniapp
uni-app 使用的多端组件集合,支持APP、H5、小程序
Stars: ✭ 37 (-15.91%)
Mutual labels:  lottery
pancakeswap-lottery
🥞 A Python client for accessing PancakeSwap Lottery smart contract information through Web3.py
Stars: ✭ 30 (-31.82%)
Mutual labels:  lottery
charity-base-api
CharityBase GraphQL API
Stars: ✭ 24 (-45.45%)
Mutual labels:  charity
react-native-super-lottery
react native prize wheel 9宫格抽奖
Stars: ✭ 38 (-13.64%)
Mutual labels:  lottery
ethereum-lottery
Ethereum smart contract lottery: 5 people send 0.2 ether, contract sends 0.8 ethers to one of the senders at random and 0.2 ethers to givedirectly
Stars: ✭ 22 (-50%)
Mutual labels:  lottery
lottery
🍀 Lottery CLI BRAZIL
Stars: ✭ 29 (-34.09%)
Mutual labels:  lottery

Krypto-Lottery

A basic lottery game implementation on Ethereum blockchain. Lotteries are heavily regulated by the governments, and aim of this project is to show people how easily you can build a lottery system on blockchain without trusting anyone and without spending millions of dollars for building a secure system.

How does it work?

You need to deploy the KriptoLottery contract to an Ethereum network then you'll have the following features;

  • Anyone can send send money to participate to the lottery as many times as they want.
  • Default amount is 0.02 ether unless you state otherwise in the contract constructor.
  • Owner can set a ratio to send some or all of the money to a charity account.
  • Owner can set a ratio to send some or all of the money to an affiliate account.
  • Owner can call runLottery function to select a random winner and transfer the balance to charity, affiliate and to the winner. (See Only owner can run the lottery section for more details)

What's missing?

Randomness

Definition from wikipedia

Randomness is the lack of pattern or predictability in events. A random sequence of events, symbols or steps has no order and does not follow an intelligible pattern or combination.

From Ethereum yellow paper

Providing random numbers within a deterministic system is, naturally, an impossible task. However, we can approximate with pseudo-random numbers by utilizing data which is generally unknowable at the time of transacting. Such data might include the block’s hash, the block’s timestamp, and the block’s beneficiary address. In order to make it hard for a malicious miner to control those values, one should use the BLOCKHASH operation in order to use hashes of the previous 256 blocks as pseudo-random numbers. For a series of such numbers, a trivial solution would be to add some constant amount and hashing the result.

With the descriptions in mind I've used the solution described by rolandkofler.

Another solution to the randomness could be using an off the chain random generator with an oracle.

User interface

Contract accepts payments and adds everyone to the list of participants. There is no user interface needed.

Only owner can run the lottery

As the title states, only owner can run the lottery whereas in a real trustless system anyone should be able to run the lottery. Even though this is very easy to implement, it's not that easy to unit test. Unfortunately, I am leaving this feature out until the tests are ready.

Building the application

Project is using truffle to compile and deploy the contracts therefore you need to have Nodejs installed.

Run npm install to install the dependencies then you can run npm test to run the unit tests.

Installing the application to an Ethereum network

Truffle commands helps you to install the contracts to a network. In this project it's slightly different but more useful. You can either use npm run migrate or alternatively if truffle is installed globally you can truffle migrate directly with the following arguments. These configurations can be updated by modifying the ./truffle-config.js

--network: name of the network you want to deploy to. You can use rinkeby or mainnet depends on which one you would like to deploy the contract.

--accessToken: Deployment is using infura to deploy the contract. In order to deploy the contract you need to create an account, obtain the access token, and pass as an argument.

--mnemonic: 12 word mnemonic for the deployment account. Your account must have enough ether to cover the gas cost.

npm run migrate -- --network <<network>> --accessToken <<token>> --mnemonic <<12 word mnemonic>>

Contribute

I ❤️ to see people contributing to this project in any way they can! Also you can reach out to me from twitter @Mertsusur.

I need help;

  • for testing the contract.
  • for oraclize the randomness.
  • unit testing the trustless runLottery function.
  • adding extra features or maybe even better math calculations.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].