amashukov/eip1559-tx-signer-php
Composer 安装命令:
composer require amashukov/eip1559-tx-signer-php
包简介
EIP-1559 (Type-2) raw transaction assembly + RFC 6979 deterministic ECDSA signing in pure PHP. Address derivation from a secp256k1 private key.
关键字:
README 文档
README
EIP-1559 (Type-2) Ethereum transaction assembly + RFC 6979 deterministic ECDSA signing in pure PHP.
Assemble and sign EIP-1559 (Type-2) Ethereum transactions in pure PHP. Produces a 0x02-prefixed raw transaction hex ready for eth_sendRawTransaction. Signatures are deterministic per RFC 6979 and canonical low-S, so the same (privateKey, transaction) pair always yields byte-identical output — ideal for reproducible builds, server-side signing, and EVM bridge/withdrawal automation.
Features
- EIP-1559 / EIP-2718 Type-2 transaction assembly (RLP-encoded,
0x02-prefixed). - RFC 6979 deterministic ECDSA signing over secp256k1, canonical low-S.
- Sender address derivation from the private key.
- Bigint-safe wei / gas fields via decimal strings (
ext-gmp). - Empty-key placeholder mode keeps DI containers booting without the real secret.
- PHPStan level 9 clean,
strict_types.
Why amashukov/eip1559-tx-signer-php
The common PHP path to a signed EVM transaction is web3p/ethereum-tx + kornrunner/ethereum-offline-raw-tx, which target the legacy transaction shape and pull in their own crypto stack. This package is focused on the modern Type-2 (EIP-1559) envelope with RFC 6979 deterministic signing as a first-class guarantee, composed from small single-purpose dependencies you can audit independently (keccak / RLP / secp256k1).
Installation
composer require amashukov/eip1559-tx-signer-php
Usage
use Amashukov\Eip1559TxSigner\Eip1559Signer; $signer = new Eip1559Signer('0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d', chainId: 1); // Sender address derived from the private key: echo $signer->address(); // 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1 $rawTx = $signer->sign( to: '0x000000000000000000000000000000000000dEaD', valueWei: '0', // decimal-string wei (bigint-safe) data: '0xf3fef3a3…', // calldata, 0x-prefixed nonce: 5, gasLimit: 100_000, maxFeePerGas: '30000000000', // 30 gwei maxPriorityFeePerGas: '1500000000', // 1.5 gwei ); // 0x02f8b1… — broadcast via eth_sendRawTransaction
Empty-key placeholder
Passing an empty private key boots the signer with an all-ones placeholder key. This keeps dependency-injection containers booting in dev/test without the real secret; the resulting transaction is signed by a throwaway key, so any chain that receives it rejects the call — loudly, not silently.
Interface for DI / test doubles
Eip1559Signer implements Eip1559SignerInterface (address() + sign()). Type-hint the interface in your services and the container wires the concrete signer in production; in tests, swap a deterministic, key-free double for the interface so signing output never depends on a real private key.
use Amashukov\Eip1559TxSigner\Eip1559SignerInterface; public function __construct(private Eip1559SignerInterface $signer) {}
How it works
- RLP-encode
[chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList]and prepend the0x02type byte. - keccak-256 the payload → signing hash.
- ECDSA-sign the hash with secp256k1 (RFC 6979 deterministic nonce, canonical low-S).
- RLP-encode the same fields plus
[yParity, r, s], prepend0x02→ the signed raw transaction.
Access lists are emitted empty; the signer targets the common "no access list" Type-2 transaction.
Requirements
- PHP 8.3+
ext-gmp- amashukov/keccak-php — signing-hash + address derivation
- amashukov/rlp-php — transaction serialization
- amashukov/secp256k1-php — ECDSA sign + public-key derivation
Related packages
| Package | Tier | Purpose |
|---|---|---|
| amashukov/keccak-php | leaf | keccak-256 hashing |
| amashukov/rlp-php | leaf | RLP encoding |
| amashukov/secp256k1-php | leaf | ECDSA sign / pubkey derivation |
| amashukov/abi-encoder-php | composite | Solidity ABI calldata encoder |
| amashukov/eth-rpc-client-php | RPC | Ethereum JSON-RPC client |
| amashukov/eth-php | meta | EVM umbrella package |
Quality
- PHPStan level 9.
- php-cs-fixer with the
@PER-CSruleset. - GitHub Actions CI on every push.
- RFC 6979 deterministic-signature test vectors validate signing output.
License
MIT.
amashukov/eip1559-tx-signer-php 适用场景与选型建议
amashukov/eip1559-tx-signer-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 402 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「signing」 「transaction」 「ECDSA」 「secp256k1」 「ethereum」 「web3」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 amashukov/eip1559-tx-signer-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 amashukov/eip1559-tx-signer-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 amashukov/eip1559-tx-signer-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
DUKPT implementation in PHP
The BlockTrail PHP SDK, for integration of Bitcoin functionality through the BlockTrail API
Send mails after DB transaction is committed
BitWeb extension for Estonian ID-Card and Mobile ID authentication and signing.
This is a transaction.
PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.
统计信息
- 总下载量: 402
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 41
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-24