amashukov/eip1559-tx-signer-php
bind()) or facades.maxFeePerGas/maxPriorityFeePerGas control for dynamic gas markets.amashukov/eth-rpc-client-php if needed).config/env or Vault).graph TD
A[Laravel Service] -->|Private Key| B[Eip1559Signer]
B -->|Sign| C[Raw Tx Hex]
C -->|eth_sendRawTransaction| D[Ethereum Node]
| Risk Area | Mitigation Strategy |
|---|---|
| Cryptographic Bugs | Uses audited dependencies (secp256k1-php, keccak-php). Test vectors validate RFC 6979. |
| PHP 8.3+ Requirement | Laravel 10+ supports PHP 8.3+. Downgrade path: Fork package to target PHP 8.2. |
| GMP Extension | Required for bigint safety. Ensure ext-gmp is enabled in php.ini. |
| Nonce Management | Nonce must be fetched from the blockchain (e.g., via eth_getTransactionCount). |
| Access Lists | Package emits empty access lists. Extend if needed (e.g., for contract deployments). |
| Gas Estimation | gasLimit must be estimated separately (e.g., via eth_estimateGas). |
config, Hashicorp Vault, or AWS KMS?)maxFeePerGas/maxPriorityFeePerGas be dynamic (e.g., fetched from an oracle)?gasLimit be estimated? (Manual input vs. RPC call.)null?web3.php.)logs table) for compliance?Eip1559Signer as a singleton in AppServiceProvider:
$this->app->singleton(Eip1559Signer::class, function ($app) {
return new Eip1559Signer(
config('ethereum.private_key'),
chainId: config('ethereum.chain_id')
);
});
Ethereum facade for cleaner syntax:
use Illuminate\Support\Facades\Facade;
class Ethereum extends Facade { protected static function getFacadeAccessor() { return Eip1559Signer::class; } }
Usage:
$rawTx = Ethereum::sign(to: '0xRecipient', valueWei: '1000000000000000000');
sign:transaction command for CLI signing:
php artisan eth:sign --to=0xRecipient --value=1ETH --gas=21000
TransactionSigned event) to integrate with queues/jobs.event(new TransactionSigned($rawTx));
| Current State | Migration Steps |
|---|---|
| Legacy Tx (EIP-1559 Unused) | Replace web3p/ethereum-tx with this package. Update all eth_sendTransaction calls to use raw hex. |
| Client-Side Signing | Move signing logic to Laravel services. Use eth_sendRawTransaction instead of personal_sign. |
| No Signing | Implement a TransactionService facade to centralize signing logic. |
web3.php or ethereumjs-tx to prevent duplicate signing logic.eth_sendRawTransaction.composer.json.Eip1559Signer in a Laravel service.eth_getTransactionCount to fetch nonces.eth_estimateGas).Eip1559Signer instances if keys are reused.amashukov/* packages for security patches (low risk due to MIT license).composer.json if stability is critical.rotate:key Artisan command to update keys in config/Vault.ETHEREUM_PRIVATE_KEY=0x...
\Log::info('Signed TX', ['hash' => keccak256($rawTx), 'to' => $to]);
chainId must match the target network (e.g., 1 for Mainnet).eth-sign-job) to avoid blocking HTTP requests.composer bench -- vendor/amashukov/eip1559-tx-signer-php
How can I help you explore Laravel packages today?