---
title: "eth_getBlockByNumber"
description: "Returns information about a block by block number (Gnosis Chiado)"
url: "https://blockreq.com/docs/build/api-reference/gnosis-chiado/eth_getBlockByNumber/"
---

# eth_getBlockByNumber

**Network:** Gnosis Chiado · Testnet · Chain ID `10200` (`0x27d8`)

**Counts as 1 request.** See [Request Counting](https://blockreq.com/docs/pricing/request-counting/index.md).

Returns information about a block by block number.

## Parameters

1. `QUANTITY|TAG` — Integer of a block number, or the string `"earliest"`, `"latest"`, `"safe"`, `"finalized"`, or `"pending"`.
2. `Boolean` — If `true`, returns full transaction objects; if `false`, returns only transaction hashes.

## Returns

`Object|null` — A block object, or `null` when no block was found.

| Field         | Type     | Description                   |
| ------------- | -------- | ----------------------------- |
| number        | QUANTITY | Block number                  |
| hash          | DATA     | Block hash                    |
| parentHash    | DATA     | Parent block hash             |
| timestamp     | QUANTITY | Unix timestamp                |
| gasUsed       | QUANTITY | Gas used                      |
| gasLimit      | QUANTITY | Gas limit                     |
| baseFeePerGas | QUANTITY | Base fee (EIP-1559)           |
| transactions  | Array    | Transaction hashes or objects |

## Request

```json
{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": ["latest", false],
  "id": 1
}
```

## Response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "number": "0x134e82a",
    "hash": "0xabc...def",
    "parentHash": "0x123...456",
    "timestamp": "0x65a1b2c3",
    "gasUsed": "0x1234",
    "gasLimit": "0x1c9c380",
    "baseFeePerGas": "0x3b9aca00",
    "transactions": ["0x..."]
  }
}
```

## Code Examples

**cURL**

```bash
curl -X POST https://gnosis-chiado-rpc.blockreq.com/v1/rpc/public \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}'
```

**TypeScript**

```typescript
const response = await fetch("https://gnosis-chiado-rpc.blockreq.com/v1/rpc/public", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": [
    "latest",
    false
  ],
  "id": 1
}),
});
const data = await response.json();
console.log(data.result);
```

**Python**

```python
import requests

response = requests.post(
    "https://gnosis-chiado-rpc.blockreq.com/v1/rpc/public",
    json={
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": [
    "latest",
    false
  ],
  "id": 1
}
)
print(response.json()["result"])
```

**Go**

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)

func main() {
	payload := []byte(`{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}`)
	resp, err := http.Post(
		"https://gnosis-chiado-rpc.blockreq.com/v1/rpc/public",
		"application/json",
		bytes.NewBuffer(payload),
	)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := io.ReadAll(resp.Body)
	var result map[string]interface{}
	json.Unmarshal(body, &result)
	fmt.Println(result["result"])
}
```

**viem**

```typescript
import { createPublicClient, http } from "viem";

const client = createPublicClient({
  transport: http("https://gnosis-chiado-rpc.blockreq.com/v1/rpc/public"),
});

const result = await client.request({
  method: "eth_getBlockByNumber",
  params: ["latest",false],
});
console.log(result);
```

**Foundry**

```bash
cast rpc --rpc-url https://gnosis-chiado-rpc.blockreq.com/v1/rpc/public eth_getBlockByNumber latest false
```

**Hardhat**

```javascript
const { ethers } = require("hardhat");

async function main() {
  const provider = new ethers.JsonRpcProvider("https://gnosis-chiado-rpc.blockreq.com/v1/rpc/public");
  const result = await provider.send("eth_getBlockByNumber", ["latest",false]);
  console.log(result);
}

main();
```
