# Bundle Simulation

Simulate a MEV bundle to verify its execution outcome before submitting it on-chain.

[Purchase the **Bundle Simulation Add-on**](https://portal.bloxroute.com/pricing) to get unlimited access to this endpoint.

## Submission Endpoint

* Method: `blxr_simulate_bundle`
* Endpoint: `api.blxrbdn.com`

### Parameters

| Parameter                | Description                                                                                                                                                                             |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`transaction`**        | A list of raw transaction bytes without a **`0x`** prefix.                                                                                                                              |
| **`block_number`**       | Block number of a future block to include this bundle in, in hex value.                                                                                                                 |
| **`state_block_number`** | \[Optional] Block number used as the base state to run a simulation on. Valid inputs include hex value of block number, or tags like “latest” and “pending”. Default value is “latest”. |
| **`timestamp`**          | \[Optional] Simulation timestamp, an integer in unix epoch format. Default value is None.                                                                                               |
| **`blockchain_network`** | \[Optional] Blockchain network name. Possible options are "Mainnet" and "BSC-Mainnet". Default value is "Mainnet" for Ethereum Mainnet.                                                 |

### Example

{% tabs %}
{% tab title="Cloud-API" %}

```bash
curl https://api.blxrbdn.com \
    --insecure \
    -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: <YOUR-AUTHORIZATION-HEADER>" \
    -d '{"method": "blxr_simulate_bundle", 
         "id": "1", 
         "params": {
            "transaction": ["ab..ab", "cd..cd"],
            "block_number": "0xba10d0",
            "state_block_number": "latest",
            "timestamp": 1617806320,
            "blockchain_network": "Mainnet"
         }
        }'
     
```

{% endtab %}
{% endtabs %}

#### Response

{% tabs %}
{% tab title="Cloud-API" %}

```bash
{
    "jsonrpc": "2.0",
    "id": "1",
    "result": {
        "bundleGasPrice": "20000000000",
        "bundleHash": "0x11aa...",
        "coinbaseDiff": "150840000000000000",
        "ethSentToCoinbase": "150000000000000000",
        "gasFees": "840000000000000",
        "results": [
            {
                "gasUsed": 21000,
                "txHash": "0xaac...",
                "value": "0x..."
            },
            {
                "gasUsed": 21000,
                "txHash": "0x123...",
                "value": "0x..."
            }
        ],
        "stateBlockNumber": 12188038,
        "totalGasUsed": 42000
    }
}

```

{% endtab %}
{% endtabs %}
