> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Freeze a holder

> Freeze a holder's token account so the network blocks their transfers, then thaw it.

<div className="sol-stepper not-prose" data-path="quickstart">
<div className="sol-stepper-nav" role="navigation" aria-label="Quickstart · ~8 min">
<ol>
<li data-state="done"><a href="/developers/docs/quickstart/check-balance"><span className="sol-stepper-n">Step 1<span className="sol-vh">, </span><span className="sol-stepper-done">Done</span><span className="sol-vh">: </span></span><span className="sol-stepper-t">Check a balance</span></a></li>
<li data-state="done"><a href="/developers/docs/quickstart/send-dollars"><span className="sol-stepper-n">Step 2<span className="sol-vh">, </span><span className="sol-stepper-done">Done</span><span className="sol-vh">: </span></span><span className="sol-stepper-t">Send dollars</span></a></li>
<li data-state="done"><a href="/developers/docs/quickstart/create-asset"><span className="sol-stepper-n">Step 3<span className="sol-vh">, </span><span className="sol-stepper-done">Done</span><span className="sol-vh">: </span></span><span className="sol-stepper-t">Create an asset</span></a></li>
<li data-state="done"><a href="/developers/docs/quickstart/send-asset"><span className="sol-stepper-n">Step 4<span className="sol-vh">, </span><span className="sol-stepper-done">Done</span><span className="sol-vh">: </span></span><span className="sol-stepper-t">Send the asset</span></a></li>
<li data-state="current"><a href="/developers/docs/quickstart/freeze-holder" aria-current="step"><span className="sol-stepper-n">Step 5<span className="sol-vh">: </span></span><span className="sol-stepper-t">Freeze a holder</span></a></li>
</ol>
</div>
</div>

As the issuer, you can apply controls that the network enforces. In this step
you use the simplest: freeze the holder's account, watch their transfer fail,
then thaw it. Step 3 made your wallet the asset's freeze authority, so you can.

## Freeze and thaw the holder

Save this as `freeze-holder.ts` next to `client.ts` and run
`npx tsx freeze-holder.ts`. It reads the asset from `asset.json` (`exf.json` in
the **CLI** tab) and the holder from `holder.json`.

<Tabs>
<Tab title="TypeScript">
<div className="sol-tab-label">TypeScript</div>

```ts
import { readFileSync } from "node:fs";
import { address, createKeyPairSignerFromBytes } from "@solana/kit";
import {
  findAssociatedTokenPda,
  TOKEN_2022_PROGRAM_ADDRESS,
} from "@solana-program/token-2022";
import { client, tokenBalance } from "./client";

const mint = address(JSON.parse(readFileSync("asset.json", "utf8")).mint);
const holder = await createKeyPairSignerFromBytes(
  new Uint8Array(JSON.parse(readFileSync("holder.json", "utf8"))),
);
const [account] = await findAssociatedTokenPda({
  mint,
  owner: holder.address,
  tokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
});
const { freezeAccount, thawAccount, transferToATA } =
  client.token2022.instructions;

// The holder sends 10 EXF back to you (you pay the fee).
const sendBack = () =>
  transferToATA({
    mint,
    authority: holder,
    recipient: client.identity.address,
    amount: 1_000n,
    decimals: 2,
  }).sendTransaction();

// 1. As the freeze authority, freeze the holder's EXF account.
await freezeAccount({
  account,
  mint,
  owner: client.identity,
}).sendTransaction();
console.log("Froze the holder's EXF account");

// 2. Nothing moves out of a frozen account: Token-2022 rejects the transfer
// (error 17, AccountFrozen) before it lands, so the holder keeps 100 EXF.
try {
  await sendBack();
} catch {
  console.log("Transfer blocked: account is frozen");
}

// 3. Thaw it, and the same transfer goes through.
await thawAccount({ account, mint, owner: client.identity }).sendTransaction();
const { context } = await sendBack();
console.log("Thawed. Transfer sent:", context.signature);
console.log("Holder balance:", await tokenBalance(holder.address, mint), "EXF");
```

