# Handle Blocked Funds

## Overview

When a transfer fails a receive policy, the funds are held rather than credited and a
`TransferBlocked` event is emitted with a claim receipt. An authorized claimer can release the
blocked funds to a destination, or they can be burned. This recipe covers reading the blocked
balance and resolving it.

[See the Policy Registry specification](https://docs.tempo.xyz/protocol/tip403/overview)

## Recipes

These recipes assume you have [set up a Tempo client](/tempo). Each recipe uses the claim receipt
(the witness emitted on the `TransferBlocked` event).

### Read a Blocked Balance

Read how much is held for a claim receipt with
[`receivePolicy.getBlockedBalance`](/tempo/actions/receivePolicy.getBlockedBalance).

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

const blockedReceipt = '0x...' as const

const amount = await client.receivePolicy.getBlockedBalance({
  receipt: blockedReceipt,
})
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/tempo/viem.config.ts:setup]
```
:::

### Claim Blocked Funds

Release blocked funds to a destination with
[`receivePolicy.claimSync`](/tempo/actions/receivePolicy.claim). Only the policy's authorized claimer
can do this.

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

const blockedReceipt = '0x...' as const

const { receipt } = await client.receivePolicy.claimSync({
  to: client.account.address,
  receipt: blockedReceipt,
})
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/tempo/viem.config.ts:setup]
```
:::

### Burn Blocked Funds

Permanently destroy blocked funds with
[`receivePolicy.burnSync`](/tempo/actions/receivePolicy.burn) when they should not be released.

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

const blockedReceipt = '0x...' as const

const { receipt } = await client.receivePolicy.burnSync({
  receipt: blockedReceipt,
})
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/tempo/viem.config.ts:setup]
```
:::

## Best Practices

### Capture the Claim Receipt

The claim receipt from the `TransferBlocked` event is required to read, claim, or burn blocked funds.
Index `TransferBlocked` events and persist the receipt so blocked transfers can always be resolved.

### Decide a Default Resolution

Have a clear policy for blocked funds: typically claim legitimate transfers to a recovery account and
burn only when funds must not be released (for example, sanctioned senders). Automating this keeps
blocked balances from piling up.

### Claim from an Authorized Account

Only the claimer configured in the receive policy can claim. Make sure the account you set when you
[set the policy](/tempo/guides/receive-policies/set) is the one performing the claim.

## See More

<Cards>
  <Card icon="lucide:shield-check" title="Set a Receive Policy" description="Configure the claimer authorized to release funds." to="/tempo/guides/receive-policies/set" />

  <Card icon="lucide:scan-line" title="Validate Transfers" description="Prevent blocks by validating transfers up front." to="/tempo/guides/receive-policies/validate" />

  <Card icon="lucide:square-function" title="receivePolicy.claim" description="Release blocked funds to a destination address." to="/tempo/actions/receivePolicy.claim" />

  <Card icon="lucide:book-open" title="Tempo Docs: Policy Registry" description="How blocked transfers and claims work." to="https://docs.tempo.xyz/protocol/tip403/overview" />
</Cards>
