> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Create Access List \[transaction.createAccessList]

Creates an EIP-2930 access list covering the storage a transaction touches (`eth_createAccessList`).

## Usage

This example creates an EIP-2930 access list covering the storage a transaction touches (`eth_createAccessList`).

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const { accessList, gasUsed } = await client.transaction.createAccessList({
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
// @log: {
// @log:   accessList: [
// @log:     {
// @log:       address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2',
// @log:       storageKeys: [
// @log:         '0x0000000000000000000000000000000000000000000000000000000000000000',
// @log:       ],
// @log:     },
// @log:   ],
// @log:   gasUsed: 26671n,
// @log: }
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http, publicActions } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
}).extend(publicActions())
```
:::

### Standalone Action

Call `Actions.transaction.createAccessList` directly by passing the Client as the first argument.

:::code-group
```ts twoslash [example.ts]
import { Actions } from 'viem'
import { client } from './viem.config'

const { accessList, gasUsed } = await Actions.transaction.createAccessList(
  client,
  {
    data: '0x06fdde03',
    to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
  },
)
// @log: {
// @log:   accessList: [
// @log:     {
// @log:       address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2',
// @log:       storageKeys: [
// @log:         '0x0000000000000000000000000000000000000000000000000000000000000000',
// @log:       ],
// @log:     },
// @log:   ],
// @log:   gasUsed: 26671n,
// @log: }
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
})
```
:::

## Recipes

### Create an Access List for an Authorization

Pass `authorizationList` when the transaction applies an EIP-7702 authorization.

```ts twoslash
import { Client, http, publicActions } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({
  chain: mainnet,
  transport: http(),
}).extend(publicActions())

const { accessList } = await client.transaction.createAccessList({
  authorizationList: [ // [!code focus]
    { // [!code focus]
      address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code focus]
      chainId: 1, // [!code focus]
      nonce: 0n, // [!code focus]
      r: '0x...', // [!code focus]
      s: '0x...', // [!code focus]
      yParity: 0, // [!code focus]
    }, // [!code focus]
  ], // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### Create an Access List for Blobs

Pass blobs and their versioned hashes when the transaction uses EIP-4844.

```ts twoslash
import { Client, http, publicActions } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({
  chain: mainnet,
  transport: http(),
}).extend(publicActions())

const { accessList } = await client.transaction.createAccessList({
  blobs: ['0x1234'], // [!code focus]
  blobVersionedHashes: ['0x...'], // [!code focus]
  maxFeePerBlobGas: 1_000_000_000n, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
  type: 'eip4844', // [!code focus]
})
```

## Return Value

`{ accessList: AccessList, gasUsed: bigint }`

The EIP-2930 access list covering the storage the call touches, and the gas consumed by the call with the access list applied.

## Parameters

### account

* **Type:** `Account | Address`
* **Default:** `client.account`

The Account object or address to use as the call's `msg.sender`. This option takes precedence over [`from`](#from).

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', // [!code focus]
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### authorizationList

* **Type:** `AuthorizationList`

The EIP-7702 signed authorization list to include in the transaction request.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  authorizationList: [ // [!code focus]
    { // [!code focus]
      address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code focus]
      chainId: 1, // [!code focus]
      nonce: 0n, // [!code focus]
      r: '0x...', // [!code focus]
      s: '0x...', // [!code focus]
      yParity: 0, // [!code focus]
    }, // [!code focus]
  ], // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### blobs

* **Type:** `readonly Hex[]`

The EIP-4844 blobs to include in the transaction request.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  blobs: ['0x1234'], // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### blobVersionedHashes

* **Type:** `readonly Hex[]`

The versioned hashes of the EIP-4844 blobs in the transaction request.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  blobVersionedHashes: ['0x...'], // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### blockNumber

* **Type:** `bigint`

Creates the access list against the state at a given block number.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  blockNumber: 42069n, // [!code focus]
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### blockTag

* **Type:** `'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'`
* **Default:** `client.blockTag ?? 'latest'`

Creates the access list against the state at a given block tag.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  blockTag: 'pending', // [!code focus]
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### chainId

* **Type:** `number | Hex`

The chain ID to include in the transaction request.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  chainId: 1, // [!code focus]
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### data

* **Type:** `Hex`

The calldata to send with the transaction.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  data: '0x06fdde03', // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### from

* **Type:** `Address`

The raw sender address. Viem uses this field only when neither [`account`](#account) nor a Client Account is available.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  data: '0x06fdde03',
  from: '0xd2135CfB216b74109775236E36d4b433F1DF507B', // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### gas

* **Type:** `number | bigint | Hex`

The gas limit for the call.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  data: '0x06fdde03',
  gas: 100_000n, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### gasPrice

* **Type:** `number | bigint | Hex`

The legacy gas price (in wei) to use. Mutually exclusive with `maxFeePerGas`/`maxPriorityFeePerGas`.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  data: '0x06fdde03',
  gasPrice: 20_000_000_000n, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### maxFeePerBlobGas

* **Type:** `number | bigint | Hex`

The maximum fee per blob gas (in wei) that the sender is willing to pay.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  maxFeePerBlobGas: 1_000_000_000n, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### maxFeePerGas

* **Type:** `number | bigint | Hex`

The total fee per gas (in wei) the sender is willing to pay (EIP-1559).

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  data: '0x06fdde03',
  maxFeePerGas: 20_000_000_000n, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### maxPriorityFeePerGas

* **Type:** `number | bigint | Hex`

The max priority fee per gas (in wei) to pay to the block producer (EIP-1559).

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  data: '0x06fdde03',
  maxPriorityFeePerGas: 1_000_000_000n, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### nonce

* **Type:** `number | bigint | Hex`

The nonce to use for the transaction's sender.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  data: '0x06fdde03',
  nonce: 69, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### requestOptions

* **Type:** `{ dedupe?: boolean; signal?: AbortSignal; ... }`

Per-request transport options (for example, an `AbortSignal` to cancel the request).

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const controller = new AbortController()
const result = await Actions.transaction.createAccessList(client, {
  data: '0x06fdde03',
  requestOptions: { signal: controller.signal }, // [!code focus]
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})
```

### to

* **Type:** `Address | null`

The transaction recipient. Pass `null` for a contract creation request.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  data: '0x06fdde03',
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', // [!code focus]
})
```

### type

* **Type:** `string`

The transaction type to include in the request.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  to: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
  type: 'eip1559', // [!code focus]
})
```

### value

* **Type:** `number | bigint | Hex`

The value (in wei) sent with the transaction.

```ts twoslash
import { Actions, Client, http } from 'viem'
import { mainnet } from 'viem/chains'
import { Value } from 'viem/utils'

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const result = await Actions.transaction.createAccessList(client, {
  to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
  value: Value.fromEther('1'), // [!code focus]
})
```

## Errors

| Error | Description |
| --- | --- |
| `RpcError.ExecutionError` | The access-list creation failed (for example, the call reverted). |
