# simulateBundle

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

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

Simulates sending a Jito bundle of transactions.

Reference: https://www.alchemy.com/docs/chains/solana/solana-api-endpoints/simulate-bundle

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Bundle | object | Yes | Encoded, serialized transactions to simulate in a bundle. |
| Configuration | object | No | Optional configuration object containing additional options. |

## Result

**Simulated bundle result** (object): The result of simulating the bundle.

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://solana-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "simulateBundle",
  "params": [
    {
      "encodedTransactions": [
        "string"
      ]
    },
    {
      "preExecutionAccountsConfigs": [
        {
          "addresses": [
            "string"
          ],
          "encoding": "base64"
        }
      ],
      "postExecutionAccountsConfigs": [
        {
          "addresses": [
            "string"
          ],
          "encoding": "base64"
        }
      ],
      "transactionEncoding": "base64",
      "simulationBank": "string",
      "skipSigVerify": false,
      "replaceRecentBlockhash": false
    }
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'simulateBundle',
    params: [
      {encodedTransactions: ['string']},
      {
        preExecutionAccountsConfigs: [{addresses: ['string'], encoding: 'base64'}],
        postExecutionAccountsConfigs: [{addresses: ['string'], encoding: 'base64'}],
        transactionEncoding: 'base64',
        simulationBank: 'string',
        skipSigVerify: false,
        replaceRecentBlockhash: false
      }
    ]
  })
};

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

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "simulateBundle",
    "params": [
        { "encodedTransactions": ["string"] },
        {
            "preExecutionAccountsConfigs": [
                {
                    "addresses": ["string"],
                    "encoding": "base64"
                }
            ],
            "postExecutionAccountsConfigs": [
                {
                    "addresses": ["string"],
                    "encoding": "base64"
                }
            ],
            "transactionEncoding": "base64",
            "simulationBank": "string",
            "skipSigVerify": False,
            "replaceRecentBlockhash": False
        }
    ]
}
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://solana-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"simulateBundle\",\n  \"params\": [\n    {\n      \"encodedTransactions\": [\n        \"string\"\n      ]\n    },\n    {\n      \"preExecutionAccountsConfigs\": [\n        {\n          \"addresses\": [\n            \"string\"\n          ],\n          \"encoding\": \"base64\"\n        }\n      ],\n      \"postExecutionAccountsConfigs\": [\n        {\n          \"addresses\": [\n            \"string\"\n          ],\n          \"encoding\": \"base64\"\n        }\n      ],\n      \"transactionEncoding\": \"base64\",\n      \"simulationBank\": \"string\",\n      \"skipSigVerify\": false,\n      \"replaceRecentBlockhash\": false\n    }\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://solana-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"simulateBundle\",\n  \"params\": [\n    {\n      \"encodedTransactions\": [\n        \"string\"\n      ]\n    },\n    {\n      \"preExecutionAccountsConfigs\": [\n        {\n          \"addresses\": [\n            \"string\"\n          ],\n          \"encoding\": \"base64\"\n        }\n      ],\n      \"postExecutionAccountsConfigs\": [\n        {\n          \"addresses\": [\n            \"string\"\n          ],\n          \"encoding\": \"base64\"\n        }\n      ],\n      \"transactionEncoding\": \"base64\",\n      \"simulationBank\": \"string\",\n      \"skipSigVerify\": false,\n      \"replaceRecentBlockhash\": false\n    }\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://solana-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\": \"simulateBundle\",\n  \"params\": [\n    {\n      \"encodedTransactions\": [\n        \"string\"\n      ]\n    },\n    {\n      \"preExecutionAccountsConfigs\": [\n        {\n          \"addresses\": [\n            \"string\"\n          ],\n          \"encoding\": \"base64\"\n        }\n      ],\n      \"postExecutionAccountsConfigs\": [\n        {\n          \"addresses\": [\n            \"string\"\n          ],\n          \"encoding\": \"base64\"\n        }\n      ],\n      \"transactionEncoding\": \"base64\",\n      \"simulationBank\": \"string\",\n      \"skipSigVerify\": false,\n      \"replaceRecentBlockhash\": false\n    }\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: simulateBundle
description: Simulates sending a Jito bundle of transactions.
params:
  - name: Bundle
    required: true
    description: Encoded, serialized transactions to simulate in a bundle.
    schema:
      title: SimulateBundle Parameters
      type: object
      required:
        - encodedTransactions
      properties:
        encodedTransactions:
          type: array
          description: Array of encoded, serialized transactions to simulate.
          items:
            type: string
  - name: Configuration
    required: false
    description: Optional configuration object containing additional options.
    schema:
      title: SimulateBundle Configuration
      type: object
      properties:
        preExecutionAccountsConfigs:
          type: array
          description: Account capture configs for each transaction before execution. Array length must equal the number of transactions in the bundle. Use null for entries where no account state is requested.
          items:
            oneOf:
              - title: SimulateBundle Accounts Configuration
                type: object
                properties:
                  addresses:
                    type: array
                    description: Base-58 encoded account addresses to capture.
                    items:
                      title: Pubkey
                      type: string
                      description: Base-58 encoded public key.
                  encoding:
                    description: Encoding used for returned account data.
                    default: base64
                    title: Data Encoding
                    type: string
                    enum:
                      - base58
                      - base64
                      - base64+zstd
                      - jsonParsed
              - type: 'null'
        postExecutionAccountsConfigs:
          type: array
          description: Account capture configs for each transaction after execution. Array length must equal the number of transactions in the bundle. Use null for entries where no account state is requested.
          items:
            oneOf:
              - title: SimulateBundle Accounts Configuration
                type: object
                properties:
                  addresses:
                    type: array
                    description: Base-58 encoded account addresses to capture.
                    items:
                      title: Pubkey
                      type: string
                      description: Base-58 encoded public key.
                  encoding:
                    description: Encoding used for returned account data.
                    default: base64
                    title: Data Encoding
                    type: string
                    enum:
                      - base58
                      - base64
                      - base64+zstd
                      - jsonParsed
              - type: 'null'
        transactionEncoding:
          type: string
          description: Encoding used for the transactions in `encodedTransactions`.
          enum:
            - base64
            - base58
          default: base64
        simulationBank:
          type: string
          description: Bank to simulate against.
        skipSigVerify:
          type: boolean
          description: If true, signature verification is skipped before simulation.
          default: false
        replaceRecentBlockhash:
          type: boolean
          description: If true, replaces recent blockhash with the most recent one.
          default: false
