> For the complete documentation index, see [llms.txt](https://docs.megaeth.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.megaeth.com/mega-evme/reference/transaction-types.md).

# Transaction Types

`mega-evme` supports five transaction types via the `--tx-type` flag. The transaction type determines which additional options are available and how the transaction is encoded.

## Common Transaction Options

These options apply to all transaction types in the `run` and `tx` commands.

| Flag                      | Default                                      | Aliases                                     | Description                                                         |
| ------------------------- | -------------------------------------------- | ------------------------------------------- | ------------------------------------------------------------------- |
| `--tx-type <TYPE>`        | `0`                                          | `--type`, `--ty`                            | Transaction type number                                             |
| `--gas <AMOUNT>`          | `10000000`                                   | `--gas-limit`                               | Gas limit                                                           |
| `--basefee <AMOUNT>`      | `0`                                          | `--gas-price`, `--price`, `--base-fee`      | Gas price (Legacy) or max fee per gas (EIP-1559)                    |
| `--priority-fee <AMOUNT>` | N/A                                          | `--priorityfee`, `--tip`                    | EIP-1559 max priority fee per gas                                   |
| `--sender <ADDRESS>`      | `0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266` | `--from`                                    | Transaction sender                                                  |
| `--receiver <ADDRESS>`    | `0x0000…0000`                                | `--to`                                      | Transaction receiver                                                |
| `--nonce <NONCE>`         | `0`                                          | —                                           | Transaction nonce                                                   |
| `--create`                | `false`                                      | —                                           | Execute in create mode (deploy contract). Requires explicit `true`. |
| `--value <AMOUNT>`        | `0`                                          | —                                           | ETH value in wei (supports `1ether`, `100gwei`, `1000wei` suffixes) |
| `--input <HEX>`           | N/A                                          | `--data`                                    | Transaction calldata as hex                                         |
| `--inputfile <PATH>`      | N/A                                          | `--datafile`, `--input-file`, `--data-file` | Calldata from file (`-` for stdin)                                  |

## Type 0 — Legacy

The default transaction type. Uses a single gas price (`--basefee`) for all gas costs.

```bash
mega-evme tx --tx-type 0 \
  --sender.balance 1ether \
  --receiver 0x4200000000000000000000000000000000000006 \
  --gas 100000 \
  --basefee 1000000000 \
  --input 0x06fdde03
```

A transaction with a non-zero `--basefee` requires the sender to hold enough balance to cover `gas × basefee`; fund it with `--sender.balance` (or run against forked/prestate state).

## Type 1 — EIP-2930 (Access List)

Adds an access list to declare which addresses and storage slots the transaction will touch. Pre-warming the access list reduces gas costs for those accesses from cold to warm.

### Additional Options

| Flag               | Default | Aliases                         | Description                    |
| ------------------ | ------- | ------------------------------- | ------------------------------ |
| `--access <ENTRY>` | N/A     | `--accesslist`, `--access-list` | Access list entry (repeatable) |

Access list entry format:

* `ADDRESS` — pre-warm an address (no storage keys)
* `ADDRESS:KEY1,KEY2,...` — pre-warm an address and specific storage keys (comma-separated)

Storage keys are full 32-byte hex values (64 hex digits, `0x`-prefixed); abbreviated forms like `0x0` are rejected.

```bash
mega-evme tx --tx-type 1 \
  --receiver 0x4200000000000000000000000000000000000006 \
  --access "0x4200000000000000000000000000000000000006" \
  --access "0x28B7E77f82B25B95953825F1E3eA0E36c1c29861:0x0000000000000000000000000000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000000000000000000000000001" \
  --input 0x06fdde03
```

## Type 2 — EIP-1559

Uses a base fee + priority fee model instead of a flat gas price. Also supports access lists.

```bash
mega-evme tx --tx-type 2 \
  --sender.balance 1ether \
  --receiver 0x4200000000000000000000000000000000000006 \
  --basefee 30000000000 \
  --priority-fee 1000000000 \
  --access "0x4200000000000000000000000000000000000006:0x0000000000000000000000000000000000000000000000000000000000000000" \
  --input 0x06fdde03
```

## Type 4 — EIP-7702 (Authorization)

Allows an EOA to temporarily delegate its execution to a contract via authorization tuples. Also supports access lists.

### Additional Options

| Flag            | Default | Aliases           | Description                      |
| --------------- | ------- | ----------------- | -------------------------------- |
| `--auth <AUTH>` | N/A     | `--authorization` | Authorization tuple (repeatable) |

Authorization format: `AUTHORITY:NONCE->DELEGATION`

* `AUTHORITY` — address of the EOA delegating control
* `NONCE` — authorization nonce (decimal or `0x`-prefixed hex)
* `DELEGATION` — address of the contract to delegate to

```bash
# Single authorization — delegate the sender's EOA to Multicall3
mega-evme tx --tx-type 4 \
  --auth "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266:0->0xcA11bde05977b3631167028862bE2a173976CA11" \
  --receiver 0x4200000000000000000000000000000000000006

# Multiple authorizations
mega-evme tx --tx-type 4 \
  --auth "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266:0->0xcA11bde05977b3631167028862bE2a173976CA11" \
  --auth "0x70997970C51812dc3A010C7d01b50e0d17dc79C8:1->0xcA11bde05977b3631167028862bE2a173976CA11" \
  --receiver 0x4200000000000000000000000000000000000006
```

## Type 126 — Deposit (Optimism)

A deposit transaction mints ETH from L1 and optionally executes a call. These are system-level transactions used by the Optimism bridge.

### Additional Options

| Flag                   | Default | Aliases        | Description                                       |
| ---------------------- | ------- | -------------- | ------------------------------------------------- |
| `--source-hash <HASH>` | N/A     | `--sourcehash` | Source hash identifying the deposit origin (B256) |
| `--mint <AMOUNT>`      | N/A     | —              | Amount of ETH to mint to the sender (in wei)      |

```bash
mega-evme tx --tx-type 126 \
  --sender 0x4200000000000000000000000000000000000010 \
  --receiver 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 \
  --mint 1000000000000000000 \
  --source-hash 0xabc123...
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.megaeth.com/mega-evme/reference/transaction-types.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
