tracyspcy@lemmy.mlM to cryptocurrency@lemmy.ml · 1 year agoChallenge: Can you identify what is wrong with this simple Solidity guessing game contract that makes it easy to cheat?lemmy.mlimagemessage-square3fedilinkarrow-up15arrow-down10
arrow-up15arrow-down1imageChallenge: Can you identify what is wrong with this simple Solidity guessing game contract that makes it easy to cheat?lemmy.mltracyspcy@lemmy.mlM to cryptocurrency@lemmy.ml · 1 year agomessage-square3fedilink
minus-squareLixen@lemmy.worldlinkfedilinkarrow-up1·1 year agoFor those that want to have an actual go at it: when deploying it with hardhat for example, you can pass in Math.floor(Math.random()*1000) as the constructor argument and then see if you can derive the number on the first guess.
minus-squaretracyspcy@lemmy.mlOPMlinkfedilinkarrow-up1·1 year agoThe formula will return a specific result of uint256 type which will be used in constructor on deployment, right? 😉
For those that want to have an actual go at it: when deploying it with hardhat for example, you can pass in
Math.floor(Math.random()*1000)
as the constructor argument and then see if you can derive the number on the first guess.The formula will return a specific result of uint256 type which will be used in constructor on deployment, right? 😉