# eth_getBlockReceipts - Somnia

> Example code for the eth_getBlockReceipts JSON-RPC method. Complete guide on how to use eth_getBlockReceipts JSON-RPC in GetBlock Web3 documentation.

This method returns all transaction receipts for a given block on the Somnia network. This is efficient for indexing entire blocks of transaction data.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| blockNumber | string | Yes | Block number (hex) or "latest" |

## Request Example

#### cURL

```bash
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "eth_getBlockReceipts",
  "params": ["latest"]
}'
```

#### Axios

```javascript
import axios from 'axios';

const data = JSON.stringify({
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "eth_getBlockReceipts",
  "params": ["latest"]
});

const config = {
    method: 'post',
    url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers: {
        'Content-Type': 'application/json'
    },
    data: data
};

axios(config)
    .then(response => console.log(JSON.stringify(response.data)))
    .catch(error => console.log(error));
```

#### Request

```python
import requests
import json

url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"

payload = json.dumps({
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "eth_getBlockReceipts",
  "params": ["latest"]
}})

headers = {
    'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=payload)
print(response.text)
```

#### Rust

```rust
use reqwest::header;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new();
    
    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header(header::CONTENT_TYPE, "application/json")
        .body(r#"{
          "jsonrpc": "2.0",
          "id": "getblock.io",
          "method": "eth_getBlockReceipts",
          "params": ["latest"]
        }"#)
        .send()
        .await?;
    
    println!("{}", response.text().await?);
    Ok(())
}
```

## Response Example

#### Response (JSON)

```json
{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "result": [
    {
      "transactionHash": "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b",
      "status": "0x1",
      "gasUsed": "0x5208",
      "logs": []
    }
  ]
}
```

## Use Cases

* Block indexing services
* Batch receipt retrieval
* Analytics and monitoring
* Building block explorers

## 

## SDK Integration

#### Ethers.js

#### Ethers.js

```javascript
const { ethers } = require('ethers');
const provider = new ethers.JsonRpcProvider('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');
const receipts = await provider.send('eth_getBlockReceipts', ['latest']);
console.log(receipts);
```