result:
  name: Simulated bundle result
  description: The result of simulating the bundle.
  schema:
    title: Simulated Bundle Result
    type: object
    properties:
      summary:
        type: string
        description: Summary of the bundle simulation result.
      transactionResults:
        type: array
        description: Result details for each transaction in the bundle.
        items:
          title: Simulated Bundle Transaction Result
          type: object
          properties:
            err:
              type: object
              nullable: true
              description: Error if the transaction failed, null if succeeded.
            logs:
              type: array
              nullable: true
              description: Log messages output during execution.
              items:
                type: string
            preExecutionAccounts:
              type: array
              nullable: true
              description: Account states before execution.
              items:
                title: Account Information
                type: object
                properties:
                  lamports:
                    type: integer
                    description: Number of lamports assigned to this account.
                  owner:
                    title: Pubkey
                    type: string
                    description: Program owner of this account.
                  data:
                    title: Account Data
                    type: array
                    description: Account data in the specified encoding format.
                    items:
                      type: string
                  executable:
                    type: boolean
                    description: Indicates if the account contains a program.
                  rentEpoch:
                    type: integer
                    description: The epoch at which this account will next owe rent.
                  size:
                    type: integer
                    description: The data size of the account.
            postExecutionAccounts:
              type: array
              nullable: true
              description: Account states after execution.
              items:
                title: Account Information
                type: object
                properties:
                  lamports:
                    type: integer
                    description: Number of lamports assigned to this account.
                  owner:
                    title: Pubkey
                    type: string
                    description: Program owner of this account.
                  data:
                    title: Account Data
                    type: array
                    description: Account data in the specified encoding format.
                    items:
                      type: string
                  executable:
                    type: boolean
                    description: Indicates if the account contains a program.
                  rentEpoch:
                    type: integer
                    description: The epoch at which this account will next owe rent.
                  size:
                    type: integer
                    description: The data size of the account.
            unitsConsumed:
              type: integer
              description: Compute budget units consumed.
            returnData:
              title: Return Data
              type: object
              nullable: true
              properties:
                programId:
                  title: Pubkey
                  type: string
                  description: Program that generated the return data.
                data:
                  type: array
                  description: Return data as base-64 encoded binary data.
                  items:
                    type: string
```
