# Evm.setBlock

Replaces the block environment.

Accepted state is untouched: this changes what block opcodes report, not what the EVM has executed. The specification and version stay as they were.

## Imports

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

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

## Examples

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

Evm.setBlock(evm, {
  number: 21_000_000n,
  timestamp: 1_700_000_000n
})
```

## Definition

```ts
function setBlock<asynchronous>(
  evm: Evm<asynchronous>,
  block: Block,
): Awaitable<asynchronous, void>
```

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

## Parameters

### evm

* **Type:** `Evm<asynchronous>`

EVM to reconfigure.

#### evm.'~async'

* **Type:** `asynchronous`

#### evm.'~chainId'

* **Type:** `bigint`

#### evm.'~config'

* **Type:** `{ block: Block; specId: "frontier" | "homestead" | "tangerine" | "spuriousDragon" | "byzantium" | "petersburg" | "istanbul" | "berlin" | "london" | "merge" | "shanghai" | "cancun" | "prague" | "osaka" | "amsterdam"; version?: Version; }`

The engine's current execution config.

Held so a setter can replace one half without discarding the other, since
the adapter's operation carries both.

#### evm.'~driver'

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

Drives the asynchronous source, when there is one.

#### evm.'~engine'

* **Type:** `Engine`

#### evm.block

* **Type:** `Block`

#### evm.specId

* **Type:** `"frontier" | "homestead" | "tangerine" | "spuriousDragon" | "byzantium" | "petersburg" | "istanbul" | "berlin" | "london" | "merge" | "shanghai" | "cancun" | "prague" | "osaka" | "amsterdam"`

#### evm.version

* **Type:** `Version`
* **Optional**

### block

* **Type:** `Block`

Block values to apply.

#### block.basefee

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

`BASEFEE`.

#### block.beneficiary

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

`COINBASE`.

#### block.blobBasefee

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

`BLOBBASEFEE`.

#### block.difficulty

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

`DIFFICULTY`, pre-merge.

#### block.gasLimit

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

`GASLIMIT`.

#### block.number

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

`NUMBER`.

#### block.prevrandao

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

`PREVRANDAO`, post-merge.

#### block.slotNum

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

Beacon slot number.

#### block.timestamp

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

`TIMESTAMP`.

## Return Type

`Awaitable<asynchronous, void>`
