Пример #1
0
 /**
  * @param PrivateKeyInterface $key
  * @param ScriptInterface $scriptCode
  * @param int $sigVersion
  * @return TransactionSignature
  */
 public function calculateSignature(PrivateKeyInterface $key, ScriptInterface $scriptCode, $sigVersion)
 {
     if ($sigVersion == 1) {
         $hasher = new V1Hasher($this->tx, $this->txOut->getValue());
     } else {
         $hasher = new Hasher($this->tx);
     }
     $hash = $hasher->calculate($scriptCode, $this->nInput, $this->sigHashType);
     return new TransactionSignature($this->ecAdapter, $this->ecAdapter->sign($hash, $key, new Rfc6979($this->ecAdapter, $key, $hash, 'sha256')), $this->sigHashType);
 }
Пример #2
0
 /**
  * @param PrivateKeyInterface $privKey
  * @param Buffer $hash
  * @param $sigHashType
  * @return TransactionSignature
  */
 public function makeSignature(PrivateKeyInterface $privKey, Buffer $hash, $sigHashType)
 {
     return new TransactionSignature($this->ecAdapter, $this->ecAdapter->sign($hash, $privKey, $this->deterministicSignatures ? new Rfc6979($this->ecAdapter, $privKey, $hash, 'sha256') : new Random()), $sigHashType);
 }