Skip to main content

Bundler & Paymaster API Reference

The Coinbase Bundler & Paymaster API provides ERC-4337 account abstraction endpoints to send transactions from smart account wallets, and to sponsor gas for user transactions.

Get started

  1. Create a new CDP account or sign in to your exsiting account.
  2. Create a Base project.
  3. Activate Paymaster and automatically receive 0.25 ETH in gas credits.
  4. Start sending user operations and sponsoring user transactions!
  5. Apply for additional gas credits as you scale.

Example repository

See paymaster-bundler-examples on Github for help integrating our Paymaster with SDKs.

Need Help?

Join the Base Discord and let us know in #developer-support if you need assistance.

Bundler methods

eth_supportedEntryPoints

This endpoint retrieves an array of supported entry points. Currently, the only supported entrypoint is 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789.

Request/Response

{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_supportedEntryPoints"
}

eth_getUserOperationByHash

This endpoint returns a UserOperation based on the hash returned from eth_sendUserOperation.

Parameters

NameTypeReqDescription
hasharrayYThe hash of the user operation to retrieve

Returns

TypeDescription
senderAccount initiating the user operation
nonceNonce
initCodeinitCode (needed if the account needs to be created)
preVerificationGasAmount of gas to pay for to compensate the bundler for pre-verification execution and calldata
maxFeePerGasMaximum fee per gas to pay for the execution of this operation
maxPriorityFeePerGasMaximum priority fee per gas
signatureSignature from the account
verificationGasLimitAmount of gas to allocate for the verification step
callGasLimitAmount of gas to allocate the main execution call
paymasterAndDataHex string signed by the paymaster for a sponsored transaction
blockNumberBlock number in which UserOperation is included
blockHashBlock hash in which UserOperation is included
transactionHashTransaction hash of the UserOperation

Request/Response

{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getUserOperationByHash",
"params": [
"0x77c0b560eb0b042902abc5613f768d2a6b2d67481247e9663bf4d68dec0ca122"
]
}

eth_getUserOperationReceipt

This endpoint returns a receipt based on the hash returned from eth_sendUserOperation.

Parameters

NameTypeReqDescription
hasharrayYThe hash of the user operation to retrieve

Returns

TypeDescription
userOpHashHash of the User Operation
entryPointEntrypoint that the User Operation was sent to
senderAccount initiating the user operation
nonceNonce
paymasterPaymaster used in the user operation
actualGasCostActual gas consumed by this UserOperation
actualGasUsedTotal gas used by this UserOperation
successWhether the execution completed successfully
reasonIf reverted, the reason the execution failed
logsLogs generated by this UserOperation (not including logs of other UserOperations in the same bundle)
receiptTransactionReceipt object for the entire bundle
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getUserOperationReceipt",
"params": [
"0x77c0b560eb0b042902abc5613f768d2a6b2d67481247e9663bf4d68dec0ca122"
]
}

eth_sendUserOperation

This endpoint sends a UserOperation for inclusion in the Bundler’s private mempool. The signature must be a valid signature from the smart account.

Parameters

NameTypeReqDescription
UserOperationUserOperationYThe UserOperation. You may add a paymasterAndData field if the transaction is sponsored.
entryPointstringYEntryPoint address that the UserOperation is intended for.
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_sendUserOperation",
"params": [
{
sender, // address
nonce, // uint256
initCode, // string
callData, // string
callGasLimit, // string
verificationGasLimit, // string
preVerificationGas, // string
maxFeePerGas, // string
maxPriorityFeePerGas, // string
signature, // string
paymasterAndData, // string
}, "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
]
}

eth_estimateUserOperationGas

This endpoint will estimate the gas values for a UserOperation. The signature field is ignored and can be a dummy value, but is recommended to be of the same size as an actual signature for an accurate estimate.

Parameters

NameTypeReqDescription
UserOperationUserOperationYThe UserOperation. You can use a dummy signature but the signature must be the correct size for an accurate gas estimate.
entryPointstringYEntryPoint address that the UserOperation is intended for.

Returns

TypeDescription
preVerificationGasAmount of gas to compensate the bundler for pre-verification execution and calldata
verificationGasLimitAmount of gas to allocate for the verification step
callGasLimitAmount of gas to allocate the main execution call
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_estimateUserOperationGas",
"params": [
{
sender, // address
nonce, // uint256
initCode, // string
callData, // string
callGasLimit, // string
verificationGasLimit, // string
preVerificationGas, // string
maxFeePerGas, // string
maxPriorityFeePerGas, // string
signature, // string
paymasterAndData, // string
}, "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
]
}

Paymaster methods

pm_sponsorUserOperation

This endpoint sends a UserOperation to a paymaster for off-chain verification based on the custom gas policies set in Coinbase Developer Platform.

If approved, it returns the paymasterAndData and updated gas values, which can be appended to the UserOperation before signing.

Parameters

NameTypeReqDescription
UserOperationUserOperationYThe UserOperation. You can use a dummy signature but the signature must be the correct size for an accurate gas estimate.
entryPointstringYEntryPoint address that the UserOperation is intended for.
contextJSON objectN(Optional) For a dummy paymasterAndData response, use { "dummy" : true } as the third parameter. The Paymaster will use a dummy signature and skip the gas estimation step.

Returns

TypeDescription
paymasterAndDataSigned hex string to put as a field in eth_sendUserOperation
preVerificationGasAmount of gas to compensate the bundler for pre-verification execution and calldata
verificationGasLimitAmount of gas to allocate for the verification step
callGasLimitAmount of gas to allocate the main execution call
{
"id": 1,
"jsonrpc": "2.0",
"method": "pm_sponsorUserOperation",
"params": [
{
sender, // address
nonce, // uint256
initCode, // string
callData, // string
callGasLimit, // string
verificationGasLimit, // string
preVerificationGas, // string
maxFeePerGas, // string
maxPriorityFeePerGas, // string
}, "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
}
]
}

Was this helpful?