# eth_getUncleCountByBlockNumber

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

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

Returns the number of uncles in a block matching the given block number.

Reference: https://www.alchemy.com/docs/chains/monad/monad-api-endpoints/eth-get-uncle-count-by-block-number

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Block number or tag | string or enum | Yes | The block number or special tags like 'latest', 'earliest', or 'pending'. |

## Result

**Uncle count** (null or string): The number of uncle blocks as a hexadecimal string.

## Example

### Request

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

### Response

```json
{
  "jsonrpc": "2.0",
  "result": "0x1",
  "id": 1
}
```

## Code Examples

### cURL

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

### JavaScript

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

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

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

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

### C#

```csharp
using RestSharp;


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

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

```


## OpenRPC Method Specification

```yaml
name: eth_getUncleCountByBlockNumber
description: Returns the number of uncles in a block matching the given block number.
params:
  - name: Block number or tag
    required: true
    description: The block number or special tags like 'latest', 'earliest', or 'pending'.
    schema:
      title: Block number or tag
      oneOf:
        - title: Block number
          type: string
          pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
        - title: Block tag
          type: string
          enum:
            - earliest
            - finalized
            - safe
            - latest
            - pending
          description: '`earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; `pending`: A sample next block built by the client on top of `latest` and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error'
result:
  name: Uncle count
  description: The number of uncle blocks as a hexadecimal string.
  schema:
    oneOf:
      - title: Not Found (null)
        type: 'null'
      - title: Uncle count
        type: string
        pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
examples:
  - name: eth_getUncleCountByBlockNumber example
    params:
      - name: Block number or tag
        value: '0xe8'
    result:
      name: Uncle count
      value: '0x1'
```
