定制 power/php-bitcoin-address 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

power/php-bitcoin-address

最新稳定版本:1.1

Composer 安装命令:

composer require power/php-bitcoin-address

包简介

A simple P2PK, P2PKH, P2SH, P2WPKH, P2WSH output script/address generator.

README 文档

README

A simple P2PK, P2PKH, P2SH, P2WPKH, P2WSH output script/address parser/generator.

Supported types:

  • Pay-To-PubKey (P2PK)
  • Pay-To-PubKeyHash (P2PKH)
  • Pay-To-Multisig (P2MS)
  • Pay-To-ScriptHash (P2SH)
  • Pay-To-WitnessPubKeyHash (P2WPKH)
  • Pay-To-WitnessScriptHash (P2WSH)
  • P2WPKH-over-P2SH
  • P2WSH-over-P2SH
  • any combination

Supported networks:

  • Bitcoin
  • Bitcoin Testnet
  • Bitcoin Gold
  • Bitcoin Cash
  • Litecoin
  • Litecoin Testnet
  • Dogecoin
  • Dogecoin Testnet
  • Viacoin
  • Viacoin Testnet
  • Dash
  • Dash Testnet
  • Zcash

Installation

composer require andkom/php-bitcoin-address

Examples

Generate a P2PK/P2PKH address:

$address = OutputFactory::p2pk($pubKey)->address(); 
$address = OutputFactory::p2pkh($pubKeyHash)->address(); 

Generate a P2MS address:

$address = OutputFactory::p2ms(2, [$pubKey1, $pubKey2, $pubKey3])->address();

Generate a P2SH address:

$factory = new OutputFactory();
$p2ms = $factory->p2ms(2, [$pubKey1, $pubKey2, $pubKey3]);
$address = $factory->p2sh($p2ms)->address();

Generate a P2WPKH address:

$address = OutputFactory::p2wpkh($pubKeyHash)->address();

Generate a P2WSH address:

$factory = new OutputFactory();
$p2ms = $factory->p2ms(2, [$pubKey1, $pubKey2, $pubKey3]);
$address = $factory->p2wsh($p2ms)->address();

Generate a P2WPKH-over-P2SH address:

$factory = new OutputFactory();
$p2wpkh = $factory->p2wpkh($pubKeyHash);
$address = $factory->p2sh($p2wpkh)->address();

Generate a P2WSH-over-P2SH address:

$factory = new OutputFactory();
$p2ms = $factory->p2ms(2, [$pubKey1, $pubKey2, $pubKey3]);
$p2wsh = $factory->p2wsh($p2ms);
$address = $factory->p2sh($p2wsh)->address();

Generate an address from an output script:

$address = OutputFactory::fromScript($script)->address();

统计信息

  • 总下载量: 69
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固