# eth_getUserOperationReceipt

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

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

Get the `UserOperationReceipt` based on the `userOpHash`.

<Note title="Limitations">
  This method retrieves and decodes userOperations from the logs of mined transactions by querying the node. If you attempt to fetch a receipt for a transaction from a distant past block, the request may be rejected by the node due to limitations on the block range size it can process.

  The default range we support is 150 blocks, however the following networks have an unlimited range.

  - Ethereum
  - Polygon
  - Base
  - Optimism
  - Worldchain
  - Arbitrum
</Note>


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

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| userOpHash | string | Yes | The `userOpHash` of the `UserOperation` to get the receipt for (as returned by `eth_sendUserOperation`). |
| tag | enum | No | The blocktag for checking the UO status. \\"pending\\" or \\"latest\\". Defaults to \\"latest\\".". |

## Result

**UserOperationReceipt** (object): `UserOperationReceipt` object representing the outcome of a `UserOperation`.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "eth_getUserOperationReceipt",
  "params": [
    "0x93c06f3f5909cc2b192713ed9bf93e3e1fde4b22fcd2466304fa404f9b80ff90"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "userOpHash": "0x77c0b560eb0b042902abc5613f768d2a6b2d67481247e9663bf4d68dec0ca122",
    "entryPoint": "0xc944E90C64B2c07662A292be6244BDf05Cda44a7",
    "sender": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    "nonce": 42,
    "paymaster": "0x7A0A0d159218E6a2f407B99173A2b12A6DDfC2a6",
    "actualGasCost": 21000,
    "actualGasUsed": 314159,
    "success": true,
    "reason": "",
    "logs": [],
    "receipt": {
      "transactionHash": "0x8fc90a6c3ee3001cdcbbb685b4fbe67b1fa2bec575b15b0395fea5540d0901ae",
      "blockHash": "0x58a945e1558810523df00490ff28cbe111b37851c44679ce5be1eeaebb4b4907",
      "blockNumber": "0xeb8822",
      "transactionIndex": "0x4e"
    },
    "status": "Mined"
  },
  "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_getUserOperationReceipt",
  "params": [
    "0x93c06f3f5909cc2b192713ed9bf93e3e1fde4b22fcd2466304fa404f9b80ff90",
    "pending"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'eth_getUserOperationReceipt',
    params: [
      '0x93c06f3f5909cc2b192713ed9bf93e3e1fde4b22fcd2466304fa404f9b80ff90',
      'pending'
    ]
  })
};

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_getUserOperationReceipt",
    "params": ["0x93c06f3f5909cc2b192713ed9bf93e3e1fde4b22fcd2466304fa404f9b80ff90", "pending"]
}
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_getUserOperationReceipt\",\n  \"params\": [\n    \"0x93c06f3f5909cc2b192713ed9bf93e3e1fde4b22fcd2466304fa404f9b80ff90\",\n    \"pending\"\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_getUserOperationReceipt\",\n  \"params\": [\n    \"0x93c06f3f5909cc2b192713ed9bf93e3e1fde4b22fcd2466304fa404f9b80ff90\",\n    \"pending\"\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_getUserOperationReceipt\",\n  \"params\": [\n    \"0x93c06f3f5909cc2b192713ed9bf93e3e1fde4b22fcd2466304fa404f9b80ff90\",\n    \"pending\"\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: eth_getUserOperationReceipt
description: |
  Get the `UserOperationReceipt` based on the `userOpHash`.

  <Note title="Limitations">
    This method retrieves and decodes userOperations from the logs of mined transactions by querying the node. If you attempt to fetch a receipt for a transaction from a distant past block, the request may be rejected by the node due to limitations on the block range size it can process.

    The default range we support is 150 blocks, however the following networks have an unlimited range.

    - Ethereum
    - Polygon
    - Base
    - Optimism
    - Worldchain
    - Arbitrum
  </Note>
params:
  - name: userOpHash
    required: true
    description: The `userOpHash` of the `UserOperation` to get the receipt for (as returned by `eth_sendUserOperation`).
    schema:
      title: 32 byte hex value
      type: string
      pattern: ^0x[0-9a-f]{64}$
  - name: tag
    required: false
    description: The blocktag for checking the UO status. \"pending\" or \"latest\". Defaults to \"latest\".".
    schema:
      type: string
      enum:
        - pending
        - latest
