# Evm.callTx

Executes a transaction and discards its state changes.

This is evm2's `call_tx`: a fully validated transaction whose state changes are discarded. Nonce, chain id, balance, and intrinsic gas are all checked, so it is stricter than an `eth_call`, and it takes an encoded envelope with its signer rather than a loose message. Output, gas, and logs come back, nothing written is kept, and executing the same transaction twice gives the same result.

A revert or an exceptional halt is a successful call returning `status: false`. It throws only when evm2 refused the transaction, or when the database could not supply state.

## Imports

:::code-group
```ts [Named]
import { Evm } from 'ox/evm'
```

```ts [Entrypoint]
import * as Evm from 'ox/evm/Evm'
```
:::

## Examples

```ts twoslash
// @noErrors
import { Database, Evm, TxResult } from 'ox/evm'

const evm = await Evm.create({ database, specId: 'osaka' })

const result = Evm.callTx(evm, { envelope, signer })
TxResult.txGasUsed(result)
// @log: 21000n
```

## Definition

```ts
function callTx(
  evm: Evm.Evm,
  transaction: Ethereum.RecoveredTx,
): TxResult.TxResult
```

**Source:** [src/evm/Evm.ts](https://github.com/wevm/ox/blob/main/src/evm/Evm.ts#L193)

## Parameters

### evm

* **Type:** [`Evm.Evm`](/evm/execution/Evm/types#evmevm)

EVM to execute on.

#### evm.'~engine'

* **Type:** `Engine`

### transaction

* **Type:** `Ethereum.RecoveredTx`

Transaction with its sender recovered.

#### transaction.envelope

* **Type:** `0x${string} | Uint8Array`

EIP-2718 encoded transaction.

#### transaction.signer

* **Type:** `abitype_Address`

Sender the signature recovers to.

## Return Type

The transaction's result.

`TxResult.TxResult`
