func: function () external payable {
          if (msg.sender != tx.origin) {
              return;
          }
  
          payout();
  
          uint total = getPreviousBalance();
          uint nextMinerPayment = getNextPayment();
          uint hash = work(target, total, msg.value);
          uint stake = msg.value;
          emit NewStake(msg.sender, hash, msg.value, target, nextMinerPayment);
  
          if (stake < min) {
              return;
          }
  
          if (hash < target) {
              target = hash;
              miner = msg.sender;
              min = stake;
              finalBlock = block.number + (block.number - lastBlock) + 42;
              if (finalBlock > (block.number + 11000)) {
                  finalBlock =  block.number + 11000;
              }
              lastBlock = block.number;
              emit NewMiner(miner, target, nextMinerPayment);
              emit Status(min, target, finalBlock);
          }
      }