I'm following this tutorial, which seems like a great intro to solidity contracts, but I've got an issue where I don't see the same results as on the post.

When calling minimumBet from remix.solidity, the article claims it should return

    uint256: 1000000000000000

but for some reason I am getting

    "0": "uint256: 100000000000000000"

where my value has too many zeroes (2 to many).

Can anyone explainw hy this is happening?

Here is my copy of the contract:

pragma solidity ^0.4.11;

contract Casino {
    address owner;
    uint public minimumBet = 100 finney; // Equal to 0.1 ether
    uint public totalBet;
    uint public numberOfBets;
    uint public maxAmountOfBets = 100;
    address[] public players;

    struct Player {
        uint amountBet;
        uint numberSelected;

    // allows us to call playerInfo[here_goes_his_address].amountBet
    mapping(address => Player) playerInfo;

    function Casino(uint _minimumBet) public {
        owner = msg.sender;
        if(_minimumBet != 0) minimumBet = _minimumBet;

    // Fallback function in case someone sendes ether to the contract so it doesn't get lost
    function() payable public {}

    function kill() public {
        if(msg.sender == owner)

    function checkPlayerExists(address player) constant returns(bool) {
        for(uint i = 0; i < players.length; i++) {
            if(players[i] == player) return true;
        return false;

    // To bet for a number between 1 and 10 both inclusive
    function bet(uint number) public payable {
        assert(checkPlayerExists(msg.sender) == false);
        assert(number >= 1 && number <= 10);
        assert(msg.value >= minimumBet);

        playerInfo[msg.sender].amountBet = msg.value;
        playerInfo[msg.sender].numberSelected = number;
        numberOfBets += 1;
        totalBet += msg.value;

        if(numberOfBets >= maxAmountOfBets) generateNumberWinner();

    // Generates a number between 1 and 10
    function generateNumberWinner() public {
        uint numberGenerated = block.number % 10 + 1; // This isn't secure

    // Sends the corresponding ether to each winner depending on the total bets
    function distributePrizes(uint numberWinner) public {
        address[100] memory winners; // we have to create a temporary in memory array with fixed size
        uint count = 0; // This is the count for the array winners

        for (uint i = 0; i < players.length; i++) {
            address playerAddress = players[i];
            if(playerInfo[playerAddress].numberSelected == numberWinner) {
                winners[count] = playerAddress;
            delete playerInfo[playerAddress]; // Delete all the players

        players.length = 0; // Delete all the players array

        uint winnerEtherAmount = totalBet / winners.length; // How much each winner gets

        for(uint j = 0; j < count; j++) {
            // Check that the address in this fixed array is not empty
            if(winners[j] != address(0)) winners[j].transfer(winnerEtherAmount);

Note as per the tutorial I am doing this with metamask on the test network. Thanks in advance!

What I tried already

  • killing the contract and recreating
  • hard refresh (ctrl + f5), which seems to solve a few other issues

This appears to just be a typo. The screenshot above that text shows the same number of zeroes that you're getting. Try contacting the author of the post to get clarification.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.