xboston/metahash

此包已被废弃且不再维护。未建议替换包。

MetaHash 比特币 PHP SDK

v0.5 2022-02-01 16:25 UTC

README

一个非官方的#MetaHash 区块链 PHP 库。

需求

  • PHP 8.0.2+
  • ext-gmp
  • ext-curl
  • composer

安装

您可以使用 Composer 安装此包。您只需要求 xboston/metahash。

composer require xboston/metahash

信息

方法

  • fetch-balance
  • fetch-balances
  • fetch-history
  • get-address-delegations
  • get-tx
  • get-block-by-hash
  • get-block-by-number
  • get-last-txs
  • get-blocks
  • get-dump-block-by-number
  • get-dump-block-by-hash
  • get-count-blocks
  • get-forging-sum
  • get-last-node-stat-result
  • get-last-node-stat-trust
  • get-last-node-stat-count
  • get-last-nodes-stats-count
  • get-all-last-nodes-count
  • get-nodes-raiting
  • get-common-balance
  • status
  • mhc_send
  • getinfo

额外方法

用法

您可以在 examples 文件夹中找到用法示例。

示例

<?php

use Metahash\MetaHash;

$metaHash = new MetaHash();
$balance = $metaHash->fetchBalance('0x00fa2a5279f8f0fd2f0f9d3280ad70403f01f9d62f52373833');
print_r($balance);

控制台示例

git clone git@github.com:xboston/metahash-php.git
cd metahash-php
composer install
php examples/cli.php method=generate
php examples/cli.php method=fetch-balance address=0x00fa2a5279f8f0fd2f0f9d3280ad70403f01f9d62f52373833
php examples/cli.php method=fetch-balances address=0x00fa2a5279f8f0fd2f0f9d3280ad70403f01f9d62f52373833,0x0039f42ad734606d250ea0b0151d4aeab6b4edc6587c4b27ef
php examples/cli.php method=fetch-history address=0x00fa2a5279f8f0fd2f0f9d3280ad70403f01f9d62f52373833
php examples/cli.php method=get-tx  hash=bc4a521c1d0d958e2c00e9cdf90a66b15df918cd22e3c408b0f793d913fc7626
php examples/cli.php method=get-last-txs

服务器模式示例

git clone git@github.com:xboston/metahash-php.git
cd metahash-php
composer install
cd examples
php -S localhost:8000

在浏览器中打开:https://:8000/

browser FOSSA Status

https://:8000/wallets.php

wallets

许可证

此包根据 MIT 许可证发布。

FOSSA Status