eth_signUserOperation method allows you to sign an ERC-4337 UserOperation using your client’s MPC key without broadcasting it to the network. The signed UserOperation can then be submitted through a separate backend such as Pimlico or a custom bundler endpoint.
Prerequisites
Before usingeth_signUserOperation, ensure that:
- Your organization has Account Abstraction enabled. See the Account Abstraction guide for setup instructions.
- Your client was created with
isAccountAbstracted: truevia the Create a new client endpoint. - Your client has a wallet created and backed up.
Signing a UserOperation
Use therequest method with the eth_signUserOperation RPC method. The params array takes a single object with standard Ethereum transaction fields.
The
chainId must be a CAIP-2 compliant Chain ID for a supported Account Abstraction network.Transaction Parameters
The params object supports the following fields:| Parameter | Type | Required | Description |
|---|---|---|---|
to | String | Yes | The recipient or contract address |
value | String | No | Value in wei (hex-encoded) |
data | String | No | Calldata (hex-encoded) |
gas | String | No | Gas limit (hex-encoded) |
maxFeePerGas | String | No | Max fee per gas for EIP-1559 (hex-encoded) |
maxPriorityFeePerGas | String | No | Max priority fee for EIP-1559 (hex-encoded) |
nonce | String | No | Transaction nonce (hex-encoded) |
Response
The method returns aPortalProviderResponse where result is a hex-encoded JSON string containing the signed UserOperation. You can decode this result and submit it to a bundler of your choice.
EIP-1559 Gas Parameters
You can specify EIP-1559 gas parameters for finer control over fees:Error Handling
| Error | Description |
|---|---|
METHOD_UNSUPPORTED | The client does not have Account Abstraction enabled |
NOT_INITIALIZED | Portal was not initialized |
RPC_ERROR | The RPC call returned an error |