As previously explained, smart contracts on the Ethereum blockchain make Ether a type of programmable money. But without testing and careful development, a lot of things can go horribly wrong. Hacker News user masterspy7 was recently a victim of his own carelessness as well when he launched CryptoButton.

CryptoButton works like this: if you have MetaMask installed (an Ethereum wallet for the browser), you can pay to execute a click on a button which resets a timer to 30 minutes. The person to last click the button gets all the funds sent into the button up until then (minus 20% which the author takes).

It looks like masterspy7 didn't test his code properly before launching:

    // The winner is responsible for withdrawing the funds
    // after the button expires
    function Win() public {
        require(msg.sender == winner);
        require(now > deadline);
        reward = 0;

The value of the reward is programmed to be 0 which means the last person gets exactly that much money – none – no matter how much Ether was sent in.

Other users have warned him of the error, but not before $246 total in Ether was sent to the bugged smart contract and lost forever. Luckily, the mistake was fixed before more people could participate.

The lesson? Always test your code before launching and have other people review it!

If you found this article useful or interesting, please consider donating to keep our operation running.


Please enter your comment!
Please enter your name here