# Evm.callTx

Executes a transaction and discards its state changes.

Runs 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 the engine 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, {
  from: '0x0000000000000000000000000000000000000001',
  gas: 100_000n,
  to: '0x0000000000000000000000000000000000000002',
  value: 1n
})
TxResult.txGasUsed(result)
// @log: 21000n
```

## Definition

```ts
function callTx(
  evm: Evm<true>,
  transaction: Ethereum.Tx,
): TxResult.TxResult
```

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

## Parameters

### evm

* **Type:** `Evm<true>`

EVM to execute on.

#### evm.'~async'

* **Type:** `asynchronous`

#### evm.'~chainId'

* **Type:** `bigint`

#### evm.'~driver'

* **Type:** `asynchronous extends true ? Driver : undefined`

Drives the asynchronous source, when there is one.

#### evm.'~engine'

* **Type:** `Engine`

### transaction

* **Type:** `Ethereum.Tx`

Transaction and the account it executes as.

#### transaction.accessList

* **Type:** `readonly { address: abitype_Address; storageKeys: readonly 0x${string}[]; }[]`
* **Optional**

EIP-2930 Access List.

#### transaction.authorizationList

* **Type:** `readonly { address: abitype_Address; chainId: numberType; nonce: bigintType; r: 0x${string}; s: 0x${string}; yParity: numberType; }[]`

EIP-7702 Authorization List.

#### transaction.blobVersionedHashes

* **Type:** `readonly 0x${string}[]`

Versioned hashes of blobs to be included in the transaction.

#### transaction.chainId

* **Type:** `numberType`

EIP-155 Chain ID.

#### transaction.data

* **Type:** `0x${string}`
* **Optional**

Contract code or a hashed method call with encoded args

#### transaction.from

* **Type:** `abitype_Address`

Account the transaction executes as.

#### transaction.gas

* **Type:** `bigintType`
* **Optional**

Gas provided for transaction execution

#### transaction.gasPrice

* **Type:** `bigintType`
* **Optional**

Base fee per gas.

#### transaction.input

* **Type:** `0x${string}`
* **Optional**

#### transaction.maxFeePerBlobGas

* **Type:** `bigintType`
* **Optional**

Maximum total fee per gas sender is willing to pay for blob gas (in wei).

#### transaction.maxFeePerGas

* **Type:** `bigintType`
* **Optional**

Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas).

#### transaction.maxPriorityFeePerGas

* **Type:** `bigintType`
* **Optional**

Max priority fee per gas (in wei).

#### transaction.nonce

* **Type:** `bigintType`
* **Optional**

Unique number identifying this transaction

#### transaction.r

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

#### transaction.s

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

#### transaction.serialized

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

EIP-2718 encoded transaction.

#### transaction.sidecars

* **Type:** `Sidecars`
* **Optional**

PeerDAS (EIP-7594) sidecars associated with this transaction. When
defined, the envelope serializes into the 5-element "PooledTransactions"
network wrapper (`rlp([tx_body, wrapper_version, blobs, commitments,
cell_proofs])`).

#### transaction.to

* **Type:** `Address.Address | null | undefined`
* **Optional**

Transaction recipient

#### transaction.type

* **Type:** `type`

Transaction type

#### transaction.v

* **Type:** `numberType`
* **Optional**

#### transaction.value

* **Type:** `bigintType`
* **Optional**

Value in wei sent with this transaction

#### transaction.yParity

* **Type:** `numberType`
* **Optional**

ECDSA signature yParity.

## Return Type

The transaction's result.

`Promise<TxResult.TxResult>`
