> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dokrypt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# dokrypt replay

> Replay and debug transactions from live networks locally.

## Usage

```bash theme={null}
dokrypt replay tx <tx-hash> [flags]
dokrypt replay block <block-number> [flags]
dokrypt replay trace <tx-hash> [flags]
```

## Subcommands

### `replay tx`

Fetch a transaction from a live network, fork the chain at that block, and re-execute it locally. Shows transaction details, gas comparison, revert reasons, and optional execution trace.

```bash theme={null}
dokrypt replay tx 0xabc123... --network arbitrum
dokrypt replay tx 0xabc123... --network mainnet --verbose
```

| Flag        | Default   | Description                                      |
| ----------- | --------- | ------------------------------------------------ |
| `--network` | `mainnet` | Source network to fetch tx from                  |
| `--chain`   |           | Target local chain                               |
| `--block`   |           | Custom fork block (default: one block before tx) |
| `--verbose` | `false`   | Show full execution trace                        |

Output includes:

* Transaction details (from, to, value, gas, method selector)
* Transaction status (success/reverted)
* Event count
* Gas comparison (original vs replayed)
* Revert reason (if applicable)

### `replay block`

List all transactions in a specific block from a live network.

```bash theme={null}
dokrypt replay block 200000000 --network arbitrum
dokrypt replay block 19000000 --network mainnet --limit 20
```

| Flag        | Default   | Description                 |
| ----------- | --------- | --------------------------- |
| `--network` | `mainnet` | Source network              |
| `--chain`   |           | Target local chain          |
| `--limit`   | `50`      | Max transactions to display |

### `replay trace`

Get a detailed execution trace of a transaction showing all internal calls.

```bash theme={null}
dokrypt replay trace 0xabc123... --network arbitrum
```

| Flag        | Default   | Description                    |
| ----------- | --------- | ------------------------------ |
| `--network` | `mainnet` | Source network                 |
| `--chain`   |           | Target local chain for tracing |

The trace shows nested call hierarchy with:

* Call type (CALL, DELEGATECALL, STATICCALL, CREATE)
* From/to addresses
* Method selectors
* ETH value transferred
* Gas used per call
* Revert reasons for failed calls

## Supported Networks

All networks from `dokrypt fork` are supported:

| Network                | RPC                      |
| ---------------------- | ------------------------ |
| `mainnet` / `ethereum` | eth.llamarpc.com         |
| `arbitrum`             | arb1.arbitrum.io/rpc     |
| `polygon`              | polygon-rpc.com          |
| `optimism`             | mainnet.optimism.io      |
| `base`                 | mainnet.base.org         |
| `sepolia`              | rpc.sepolia.org          |
| `bsc`                  | bsc-dataseed.binance.org |
| `avalanche`            | api.avax.network         |

You can also pass a custom RPC URL directly.

## Examples

Debug a reverted transaction on Arbitrum:

```bash theme={null}
dokrypt replay tx 0xfailed... --network arbitrum --verbose
```

Inspect a block on Ethereum:

```bash theme={null}
dokrypt replay block 19500000 --network mainnet
```

Trace internal calls of a DeFi transaction:

```bash theme={null}
dokrypt replay trace 0xswap... --network arbitrum
```
