# eth_getTransactionReceipt

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

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

Returns the receipt of a transaction by transaction hash.

Reference: https://www.alchemy.com/docs/chains/pharos/pharos-api-endpoints/eth-get-transaction-receipt

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Transaction hash | string | Yes | The hash of the transaction for which to get the receipt. |

## Result

**Receipt information** (null or object): The transaction receipt object containing various properties of the transaction receipt.

## Example

### Request

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

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "blockHash": "0xe7212a92cfb9b06addc80dec2a0dfae9ea94fd344efeb157c41e12994fcad60a",
    "blockNumber": "0x50",
    "contractAddress": null,
    "cumulativeGasUsed": "0x5208",
    "from": "0x627306090abab3a6e1400e9345bc60c78a8bef57",
    "gasUsed": "0x5208",
    "effectiveGasPrice": "0x1",
    "logs": [],
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "status": "0x1",
    "to": "0xf17f52151ebef6c7334fad080c5704d77216b732",
    "transactionHash": "0x504ce587a65bdbdb6414a0c6c16d86a04dd79bfcc4f2950eec9634b30ce5370f",
    "transactionIndex": "0x0",
    "type": "0x0"
  },
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://pharos-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getTransactionReceipt",
  "params": [
    "0x504ce587a65bdbdb6414a0c6c16d86a04dd79bfcc4f2950eec9634b30ce5370f"
  ]
}'
```

### JavaScript

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

fetch('https://pharos-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://pharos-mainnet.g.alchemy.com/v2/docs-demo"

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_getTransactionReceipt",
    "params": ["0x504ce587a65bdbdb6414a0c6c16d86a04dd79bfcc4f2950eec9634b30ce5370f"]
}
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://pharos-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_getTransactionReceipt\",\n  \"params\": [\n    \"0x504ce587a65bdbdb6414a0c6c16d86a04dd79bfcc4f2950eec9634b30ce5370f\"\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://pharos-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"eth_getTransactionReceipt\",\n  \"params\": [\n    \"0x504ce587a65bdbdb6414a0c6c16d86a04dd79bfcc4f2950eec9634b30ce5370f\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://pharos-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_getTransactionReceipt\",\n  \"params\": [\n    \"0x504ce587a65bdbdb6414a0c6c16d86a04dd79bfcc4f2950eec9634b30ce5370f\"\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: eth_getTransactionReceipt
description: Returns the receipt of a transaction by transaction hash.
params:
  - name: Transaction hash
    required: true
    description: The hash of the transaction for which to get the receipt.
    schema:
      title: 32 byte hex value
      type: string
      pattern: ^0x[0-9a-f]{64}$
result:
  name: Receipt information
  description: The transaction receipt object containing various properties of the transaction receipt.
  schema:
    oneOf:
      - title: Not Found (null)
        type: 'null'
      - type: object
        title: Receipt information
        required:
          - blockHash
          - blockNumber
          - from
          - cumulativeGasUsed
          - gasUsed
          - logs
          - logsBloom
          - transactionHash
          - transactionIndex
          - effectiveGasPrice
        additionalProperties: false
        properties:
          type:
            title: type
            type: string
            pattern: ^0x([0-9a-fA-F]?){1,2}$
          transactionHash:
            title: transaction hash
            type: string
            pattern: ^0x[0-9a-f]{64}$
          transactionIndex:
            title: transaction index
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          blockHash:
            title: block hash
            type: string
            pattern: ^0x[0-9a-f]{64}$
          blockNumber:
            title: block number
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          from:
            title: from
            type: string
            pattern: ^0x[0-9a-fA-F]{40}$
          to:
            title: to
            description: Address of the receiver or null in a contract creation transaction.
            oneOf:
              - title: Contract Creation (null)
                type: 'null'
              - title: Recipient Address
                type: string
                pattern: ^0x[0-9a-fA-F]{40}$
          cumulativeGasUsed:
            title: cumulative gas used
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
            description: The sum of gas used by this transaction and all preceding transactions in the same block.
          gasUsed:
            title: gas used
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
            description: The amount of gas used for this specific transaction alone.
          blobGasUsed:
            title: blob gas used
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
            description: The amount of blob gas used for this specific transaction. Only specified for blob transactions as defined by EIP-4844.
          contractAddress:
            title: contract address
            description: The contract address created, if the transaction was a contract creation, otherwise null.
            oneOf:
              - title: hex encoded address
                type: string
                pattern: ^0x[0-9a-fA-F]{40}$
              - title: 'Null'
                type: 'null'
          logs:
            title: logs
            type: array
            items:
              title: log
              type: object
              required:
                - transactionHash
              additionalProperties: false
              properties:
                removed:
                  title: removed
                  type: boolean
                logIndex:
                  title: log index
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                transactionIndex:
                  title: transaction index
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                transactionHash:
                  title: transaction hash
                  type: string
                  pattern: ^0x[0-9a-f]{64}$
                blockHash:
                  title: block hash
                  type: string
                  pattern: ^0x[0-9a-f]{64}$
                blockNumber:
                  title: block number
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                address:
                  title: address
                  type: string
                  pattern: ^0x[0-9a-fA-F]{40}$
                data:
                  title: data
                  type: string
                  pattern: ^0x[0-9a-f]*$
                topics:
                  title: topics
                  type: array
                  items:
                    title: 32 hex encoded bytes
                    type: string
                    pattern: ^0x[0-9a-f]{64}$
          logsBloom:
            title: logs bloom
            type: string
            pattern: ^0x[0-9a-f]{512}$
          root:
            title: state root
            type: string
            pattern: ^0x[0-9a-f]{64}$
            description: The post-transaction state root. Only specified for transactions included before the Byzantium upgrade.
          status:
            title: status
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
            description: Either 1 (success) or 0 (failure). Only specified for transactions included after the Byzantium upgrade.
          effectiveGasPrice:
            title: effective gas price
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
            description: The actual value per gas deducted from the sender's account. Before EIP-1559, this is equal to the transaction's gas price. After, it is equal to baseFeePerGas + min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas).
          blobGasPrice:
            title: blob gas price
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
            description: The actual value per gas deducted from the sender's account for blob gas. Only specified for blob transactions as defined by EIP-4844.
examples:
  - name: eth_getTransactionReceipt example
    params:
      - name: Transaction hash
        value: '0x504ce587a65bdbdb6414a0c6c16d86a04dd79bfcc4f2950eec9634b30ce5370f'
    result:
      name: Receipt information
      value:
        blockHash: '0xe7212a92cfb9b06addc80dec2a0dfae9ea94fd344efeb157c41e12994fcad60a'
        blockNumber: '0x50'
        contractAddress: null
        cumulativeGasUsed: '0x5208'
        from: '0x627306090abab3a6e1400e9345bc60c78a8bef57'
        gasUsed: '0x5208'
        effectiveGasPrice: '0x1'
        logs: []
        logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
        status: '0x1'
        to: '0xf17f52151ebef6c7334fad080c5704d77216b732'
        transactionHash: '0x504ce587a65bdbdb6414a0c6c16d86a04dd79bfcc4f2950eec9634b30ce5370f'
        transactionIndex: '0x0'
        type: '0x0'
```
