vaneeves/bitcoin-php

此包最新版本(0.0.1)没有可用的许可证信息。

比特币交易列表库

0.0.1 2018-02-28 03:21 UTC

This package is auto-updated.

Last update: 2024-09-19 10:02:06 UTC


README

安装

通过 Composer

composer require vaneves/bitcoin-php

使用

创建地址

创建一个新的地址。

use Vaneves\Bitcoin\Network;
use Vaneves\Bitcoin\Bitcoin;
use Vaneves\Bitcoin\BitcoinException;

try {
    $network = new Network('http://username:password@127.0.0.1:18332');
    $bitcoin = new Bitcoin($network);
    $address = $bitcoin->account('vaneves')->newAddress();

    echo $address; 

} catch (BitcoinException $e) {
    echo $e->getMessage();
} catch (\Exception $e) {
    echo $e->getMessage();
}

列出交易

列出接收和发送的所有交易。

use Vaneves\Bitcoin\Network;
use Vaneves\Bitcoin\Bitcoin;
use Vaneves\Bitcoin\BitcoinException;

try {
    $network = new Network('http://username:password@127.0.0.1:18332');
    $bitcoin = new Bitcoin($network);

    $offset = 0;
    $limit = 100;
    $transactions = $bitcoin->transaction()->paginate($offset, $limit);
    print_r($transactions);
} catch (BitcoinException $e) {
    echo $e->getMessage();
} catch (\Exception $e) {
    echo $e->getMessage();
}

许可证

MIT 许可证(MIT)

捐赠

比特币地址: 1H6ssXbPbLeDVQNf9PqaarTEeG9sjurEgm