# Evm.create

Creates an EVM.

Asynchronous because the engine is WebAssembly and browsers refuse to compile a module this size synchronously on the main thread. The module is compiled once per JavaScript realm; every call afterwards is synchronous.

The specification selects the instruction table, gas schedule, precompiles, and transaction handlers. Choosing among compiled precompile sets or handler registries arrives with the configuration surface; until then the specification determines all of them.

## Imports

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

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

## Examples

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

const evm = await Evm.create()
```

### Seeding state

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

const evm = await Evm.create({
  database: Database.fromMemory({
    accounts: {
      '0x0000000000000000000000000000000000000001': {
        balance: 1n
      }
    }
  })
})
```

## Definition

```ts
function create(
  options?: create.Options,
): Promise<Evm>
```

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

## Parameters

### options

* **Type:** `create.Options`
* **Optional**

Constructor components.

#### options.block

* **Type:** `Block`
* **Optional**

Block values opcodes read.

#### options.chainId

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

Chain id `CHAINID` reports and transactions are validated against.

#### options.database

* **Type:** `Database`
* **Optional**

State the EVM reads through.

An empty in-memory database by default, holding no accounts. evm2 reads a
missing account as balance and nonce zero, so a transaction that costs
nothing still executes; anything needing funds fails until state is
seeded.

#### options.specId

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

Specification whose rules apply.

## Return Type

An EVM.

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