예제 #1
0
 /**
  * @param Buffer $bits
  * @return string
  */
 public function getDifficulty(Buffer $bits)
 {
     $target = $this->getTarget($bits);
     $lowest = $this->getMaxTarget();
     $lowest = $this->math->mul($lowest, $this->math->pow(10, self::DIFF_PRECISION));
     $difficulty = str_pad($this->math->div($lowest, $target), self::DIFF_PRECISION + 1, '0', STR_PAD_LEFT);
     $intPart = substr($difficulty, 0, 0 - self::DIFF_PRECISION);
     $decPart = substr($difficulty, 0 - self::DIFF_PRECISION, self::DIFF_PRECISION);
     return $intPart . '.' . $decPart;
 }
예제 #2
0
 /**
  * @return int|string
  */
 public function getMaxTxSigOps()
 {
     return $this->math->div($this->getMaxBlockSigOps(), 5);
 }