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

# sauce inspect

> Decode calldata, a transaction or a program file back into what its author wrote, to check what you are about to sign.

`sauce inspect` reads calldata, a transaction or a program file and reports what it does: the engine and program of a cook, the Pot a deployment makes, or the parameters a program takes.

## Synopsis

```bash theme={null}
sauce inspect <hex | tx-hash | file | -> [--chain <slug|id>] [--source <file | ->] [options]
```

## Description

The operand is one of:

* **Calldata in hex**, or `-` to read it from stdin:
  * a `Pot.cook`: the engine it names, whether that is the released engine, and the program's size and keccak256 hash;
  * a `Kitchen.deployPot`: the Pot it deploys, with its owner and salt;
  * an ERC-20 call;
  * bare program bytes.
* **A 32-byte transaction hash**, with `--chain` or `--rpc-url`: the transaction is fetched first. The report gives its status, sender, value and call; what it cost (gas, an OP-stack chain's L1 data fee, the value); and the token transfers, approvals and net balance changes its receipt's logs record.
* **A program file**: it is compiled for the chain, and the report gives the program's size and hash, and the parameters `main` takes.

With `--source <file>`, a cook's program is compared with the program that file compiles to, and the arguments appended after it are decoded against that file's `main`.

There is no opcode listing or disassembly: programs are reported by size and hash. The command signs and sends nothing, and works on every chain in the registry.

## Options

| Option | Description |
| - | - |
| `--chain <slug\|id>` | The chain the program runs on (`base`, `8453`, `solana`) |
| `--target <evm\|svm>` | Checked against the chain. `svm` alone means Solana |
| `--source-dir <dir>` | The directory the program's relative imports resolve from. Default: beside the file; for stdin, the current directory |
| `--source <file>` | The program a cook was compiled from: compare it and decode the cook's arguments |
| `--rpc-url <url>` | Your own RPC endpoint for the chain. Default: a built-in public one |
| `--config <file>` | A file of your own endpoints: `{ "rpcUrls": { "<chain id>": "<url>" } }` |
| `--offline` | Read no chain: no endpoint, built-in ones included |
| `--json` | Print one JSON object instead of text |
| `-h, --help` | Show the help |
| `--no-update-check` | Print no notice of a newer `sauce`, and read no registry for one |

### Low-level options

`--help` lists these apart, with the note "a program's inputs are main's parameters, given with --args".

| Option | Description |
| - | - |
| `--define NAME=VALUE` | A compile-time value for a name the program leaves undeclared: an integer, `0x` hex, `true` or `false`; base58 on Solana |
| `--defines <file.json>` | Compile-time values from a JSON object of name to value. `--define` takes precedence |

## Output

Text on stdout; endpoint notes on stderr.

With `--json`, a cook reports `call` (`Pot.cook`), `engine` (`address`, and `released`: whether it is the released engine) and `program` (`size`, `keccak256`, and with `--source`, `source`: the file, whether the program `matches`, `argumentsSize` and the decoded `arguments` with `name`, `type` and `value`).

Exit codes: `0` on success; `1` when what it was given cannot be read, such as a missing file (`sauce inspect: does-not-exist.json: no such file`) or a transaction hash with no such transaction on the chain; `2` for a usage error.

## Examples

The examples take apart the transactions [`sauce tx`](https://docs.eco.com/sauce-sdk/cli/tx) built for this program on Base:

```ts pay.sauce.ts theme={null}
// Sends USDC from the Pot to a recipient.
//   sauce tx pay.sauce.ts --chain base --owner <owner> --args <to> <amount>
//   to: Address, the recipient
//   amount: Uint256, USDC in base units (1000000 is 1 USDC)
function main(to: Address, amount: Uint256) {
  USDC.transfer(to, amount);
}
```

```bash theme={null}
sauce tx pay.sauce.ts --chain base --owner 0x1111111111111111111111111111111111111111 \
  --args 0x2222222222222222222222222222222222222222 1000000 > tx.json
```

The Pot had no code, so `tx.json` holds two transactions: the `Kitchen.deployPot`, then the cook.

### Decode a cook against its source

```bash theme={null}
sauce inspect 0x<cook calldata> --chain base --source pay.sauce.ts --offline
```

```text theme={null}
Pot.cook on engine <engine address> (the released v12 engine <version>)
  program: 218 bytes, keccak256 0x5866f368bd801e84e5e1b8bc5a72059822d6325a2c8d4a556c8718f01e8acebf
    pay.sauce.ts's program, 154 bytes, then 64 of arguments
      to: Address = 0x2222222222222222222222222222222222222222
      amount: Uint256 = 1000000
```

The cook carries 218 bytes: the 154-byte program and two 32-byte arguments.

### The same, as JSON

```bash theme={null}
sauce inspect 0x<cook calldata> --chain base --source pay.sauce.ts --offline --json
```

```json theme={null}
{
  "call": "Pot.cook",
  "engine": {
    "address": "<engine address>",
    "released": true
  },
  "program": {
    "size": 218,
    "keccak256": "0x5866f368bd801e84e5e1b8bc5a72059822d6325a2c8d4a556c8718f01e8acebf",
    "source": {
      "file": "pay.sauce.ts",
      "matches": true,
      "argumentsSize": 64,
      "arguments": [
        { "name": "to", "type": "Address", "value": "0x2222222222222222222222222222222222222222" },
        { "name": "amount", "type": "Uint256", "value": "1000000" }
      ]
    }
  }
}
```

### Decode a Pot deployment

```bash theme={null}
sauce inspect 0x<deployPot calldata> --chain base --offline
```

```text theme={null}
Kitchen.deployPot: the Pot 0x6c9175d272D49e6C8C139A3FE6BC6fDb422eD3Fe, owner 0x1111111111111111111111111111111111111111, salt 0x0000000000000000000000000000000000000000000000000000000000000000
```

### Inspect a program file

```bash theme={null}
sauce inspect pay.sauce.ts --chain base
```

```text theme={null}
pay.sauce.ts for base (evm)
  program: 154 bytes, keccak256 0xf11d12819e3beed2d58504d5883eb0c53ce3a1a129046c45ac7fea60db976503
  main(to: Address, amount: Uint256), arguments abi-v1
```

## Next steps

* [`sauce verify`](https://docs.eco.com/sauce-sdk/cli/verify): check that a cook runs the settle program the package ships.
* [`sauce tx`](https://docs.eco.com/sauce-sdk/cli/tx): build the cook this command decodes.
* [Cook](https://docs.eco.com/sauce/cook.md): what a cook's calldata holds.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.