# sui_devInspectTransactionBlock

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

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

Runs a transaction in dev-inspect mode. This allows testing nearly any transaction with any arguments. Detailed results are provided, including execution effects and return values.  Note: gas is not charged, but usage is calculated.


Reference: https://www.alchemy.com/docs/chains/sui/sui-api-endpoints/sui-dev-inspect-transaction-block

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| sender_address | string | Yes | The address that initiates the dev inspect transaction. |
| tx_bytes | string | Yes | Base64-encoded BCS transaction kind (excluding gas info). |
| gas_price | string | Yes | Simulated gas price to be used during dev inspect (gas is not deducted). |
| epoch | string | Yes | The epoch context in which to perform the inspection. |

## Result

**result** (object): Simulated transaction inspection result.

## Example

### Request

```json
{
  "jsonrpc": "2.0",
  "method": "sui_devInspectTransactionBlock",
  "params": [
    "0x8d59ac375d6bea13560d6ddcf33a3d6f45fa9f5b1be6819974242480b678711a",
    "AAPDdSGd1K6HApnQ1UMmEIOXvtBFDAEFAAAAAAAAADDat41YRxp4SW63HCxud7omjwOQOg6huYDqcvdFeE95OGaVEnTPlWWtjAYAAAAAACBCRYDRhl1WPPDl5P0n7fK6uWgf",
    "10",
    "1"
  ],
  "id": 1
}
```

### Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "effects": {
      "messageVersion": "v1",
      "status": {
        "status": "success"
      },
      "executedEpoch": "0",
      "gasUsed": {
        "computationCost": "100",
        "storageCost": "100",
        "storageRebate": "10",
        "nonRefundableStorageFee": "0"
      },
      "transactionDigest": "76gyHCk7FRrGACRqXM7Ybj5uJLtAzgEMJ5P9CeEzxZSG",
      "mutated": [
        {
          "owner": {
            "AddressOwner": "0x2f5c543d716ae43d453deb3b199bbdaf1bc7030c7682f87703dce431248fede0"
          },
          "reference": {
            "objectId": "0x2c43805d0d6f5402a7ad0da5bdec549c7cdea06bc4a1d339a22521eea933b889",
            "version": 2,
            "digest": "BhbWpBeESxuRWvmvLMyb2JNUuFa6j4aG1T4WUiPgKAHm"
          }
        },
        {
          "owner": {
            "AddressOwner": "0x67c6d31c6c970e567f03ef67d811a4f843665b8de3f282fa48b3e0103ba9bbed"
          },
          "reference": {
            "objectId": "0x6a06153b9fc486e101f0e9e2703ac8666d06aecc4ddf7e7926a361970c65a5b1",
            "version": 2,
            "digest": "GdfET1avZReDftpJNB8LSuHJ2cKUheSbEaLMzuPVXHsM"
          }
        }
      ],
      "gasObject": {
        "owner": {
          "ObjectOwner": "0x2f5c543d716ae43d453deb3b199bbdaf1bc7030c7682f87703dce431248fede0"
        },
        "reference": {
          "objectId": "0x2c43805d0d6f5402a7ad0da5bdec549c7cdea06bc4a1d339a22521eea933b889",
          "version": 2,
          "digest": "BhbWpBeESxuRWvmvLMyb2JNUuFa6j4aG1T4WUiPgKAHm"
        }
      },
      "eventsDigest": "6kerMphN4S5QTfd9TAhwMiFq1q9c2YwfpheBfWm85vUq"
    },
    "events": []
  },
  "id": 1
}
```

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://sui-mainnet.g.alchemy.com/v2/docs-demo \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "sui_devInspectTransactionBlock",
  "params": [
    "0x8d59ac375d6bea13560d6ddcf33a3d6f45fa9f5b1be6819974242480b678711a",
    "AAPDdSGd1K6HApnQ1UMmEIOXvtBFDAEFAAAAAAAAADDat41YRxp4SW63HCxud7omjwOQOg6huYDqcvdFeE95OGaVEnTPlWWtjAYAAAAAACBCRYDRhl1WPPDl5P0n7fK6uWgf",
    "10",
    "1"
  ]
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'sui_devInspectTransactionBlock',
    params: [
      '0x8d59ac375d6bea13560d6ddcf33a3d6f45fa9f5b1be6819974242480b678711a',
      'AAPDdSGd1K6HApnQ1UMmEIOXvtBFDAEFAAAAAAAAADDat41YRxp4SW63HCxud7omjwOQOg6huYDqcvdFeE95OGaVEnTPlWWtjAYAAAAAACBCRYDRhl1WPPDl5P0n7fK6uWgf',
      '10',
      '1'
    ]
  })
};

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

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "sui_devInspectTransactionBlock",
    "params": ["0x8d59ac375d6bea13560d6ddcf33a3d6f45fa9f5b1be6819974242480b678711a", "AAPDdSGd1K6HApnQ1UMmEIOXvtBFDAEFAAAAAAAAADDat41YRxp4SW63HCxud7omjwOQOg6huYDqcvdFeE95OGaVEnTPlWWtjAYAAAAAACBCRYDRhl1WPPDl5P0n7fK6uWgf", "10", "1"]
}
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://sui-mainnet.g.alchemy.com/v2/docs-demo"

	payload := strings.NewReader("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"sui_devInspectTransactionBlock\",\n  \"params\": [\n    \"0x8d59ac375d6bea13560d6ddcf33a3d6f45fa9f5b1be6819974242480b678711a\",\n    \"AAPDdSGd1K6HApnQ1UMmEIOXvtBFDAEFAAAAAAAAADDat41YRxp4SW63HCxud7omjwOQOg6huYDqcvdFeE95OGaVEnTPlWWtjAYAAAAAACBCRYDRhl1WPPDl5P0n7fK6uWgf\",\n    \"10\",\n    \"1\"\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://sui-mainnet.g.alchemy.com/v2/docs-demo")
  .header("Content-Type", "application/json")
  .body("{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 1,\n  \"method\": \"sui_devInspectTransactionBlock\",\n  \"params\": [\n    \"0x8d59ac375d6bea13560d6ddcf33a3d6f45fa9f5b1be6819974242480b678711a\",\n    \"AAPDdSGd1K6HApnQ1UMmEIOXvtBFDAEFAAAAAAAAADDat41YRxp4SW63HCxud7omjwOQOg6huYDqcvdFeE95OGaVEnTPlWWtjAYAAAAAACBCRYDRhl1WPPDl5P0n7fK6uWgf\",\n    \"10\",\n    \"1\"\n  ]\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://sui-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\": \"sui_devInspectTransactionBlock\",\n  \"params\": [\n    \"0x8d59ac375d6bea13560d6ddcf33a3d6f45fa9f5b1be6819974242480b678711a\",\n    \"AAPDdSGd1K6HApnQ1UMmEIOXvtBFDAEFAAAAAAAAADDat41YRxp4SW63HCxud7omjwOQOg6huYDqcvdFeE95OGaVEnTPlWWtjAYAAAAAACBCRYDRhl1WPPDl5P0n7fK6uWgf\",\n    \"10\",\n    \"1\"\n  ]\n}", false);
var response = await client.PostAsync(request);

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

```


## OpenRPC Method Specification

