# eth_getUncleByBlockHashAndIndex

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

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

Returns information about an uncle of a block by hash and uncle index.

Reference: https://www.alchemy.com/docs/chains/pharos/pharos-api-endpoints/eth-get-uncle-by-block-hash-and-index

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Block hash | string | Yes | The hash of the block containing the uncle. |
| Uncle index | string | Yes | The index position of the uncle in the block's uncles array. |

## Result

**Uncle block information** (null or object): The uncle block object, or null if not found.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "eth_getUncleByBlockHashAndIndex",
  "params": [
    "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
    "0x0"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "number": "0x1b4",
    "hash": "0x5e7b81b43b5f84edbb2c3ebd92e9b1b7b6db0c6420c1a0e59b1eb542f1fdd3b2",
    "parentHash": "0x9fc6f13f4be42b93e9f7243d2e72607fbea6edb5e2f8a66e2b5b4c6f5e8c50c6",
    "nonce": "0x0000000000000000",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "logsBloom": "0x00...0",
    "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "stateRoot": "0xd7f8974fb5ac78d7c5fc5e38a69b1a65b6cdefbf207f53ca3ed49f0610f2342f",
    "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "miner": "0x0000000000000000000000000000000000000000",
    "difficulty": "0x27f07",
    "totalDifficulty": "0x27f07",
    "extraData": "0x",
    "size": "0x1f8",
    "gasLimit": "0x47e7c4",
    "gasUsed": "0x0",
    "timestamp": "0x55ba467c",
    "transactions": [],
    "uncles": []
  },
  "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_getUncleByBlockHashAndIndex",
  "params": [
    "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
    "0x0"
  ]
}'
```

### JavaScript

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

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

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

```


## OpenRPC Method Specification

