# Database.fromMemory

Creates an in-memory database.

Code is supplied inline with each account, so [`Database.Database`](/evm/execution/Database/types#database)`.getCodeByHash` is never reached: the engine files inline code under its hash when it loads the account.

## Imports

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

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

## Examples

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

const database = Database.fromMemory({
  accounts: {
    '0x0000000000000000000000000000000000000001': {
      balance: 1n
    },
    '0x0000000000000000000000000000000000000002': {
      code: '0x5f5ff3'
    }
  }
})
```

## Definition

```ts
function fromMemory(
  options?: fromMemory.Options,
): Database
```

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

## Parameters

### options

* **Type:** `fromMemory.Options`
* **Optional**

Initial state.

#### options.accounts

* **Type:** `Record`
* **Optional**

Accounts to seed, keyed by address.

#### options.balance

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

Balance in wei.

#### options.blockHashes

* **Type:** `Record`
* **Optional**

Historical block hashes, keyed by block number. A `BLOCKHASH` for a
height inside the window but absent here fails the read.

#### options.code

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

Deployed code.

#### options.nonce

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

Nonce.

#### options.storage

* **Type:** `Record`
* **Optional**

Storage slots, keyed by slot.

## Return Type

An in-memory database.

`Database`
