> **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.

# Get Confirmations \[transaction.getConfirmations]

Returns the number of blocks passed (confirmations) since the transaction was processed on a block.

## Usage

This example returns the number of blocks passed (confirmations) since the transaction was processed on a block.

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

const confirmations = await client.transaction.getConfirmations({
  hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
})
// @log: 15n
```

```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.getConfirmations` 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 confirmations = await Actions.transaction.getConfirmations(client, {
  hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
})
// @log: 15n
```

```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(),
})
```
:::

## Return Value

`bigint`

The number of blocks passed since the transaction was processed. If confirmations is `0`, the transaction has not been confirmed and processed yet.

## Parameters

### hash

* **Type:** `Hex`

Compute confirmations for the transaction with the given hash.

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

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const confirmations = await Actions.transaction.getConfirmations(client, {
  hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', // [!code focus]
})
```

### transactionReceipt

* **Type:** `TransactionReceipt`

Compute confirmations from an already-fetched [transaction receipt](/docs/actions/public/transaction/getReceipt), saving an extra `eth_getTransactionByHash` request. Mutually exclusive with [`hash`](#hash).

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

const client = Client.create({ chain: mainnet, transport: http() })
// ---cut---
const receipt = await Actions.transaction.getReceipt(client, {
  hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
})

const confirmations = await Actions.transaction.getConfirmations(client, {
  transactionReceipt: receipt, // [!code focus]
})
```

## Errors

| Error | Description |
| --- | --- |
| `Actions.transaction.Errors.TransactionNotFoundError` | The transaction could not be found. |
