# Batch Decoder API

The Blocknative Decoding API offers:

* **Effortless Decoding**: No more manual decoding and deciphering of bytes of data. We do all the complicated computation decoding the data and seamlessly translating it into a clear, human-readable format so that you can spend less time troubleshooting and more time building.
* **No Expensive Storage**: We store ephemeral blob data so you don’t have to. You will be able to call upon any past transaction and pull up the details even after the 4096 epoch window.
* **No Maintenance Headaches:** No need to worry about format changes that occur. We handle all the updates behind the scenes, ensuring your API calls are always accurate.
* **Enhanced Observability**: Backend developers and end-users can track the status of their transactions down to the L1 at any point in the journey.

## Supported Networks

The Blocknative Decoding API currently supports the following networks:

* Optimism:
  * Optimism
  * Base
  * Mode
  * Zora
  * Kroma
  * Blast
* Arbitrum:
  * Arbitrum
* zksync:
  * ZKsync

We are committed to the ongoing development of batch decoding. Support for additional chains is on the horizon. If you would like to request support of a chain please go to the Blocknative [discord](https://discord.gg/CJtTkStkfZ).

## API Endpoint

<mark style="color:blue;">`GET`</mark> [`https://api.ethernow.xyz/v1/batch/<tx_hash>`](https://api.ethernow.xyz/v1/batch/%3Ctx_hash%3E)

Input the transaction hash of a batch and the decoded data is returned. You can query any batch - pending or confirmed. The API supports decoding of calldata (type-2) and blobdata (type-3).

### Query Parameters

<table><thead><tr><th width="192">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>batchIndex</td><td>integer</td><td>For batches on the Optimism or Arbitrum network, we paginate the transaction list by frame number (Optimism network) or sequence number (Arbitrum network).</td></tr><tr><td>initialStateDiffs</td><td>bool</td><td>For batches on the ZKsync network, you can choose not to receive the list of state diffs. Param default is set to true.</td></tr></tbody></table>

#### Example Request

{% code overflow="wrap" %}

```html
https://api.ethernow.xyz/v1/batch/0x02f505c98aa74d629ecfde0fff21df969542394661804f4ea26a6e0c1fc43600
```

{% endcode %}

#### Example Response

```json
{
  "network": "optimism",
  "chainId": 10,
  "data": {
    "blob": {
      "txCount": 1005,
      "frames": [
        {
          "channelID": "4739f7d92319e39c651811d37e0fdc42",
          "frameNumber": 4,
          "isLast": true,
          "blocksCount": 91,
          "txsCount": 1005,
          "batchType": 1,
          "batches": [
            {
              "batch": {
                "relTimestamp": 31371628,
                "l1OriginNum": 20013189,
                "parentCheck": "0x8d8d5ab78a42bc90fe77091a5a963e8cb2a66dc5",
                "l1OriginCheck": "0x62e8503ae912a7dd64fdccec400d2f4ff961acce",
                "blocksCount": 91,
                "originBits": 6.287949405896787e+26,
                "blockTxCounts": 1005,
                "txs": [
                  [
                    {
                      "from": "0xEBFce130290083da707F5053568a90B7BDE7eB83",
                      "to": "0xC110E7FAA95680c79937CCACa3d1caB7902bE25e",
                      "gasLimit": 264439,
                      "maxFeePerGas": 73468696,
                      "maxPriorityFeePerGas": 73468696,
                      "nonce": 0,
                      "value": 334155400000000000,
                      "data": "0x6b634a62",
                      "gasPrice": 73468696,
                      "chainId": 10,
                      "hash": "0xb3ba553c696b36b26c336fd73563e453fbffde73e1450062d84b925fc282eda6"
                    },
                    ...
```

### Description of Terms

| Term     | Description                                                                                                                                                                                                                                    |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| network  | Options include: optimism, arbitrum or zksync                                                                                                                                                                                                  |
| chainId  | The chain ID of the chain that posted the batch                                                                                                                                                                                                |
| data     | A container with either the decoded blobdata and/or decoded calldata, depending on the chain and the transaction type. Type-2 transactions only contain calldata. Type-3 transactions can contain only blobdata or both blobdata and calldata. |
| blob     | Decoded contents of the blobdata, specific to each chain. For example, Optimism chains have a list of frames and transactions within those frames.                                                                                             |
| calldata | Decoded contents of the calldata specific to each chain. For example, ZKsync calldata contains data on the previous and new state of the chain.                                                                                                |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.blocknative.com/ethernow/batch-decoder-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
