function mint(uint256 nonce, bytes32 challenge_digest) public returns (bool success) {


            
            bytes32 digest =  keccak256(challengeNumber, msg.sender, nonce );

            
            if (digest != challenge_digest) revert();

            
            if(uint256(digest) > miningTarget) revert();


            
             bytes32 solution = solutionForChallenge[challengeNumber];
             solutionForChallenge[challengeNumber] = digest;
             if(solution != 0x0) revert();  


            uint reward_amount = getMiningReward(digest);

            balances[msg.sender] = balances[msg.sender].add(reward_amount);

            _totalSupply = _totalSupply.add(reward_amount);

            
            lastRewardTo = msg.sender;
            lastRewardAmount = reward_amount;
            lastRewardEthBlockNumber = block.number;

             _startNewMiningEpoch();

              emit Mint(msg.sender, reward_amount, epochCount, challengeNumber );

           return true;

        }