# starknet_getBlockWithReceipts

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

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

Returns detailed block information, including full transactions and receipts, corresponding to the provided block ID.

Reference: https://www.alchemy.com/docs/chains/starknet/starknet-api-endpoints/starknet-get-block-with-receipts

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| block_id | object or enum | Yes | The hash of the requested block, the block number (height) of the requested block, or a block tag (latest or pending) |

## Result

**result** (object): The result object which can be one of the following object

## Code Examples

### cURL

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

### JavaScript

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

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

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

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

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://starknet-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\": \"starknet_getBlockWithReceipts\",\n  \"params\": [\n    {\n      \"block_hash\": \"string\"\n    }\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: starknet_getBlockWithReceipts
description: Returns detailed block information, including full transactions and receipts, corresponding to the provided block ID.
paramStructure: by-name
params:
  - name: block_id
    description: The hash of the requested block, the block number (height) of the requested block, or a block tag (latest or pending)
    required: true
    schema:
      title: Block id
      description: Block hash, number or tag
      oneOf:
        - title: Block hash
          type: object
          required:
            - block_hash
          properties:
            block_hash:
              title: Block hash
              description: The hash identifying a block
              type: string
              pattern: ^0x(0|[a-fA-F1-9]{1}[a-fA-F0-9]{0,62})$
        - title: Block number
          type: object
          required:
            - block_number
          properties:
            block_number:
              title: Block number
              description: The block's number (its height)
              type: integer
              minimum: 0
        - title: Block tag
          description: A tag specifying a dynamic reference to a block
          type: string
          enum:
            - latest
            - pending