<div className="sol-term not-prose" data-term="paths/start/quickstart/freeze" data-tab="TypeScript" data-kind="block" data-steps="1" data-l-run="Run" data-l-run-step="Run step" data-l-next="Next step" data-l-all="Run all" data-l-again="Run again" data-l-running="Running…" data-l-tx="Sending transaction…" data-l-http="Requesting…" data-l-call="Running…" data-l-confirming="Confirming…" data-l-done="Done" data-l-copied="Copied" data-l-step="Step">
<div className="sol-term-head"><span className="sol-term-title">Output of npx tsx freeze-holder.ts</span><span className="sol-term-env">Local test network (Surfpool)</span><button type="button" className="sol-term-copy" data-act="copy">Copy</button></div>
<div className="sol-term-screen" role="region" tabIndex="0" aria-label="Output of npx tsx freeze-holder.ts: Output">
<div className="sol-term-step" data-step="1" data-pending="call">
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\$</span> npx tsx freeze-holder.ts</div>
<div className="sol-term-row sol-term-ln">`Froze the holder's EXF account`</div>
<div className="sol-term-row sol-term-ln" data-tone="error">Transfer blocked\: account is frozen</div>
<div className="sol-term-row sol-term-ln">Thawed. Transfer sent\: <span className="sol-h" title="3Bnnn7495CMuoae88MuQsRKpDVsRqEpZRuYSPkP4hSRSyPA48ZXvpLWZAo8eXK8YbiARbYyQYn8nEnPucU3s5Sri"><span className="sol-h-f">3Bnnn7495CMuoae88MuQsRKpDVsRqEpZRuYSPkP4hSRSyPA48ZXvpLWZAo8eXK8YbiARbYyQYn8nEnPucU3s5Sri</span><span className="sol-h-s" aria-hidden="true">3Bnn…5Sri</span></span></div>
<div className="sol-term-row sol-term-ln">Holder <span className="sol-term-k">balance\:</span> 90 EXF</div>
<div className="sol-term-result"><span className="sol-term-badge" data-tone="ok">Confirmed</span></div>
</div>
</div>
<div className="sol-term-foot"><button type="button" className="sol-term-btn" data-act="run">Run</button><span className="sol-term-status"></span><span className="sol-term-sr" role="status"></span></div>
</div>

</Tab>
<Tab title="CLI">
<div className="sol-tab-label">CLI</div>

```bash
MINT=$(solana address -k exf.json)
# The holder's EXF token account (step 4 opened it)
ACCOUNT=$(spl-token address --verbose --token $MINT --owner holder.json \
  | awk '/Associated/ {print $NF}')
spl-token freeze $ACCOUNT
# The holder sends 10 EXF back (you pay the fee). Fails: Account is frozen
spl-token transfer $MINT 10 $(solana address) \
  --owner holder.json --fee-payer ~/.config/solana/id.json
spl-token thaw $ACCOUNT
# The same transfer now goes through
spl-token transfer $MINT 10 $(solana address) \
  --owner holder.json --fee-payer ~/.config/solana/id.json
```

</Tab>
</Tabs>

What the code does:

- `findAssociatedTokenPda(...)` works out the holder's EXF token account, the
  one step 4 opened.
- `sendBack()` builds a transfer of 10 EXF from the holder back to you, signed
  by the holder. Your wallet pays the fee.

Then, in order:

1. **Freeze.** `freezeAccount(...)`, signed by your wallet as the freeze
   authority, freezes the holder's EXF account.
2. **Try a transfer.** Token-2022 rejects any transfer out of a frozen account
   (error 17, `AccountFrozen`). It fails in the RPC node's pre-send simulation,
   so it never lands and costs nothing. The script prints
   `Transfer blocked: account is frozen`.
3. **Thaw.** `thawAccount(...)` unfreezes the account, and the same transfer
   goes through. The holder ends with 90 EXF.

Freezing only affects this one account: the holder's other tokens, and everyone
else's EXF, keep moving.

<div className="sol-concept not-prose">
[<span className="sol-concept-name">Mints & authorities</span> <span className="sol-concept-def">A mint account defines a token: its supply, its decimals, who may create more (mint authority), and who may freeze holders (freeze authority).</span>](/developers/docs/tokens/basics/create-mint)
</div>

## Next steps

<Columns cols={2}>
<Card title="Issue an asset" icon="layers" href="/developers/docs/assets/issue-asset">
Add an approval list and a pause switch that the network enforces on every
transfer.
</Card>
<Card title="Learn how Solana works" icon="box" href="/developers/docs/core">
Accounts, transactions, programs, and fees: the building blocks behind each
step.
</Card>
</Columns>

Or build something real with a tutorial:

<Columns cols={3}>
<Card title="Paywall an endpoint" icon="code" href="/developers/docs/payments/paywall-api">
Charge per API call over HTTP 402.
</Card>
<Card title="Build a checkout" icon="credit-card" href="/developers/docs/payments/checkout">
Take USDC payments and confirm them from your server.
</Card>
<Card title="Settle a trade" icon="arrow-left-right" href="/developers/docs/defi/settle-trade">
Move an asset and its payment in one transaction.
</Card>
</Columns>
