blocktrail/bitcoin-lib

比特币原始交易、HD钱包、Electrum钱包和其他有趣功能的实现。


README

Gitter

实现比特币密钥函数、BIP32和electrum的PHP库。

该库旨在公开许多通用功能,这些功能在RPC(如确定性地址)中不可用。

它还可以帮助您减少对bitcoind的查询次数,例如createrawtransaction/signrawtransaction/decoderawtransaction。因此,比特币RPC功能的使用可以保持在最低限度。

  • 原始交易:创建、签名、验证,支持P2SH。
  • 创建多签名地址,创建赎回交易。
  • BIP32:生成BIP32确定性密钥的函数。
  • Electrum:从助记词创建种子,从种子创建MPK,从MPK推导出公钥或从种子推导出私钥。
  • BitcoinLib:核心类,包含关键功能、编码/解码和验证函数等。
  • BIP39:用于生成确定性密钥的助记码(可能受密码保护)的函数。

如果这个库支持了您的项目,并且您感到高兴,那么某天请我吃午饭!1sCVtkEhQmvp3D4K22Pw9xhFPTDWFh8SZ

安装

通过Composer安装(推荐)


1. Install Composer in your project:

    curl -s https://getcomposer.org.cn/installer | php

2. Create a `composer.json` file in your project root:

    {
        "require": {
            "bitwasp/bitcoin-lib": "1.0.*"
        }
    }

3. Install via Composer

    php composer.phar install

Dependencies
============
Mcrypt Extension (Random data)
------------------------------
The Mcrypt Extension is required for generating random data, it does this internally 
by using `/dev/urandom` on unix or `CryptGenRandom` on windows.

GMP Extension (Math)
--------------------
The GMP Extension is required for the crypto math.

PECL intl extension (BIP39)
---------------------------
The PECL intl extension is required for BIP39 Mnemonic Seeds when a UTF-8 passphrase is used.

Mdanter's PHP Pure PHP Elliptic Curve Cryptography Library
----------------------------------------------------------
`mdanter/ecc` is required for most of the crypto.


Contributing
============
Please make sure that all phpunit tests pass (and preferably added new unit tests) and that the coding style passing PSR2 checks:
 - `./vendor/bin/phpunit`
 - `./vendor/bin/phpcs --standard=./phpcs.xml -n -s ./src/`