PHPackages                             amashukov/eip1559-tx-signer-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. amashukov/eip1559-tx-signer-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

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.

v0.1.1(1mo ago)0340—5.9%1MITPHPPHP &gt;=8.3CI failing

Since May 24Pushed 1mo agoCompare

[ Source](https://github.com/AndreyMashukov/eip1559-tx-signer-php)[ Packagist](https://packagist.org/packages/amashukov/eip1559-tx-signer-php)[ Docs](https://github.com/AndreyMashukov/eip1559-tx-signer-php)[ RSS](/packages/amashukov-eip1559-tx-signer-php/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (16)Versions (3)Used By (1)

amashukov/eip1559-tx-signer-php
===============================

[](#amashukoveip1559-tx-signer-php)

EIP-1559 (Type-2) Ethereum transaction assembly + RFC 6979 deterministic ECDSA signing in pure PHP.

[![CI](https://camo.githubusercontent.com/9901e9f869b45776ce04ca52d0d97551ab77ae0229a2ee304f8aef2bdd8232f4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416e647265794d617368756b6f762f656970313535392d74782d7369676e65722d7068702f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d4349)](https://github.com/AndreyMashukov/eip1559-tx-signer-php/actions)[![PHPStan L9](https://camo.githubusercontent.com/5ccab70cf929b505b62b156428a14319b0cc4640c7b0b2ec2d6604a977b30786/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416e647265794d617368756b6f762f656970313535392d74782d7369676e65722d7068702f7374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d5048505374616e2532304c39)](https://github.com/AndreyMashukov/eip1559-tx-signer-php/actions)[![Latest Version](https://camo.githubusercontent.com/0362c015596d2b263e3745188ece56f4b319a763daea437b3d39d1175a1a3d67/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d617368756b6f762f656970313535392d74782d7369676e65722d706870)](https://packagist.org/packages/amashukov/eip1559-tx-signer-php)[![Downloads](https://camo.githubusercontent.com/22b14b33274693f86b0be63b3b8eeac8f6f9fe385d984559f4eb990279458f34/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616d617368756b6f762f656970313535392d74782d7369676e65722d706870)](https://packagist.org/packages/amashukov/eip1559-tx-signer-php)[![PHP](https://camo.githubusercontent.com/e1c3cf8b5968f510b35e5c7b4672a4b48c3b43a0f1e557fdb80b4db7d08ea21c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f616d617368756b6f762f656970313535392d74782d7369676e65722d7068702f706870)](https://packagist.org/packages/amashukov/eip1559-tx-signer-php)[![License](https://camo.githubusercontent.com/ec625466310f850e557d3e0468e64281759a95b25471257f1991cc687f907b76/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616d617368756b6f762f656970313535392d74782d7369676e65722d706870)](LICENSE)[![Stars](https://camo.githubusercontent.com/d127a26bd6508fd79b8e015905f0a3f9edb5fe3c0106142a3ae57d5c1201dd25/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f416e647265794d617368756b6f762f656970313535392d74782d7369676e65722d7068703f7374796c653d736f6369616c)](https://github.com/AndreyMashukov/eip1559-tx-signer-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
--------

[](#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
-----------------------------------

[](#why-amashukoveip1559-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
------------

[](#installation)

```
composer require amashukov/eip1559-tx-signer-php
```

Usage
-----

[](#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

[](#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

[](#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
------------

[](#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
------------

[](#requirements)

- PHP 8.3+
- `ext-gmp`
- [amashukov/keccak-php](https://github.com/AndreyMashukov/keccak-php) — signing-hash + address derivation
- [amashukov/rlp-php](https://github.com/AndreyMashukov/rlp-php) — transaction serialization
- [amashukov/secp256k1-php](https://github.com/AndreyMashukov/secp256k1-php) — ECDSA sign + public-key derivation

Related packages
----------------

[](#related-packages)

PackageTierPurpose[amashukov/keccak-php](https://github.com/AndreyMashukov/keccak-php)leafkeccak-256 hashing[amashukov/rlp-php](https://github.com/AndreyMashukov/rlp-php)leafRLP encoding[amashukov/secp256k1-php](https://github.com/AndreyMashukov/secp256k1-php)leafECDSA sign / pubkey derivation[amashukov/abi-encoder-php](https://github.com/AndreyMashukov/abi-encoder-php)compositeSolidity ABI calldata encoder[amashukov/eth-rpc-client-php](https://github.com/AndreyMashukov/eth-rpc-client-php)RPCEthereum JSON-RPC client[amashukov/eth-php](https://github.com/AndreyMashukov/eth-php)metaEVM umbrella packageQuality
-------

[](#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
-------

[](#license)

MIT.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance90

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~15 days

Total

2

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b3e86ca79a82515b23e0239b1d3616c747e59b64c40e169d538d5c759c9bbc4?d=identicon)[Andrey Mashukov](/maintainers/Andrey%20Mashukov)

---

Top Contributors

[![AndreyMashukov](https://avatars.githubusercontent.com/u/24682497?v=4)](https://github.com/AndreyMashukov "AndreyMashukov (4 commits)")

---

Tags

blockchainecdsaeip-1559ethereumphprfc6979signingtransactionsigningtransactionethereumweb3ECDSAsecp256k1evmeip-1559rlprfc6979raw-transaction

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/amashukov-eip1559-tx-signer-php/health.svg)

```
[![Health](https://phpackages.com/badges/amashukov-eip1559-tx-signer-php/health.svg)](https://phpackages.com/packages/amashukov-eip1559-tx-signer-php)
```

###  Alternatives

[kornrunner/ethereum-offline-raw-tx

Pure PHP Ethereum Offline Raw Transaction Signer

62204.6k24](/packages/kornrunner-ethereum-offline-raw-tx)[bitcoin-php/bitcoin-ecdsa

PHP library allowing to generate BTC addresses from private keys

22766.7k7](/packages/bitcoin-php-bitcoin-ecdsa)[drlecks/simple-web3-php

Web3 library in PHP

7744.0k2](/packages/drlecks-simple-web3-php)[kornrunner/secp256k1

Pure PHP secp256k1

40609.0k120](/packages/kornrunner-secp256k1)[kornrunner/ethereum-token

PHP Ethereum Token Utils

1413.3k1](/packages/kornrunner-ethereum-token)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
