# CDK Erigon RPC Methods

## CDK-Erigon RPC Methods

### Transaction Pool (`txpool`)

<details>

<summary><strong>txpool_content</strong></summary>

#### Description:

Returns details of all pending and queued transactions in the transaction pool.

#### Parameters:

*None*

#### Response:

Returns an object containing:

* **pending** – A list of transactions waiting to be included in a block.
* **queued** – A list of transactions that are queued due to nonce gaps.

#### Example:

```json
{
  "pending": { "0xSenderAddress": [ { "to": "0xReceiver", "value": "0x10" } ] },
  "queued": { "0xSenderAddress": [ { "to": "0xReceiver", "value": "0x20" } ] }
}
```

</details>

<details>

<summary><strong>txpool_contentFrom</strong></summary>

#### Description:

Fetches all pending and queued transactions from a specific sender.

#### Parameters:

* `address` *(string)*: The sender’s Ethereum address.

#### Response:

Returns the list of transactions originating from the specified sender.

#### Example:

```json
{
  "pending": [{ "to": "0xReceiver", "value": "0x10" }],
  "queued": [{ "to": "0xReceiver", "value": "0x20" }]
}
```

</details>

<details>

<summary><strong>txpool_limbo</strong></summary>

#### Description:

Returns transactions that are stuck in limbo due to missing dependencies or nonce gaps.

#### Parameters:

*None*

#### Response:

Returns an array of transactions that are unprocessable.

#### Example:

```json
{
  "limbo": [{ "from": "0xSender", "nonce": 5, "to": "0xReceiver" }]
}
```

</details>

### zkEVM Methods (`zkevm`)

<details>

<summary><strong>zkevm_batchNumber</strong></summary>

#### Description:

Returns the latest batch number finalized on L1.

#### Parameters:

*None*

#### Response:

* `batchNumber` *(integer)*: The latest verified batch.

#### Example:

```json
{
  "batchNumber": 10045
}
```

</details>

<details>

<summary><strong>zkevm_batchNumberByBlockNumber</strong></summary>

#### Description:

Fetches the batch number corresponding to a specific block number.

#### Parameters:

* `blockNumber` *(integer)*: The L2 block number.

#### Response:

* `batchNumber` *(integer)*: The batch associated with the block.

#### Example:

```json
{
  "batchNumber": 9998
}
```

</details>

<details>

<summary><strong>zkevm_consolidatedBlockNumber</strong></summary>

#### Description:

Retrieves the latest L2 block that has been consolidated.

#### Parameters:

*None*

#### Response:

* `blockNumber` *(integer)*: The latest consolidated L2 block.

#### Example:

```json
{
  "blockNumber": 105432
}
```

</details>

<details>

<summary><strong>zkevm_estimateCounters</strong></summary>

#### Description:

Estimates the counter usage for a given transaction, similar to `estimateGas` but for zkEVM.

#### Parameters:

* `transaction` *(object)*: The transaction object to analyze.

#### Response:

* `counterEstimate` *(integer)*: Estimated zk-counter usage.

#### Example:

```json
{
  "counterEstimate": 25000
}
```

</details>

<details>

<summary><strong>zkevm_getBatchByNumber</strong></summary>

#### Description:

Returns details about a specific batch by its number.

#### Parameters:

* `batchNumber` *(integer)*: The batch ID to fetch.

#### Response:

Batch details, including block range, state root, and L1 commitment status.

#### Example:

```json
{
  "batch": {
    "batchNumber": 10045,
    "blockRange": "100430-100450",
    "stateRoot": "0xabcdef"
  }
}
```

</details>

<details>

<summary><strong>zkevm_getBatchCountersByNumber</strong></summary>

#### Description:

Retrieves the counter usage details of a specific batch.

#### Parameters:

* `batchNumber` *(integer)*: The batch ID.

#### Response:

A list of counter values for that batch.

#### Example:

```json
{
  "counters": {
    "zkCountersUsed": 14000,
    "gasUsed": 8000000
  }
}
```

</details>

<details>

<summary><strong>zkevm_getBatchWitness</strong></summary>

#### Description:

Returns the witness data used to generate a zk-proof for a batch.

#### Parameters:

* `batchNumber` *(integer)*: The batch ID.

#### Response:

A large witness dataset used in zk-proof computation.

#### Example:

```json
{
  "witnessData": "0xabcdef12345..."
}
```

</details>

<details>

<summary><strong>zkevm_getExitRootTable</strong></summary>

#### Description:

Returns the global exit root table.

#### Parameters:

*None*

#### Response:

A mapping of all exit roots across different rollups.

#### Example:

```json
{
  "exitRoots": {
    "rollup1": "0x123abc...",
    "rollup2": "0x456def..."
  }
}
```

</details>

<details>

<summary><strong>zkevm_isBlockConsolidated</strong></summary>

#### Description:

Checks if an L2 block has been consolidated into a batch.

#### Parameters:

* `blockNumber` *(integer)*: The L2 block ID.

#### Response:

* `boolean` *(true/false)*: Whether the block is consolidated.

#### Example:

```json
{
  "isConsolidated": true
}
```

</details>

<details>

<summary><strong>zkevm_verifiedBatchNumber</strong></summary>

#### Description:

Returns the last verified batch number on L1.

#### Parameters:

*None*

#### Response:

* `batchNumber` *(integer)*: The latest verified batch.

#### Example:

```json
{
  "batchNumber": 10432
}
```

</details>

### Other zkEVM Methods

| Method                           | Description                                           |
| -------------------------------- | ----------------------------------------------------- |
| `zkevm_getForkById`              | Fetches details of a specific fork by its ID.         |
| `zkevm_getForks`                 | Lists all available forks in the zkEVM environment.   |
| `zkevm_getLatestDataStreamBlock` | Retrieves the latest block in the data stream.        |
| `zkevm_getLatestGlobalExitRoot`  | Returns the latest exit root for rollup transactions. |
| `zkevm_getRollupAddress`         | Fetches the rollup contract address.                  |
| `zkevm_getRollupManagerAddress`  | Retrieves the address of the rollup manager contract. |
| `zkevm_getVersionHistory`        | Returns a list of version upgrades and changes.       |

### Notes on Usage

* **State Verification:** Some calls return **trusted** vs. **verified** results, meaning finality may depend on L1 settlement.
* **Performance Considerations:** Calls returning large datasets (e.g., `getWitness`) may take longer to execute.
* **Gas Considerations:** `zkevm_estimateCounters` helps optimize transaction gas usage in zkEVM environments.

For more details, refer to the **Polygon zkEVM API Documentation**: [Polygon zkEVM Docs](https://docs.polygon.technology/zkEVM/architecture/protocol/etrog-upgrade/#supported-opcodes).


---

# 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-presto.gateway.fm/overview/cdk-erigon-rpc-methods.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.
