Beispiel #1
0
 /**
  * @param int $minConfirms
  * @param int $maxConfirms
  * @param array $addresses
  * @param NetworkInterface $network
  * @return array
  */
 public function listunspent($minConfirms = 1, $maxConfirms = 9999999, array $addresses = [], NetworkInterface $network = null)
 {
     $amount = new Amount();
     $results = $this->client->execute('listunspent', [$minConfirms, $maxConfirms, array_map(function (AddressInterface $address) use($network) {
         return $address->getAddress($network);
     }, $addresses)]);
     return array_map(function (array $value) use($amount) {
         return new Utxo(new OutPoint(Buffer::hex($value['txid'], 32), $value['vout']), new TransactionOutput($amount->toSatoshis($value['amount']), new Script(Buffer::hex($value['scriptPubKey']))));
     }, $results);
 }
Beispiel #2
0
 /**
  * @param string $host
  * @param int $port
  * @param string $user
  * @param string $password
  * @param int $timeout
  * @param array $headers
  * @return Bitcoind
  */
 public static function bitcoind($host, $port, $user, $password, $timeout = 5, array $headers = array())
 {
     $jsonRPCclient = new JsonRpcClient($host, $port, $timeout, $headers);
     $jsonRPCclient->authentication($user, $password);
     return new Bitcoind($jsonRPCclient);
 }