Giter Site home page Giter Site logo

ethereum-contracts's People

Contributors

drlecks 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ethereum-contracts's Issues

Stack Lottery is not random or secure at all!

In the Stack Lottery contract the winner is chosen when numtickets == maxTickets. Both of these variables can easily be read so someone can just wait until numtickets == maxTickets - 1 to "buy" their ticket.

Even though the numtickets and maxTickets variables are private, you can still get their current values.

Let's look at your live version: http://lottery.powdercode.com/

At the time of writing this ticket maxTickets (the 0th variable in your contract) is:

web3.eth.getStorageAt('0x1e217ADC6a6ADC16E248af109Ab7EFA4d1bb252D', 0, function() { console.log(arguments[1]); })
> 0x0000000000000000000000000000000000000000000000000000000000000011

So 17.

And numtickets (the 5th variable in your contract) is:

web3.eth.getStorageAt('0x1e217ADC6a6ADC16E248af109Ab7EFA4d1bb252D', 5, function() { console.log(arguments[1]); })
> 0x0000000000000000000000000000000000000000000000000000000000000000

So 0.

So luckily nobody was stupid enough to play this game yet :)

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.