function mine(uint256 nonce, bytes32 challenge_digest) public returns (bool success) {
        require(!locked) ; 
        require(tokenContract.balanceOf(address(this)) > blockReward) ;
        
        bytes32 digest =  keccak256(challenge, msg.sender, nonce); 
        
        if (digest != challenge_digest) {
            revert() ; 
        }
        
        if (uint256(challenge_digest) > target) {
            revert() ; 
        }
        

        bytes32 solution = solutionForChallenge[challenge];
        solutionForChallenge[challenge] = digest;
        if(solution != 0x0) {
            revert();
        }
        
        minedTokensAmount = minedTokensAmount.add(blockReward) ; 
        
        lastRewardedMiner = msg.sender ; 
        lastRewardAmount = blockReward ; 
        lastRewardETHBlock = block.number ; 
        
        emit newBlock(msg.sender, blockReward) ; 
        
        tokenContract.transfer(msg.sender, blockReward * 10 ** tokenContract.decimals()) ; 
        
        newBlockChallenge() ; 
        
        return true ; 
    }