result:
  name: result
  description: The result object which can be one of the following object
  schema:
    type: object
    title: BLOCK_WITH_RECEIPTS
    properties:
      status:
        type: string
        description: The block status, which can be one of - 'PENDING', 'ACCEPTED_ON_L2', 'ACCEPTED_ON_L1', 'REJECTED'
      block_hash:
        type: string
        description: The block hash
      parent_hash:
        type: string
        description: The parent block hash
      block_number:
        type: string
        description: The block number (its height)
      new_root:
        type: string
        description: The new global state root
      timestamp:
        type: integer
        description: The time in which the block was created, encoded in Unix time
      sequencer_address:
        type: string
        description: The StarkNet identity of the sequencer submitting this block
      l1_gas_price:
        type: object
        properties:
          price_in_fri:
            type: string
            description: The price of one unit of the given resource, denominated in fri (10^-18 strk)
          price_in_wei:
            type: string
            description: The price of one unit of the given resource, denominated in wei
      l1_data_gas_price:
        type: object
        properties:
          price_in_fri:
            type: string
            description: The price of one unit of the given resource, denominated in fri (10^-18 strk)
          price_in_wei:
            type: string
            description: The price of one unit of the given resource, denominated in wei
      l1_da_mode:
        type: string
        description: It specifies whether the data of this block is published via blob data or calldata. It can be one of - 'BLOB' or 'CALLDATA'
      starknet_version:
        type: string
        description: The semver of the current Starknet protocol
      transactions:
        type: object
        properties:
          transaction:
            type: object
            oneOf:
              - type: object
                title: INVOKE_TXN_V3
                properties:
                  type:
                    type: string
                    description: The type of transaction. It can take only one value - 'INVOKE'
                  sender_address:
                    type: string
                    description: The sender address
                  calldata:
                    type: array
                    description: The parameters passed to the constructor
                  version:
                    type: string
                    description: The version of the transaction scheme
                  signature:
                    type: string
                    description: The signature associated with the transaction
                  nonce:
                    type: string
                    description: The nonce value
                  resource_bounds:
                    type: object
                    properties:
                      l1_gas:
                        type: object
                        description: The max amount and max price per unit of L1 gas used in this tx
                        properties:
                          max_amount:
                            type: string
                            description: The max amount of the resource that can be used in the tx
                          max_price_per_unit:
                            type: string
                            description: The max price per unit of this resource for this tx
                      l2_gas:
                        type: object
                        description: The max amount and max price per unit of L2 gas used in this tx
                        properties:
                          max_amount:
                            type: string
                            description: The max amount of the resource that can be used in the tx
                          max_price_per_unit:
                            type: string
                            description: The max price per unit of this resource for this tx
                  tip:
                    type: string
                    description: The tip for the transaction
                  paymaster_data:
                    type: array
                    description: The data needed to allow the paymaster to pay for the transaction in native tokens
                  account_deployment_data:
                    type: array
                    description: The data needed to deploy the account contract from which this tx will be initiated
                  nonce_data_availability_mode:
                    type: string
                    description: The storage domain of the account's nonce (an account has a nonce per DA mode). It can be one of 'L1' or 'L2'
                  fee_data_availability_mode:
                    type: string
                    description: The storage domain of the account's balance from which fee will be charged. It can be one of 'L1' or 'L2'
              - type: object
                title: DECLARE_TXN_V3
                properties:
                  type:
                    type: string
                    description: The type of transaction. It can take only one value - 'DECLARE'
                  sender_address:
                    type: string
                    description: The address of the account contract sending the declaration transaction
                  compiled_class_hash:
                    type: string
                    description: The hash of the Cairo assembly resulting from the Sierra compilation
                  version:
                    type: string
                    description: The version of the transaction scheme
                  signature:
                    type: string
                    description: The signature associated with the transaction
                  nonce:
                    type: string
                    description: The nonce value
                  class_hash:
                    type: string
                    description: The hash of the declared class
                  resource_bounds:
                    type: object
                    properties:
                      l1_gas:
                        type: object
                        properties:
                          max_amount:
                            type: string
                          max_price_per_unit:
                            type: string
                      l2_gas:
                        type: object
                        properties:
                          max_amount:
                            type: string
                          max_price_per_unit:
                            type: string
                  tip:
                    type: string
                    description: The tip for the transaction
                  paymaster_data:
                    type: array
                    description: Data needed to allow the paymaster to pay for the transaction in native tokens
                  account_deployment_data:
                    type: array
                    description: Data needed to deploy the account contract from which this transaction will be initiated
                  nonce_data_availability_mode:
                    type: string
                    description: The storage domain of the account's nonce. It can be one of 'L1' or 'L2'
                  fee_data_availability_mode:
                    type: string
                    description: The storage domain of the account's balance from which the fee will be charged. It can be one of 'L1' or 'L2'
              - type: object
                title: DEPLOY_ACCOUNT_TXN_V3
                properties:
                  type:
                    type: string
                    description: The type of transaction. It can take only one value - 'DEPLOY_ACCOUNT'
                  version:
                    type: string
                    description: The version of the transaction scheme
                  signature:
                    type: string
                    description: The signature associated with the transaction
                  nonce:
                    type: string
                    description: The nonce value
                  contract_address_salt:
                    type: string
                    description: The salt for the address of the deployed contract
                  constructor_calldata:
                    type: array
                    description: The parameters passed to the constructor
                  class_hash:
                    type: string
                    description: The hash of the deployed contract's class
                  resource_bounds:
                    type: object
                    properties:
                      l1_gas:
                        type: object
                        properties:
                          max_amount:
                            type: string
                          max_price_per_unit:
                            type: string
                      l2_gas:
                        type: object
                        properties:
                          max_amount:
                            type: string
                          max_price_per_unit:
                            type: string
                  tip:
                    type: string
                    description: The tip for the transaction
                  paymaster_data:
                    type: array
                    description: Data needed to allow the paymaster to pay for the transaction in native tokens
                  account_deployment_data:
                    type: array
                    description: Data needed to deploy the account contract from which this transaction will be initiated
                  nonce_data_availability_mode:
                    type: string
                    description: The storage domain of the account's nonce. It can be one of 'L1' or 'L2'
                  fee_data_availability_mode:
                    type: string
                    description: The storage domain of the account's balance from which the fee will be charged. It can be one of 'L1' or 'L2'
```
