# TxResult.stateGasSpent

Returns the EIP-8037 state gas this transaction contributes to a block.

The counterpart to [`TxResult.regularGasSpent`](/evm/execution/TxResult/regularGasSpent) in the per-transaction block-gas split.

## Imports

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

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

## Examples

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

const result = Evm.callTx(evm, transaction)
TxResult.stateGasSpent(result)
// @log: 0n
```

## Definition

```ts
function stateGasSpent(
  result: TxResult,
): bigint
```

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

## Parameters

### result

* **Type:** `TxResult`

Transaction result.

#### result.createdAddress

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

Address of the contract a successful create transaction deployed.

#### result.errorCode

* **Type:** `bigint`
* **Optional**

Host error code raised during execution, if any.

#### result.floorGas

* **Type:** `bigint`

EIP-7623 calldata floor gas. Zero when it does not apply.

#### result.logs

* **Type:** `readonly Log[]`

Logs emitted during execution.

#### result.output

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

Returned data, or revert data when `status` is `false`.

#### result.refunded

* **Type:** `bigint`

Gas refund, capped per EIP-3529, before the EIP-7623 floor applies.

#### result.stateGasSpent

* **Type:** `bigint`

State gas consumed per EIP-8037. Zero when EIP-8037 is disabled.

#### result.status

* **Type:** `boolean`

Whether execution succeeded.

#### result.stop

* **Type:** `"stop" | "return" | "selfDestruct" | "revert" | "callTooDeep" | "outOfFunds" | "createInitCodeStartingEF00" | "invalidEofInitCode" | "invalidExtDelegateCallTarget" | "outOfGas" | ... 22 more ... | "invalidImmediateEncoding"`

Why the interpreter stopped.

#### result.totalGasSpent

* **Type:** `bigint`

Total gas spent, regular plus state, before any refund.

## Return Type

State gas.

`bigint`
