# Database.fromAsync

Marks a source as asynchronous.

An EVM created over the result performs its reads asynchronously, so executing through it returns a promise. Marking is explicit because whether a read returns a promise is otherwise only knowable by performing one.

## Imports

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

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

## Examples

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

const database = Database.fromAsync({
  async getAccount(address) {
    return load(address)
  },
  async getBlockHash(number) {
    return hashes[String(number)]
  },
  async getCodeByHash(codeHash) {
    return code[codeHash]
  },
  async getStorage(address, key) {
    return slots[`${address}:${key}`] ?? 0n
  }
})
```

## Definition

```ts
function fromAsync(
  source: async.Async,
): Async
```

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

## Parameters

### source

* **Type:** `async.Async`

Reads to perform.

## Return Type

An asynchronous database.

[`Database.Async`](/evm/execution/Database/types#databaseasync)
