Four scripts to ordinary generate, EIP-4844-type generate, EIP-7702-type generate, and execute a signed raw transaction with ethers.
It is recommended to install pnpm through the npm package manager, which comes bundled with Node.js when you install it on your system. It is recommended to use a Node.js version >=24.2.0.
Once you have npm installed, you can run the following both to install and upgrade pnpm:
npm install -g pnpmAfter having installed pnpm, simply run:
pnpm installCreate a .env file in the root directory and place the private key of your wallet used for signing in the variable PRIVATE_KEY and the RPC provider for the transaction in the variable RPC_PROVIDER. Example:
PRIVATE_KEY=abc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
RPC_PROVIDER=https://rpc.ankr.com/eth_goerliConfigure the placeholder(s) payload in sign, sign-eip48441, or sign-eip7702 according to your needs and run:
pnpm generateor
generate:eip4844or
generate:eip7702This will print all raw transaction details to your terminal. Use the output signedTx.serialized to broadcast a transaction e.g. with services like pushTx. You can also use the automatically saved serialised signed transaction in signed_serialised_transaction.json (in the scripts/out directory) via pnpm execute as explained in the next section.
Configure your RPC provider in execute according to your needs and run:
pnpm executeIf the transaction is successful, it saves a file transaction_receipt.json or in case of a failure a file transaction_error.json in the scripts/out directory.
Footnotes
-
The EIP-4844-type
sign-eip4844script is compatible with PeerDAS EIP-7594. ↩