示例#1
0
 /**
  * @param EcAdapterInterface $ecAdapter
  * @param KeyInterface $masterKey
  */
 public function __construct(EcAdapterInterface $ecAdapter, KeyInterface $masterKey)
 {
     if ($masterKey->isCompressed()) {
         throw new \RuntimeException('Electrum keys are not compressed');
     }
     $this->ecAdapter = $ecAdapter;
     if ($masterKey instanceof PrivateKeyInterface) {
         $this->masterKey = $masterKey;
         $masterKey = $this->masterKey->getPublicKey();
     }
     $this->publicKey = $masterKey;
 }
示例#2
0
 /**
  * Returns a pay-to-pubkey-hash address for the given public key
  *
  * @param KeyInterface $key
  * @return PayToPubKeyHashAddress
  */
 public static function fromKey(KeyInterface $key)
 {
     return new PayToPubKeyHashAddress($key->getPubKeyHash());
 }
示例#3
0
 /**
  * Return whether this is a private key
  *
  * @return bool
  */
 public function isPrivate()
 {
     return $this->key->isPrivate();
 }