API Reference

eth_sendUserOperation

Submits a UserOperation object to the UserOperation pool of the bundler. It returns a userOpHash if the UserOperation was accepted otherwise returns an error.

maxFeePerGas and maxPriorityFeePerGas

  • baseFeePerGas This is the minimum amount of gas required for a transaction to be included in a block. It's algorithmically adjusted by the protocol based on network congestion. When the network is more congested, the base fee goes up; when it's less congested, the base fee goes down. Every transaction must at least pay the base fee.
  • maxPriorityFeePerGas Also known as the "tip," this is an additional fee that a user can set to give their transaction higher priority for inclusion by miners. Essentially, it's the maximum amount a user is willing to pay on top of the base fee to incentivize miners to include their transaction in a block quickly.

How to calculate maxFeePerGas and maxPriorityFeePerGas:

  1. Fetch Current Base Fee: Use the method eth_getBlockByNumber with the 'latest' parameter to get the current baseFeePerGas.
  2. Apply Buffer on Base Fee: To account for potential fee changes, apply a buffer on the current base fee, according to the table below.
  3. Fetch Current Priority Fee: Use the eth_maxPriorityFeePerGas method to query the current priority fee for the network.
  4. Apply Buffer on Priority Fee: Once you have the current priority fee using eth_maxPriorityFeePerGas, increase it according to the table below.
  5. Determine maxFeePerGas: sum of the baseFeePerGas and maxPriorityFeePerGas, and the buffers.

Recomended Extra Fees

EcosystemNetworkExtra Fee Requirement
EthereumMainnetRecommended 25% buffer on priority fee and 50% buffer on base fee for the network.
EthereumSepoliaNo extra priority fee, minimal priority fee . Recommended 20% buffer on base fee for the network.
Polygon PoSMainnetNo extra priority fee, minimal priority fee 30 GWei. Recommended 50% buffer on base fee for the network.
Polygon PoSMumbaiNo extra priority fee, minimal priority fee 1.5 GWei. Recommended 20% buffer on base fee for the network.
OptimismMainnetNo extra priority fee, minimal priority fee 100,000. Recommended 50% buffer on base fee for the network.
OptimismSepoliaNo extra priority fee, minimal priority fee 100,000. Recommended 20% buffer on base fee for the network.
ArbitrumOneNo priority fee. Recommended 5% buffer on base fee for the network.
ArbitrumSepoliaNo priority fee. Recommended 5% buffer on base fee for the network.

Replacement Underpriced Error

When utilizing eth_sendUserOperation, you may encounter a 'Replacement Underpriced Error.' This error typically arises if there's already a pending operation from the same user in the transaction pool. Such operations can linger in the mempool when the gas fees set are insufficient for them to be packaged into a block.

To rectify the issue, it's necessary for the user to increment the maxFeePerGas and maxPriorityFeePerGas values by a minimum of 10%.

Language
Click Try It! to start a request and see the response here!