# eth_sendUserOperation

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://eth-mainnet.g.alchemy.com/v2/{apiKey}

Sends a `UserOperation` to the given EVM network.


Reference: https://www.alchemy.com/docs/wallets/api-reference/bundler-api/bundler-api-endpoints/eth-send-user-operation

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| UserOperation | object | Yes | The UserOperation object. This can be a v0.6, v0.7, or v0.8 user operation, but MUST match the version of the entry point at the address of the second parameter. |
| Entrypoint address | string | Yes | The EntryPoint address the request should be sent through. This MUST be one of the EntryPoints returned by the `supportedEntryPoints` RPC call. |

## Result

**userOpHash** (string): The calculated `userOpHash` for the `UserOperation`.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "eth_sendUserOperation",
  "params": [
    {
      "sender": "0x...",
      "nonce": "0x...",
      "callData": "0x..."
    },
    "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "result": "0x1234...5678"
  },
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://eth-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_sendUserOperation",
  "params": [
    {
      "sender": "string",
      "nonce": "string",
      "initCode": "string",
      "callData": "string",
      "callGasLimit": "string",
      "verificationGasLimit": "string",
      "preVerificationGas": "string",
      "maxFeePerGas": "string",
      "maxPriorityFeePerGas": "string",
      "signature": "string",
      "paymasterAndData": "string",
      "eip7702Auth": {
        "chain_id": "string",
        "address": "string",
        "nonce": "string",
        "y_parity": "string",
        "r": "string",
        "s": "string"
      }
    },
    "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'eth_sendUserOperation',
    params: [
      {
        sender: 'string',
        nonce: 'string',
        initCode: 'string',
        callData: 'string',
        callGasLimit: 'string',
        verificationGasLimit: 'string',
        preVerificationGas: 'string',
        maxFeePerGas: 'string',
        maxPriorityFeePerGas: 'string',
        signature: 'string',
        paymasterAndData: 'string',
        eip7702Auth: {
          chain_id: 'string',
          address: 'string',
          nonce: 'string',
          y_parity: 'string',
          r: 'string',
          s: 'string'
        }
      },
      '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789'
    ]
  })
};

