Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Eip1559 Tx Signer Php Laravel Package

amashukov/eip1559-tx-signer-php

View on GitHub
Deep Wiki
Context7

amashukov/eip1559-tx-signer-php

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity