rootchips / multichain
PHP 库,用于与 Multichain JsonRPC 接口交互
v1.0.1
2018-09-27 20:48 UTC
Requires
- php: >=5.4
- fguillot/json-rpc: ~v1.2.3
Requires (Dev)
- phpunit/phpunit: @stable
This package is auto-updated.
Last update: 2024-09-08 22:40:32 UTC
README
安装
推荐通过 Composer 安装此库。运行 Composer 命令以安装最新稳定版本
composer require rootchips/multichain
要求
>= PHP 5.4 Multichain 2.0
设置
<?php use Chips\Multichain\Client; $blockchain = new Client( sprintf( 'https://%s:%s', '127.0.0.1', '4258' // Blockchain host and port ), 'multichainrpc', // Blockchain username 'das858929had88yhfbw37ryw8yh3heyuhebhj', // Blockchain password 3 );
用法:发布数据到流
$blockchain->publish('stream1', 'key', 'data');
结果
{
"result": "a92f7e9520df83999fca41f44f0e0434e9b802a54d2737b5ae548decbb49e321",
"error": null,
"id": 1
}
用法:通过传递事务 ID 检索数据
$blockchain->gettxoutdata('a92f7e9520df83999fca41f44f0e0434e9b802a54d2737b5ae548decbb49e321', 0, 1024);
结果
{
"result": "1234",
"error": null,
"id": 1
}