web3p/ethereum-tx
Composer 安装命令:
composer require web3p/ethereum-tx
包简介
Ethereum transaction library in PHP.
README 文档
README
Ethereum transaction library in PHP.
Install
composer require web3p/ethereum-tx
Usage
Create a transaction
use Web3p\EthereumTx\Transaction; // without chainId $transaction = new Transaction([ 'nonce' => '0x01', 'from' => '0xb60e8dd61c5d32be8058bb8eb970870f07233155', 'to' => '0xd46e8dd67c5d32be8058bb8eb970870f07244567', 'gas' => '0x76c0', 'gasPrice' => '0x9184e72a000', 'value' => '0x9184e72a', 'data' => '' ]); // with chainId $transaction = new Transaction([ 'nonce' => '0x01', 'from' => '0xb60e8dd61c5d32be8058bb8eb970870f07233155', 'to' => '0xd46e8dd67c5d32be8058bb8eb970870f07244567', 'gas' => '0x76c0', 'gasPrice' => '0x9184e72a000', 'value' => '0x9184e72a', 'chainId' => 1, 'data' => '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675' ]); // hex encoded transaction $transaction = new Transaction('0xf86c098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a76400008025a028ef61340bd939bc2195fe537567866003e1a15d3c71ff63e1590620aa636276a067cbe9d8997f761aecb703304b3800ccf555c9f3dc64214b297fb1966a3b6d83');
Create a EIP1559 transaction
use Web3p\EthereumTx\EIP1559Transaction; // generate transaction instance with transaction parameters $transaction = new EIP1559Transaction([ 'nonce' => '0x01', 'from' => '0xb60e8dd61c5d32be8058bb8eb970870f07233155', 'to' => '0xd46e8dd67c5d32be8058bb8eb970870f07244567', 'maxPriorityFeePerGas' => '0x9184e72a000', 'maxFeePerGas' => '0x9184e72a000', 'gas' => '0x76c0', 'value' => '0x9184e72a', 'chainId' => 1, // required 'accessList' => [], 'data' => '' ]);
Create a EIP2930 transaction:
use Web3p\EthereumTx\EIP2930Transaction; // generate transaction instance with transaction parameters $transaction = new EIP2930Transaction([ 'nonce' => '0x01', 'from' => '0xb60e8dd61c5d32be8058bb8eb970870f07233155', 'to' => '0xd46e8dd67c5d32be8058bb8eb970870f07244567', 'gas' => '0x76c0', 'value' => '0x9184e72a', 'chainId' => 1, // required 'accessList' => [], 'data' => '' ]);
Sign a transaction:
use Web3p\EthereumTx\Transaction; $signedTransaction = $transaction->sign('your private key');
API
https://www.web3p.xyz/ethereumtx.html
License
MIT
web3p/ethereum-tx 适用场景与选型建议
web3p/ethereum-tx 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 373.67k 次下载、GitHub Stars 达 189, 最近一次更新时间为 2018 年 03 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 web3p/ethereum-tx 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 web3p/ethereum-tx 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 373.67k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 193
- 点击次数: 26
- 依赖项目数: 38
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-13