You might get a
"Replacement Underpriced Error" when using
eth_sendUserOperation. This error occurs when a user already has an existing operation in the mempool. User operations can become "stuck" in the mempool if their gas fee limits are too low to be included in a bundle.
To resolve this, the user must increase both
maxPriorityFeePerGas by at least 10%.
maxFeePerGas vs. maxPriorityFeePerGas
maxFeePerGasis the sum of the
maxPriorityFeePerGas. Learn the differences between maxFeePerGas vs. maxPriorityFeePerGas in our comparative article.
Re-estimate gas fees: Re-estimate the gas fees required for your operation. This can be done in various ways which are mentioned below:
maxPriorityFeePerGascan be obtained using this method.
getFeeData: This method on Alchemy SDK returns both the current
maxFeePerGas. This method is also available on web3 libraries like
ethers.jsand can be accessed through the provider as
Choose the suitable increase values: Once you have the re-estimated gas fees, choose the maximum of a 10% increase or the re-estimated values. This ensures that your new gas fee is competitively priced to be included in a block.
Account for Rundler's service tip: Rundler requires a small tip for its services via
maxPriorityFeePerGas. Detailed information about this can be found on the Bundler API Fee Logic page but in summary:
On Ethereum, Polygon, and Optimism mainnets, the tip should be at least 25% higher than the estimated priority fee on the network.
On Arbitrum / Optimism mainnet, the tip is set to a minimum 5% of the estimated network base fee when the bundle is mined.
No tip is required on testnets.
Now, send your
userOperation again using the calculated values and it should go through successfully.