# zks_getRawBlockTransactions

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

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

Lists transactions in a block without processing them.

Reference: https://www.alchemy.com/docs/chains/zksync/zk-sync-api-endpoints/zks-get-raw-block-transactions

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Block number | string | Yes | Number of the block. |

## Result

**Raw transactions** (object[]): Array of raw transactions within the specified block.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "zks_getRawBlockTransactions",
  "params": [
    30098049
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "common_data": {
        "L2": {
          "nonce": 117,
          "fee": {
            "gas_limit": "0xbadbc",
            "max_fee_per_gas": "0x202fbf0",
            "max_priority_fee_per_gas": "0x0",
            "gas_per_pubdata_limit": "0xc350"
          },
          "initiatorAddress": "0xe7734c4a8201af41db64da90eddb4c19bbf64710",
          "signature": [
            203,
            118,
            119,
            63,
            1,
            54,
            91,
            252,
            188,
            23,
            120,
            51,
            4,
            28
          ],
          "transactionType": "EIP1559Transaction",
          "input": {
            "hash": "0x970c9480960818b05832f7e5b76a0c46956003c34942e005672d7ddc537aaa59",
            "data": [
              2,
              249,
              1,
              111,
              1305,
              187,
              2,
              170,
              21,
              166,
              251,
              255
            ]
          },
          "paymasterParams": {
            "paymaster": "0x0000000000000000000000000000000000000000",
            "paymasterInput": []
          }
        }
      },
      "execute": {
        "contractAddress": "0x5155704bb41fde152ad3e1ae402e8e8b9ba335d3",
        "calldata": "0xfa0x5155704bb41fde152ad3e1ae402e8e8b9ba335d3",
        "value": "0x0",
        "factoryDeps": null
      },
      "received_timestamp_ms": 1711649348872,
      "raw_bytes": "0x02f9016f8201447580840202fbf"
    }
  ],
  "id": 1
}
```

## Code Examples

### cURL

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

### JavaScript

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

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

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "zks_getRawBlockTransactions",
    "params": ["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://zksync-mainnet.g.alchemy.com/v2/docs-demo"

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

### C#

```csharp
using RestSharp;


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

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

```


## OpenRPC Method Specification

```yaml
name: zks_getRawBlockTransactions
summary: Lists transactions in a block without processing them.
description: Lists transactions in a block without processing them.
params:
  - name: Block number
    required: true
    description: Number of the block.
    schema:
      title: hex encoded 32-bit unsigned integer
      type: string
      pattern: ^0x[0-9a-fA-F]{1,8}$
result:
  name: Raw transactions
  description: Array of raw transactions within the specified block.
  schema:
    type: array
    items:
      type: object
      title: Raw Transaction
      required:
        - common_data
        - execute
        - received_timestamp_ms
        - raw_bytes
      properties:
        common_data:
          type: object
          title: Transaction Common Data
          properties:
            L2:
              type: object
              properties:
                nonce:
                  title: hex encoded unsigned integer
                  type: string
                  pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                fee:
                  type: object
                  properties:
                    gas_limit:
                      title: hex encoded unsigned integer
                      type: string
                      pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                    max_fee_per_gas:
                      title: hex encoded unsigned integer
                      type: string
                      pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                    max_priority_fee_per_gas:
                      title: hex encoded unsigned integer
                      type: string
                      pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                    gas_per_pubdata_limit:
                      title: hex encoded unsigned integer
                      type: string
                      pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
                initiatorAddress:
                  title: hex encoded address
                  type: string
                  pattern: ^0x[0-9a-fA-F]{40}$
                signature:
                  type: array
                  items:
                    type: integer
                    minimum: 0
                    maximum: 255
                transactionType:
                  type: string
                input:
                  type: object
                  properties:
                    hash:
                      title: 32 byte hex value
                      type: string
                      pattern: ^0x[0-9a-f]{64}$
                    data:
                      type: array
                      items:
                        type: integer
                        minimum: 0
                        maximum: 255
                paymasterParams:
                  type: object
                  properties:
                    paymaster:
                      title: hex encoded address
                      type: string
                      pattern: ^0x[0-9a-fA-F]{40}$
                    paymasterInput:
                      type: array
                      items:
                        type: integer
                        minimum: 0
                        maximum: 255
        execute:
          type: object
          properties:
            contractAddress:
              title: hex encoded address
              type: string
              pattern: ^0x[0-9a-fA-F]{40}$
            calldata:
              title: hex encoded bytes
              type: string
              pattern: ^0x[0-9a-f]*$
            value:
              title: hex encoded unsigned integer
              type: string
              pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$
            factoryDeps:
              type: array
              items:
                title: 32 byte hex value
                type: string
                pattern: ^0x[0-9a-f]{64}$
        received_timestamp_ms:
          type: integer
          description: Timestamp when the transaction was received, in milliseconds.
        raw_bytes:
          title: hex encoded bytes
          type: string
          pattern: ^0x[0-9a-f]*$
          description: Raw bytes of the transaction as a hexadecimal string.
examples:
  - name: zks_getRawBlockTransactions example
    params:
      - name: Block number
        value: 30098049
    result:
      name: Raw transactions
      value:
        - common_data:
            L2:
              nonce: 117
              fee:
                gas_limit: '0xbadbc'
                max_fee_per_gas: '0x202fbf0'
                max_priority_fee_per_gas: '0x0'
                gas_per_pubdata_limit: '0xc350'
              initiatorAddress: '0xe7734c4a8201af41db64da90eddb4c19bbf64710'
              signature:
                - 203
                - 118
                - 119
                - 63
                - 1
                - 54
                - 91
                - 252
                - 188
                - 23
                - 120
                - 51
                - 4
                - 28
              transactionType: EIP1559Transaction
              input:
                hash: '0x970c9480960818b05832f7e5b76a0c46956003c34942e005672d7ddc537aaa59'
                data:
                  - 2
                  - 249
                  - 1
                  - 111
                  - 1305
                  - 187
                  - 2
                  - 170
                  - 21
                  - 166
                  - 251
                  - 255
              paymasterParams:
                paymaster: '0x0000000000000000000000000000000000000000'
                paymasterInput: []
          execute:
            contractAddress: '0x5155704bb41fde152ad3e1ae402e8e8b9ba335d3'
            calldata: 0xfa0x5155704bb41fde152ad3e1ae402e8e8b9ba335d3
            value: '0x0'
            factoryDeps: null
          received_timestamp_ms: 1711649348872
          raw_bytes: '0x02f9016f8201447580840202fbf'
```
