- How do I install and set up this package in Laravel?
- Run `composer require amashukov/eip1559-tx-signer-php`, then register the signer in your `AppServiceProvider` using Laravel’s service container. Bind the `Eip1559Signer` class with your private key (from config or env) and chain ID. Ensure `ext-gmp` is enabled in `php.ini` for bigint safety.
- Does this package support Laravel 10 and PHP 8.3?
- Yes, this package is fully compatible with Laravel 10 and PHP 8.3+. If you need PHP 8.2 support, you’ll need to fork the package and adjust the dependencies manually, as the current version targets PHP 8.3+.
- Can I use this for serverless or cron job signing?
- Absolutely. The package uses RFC 6979 deterministic signing, ensuring reproducible signatures for the same transaction and private key. This makes it ideal for serverless functions or cron jobs where consistency is critical.
- How do I handle private key storage securely?
- Store private keys in Laravel’s encrypted config (`.env` or `config/ethereum.php`), Hashicorp Vault, or AWS KMS. Avoid hardcoding keys in source files. The package supports placeholder keys for development/testing, but these generate invalid transactions.
- What’s the difference between this and web3.php or web3.js?
- This package is a pure PHP library for **server-side** EIP-1559 transaction signing, eliminating the need for Web3.js or client-side dependencies. It’s optimized for Laravel’s backend workflows, while web3.php/web3.js are typically used for browser-based interactions.
- How do I estimate gasLimit for transactions?
- You must estimate `gasLimit` separately, either via an RPC call (e.g., `eth_estimateGas`) or manually. The package doesn’t include gas estimation—pair it with `amashukov/eth-rpc-client-php` if needed for dynamic calculations.
- Does this package support access lists for contract interactions?
- No, this package emits empty access lists by default, as they’re optional for simple transactions. For contract deployments or complex interactions, extend the package or use a separate library to build access lists before signing.
- Can I use this for multi-signature or hardware wallet signing?
- No, this package is designed for single-key signing only. For multi-sig or hardware wallets (e.g., Ledger), integrate with a library like `bitgo/bitgo-php` or `web3auth/web3auth-php` alongside this signer for raw transaction assembly.
- How do I handle dynamic maxFeePerGas and maxPriorityFeePerGas?
- Pass these values directly when calling the signer’s `sign()` method. For dynamic fees, fetch them from an oracle (e.g., Chainlink or a custom API) and inject them into your Laravel config or service layer before signing.
- Are there performance concerns for high-volume signing?
- The package is optimized for correctness and determinism, but pure PHP may be slower than compiled languages for batch signing. Benchmark against alternatives like `web3.php` for your workload. For high throughput, consider caching signed transactions or offloading signing to a microservice.