```yaml
name: eth_getUncleByBlockHashAndIndex
description: Returns information about an uncle of a block by hash and uncle index.
params:
  - name: Block hash
    required: true
    description: The hash of the block containing the uncle.
    schema:
      title: 32 byte hex value
      type: string
      pattern: ^0x[0-9a-f]{64}$
  - name: Uncle index
    required: true
    description: The index position of the uncle in the block's uncles array.
    schema:
      title: hex encoded unsigned integer
      type: string
      pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
result:
  name: Uncle block information
  description: The uncle block object, or null if not found.
  schema:
    oneOf:
      - title: Not Found (null)
        type: 'null'
      - title: Block object
        type: object
        required:
          - hash
          - parentHash
          - sha3Uncles
          - miner
          - stateRoot
          - transactionsRoot
          - receiptsRoot
          - logsBloom
          - number
          - gasLimit
          - gasUsed
          - timestamp
          - extraData
          - mixHash
          - nonce
          - size
          - transactions
          - uncles
        additionalProperties: false
        properties:
          hash:
            title: Hash
            type: string
            pattern: ^0x[0-9a-f]{64}$
          parentHash:
            title: Parent block hash
            type: string
            pattern: ^0x[0-9a-f]{64}$
          sha3Uncles:
            title: Ommers hash
            type: string
            pattern: ^0x[0-9a-f]{64}$
          miner:
            title: Coinbase
            type: string
            pattern: ^0x[0-9a-fA-F]{40}$
          stateRoot:
            title: State root
            type: string
            pattern: ^0x[0-9a-f]{64}$
          transactionsRoot:
            title: Transactions root
            type: string
            pattern: ^0x[0-9a-f]{64}$
          receiptsRoot:
            title: Receipts root
            type: string
            pattern: ^0x[0-9a-f]{64}$
          logsBloom:
            title: Bloom filter
            type: string
            pattern: ^0x[0-9a-f]{512}$
          difficulty:
            title: Difficulty
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          number:
            title: Number
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          gasLimit:
            title: Gas limit
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          gasUsed:
            title: Gas used
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          timestamp:
            title: Timestamp
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          extraData:
            title: Extra data
            type: string
            pattern: ^0x[0-9a-f]*$
          mixHash:
            title: Mix hash
            type: string
            pattern: ^0x[0-9a-f]{64}$
          nonce:
            title: Nonce
            type: string
            pattern: ^0x[0-9a-f]{16}$
          baseFeePerGas:
            title: Base fee per gas
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          withdrawalsRoot:
            title: Withdrawals root
            type: string
            pattern: ^0x[0-9a-f]{64}$
          blobGasUsed:
            title: Blob gas used
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          excessBlobGas:
            title: Excess blob gas
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          parentBeaconBlockRoot:
            title: Parent Beacon Block Root
            type: string
            pattern: ^0x[0-9a-f]{64}$
          size:
            title: Block size
            type: string
            pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
          transactions:
            anyOf:
              - title: Transaction hashes
                type: array
                items:
                  title: 32 byte hex value
                  type: string
                  pattern: ^0x[0-9a-f]{64}$
              - title: Full transactions
                type: array
                items:
                  type: object
                  title: Transaction information
                  required:
                    - blockHash
                    - blockNumber
                    - from
                    - hash
                    - transactionIndex
                  unevaluatedProperties: false
                  oneOf:
                    - title: Signed 4844 Transaction
                      type: object
                      required:
                        - accessList
                        - blobVersionedHashes
                        - chainId
                        - gas
                        - input
                        - maxFeePerBlobGas
                        - maxFeePerGas
                        - maxPriorityFeePerGas
                        - nonce
                        - r
                        - s
                        - to
                        - type
                        - value
                        - yParity
                      properties:
                        type:
                          title: type
                          type: string
                          pattern: ^0x([0-9a-fA-F]?){1,2}$
                        nonce:
                          title: nonce
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        to:
                          title: to address
                          type: string
                          pattern: ^0x[0-9a-fA-F]{40}$
                        gas:
                          title: gas limit
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        value:
                          title: value
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        input:
                          title: input data
                          type: string
                          pattern: ^0x[0-9a-f]*$
                        maxPriorityFeePerGas:
                          title: max priority fee per gas
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: Maximum fee per gas the sender is willing to pay to miners in wei
                        maxFeePerGas:
                          title: max fee per gas
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei
                        maxFeePerBlobGas:
                          title: max fee per blob gas
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: The maximum total fee per gas the sender is willing to pay for blob gas in wei
                        accessList:
                          title: accessList
                          description: EIP-2930 access list
                          type: array
                          items:
                            title: Access list entry
                            type: object
                            additionalProperties: false
                            properties:
                              address:
                                title: hex encoded address
                                type: string
                                pattern: ^0x[0-9a-fA-F]{40}$
                              storageKeys:
                                type: array
                                items:
                                  title: 32 byte hex value
                                  type: string
                                  pattern: ^0x[0-9a-f]{64}$
                        blobVersionedHashes:
                          title: blobVersionedHashes
                          description: List of versioned blob hashes associated with the transaction's EIP-4844 data blobs.
                          type: array
                          items:
                            title: 32 byte hex value
                            type: string
                            pattern: ^0x[0-9a-f]{64}$
                        chainId:
                          title: chainId
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: Chain ID that this transaction is valid on.
                        yParity:
                          title: yParity
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature.
                        r:
                          title: r
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        s:
                          title: s
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                    - title: Signed 1559 Transaction
                      type: object
                      required:
                        - accessList
                        - chainId
                        - gas
                        - gasPrice
                        - input
                        - maxFeePerGas
                        - maxPriorityFeePerGas
                        - nonce
                        - r
                        - s
                        - type
                        - value
                        - yParity
                      properties:
                        type:
                          title: type
                          type: string
                          pattern: ^0x2$
                        nonce:
                          title: nonce
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        to:
                          title: to address
                          oneOf:
                            - title: Contract Creation (null)
                              type: 'null'
                            - title: Address
                              type: string
                              pattern: ^0x[0-9a-fA-F]{40}$
                        gas:
                          title: gas limit
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        value:
                          title: value
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        input:
                          title: input data
                          type: string
                          pattern: ^0x[0-9a-f]*$
                        maxPriorityFeePerGas:
                          title: max priority fee per gas
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: Maximum fee per gas the sender is willing to pay to miners in wei
                        maxFeePerGas:
                          title: max fee per gas
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei
                        gasPrice:
                          title: gas price
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: The effective gas price paid by the sender in wei. For transactions not yet included in a block, this value should be set equal to the max fee per gas. This field is DEPRECATED, please transition to using effectiveGasPrice in the receipt object going forward.
                        accessList:
                          title: accessList
                          description: EIP-2930 access list
                          type: array
                          items:
                            title: Access list entry
                            type: object
                            additionalProperties: false
                            properties:
                              address:
                                title: hex encoded address
                                type: string
                                pattern: ^0x[0-9a-fA-F]{40}$
                              storageKeys:
                                type: array
                                items:
                                  title: 32 byte hex value
                                  type: string
                                  pattern: ^0x[0-9a-f]{64}$
                        chainId:
                          title: chainId
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: Chain ID that this transaction is valid on.
                        yParity:
                          title: yParity
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature.
                        v:
                          title: v
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: For backwards compatibility, `v` is optionally provided as an alternative to `yParity`. This field is DEPRECATED and all use of it should migrate to `yParity`.
                        r:
                          title: r
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        s:
                          title: s
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                    - title: Signed 2930 Transaction
                      type: object
                      required:
                        - accessList
                        - chainId
                        - gas
                        - gasPrice
                        - input
                        - nonce
                        - r
                        - s
                        - type
                        - value
                        - yParity
                      properties:
                        type:
                          title: type
                          type: string
                          pattern: ^0x1$
                        nonce:
                          title: nonce
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        to:
                          title: to address
                          oneOf:
                            - title: Contract Creation (null)
                              type: 'null'
                            - title: Address
                              type: string
                              pattern: ^0x[0-9a-fA-F]{40}$
                        gas:
                          title: gas limit
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        value:
                          title: value
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        input:
                          title: input data
                          type: string
                          pattern: ^0x[0-9a-f]*$
                        gasPrice:
                          title: gas price
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: The gas price willing to be paid by the sender in wei
                        accessList:
                          title: accessList
                          description: EIP-2930 access list
                          type: array
                          items:
                            title: Access list entry
                            type: object
                            additionalProperties: false
                            properties:
                              address:
                                title: hex encoded address
                                type: string
                                pattern: ^0x[0-9a-fA-F]{40}$
                              storageKeys:
                                type: array
                                items:
                                  title: 32 byte hex value
                                  type: string
                                  pattern: ^0x[0-9a-f]{64}$
                        chainId:
                          title: chainId
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: Chain ID that this transaction is valid on.
                        yParity:
                          title: yParity
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature.
                        v:
                          title: v
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: For backwards compatibility, `v` is optionally provided as an alternative to `yParity`. This field is DEPRECATED and all use of it should migrate to `yParity`.
                        r:
                          title: r
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        s:
                          title: s
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                    - title: Signed Legacy Transaction
                      type: object
                      required:
                        - gas
                        - gasPrice
                        - input
                        - nonce
                        - r
                        - s
                        - type
                        - v
                        - value
                      properties:
                        type:
                          title: type
                          type: string
                          pattern: ^0x0$
                        nonce:
                          title: nonce
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        to:
                          title: to address
                          oneOf:
                            - title: Contract Creation (null)
                              type: 'null'
                            - title: Address
                              type: string
                              pattern: ^0x[0-9a-fA-F]{40}$
                        gas:
                          title: gas limit
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        value:
                          title: value
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        input:
                          title: input data
                          type: string
                          pattern: ^0x[0-9a-f]*$
                        gasPrice:
                          title: gas price
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: The gas price willing to be paid by the sender in wei
                        chainId:
                          title: chainId
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                          description: Chain ID that this transaction is valid on.
                        v:
                          title: v
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        r:
                          title: r
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                        s:
                          title: s
                          type: string
                          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                  properties:
                    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 address
                      type: string
                      pattern: ^0x[0-9a-fA-F]{40}$
                    hash:
                      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)$
          withdrawals:
            title: Withdrawals
            type: array
            items:
              type: object
              title: Validator withdrawal
              required:
                - index
                - validatorIndex
                - address
                - amount
              additionalProperties: false
              properties:
                index:
                  title: index of withdrawal
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
                validatorIndex:
                  title: index of validator that generated withdrawal
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$
                address:
                  title: recipient address for withdrawal value
                  type: string
                  pattern: ^0x[0-9a-fA-F]{40}$
                amount:
                  title: value contained in withdrawal
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]{0,31})|0$
          uncles:
            title: Uncles
            type: array
            items:
              title: 32 byte hex value
              type: string
              pattern: ^0x[0-9a-f]{64}$
examples:
  - name: eth_getUncleByBlockHashAndIndex example
    params:
      - name: Block hash
        value: '0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35'
      - name: Uncle index
        value: '0x0'
    result:
      name: Uncle block information
      value:
        number: '0x1b4'
        hash: '0x5e7b81b43b5f84edbb2c3ebd92e9b1b7b6db0c6420c1a0e59b1eb542f1fdd3b2'
        parentHash: '0x9fc6f13f4be42b93e9f7243d2e72607fbea6edb5e2f8a66e2b5b4c6f5e8c50c6'
        nonce: '0x0000000000000000'
        sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'
        logsBloom: 0x00...0
        transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'
        stateRoot: '0xd7f8974fb5ac78d7c5fc5e38a69b1a65b6cdefbf207f53ca3ed49f0610f2342f'
        receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'
        miner: '0x0000000000000000000000000000000000000000'
        difficulty: '0x27f07'
        totalDifficulty: '0x27f07'
        extraData: 0x
        size: '0x1f8'
        gasLimit: '0x47e7c4'
        gasUsed: '0x0'
        timestamp: '0x55ba467c'
        transactions: []
        uncles: []
```
