Learn how to use the estimateUserOperationGas JSON-RPC method.
curl --request POST \
--url 'https://bundler.particle.network/#eth_estimateUserOperationGas' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"chainId": 80001,
"method": "eth_estimateUserOperationGas",
"params": [
{
"sender": "0xSenderAddress",
"nonce": "0x1",
"initCode": "0xInitCode",
"callData": "0xCallData",
"signature": "0xSignature"
}
]
}
'{
"jsonrpc": "2.0",
"id": 1,
"chainId": 80001,
"result": {
"maxFeePerGas": "0x3B9ACA00",
"maxPriorityFeePerGas": "0x3B9ACA00",
"preVerificationGas": "0x5208",
"verificationGas": "0x5208",
"verificationGasLimit": "0x5208",
"callGasLimit": "0x5208"
}
}estimateUserOperationGasestimateUserOperationGas takes a partial UserOperation object and returns detailed gas estimates to be used in continued UserOperation construction. It takes:
sender - string.nonce - string.initCode - string.callData - string.signature - string.signature can be a dummy string, such as 0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c.entrypointAddress - string.{
"method": "eth_estimateUserOperationGas",
"params": [
// partial user operation
{
"sender": "0x8fb859e944561678be40cdd2db16551396c0b074",
"nonce": "0x0152",
"initCode": "0x",
"callData": "0x9e5d4c49000000000000000000000000329a7f8b91ce7479035cb1b5d62ab41845830ce8000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
"signature": "0x73c3ac716c487ca34bb858247b5ccf1dc354fbaabdd089af3b2ac8e78ba85a4959a2d76250325bd67c11771c31fccda87c33ceec17cc0de912690521bb95ffcb1b"
},
"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789"
],
"id": 1695717515,
"jsonrpc": "2.0",
"chainId": 80001
}
Request to estimate the gas cost of a user operation.
Version of the JSON-RPC protocol, should be 2.0.
"2.0"
The request identifier.
1
The chain ID.
80001
API method being called.
eth_estimateUserOperationGas Parameters for gas estimation.
Show child attributes
Successful response with gas estimation.
Was this page helpful?
curl --request POST \
--url 'https://bundler.particle.network/#eth_estimateUserOperationGas' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"chainId": 80001,
"method": "eth_estimateUserOperationGas",
"params": [
{
"sender": "0xSenderAddress",
"nonce": "0x1",
"initCode": "0xInitCode",
"callData": "0xCallData",
"signature": "0xSignature"
}
]
}
'{
"jsonrpc": "2.0",
"id": 1,
"chainId": 80001,
"result": {
"maxFeePerGas": "0x3B9ACA00",
"maxPriorityFeePerGas": "0x3B9ACA00",
"preVerificationGas": "0x5208",
"verificationGas": "0x5208",
"verificationGasLimit": "0x5208",
"callGasLimit": "0x5208"
}
}