Code Monkey home page Code Monkey logo

ethereum-games's People

Contributors

k26dr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ethereum-games's Issues

Powerball(Lotteries.sol) Vulnerability?

Couldn't find an email to report this to, but what happens in this scenario:

var numbers = [[1,1,1,1,1,1]];
lottery.buy(numbers, { from: accounts[0], value: 2e15 });

AFAICT the code doesn't check if numbers provided are unique, so it's much easier to guess the numbers, and jackpot chances are ~1 in 69 or even better :)

Powerball drain all account balance

This issue only happens if there are periods when the powerball contract is not actively used, and if any period like that exists, then I could draw all the account balance(jackpot) from the contract at any later time. Let's says someone deploys the contract, and then initially very few people use it. I as an attacker would submit the same same lottery tickets for every round with number(a1, a2, a3, a4, a5, a6) where those numbers were derived from a blockhash of 0. As the assumption is that very few people use it initially, I would end up with a round where noone called the drawNumber() method.

Few years passed, and the current jackpot is 1.000.000USD, then I call the drawNumber(at this time the blockhash will be 0, so I am getting the winning numbers). I just drew the entire balance of the contract, and all I had to do is buy some ticket at a period that very few people used it. :)

Little help

Hey man, very nice project!
I am learning solidity and trying to implement some knowledge in a personal project.
Your powerball code is amazing and it is kind like something I am trying to learn.
Can you tell me how it works?
I trying to test it using remix.
But when i choose the numbers i have this error
"transact to Powerball.buy errored: Error encoding arguments: Error: types/values length mismatch (count={"types":1,"values":4}, value={"types":["uint256[6][]"],"values":["",",2,",",4,",",6"]}, code=INVALID_ARGUMENT, version=abi/5.1.2)"
And I don't know what to do :(
Thanks man

RNGLottery security issue

I think there is problem with that RNGLottery contract. If I am an attacker, I can have 3 addresses and buy 3 different lottery tickets. During the reveal phase I can influence the 'seed' calculation by choosing which one of my 3 commitments I want to reveal (and hence influence make myself the winner). Maybe I chose not to reveal 1 of my commitments, so one of my 2 other tickets can win.

If I buy n lottery tickets and I also observer the node's transaction pool (in order to decide which of the n commitments to reveal), then I will have 2n-1 ways to manipulate the final seed value and still have at least 1 valid lottery ticket. That is a much higher chance than someone buying n tickets and not trying to manipulate the seed value.

To carry out this attack I would either have to:

  1. be able to send my carefully selected commitments at the last block of the reveal phase and also be able to predict which other reveals from other players will be included in the last block or
  2. mine the block myself and decide which reveal transactions go into the block

Although attack number 2 is hard to carry out, number 1 seems easy enough. Most mining clients order transactions in the block deterministically, so as long as I can predict which other reveal transactions from other players end up in the last block of the reveal phase, I would be able to manipulate the seed value.

CasinoRoulette issues

I think there are 2 smaller problems with this contract:

  1. it seems you allow 38 different numbers, but a roulette only has 37 numbers:

    require(choice >= -1 && choice <= 36);

  2. you don't have any checks on the type of the bet here:

however you do check the type here:

else if (bet.betType == BetType.Number) {

this can cause bets accidentally submitted invalid BetTypes like 3 or 4 to be permanently stuck

Anyway, it was a great book overal, thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.