fetch('https://eth-mainnet.g.alchemy.com/v2/docs-demo', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://eth-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_sendUserOperation",
    "params": [
        {
            "sender": "string",
            "nonce": "string",
            "initCode": "string",
            "callData": "string",
            "callGasLimit": "string",
            "verificationGasLimit": "string",
            "preVerificationGas": "string",
            "maxFeePerGas": "string",
            "maxPriorityFeePerGas": "string",
            "signature": "string",
            "paymasterAndData": "string",
            "eip7702Auth": {
                "chain_id": "string",
                "address": "string",
                "nonce": "string",
                "y_parity": "string",
                "r": "string",
                "s": "string"
            }
        },
        "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
    ]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://eth-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_sendUserOperation\",\n  \"params\": [\n    {\n      \"sender\": \"string\",\n      \"nonce\": \"string\",\n      \"initCode\": \"string\",\n      \"callData\": \"string\",\n      \"callGasLimit\": \"string\",\n      \"verificationGasLimit\": \"string\",\n      \"preVerificationGas\": \"string\",\n      \"maxFeePerGas\": \"string\",\n      \"maxPriorityFeePerGas\": \"string\",\n      \"signature\": \"string\",\n      \"paymasterAndData\": \"string\",\n      \"eip7702Auth\": {\n        \"chain_id\": \"string\",\n        \"address\": \"string\",\n        \"nonce\": \"string\",\n        \"y_parity\": \"string\",\n        \"r\": \"string\",\n        \"s\": \"string\"\n      }\n    },\n    \"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://eth-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_sendUserOperation\",\n  \"params\": [\n    {\n      \"sender\": \"string\",\n      \"nonce\": \"string\",\n      \"initCode\": \"string\",\n      \"callData\": \"string\",\n      \"callGasLimit\": \"string\",\n      \"verificationGasLimit\": \"string\",\n      \"preVerificationGas\": \"string\",\n      \"maxFeePerGas\": \"string\",\n      \"maxPriorityFeePerGas\": \"string\",\n      \"signature\": \"string\",\n      \"paymasterAndData\": \"string\",\n      \"eip7702Auth\": {\n        \"chain_id\": \"string\",\n        \"address\": \"string\",\n        \"nonce\": \"string\",\n        \"y_parity\": \"string\",\n        \"r\": \"string\",\n        \"s\": \"string\"\n      }\n    },\n    \"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://eth-mainnet.g.alchemy.com/v2/docs-demo");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_sendUserOperation\",\n  \"params\": [\n    {\n      \"sender\": \"string\",\n      \"nonce\": \"string\",\n      \"initCode\": \"string\",\n      \"callData\": \"string\",\n      \"callGasLimit\": \"string\",\n      \"verificationGasLimit\": \"string\",\n      \"preVerificationGas\": \"string\",\n      \"maxFeePerGas\": \"string\",\n      \"maxPriorityFeePerGas\": \"string\",\n      \"signature\": \"string\",\n      \"paymasterAndData\": \"string\",\n      \"eip7702Auth\": {\n        \"chain_id\": \"string\",\n        \"address\": \"string\",\n        \"nonce\": \"string\",\n        \"y_parity\": \"string\",\n        \"r\": \"string\",\n        \"s\": \"string\"\n      }\n    },\n    \"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\"\n  ]\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## OpenRPC Method Specification

```yaml
name: eth_sendUserOperation
description: |
  Sends a `UserOperation` to the given EVM network.
params:
  - name: UserOperation
    required: true
    description: The UserOperation object. This can be a v0.6, v0.7, or v0.8 user operation, but MUST match the version of the entry point at the address of the second parameter.
    schema:
      oneOf:
        - type: object
          title: User Operation v0.6
          properties:
            sender:
              title: hex encoded address
              type: string
              pattern: ^0x[0-9a-fA-F]{40}$
              description: The account making the operation
            nonce:
              description: Anti-replay parameter; used as salt for first-time account creation
              title: hex encoded unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
            initCode:
              description: The initCode of the account (needed if the account is not yet on-chain and needs creation)
              title: hex encoded bytes
              type: string
              pattern: ^0x[0-9a-f]*$
            callData:
              description: Encoded data for the primary function call or operation
              title: hex encoded bytes
              type: string
              pattern: ^0x[0-9a-f]*$
            callGasLimit:
              description: Gas allocated for the main execution call
              title: hex encoded 64 bit unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
            verificationGasLimit:
              description: Gas allocated for verification
              title: hex encoded 64 bit unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
            preVerificationGas:
              description: Gas for pre-verification execution and calldata
              title: hex encoded 64 bit unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
            maxFeePerGas:
              description: Maximum fee per gas (EIP-1559)
              title: hex encoded 64 bit unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
            maxPriorityFeePerGas:
              description: Max priority fee per gas (EIP-1559)
              title: hex encoded 64 bit unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
            signature:
              description: Data passed during verification
              title: hex encoded bytes (any case)
              type: string
              pattern: ^0x[0-9a-fA-F]*$
            paymasterAndData:
              description: Paymaster address and extra data
              title: hex encoded bytes
              type: string
              pattern: ^0x[0-9a-f]*$
            eip7702Auth:
              description: The authorization tuple that an EOA account delegates to in EIP-7702
              title: Eip 7702 Auth
              type: object
              properties:
                chain_id:
                  description: The chain Id of the authorization
                  title: hex encoded 64 bit unsigned integer
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
                address:
                  title: hex encoded address
                  type: string
                  pattern: ^0x[0-9a-fA-F]{40}$
                  description: The address of the authorization
                nonce:
                  description: The nonce for the authorization
                  title: hex encoded 64 bit unsigned integer
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
                y_parity:
                  description: Y parity of signed authorizzation tuple
                  title: hex encoded unsigned integer
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                r:
                  description: R of signed authorizzation tuple
                  title: hex encoded 256 bit unsigned integer
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]{0,31})|0$
                s:
                  description: S of signed authorizzation tuple
                  title: hex encoded 256 bit unsigned integer
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]{0,31})|0$
        - type: object
          title: User Operation v0.7 / v0.8
          properties:
            sender:
              title: hex encoded address
              type: string
              pattern: ^0x[0-9a-fA-F]{40}$
              description: Account initiating operation
            nonce:
              description: Account nonce or creation salt
              title: hex encoded unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
            callData:
              description: Data for operation call
              title: hex encoded bytes
              type: string
              pattern: ^0x[0-9a-f]*$
            callGasLimit:
              description: Gas allocated for call
              title: hex encoded 64 bit unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
            verificationGasLimit:
              description: Gas allocated for verification
              title: hex encoded 64 bit unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
            maxFeePerGas:
              description: Max fee per gas (EIP-1559)
              title: hex encoded 64 bit unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
            maxPriorityFeePerGas:
              description: Priority fee per gas (EIP-1559)
              title: hex encoded 64 bit unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
            paymaster:
              title: hex encoded address
              type: string
              pattern: ^0x[0-9a-fA-F]{40}$
              description: Paymaster contract address
            paymasterData:
              description: Data for paymaster
              title: hex encoded bytes
              type: string
              pattern: ^0x[0-9a-f]*$
            paymasterVerificationGasLimit:
              type: string
              description: The gas limit for paymaster verification.
            factory:
              title: hex encoded address
              type: string
              pattern: ^0x[0-9a-fA-F]{40}$
              description: The account factory address (needed if and only if the account is not yet on-chain and needs to be created)
            factoryData:
              description: Data for the account factory (only if the account factory exists)
              title: hex encoded bytes
              type: string
              pattern: ^0x[0-9a-f]*$
            preVerificationGas:
              description: The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata
              title: hex encoded 64 bit unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
            paymasterPostOpGasLimit:
              description: The amount of gas to allocate for the paymaster post-op code (only if a paymaster exists)
              title: hex encoded 64 bit unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
            signature:
              description: Data passed into the account along with the nonce during the verification step
              title: hex encoded bytes (any case)
              type: string
              pattern: ^0x[0-9a-fA-F]*$
            eip7702Auth:
              description: The authorization tuple that an EOA account delegates to in EIP-7702
              title: Eip 7702 Auth
              type: object
              properties:
                chain_id:
                  description: The chain Id of the authorization
                  title: hex encoded 64 bit unsigned integer
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
                address:
                  title: hex encoded address
                  type: string
                  pattern: ^0x[0-9a-fA-F]{40}$
                  description: The address of the authorization
                nonce:
                  description: The nonce for the authorization
                  title: hex encoded 64 bit unsigned integer
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
                y_parity:
                  description: Y parity of signed authorizzation tuple
                  title: hex encoded unsigned integer
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                r:
                  description: R of signed authorizzation tuple
                  title: hex encoded 256 bit unsigned integer
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]{0,31})|0$
                s:
                  description: S of signed authorizzation tuple
                  title: hex encoded 256 bit unsigned integer
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]{0,31})|0$
  - name: Entrypoint address
    required: true
    description: The EntryPoint address the request should be sent through. This MUST be one of the EntryPoints returned by the `supportedEntryPoints` RPC call.
    schema:
      title: hex encoded address
      type: string
      pattern: ^0x[0-9a-fA-F]{40}$
result:
  name: userOpHash
  description: The calculated `userOpHash` for the `UserOperation`.
  schema:
    type: string
    format: hex
examples:
  - name: eth_sendUserOperation example
    params:
      - name: UserOperation
        value:
          sender: 0x...
          nonce: 0x...
          callData: 0x...
      - name: Entrypoint address
        value: '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789'
    result:
      name: userOpHash
      value:
        result: 0x1234...5678
```