```yaml
name: sui_devInspectTransactionBlock
summary: Run a transaction in dev-inspect mode
description: |
  Runs a transaction in dev-inspect mode. This allows testing nearly any transaction with any arguments. Detailed results are provided, including execution effects and return values.  Note: gas is not charged, but usage is calculated.
params:
  - name: sender_address
    required: true
    description: The address that initiates the dev inspect transaction.
    schema:
      type: string
  - name: tx_bytes
    required: true
    description: Base64-encoded BCS transaction kind (excluding gas info).
    schema:
      type: string
  - name: gas_price
    required: true
    description: Simulated gas price to be used during dev inspect (gas is not deducted).
    schema:
      type: string
  - name: epoch
    required: true
    description: The epoch context in which to perform the inspection.
    schema:
      type: string
result:
  name: result
  description: Simulated transaction inspection result.
  schema:
    type: object
    properties:
      effects:
        type: object
        description: The simulated effects of the transaction.
        properties:
          messageVersion:
            type: string
          status:
            type: object
            properties:
              status:
                type: string
          executedEpoch:
            type: string
          gasUsed:
            type: object
            properties:
              computationCost:
                type: string
              storageCost:
                type: string
              storageRebate:
                type: string
              nonRefundableStorageFee:
                type: string
          transactionDigest:
            type: string
          mutated:
            type: array
            items:
              type: object
              properties:
                owner:
                  type: object
                  properties:
                    AddressOwner:
                      type: string
                reference:
                  type: object
                  properties:
                    objectId:
                      type: string
                    version:
                      type: integer
                    digest:
                      type: string
          gasObject:
            type: object
            properties:
              owner:
                type: object
                properties:
                  ObjectOwner:
                    type: string
              reference:
                type: object
                properties:
                  objectId:
                    type: string
                  version:
                    type: integer
                  digest:
                    type: string
          eventsDigest:
            type: string
      events:
        type: array
        description: Events that would be emitted if the transaction were run.
        items:
          type: object
      error:
        type:
          - string
          - 'null'
        description: Execution error message, if any.
      results:
        type: array
        description: Return values and execution results for Move calls.
        items:
          type: object
examples:
  - name: Dev Inspect SUI transaction
    params:
      - name: sender_address
        value: '0x8d59ac375d6bea13560d6ddcf33a3d6f45fa9f5b1be6819974242480b678711a'
      - name: tx_bytes
        value: AAPDdSGd1K6HApnQ1UMmEIOXvtBFDAEFAAAAAAAAADDat41YRxp4SW63HCxud7omjwOQOg6huYDqcvdFeE95OGaVEnTPlWWtjAYAAAAAACBCRYDRhl1WPPDl5P0n7fK6uWgf
      - name: gas_price
        value: '10'
      - name: epoch
        value: '1'
    result:
      name: result
      value:
        effects:
          messageVersion: v1
          status:
            status: success
          executedEpoch: '0'
          gasUsed:
            computationCost: '100'
            storageCost: '100'
            storageRebate: '10'
            nonRefundableStorageFee: '0'
          transactionDigest: 76gyHCk7FRrGACRqXM7Ybj5uJLtAzgEMJ5P9CeEzxZSG
          mutated:
            - owner:
                AddressOwner: '0x2f5c543d716ae43d453deb3b199bbdaf1bc7030c7682f87703dce431248fede0'
              reference:
                objectId: '0x2c43805d0d6f5402a7ad0da5bdec549c7cdea06bc4a1d339a22521eea933b889'
                version: 2
                digest: BhbWpBeESxuRWvmvLMyb2JNUuFa6j4aG1T4WUiPgKAHm
            - owner:
                AddressOwner: '0x67c6d31c6c970e567f03ef67d811a4f843665b8de3f282fa48b3e0103ba9bbed'
              reference:
                objectId: '0x6a06153b9fc486e101f0e9e2703ac8666d06aecc4ddf7e7926a361970c65a5b1'
                version: 2
                digest: GdfET1avZReDftpJNB8LSuHJ2cKUheSbEaLMzuPVXHsM
          gasObject:
            owner:
              ObjectOwner: '0x2f5c543d716ae43d453deb3b199bbdaf1bc7030c7682f87703dce431248fede0'
            reference:
              objectId: '0x2c43805d0d6f5402a7ad0da5bdec549c7cdea06bc4a1d339a22521eea933b889'
              version: 2
              digest: BhbWpBeESxuRWvmvLMyb2JNUuFa6j4aG1T4WUiPgKAHm
          eventsDigest: 6kerMphN4S5QTfd9TAhwMiFq1q9c2YwfpheBfWm85vUq
        events: []
```
