PHP code example of amashukov / eip1559-tx-signer-php
1. Go to this page and download the library: Download amashukov/eip1559-tx-signer-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
amashukov / eip1559-tx-signer-php example snippets
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
use Amashukov\Eip1559TxSigner\Eip1559SignerInterface;
public function __construct(private Eip1559SignerInterface $signer) {}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.