承接 amashukov/eip1559-tx-signer-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

amashukov/eip1559-tx-signer-php

最新稳定版本:v0.1.1

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.

CI PHPStan L9 Latest Version Downloads PHP License Stars

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

  1. RLP-encode [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList] and prepend the 0x02 type byte.
  2. keccak-256 the payload → signing hash.
  3. ECDSA-sign the hash with secp256k1 (RFC 6979 deterministic nonce, canonical low-S).
  4. RLP-encode the same fields plus [yParity, r, s], prepend 0x02 → the signed raw transaction.

Access lists are emitted empty; the signer targets the common "no access list" Type-2 transaction.

Requirements

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-CS ruleset.
  • GitHub Actions CI on every push.
  • RFC 6979 deterministic-signature test vectors validate signing output.

License

MIT.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固