result:
  name: UserOperationReceipt
  description: '`UserOperationReceipt` object representing the outcome of a `UserOperation`.'
  schema:
    type: object
    required:
      - userOpHash
      - entryPoint
      - sender
      - nonce
      - paymaster
      - actualGasCost
      - actualGasUsed
      - success
      - reason
      - logs
      - receipt
      - status
    properties:
      userOpHash:
        type: string
        description: The hash of the `UserOperation`.
      entryPoint:
        type: string
        description: The EntryPoint address the request should be sent through. This MUST be one of the EntryPoints returned by the `supportedEntryPoints` RPC call.
      sender:
        type: string
        description: The account initiating the `UserOperation`.
      nonce:
        type: string
        description: The nonce used in the `UserOperation`.
      paymaster:
        type: string
        description: The paymaster used for this `UserOperation` (or empty if self-sponsored).
      actualGasCost:
        type: string
        description: The actual amount paid (by account or paymaster) for this `UserOperation`.
      actualGasUsed:
        type: string
        description: The total gas used by this `UserOperation` (including `preVerification`, `creation`, `validation`, and `execution`).
      success:
        type: boolean
        description: Indicates whether the execution completed without reverting.
      reason:
        type: string
        description: In case of revert, this is the revert reason.
      logs:
        type: array
        description: The logs generated by this `UserOperation` (not including logs of other `UserOperations` in the same bundle).
        items:
          type: string
      receipt:
        type: object
        description: The `TransactionReceipt` object for the entire bundle, not only for this `UserOperation`.
        required:
          - blockHash
          - blockNumber
          - transactionIndex
          - transactionHash
          - from
          - to
          - cumulativeGasUsed
          - gasUsed
          - contractAddress
          - logs
          - logsBloom
          - root
          - status
          - effectiveGasPrice
          - type
        properties:
          blockHash:
            type: string
            description: 32 Bytes - The hash of the block where the given transaction was included.
          blockNumber:
            type: string
            description: The number of the block where the given transaction was included.
          transactionIndex:
            type: string
            description: The index of the transaction in the block.
          transactionHash:
            type: string
            description: 32 Bytes - The hash of the transaction.
          from:
            type: string
            description: 20 Bytes - address of the sender.
          to:
            type: string
            description: 20 Bytes - address of the receiver. Null when its a contract creation transaction.
          cumulativeGasUsed:
            type: string
            description: The total amount of gas used when this transaction was executed in the block.
          gasUsed:
            type: string
            description: The amount of gas used by this specific transaction alone.
          contractAddress:
            type: string
            description: 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null.
          logs:
            type: array
            description: Array of `Log` objects.
            required:
              - blockHash
              - blockNumber
              - transactionIndex
              - address
              - logIndex
              - data
              - removed
              - topics
              - transactionHash
            items:
              type: object
              properties:
                blockHash:
                  type: string
                  description: hash of the block where this log was in. `null` when its pending log.
                blockNumber:
                  type: string
                  description: The block num.
                transactionIndex:
                  type: integer
                  description: Integer of the transactions index position log was created from. null when its pending log.
                address:
                  type: string
                  description: 20 Bytes - address from which this log originated.
                logIndex:
                  type: integer
                  description: Integer of the log index position in the block. null when its pending log.
                data:
                  type: string
                  description: Contains one or more 32 Bytes non-indexed arguments of the log.
                removed:
                  type: boolean
                  description: '`true` when the log was removed, due to a chain reorganization. `false` if its a valid log.'
                topics:
                  type: array
                  description: 'Array of zero to four 32 Bytes `DATA` of indexed log arguments. In solidity: The first topic is the hash of the signature of the event (e.g. `Deposit(address,bytes32,uint256)`), except you declare the event with the anonymous specifier.'
                  items:
                    type: string
                transactionHash:
                  type: string
                  description: Hash of the transactions this log was created from. null when its pending log.
          logsBloom:
            type: string
            description: 256 Bytes - Bloom filter for light clients to quickly retrieve related logs.
          root:
            type: string
            description: 32 bytes of post-transaction stateroot. (pre Byzantium hard fork at block 4,370,000).
          status:
            type: integer
            description: Either `1` (success) or `0` (failure). (post Byzantium hard fork at block 4,370,000).
          effectiveGasPrice:
            type: string
            description: The actual price per unit of gas paid by the sender.
          type:
            type: string
            description: The type of the transaction.
      status:
        type: string
        description: The status of the `UserOperation`. Could be \"Mined\" or \"Preconfirmed\"."
examples:
  - name: eth_getUserOperationReceipt example
    params:
      - name: userOpHash
        value: '0x93c06f3f5909cc2b192713ed9bf93e3e1fde4b22fcd2466304fa404f9b80ff90'
    result:
      name: UserOperationReceipt
      value:
        userOpHash: '0x77c0b560eb0b042902abc5613f768d2a6b2d67481247e9663bf4d68dec0ca122'
        entryPoint: '0xc944E90C64B2c07662A292be6244BDf05Cda44a7'
        sender: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
        nonce: 42
        paymaster: '0x7A0A0d159218E6a2f407B99173A2b12A6DDfC2a6'
        actualGasCost: 21000
        actualGasUsed: 314159
        success: true
        reason: ''
        logs: []
        receipt:
          transactionHash: '0x8fc90a6c3ee3001cdcbbb685b4fbe67b1fa2bec575b15b0395fea5540d0901ae'
          blockHash: '0x58a945e1558810523df00490ff28cbe111b37851c44679ce5be1eeaebb4b4907'
          blockNumber: '0xeb8822'
          transactionIndex: '0x4e'
        status: Mined
```
