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

# Hold a restricted asset

> See a restricted asset at work: two investors are approved, a transfer to one succeeds, and a transfer to an unapproved account fails onchain.

<div className="sol-stepper not-prose" data-path="issue-asset">
<div className="sol-stepper-nav" role="navigation" aria-label="Issue an asset · ~45 min">
<ol>
<li data-state="current"><a href="/developers/docs/assets/issue-asset/try-it" aria-current="step"><span className="sol-stepper-n">Step 1<span className="sol-vh">: </span></span><span className="sol-stepper-t">Hold a restricted asset</span></a></li>
<li data-state="todo"><a href="/developers/docs/assets/issue-asset/browser"><span className="sol-stepper-n">Step 2<span className="sol-vh">: </span></span><span className="sol-stepper-t">Read the code</span></a></li>
<li data-state="todo"><a href="/developers/docs/assets/issue-asset/local"><span className="sol-stepper-n">Step 3<span className="sol-vh">: </span></span><span className="sol-stepper-t">Run it from your machine</span></a></li>
<li data-state="todo"><a href="/developers/docs/assets/issue-asset/go-live"><span className="sol-stepper-n">Step 4<span className="sol-vh">: </span></span><span className="sol-stepper-t">Go live</span></a></li>
</ol>
</div>
</div>

The Lisbon Solar Fund (LSF) is a demo asset whose token accounts start
**frozen**. An account can receive LSF only after the issuer approves it. Below,
the issuer approves two investors, then a holder sends LSF to an approved
investor and to an account nobody approved. Last, the issuer uses two more
controls: a pause and a clawback. Press **Run** to step through this tutorial's
code on a local test network (Surfpool). Nothing is sent from your browser, and
you need no code or wallet.

<div className="sol-term not-prose" data-term="paths/issue-asset/demo" data-kind="asset" data-steps="3" 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">Lisbon Solar Fund (LSF) · restricted asset</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-stage" data-stage="asset">
<div className="sol-term-item"><span className="sol-term-item-label">Holder</span><span className="sol-term-item-sub"><span className="sol-h" title="JAg5yGYw5Be2J54jk9s7ZUxhtU2FXN8txfpjxPctaeqx"><span className="sol-h-f">JAg5yGYw5Be2J54jk9s7ZUxhtU2FXN8txfpjxPctaeqx</span><span className="sol-h-s" aria-hidden="true">JAg5…aeqx</span></span></span><span className="sol-term-pill" data-at="0" data-tone="todo">Not approved</span><span className="sol-term-pill" data-at="1" data-tone="ok">Approved · 1000 LSF</span><span className="sol-term-pill" data-at="2" data-tone="ok">Sent 100 LSF · 900 LSF left</span><span className="sol-term-pill" data-at="3" data-tone="ok" data-final="">900 LSF</span></div>
<div className="sol-term-item"><span className="sol-term-item-label">Approved investor</span><span className="sol-term-item-sub"><span className="sol-h" title="CpvfwkairbnMrGqdW9wxMSiFgsHxi7666Gu4j7vCdjDv"><span className="sol-h-f">CpvfwkairbnMrGqdW9wxMSiFgsHxi7666Gu4j7vCdjDv</span><span className="sol-h-s" aria-hidden="true">Cpvf…djDv</span></span></span><span className="sol-term-pill" data-at="0" data-tone="todo">Not approved</span><span className="sol-term-pill" data-at="1" data-tone="ok">Approved · 0 LSF</span><span className="sol-term-pill" data-at="2" data-tone="ok">Received 100 LSF</span><span className="sol-term-pill" data-at="3" data-tone="info" data-final="">50 LSF · 50 moved to the issuer</span></div>
<div className="sol-term-item"><span className="sol-term-item-label">Unapproved account</span><span className="sol-term-item-sub"><span className="sol-h" title="FecRDHyzRTLH3dfdz6ni5pnGq5j883zcSBToSe3PPdbP"><span className="sol-h-f">FecRDHyzRTLH3dfdz6ni5pnGq5j883zcSBToSe3PPdbP</span><span className="sol-h-s" aria-hidden="true">FecR…PdbP</span></span></span><span className="sol-term-pill" data-at="0" data-tone="todo">Not opened</span><span className="sol-term-pill" data-at="1" data-tone="todo">Not opened</span><span className="sol-term-pill" data-at="2" data-tone="error">Frozen · transfer blocked</span><span className="sol-term-pill" data-at="3" data-tone="error" data-final="">Frozen · 0 LSF</span></div>
</div>
<ol className="sol-term-plan">
<li data-step="1"><span className="sol-term-plan-n" aria-hidden="true">1</span><span className="sol-term-plan-body"><strong className="sol-term-plan-title">Approve two investors</strong> <span className="sol-term-plan-desc">Every new LSF token account opens frozen. The issuer opens and approves (thaws) two investor accounts: the first now holds 1000 LSF, the second 0 LSF.</span></span></li>
<li data-step="2"><span className="sol-term-plan-n" aria-hidden="true">2</span><span className="sol-term-plan-body"><strong className="sol-term-plan-title">Send to an approved and an unapproved account</strong> <span className="sol-term-plan-desc">The holder (the first investor) sends 100 LSF to the approved investor, and it confirms. Sending 1 LSF to an account nobody approved, still frozen, fails onchain with `Custom: 17` (*Account is frozen*), and with preflight it is rejected before it lands.</span></span></li>
<li data-step="3"><span className="sol-term-plan-n" aria-hidden="true">3</span><span className="sol-term-plan-body"><strong className="sol-term-plan-title">Pause, resume, and claw back</strong> <span className="sol-term-plan-desc">The issuer pauses the asset, which blocks every transfer (`Custom: 67`), and resumes it. As permanent delegate it then moves 50 LSF out of the approved investor's account without their signature.</span></span></li>
</ol>
<div className="sol-term-screen" role="region" tabIndex="0" aria-label="Lisbon Solar Fund (LSF) · restricted asset: Output">
<div className="sol-term-step" data-step="1" data-pending="tx">
<div className="sol-term-row sol-term-note">\# Step 1/3 · Approve two investors</div>
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\></span> await openAccount(issuer, mint, holder.address)</div>
<div className="sol-term-row sol-term-ln">Opened <span className="sol-h" title="JAg5yGYw5Be2J54jk9s7ZUxhtU2FXN8txfpjxPctaeqx"><span className="sol-h-f">JAg5yGYw5Be2J54jk9s7ZUxhtU2FXN8txfpjxPctaeqx</span><span className="sol-h-s" aria-hidden="true">JAg5…aeqx</span></span> <span className="sol-term-k">state\:</span> Frozen</div>
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\></span> await approveHolder(issuer, mint, holder.address, 1\_000\_000\_000n)</div>
<div className="sol-term-row sol-term-ln" data-tone="ok">Approved <span className="sol-h" title="JAg5yGYw5Be2J54jk9s7ZUxhtU2FXN8txfpjxPctaeqx"><span className="sol-h-f">JAg5yGYw5Be2J54jk9s7ZUxhtU2FXN8txfpjxPctaeqx</span><span className="sol-h-s" aria-hidden="true">JAg5…aeqx</span></span> <span className="sol-term-k">state\:</span> Initialized <span className="sol-term-k">balance\:</span> 1000 LSF</div>
<div className="sol-term-row sol-term-ln"><span className="sol-term-k">Signature\:</span> <span className="sol-h" title="2cTiGJS6oWQFZ8XG4gTXqHz6RiywDvCYRzbprNrPfop8AacwZQCWC4ExL4UNQxK3XYF3LfakaqHPWN9RJQUiQexW"><span className="sol-h-f">2cTiGJS6oWQFZ8XG4gTXqHz6RiywDvCYRzbprNrPfop8AacwZQCWC4ExL4UNQxK3XYF3LfakaqHPWN9RJQUiQexW</span><span className="sol-h-s" aria-hidden="true">2cTi…QexW</span></span></div>
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\></span> await openAccount(issuer, mint, approved.address)</div>
<div className="sol-term-row sol-term-ln">Opened <span className="sol-h" title="CpvfwkairbnMrGqdW9wxMSiFgsHxi7666Gu4j7vCdjDv"><span className="sol-h-f">CpvfwkairbnMrGqdW9wxMSiFgsHxi7666Gu4j7vCdjDv</span><span className="sol-h-s" aria-hidden="true">Cpvf…djDv</span></span> <span className="sol-term-k">state\:</span> Frozen</div>
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\></span> await approveHolder(issuer, mint, approved.address, 0n)</div>
<div className="sol-term-row sol-term-ln" data-tone="ok">Approved <span className="sol-h" title="CpvfwkairbnMrGqdW9wxMSiFgsHxi7666Gu4j7vCdjDv"><span className="sol-h-f">CpvfwkairbnMrGqdW9wxMSiFgsHxi7666Gu4j7vCdjDv</span><span className="sol-h-s" aria-hidden="true">Cpvf…djDv</span></span> <span className="sol-term-k">state\:</span> Initialized <span className="sol-term-k">balance\:</span> 0 LSF</div>
<div className="sol-term-row sol-term-ln"><span className="sol-term-k">Signature\:</span> <span className="sol-h" title="5bjv6TA5KoJ8v61sPZ4Vuf3U8qRoryzTcEGqDShtfGLjxq7zaMn3vxf69QJwbPAxrEFu1tyzPNjw5RLf9ebzRcFa"><span className="sol-h-f">5bjv6TA5KoJ8v61sPZ4Vuf3U8qRoryzTcEGqDShtfGLjxq7zaMn3vxf69QJwbPAxrEFu1tyzPNjw5RLf9ebzRcFa</span><span className="sol-h-s" aria-hidden="true">5bjv…RcFa</span></span></div>
<div className="sol-term-result"><span className="sol-term-badge" data-tone="ok">Opened and approved · 4 transactions</span></div>
</div>
<div className="sol-term-step" data-step="2" data-pending="tx">
<div className="sol-term-row sol-term-note">\# Step 2/3 · Send to an approved and an unapproved account</div>
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\></span> await transfer(holder, mint, approved.address, 100\_000\_000n)</div>
<div className="sol-term-row sol-term-ln" data-tone="ok">Transfer 100 LSF\: confirmed</div>
<div className="sol-term-row sol-term-ln"><span className="sol-term-k">Signature\:</span> <span className="sol-h" title="3m3VeXJvsqmPunuwHRyf3qrXXYApTCv2WABEib1U9M7qrXSXgwJxDopg1L6cfvUQ9NL6aG8bJDj6csHVxDm69oTM"><span className="sol-h-f">3m3VeXJvsqmPunuwHRyf3qrXXYApTCv2WABEib1U9M7qrXSXgwJxDopg1L6cfvUQ9NL6aG8bJDj6csHVxDm69oTM</span><span className="sol-h-s" aria-hidden="true">3m3V…9oTM</span></span></div>
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\></span> await openAccount(issuer, mint, unapproved.address)</div>
<div className="sol-term-row sol-term-ln">Opened <span className="sol-h" title="FecRDHyzRTLH3dfdz6ni5pnGq5j883zcSBToSe3PPdbP"><span className="sol-h-f">FecRDHyzRTLH3dfdz6ni5pnGq5j883zcSBToSe3PPdbP</span><span className="sol-h-s" aria-hidden="true">FecR…PdbP</span></span> <span className="sol-term-k">state\:</span> Frozen</div>
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\></span> await sendToUnapproved(holder, mint, unapproved.address)</div>
<div className="sol-term-row sol-term-ln" data-tone="error">Transfer 1 LSF\: failed onchain</div>
<div className="sol-term-row sol-term-ln" data-tone="error">Failed <span className="sol-term-k">signature\:</span> <span className="sol-h" title="57czSUTPw8a1c8yN7n4TMV3CsRGEQSqaa3s7Tuvv4sV3jN5HQaurXZZnCtkFnv4DumVSi7WFMpHVhDYcKdtaxseW"><span className="sol-h-f">57czSUTPw8a1c8yN7n4TMV3CsRGEQSqaa3s7Tuvv4sV3jN5HQaurXZZnCtkFnv4DumVSi7WFMpHVhDYcKdtaxseW</span><span className="sol-h-s" aria-hidden="true">57cz…xseW</span></span></div>
<div className="sol-term-row sol-term-ln" data-tone="error" data-indent="2"><span className="sol-term-k">err\:</span> `{"InstructionError":[0,{"Custom":17}]}`</div>
<div className="sol-term-row sol-term-ln" data-tone="error" data-indent="2"><span className="sol-term-k">log\:</span> Program log\: Error\: Account is frozen</div>
<div className="sol-term-row sol-term-ln" data-indent="2">fee paid anyway\: 5000 lamports</div>
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\></span> await sendToUnapprovedWithPreflight(holder, mint, unapproved.address)</div>
<div className="sol-term-row sol-term-ln" data-tone="error">Transfer 1 LSF\: rejected\: Custom program error\: \#17 (instruction \#1)</div>
<div className="sol-term-row sol-term-ln" data-indent="2"><span className="sol-term-k">accountFrozen\:</span> true (no <span className="sol-term-k">fee\:</span> it never landed)</div>
<div className="sol-term-result"><span className="sol-term-badge" data-tone="ok">Approved investor\: 100 LSF received</span><span className="sol-term-badge" data-tone="error">Unapproved account\: blocked, account is frozen (Custom\: 17)</span></div>
</div>
<div className="sol-term-step" data-step="3" data-pending="tx">
<div className="sol-term-row sol-term-note">\# Step 3/3 · Pause, resume, and claw back</div>
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\></span> await pause(issuer, mint)</div>
<div className="sol-term-row sol-term-ln">Paused the asset. <span className="sol-term-k">Signature\:</span> <span className="sol-h" title="34UgQ3NwajBVsXCGihEi9pTCpFc8CCkWDfgRzQD2KLyfGGwTpAux7hf7e8RTQfFBChZDsdxQwa4Ef5AVSCgWWy67"><span className="sol-h-f">34UgQ3NwajBVsXCGihEi9pTCpFc8CCkWDfgRzQD2KLyfGGwTpAux7hf7e8RTQfFBChZDsdxQwa4Ef5AVSCgWWy67</span><span className="sol-h-s" aria-hidden="true">34Ug…Wy67</span></span></div>
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\></span> await transfer(holder, mint, approved.address, 1\_000\_000n)</div>
<div className="sol-term-row sol-term-ln" data-tone="error">Transfer 1 LSF\: rejected\: Custom program error\: \#67 (instruction \#1)</div>
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\></span> await resume(issuer, mint)</div>
<div className="sol-term-row sol-term-ln" data-tone="ok">Resumed the asset. <span className="sol-term-k">Signature\:</span> <span className="sol-h" title="2k8BNXskFbwdVxvxihzs72mDDkGkm6GBmgtVXwJAD8X8QXCUcSSXYSENSWbi85uKmUSNEUBwNv63sem2f7vb9weA"><span className="sol-h-f">2k8BNXskFbwdVxvxihzs72mDDkGkm6GBmgtVXwJAD8X8QXCUcSSXYSENSWbi85uKmUSNEUBwNv63sem2f7vb9weA</span><span className="sol-h-s" aria-hidden="true">2k8B…9weA</span></span></div>
<div className="sol-term-row sol-term-cmd"><span className="sol-term-ps" aria-hidden="true">\></span> await clawBack(issuer, mint, approved.address, 50\_000\_000n)</div>
<div className="sol-term-row sol-term-ln">Permanent delegate moved 50 LSF from <span className="sol-h" title="CpvfwkairbnMrGqdW9wxMSiFgsHxi7666Gu4j7vCdjDv"><span className="sol-h-f">CpvfwkairbnMrGqdW9wxMSiFgsHxi7666Gu4j7vCdjDv</span><span className="sol-h-s" aria-hidden="true">Cpvf…djDv</span></span> to the issuer</div>
<div className="sol-term-row sol-term-ln"><span className="sol-term-k">Signature\:</span> <span className="sol-h" title="3ZXvUsuYkbBJMyCr4y1g8iKt8wmsJtt5xhybWW34W6vYShELvj2MMhwZ7UqeAxXVuAFK3Hs76Xb1QBhDJuNXwkmE"><span className="sol-h-f">3ZXvUsuYkbBJMyCr4y1g8iKt8wmsJtt5xhybWW34W6vYShELvj2MMhwZ7UqeAxXVuAFK3Hs76Xb1QBhDJuNXwkmE</span><span className="sol-h-s" aria-hidden="true">3ZXv…wkmE</span></span></div>
<div className="sol-term-result"><span className="sol-term-badge" data-tone="warn">While paused\: transfer blocked (Custom\: 67)</span><span className="sol-term-badge" data-tone="ok">Resumed</span><span className="sol-term-badge" data-tone="ok">50 LSF moved by the permanent delegate</span></div>
</div>
</div>
<div className="sol-term-success"><span className="sol-term-success-icon" aria-hidden="true">✓</span><span>The approved investor received 100 LSF, and the network blocked the 1 LSF transfer to the unapproved account. The issuer then paused and resumed the asset, and moved 50 LSF out of the approved investor's account.</span></div>
<div className="sol-term-foot"><button type="button" className="sol-term-btn" data-act="run">Run step 1</button><button type="button" className="sol-term-btn" data-act="all" data-variant="secondary">Run all</button><span className="sol-term-status"></span><span className="sol-term-sr" role="status"></span></div>
</div>

The holder, the token, and the instruction were the same both times, but only
one transfer settled. The rule lives in the token, so it applies in every
wallet and app.

<div className="sol-concept not-prose">
[<span className="sol-concept-name">Token accounts</span> <span className="sol-concept-def">Wallets don't hold tokens directly.</span>](/developers/docs/tokens/basics/create-token-account)
</div>

<div className="sol-concept not-prose">
[<span className="sol-concept-name">Transactions</span> <span className="sol-concept-def">A transaction is a signed request to change the shared ledger.</span>](/developers/docs/core/transactions)
</div>

## Why the transfer failed

Every new LSF token account opens in the `Frozen` state. The issuer approves an
investor after a KYC check by **thawing** their account, which is what "Approve
two investors" did. Nobody approved the third account, so the
<span className="sol-chip" data-concept="program"><Tooltip headline="Programs" tip="Programs are code deployed to the network that owns and updates accounts. Most apps call existing programs, such as the Token program, rather than writing their own." cta="Learn more" href="/developers/docs/core/programs">Token-2022 program</Tooltip><span className="nojs-only"> ([Programs](/developers/docs/core/programs): Programs are code deployed to the network that owns and updates accounts. Most apps call existing programs, such as the Token program, rather than writing their own.)</span></span>
refused to credit it. Here are the lines from step 2 (excerpt):

```text title="Failed transfer (excerpt of the output)"
Opened FecRDHyzRTLH3dfdz6ni5pnGq5j883zcSBToSe3PPdbP state: Frozen
Transfer 1 LSF: failed onchain
  err: {"InstructionError":[0,{"Custom":17}]}
  log: Program log: Error: Account is frozen
  fee paid anyway: 5000 lamports
Transfer 1 LSF: rejected: Custom program error: #17 (instruction #1)
  accountFrozen: true (no fee: it never landed)
```

How to read it:

- `{"InstructionError":[0,{"Custom":17}]}` means instruction 0 of the
  transaction failed with Token-2022 error 17, `AccountFrozen`. The program log
  says the same in words: `Account is frozen`.
- Transactions are all-or-nothing. The failed transfer moved no tokens: the
  unapproved account still holds 0 LSF.
- This transfer was sent with `skipPreflight`, so it landed onchain as a failed
  transaction and the sender still paid the 5000-lamport network fee.
- Sent the normal way, with preflight, the RPC node simulates the transaction
  first and rejects it before it lands. No fee is charged, and your code gets
  the same error 17 back (`accountFrozen: true`).

Step 3 of the run shows the other two controls. While the asset is paused,
every transfer fails with error 67 (`Transferring, minting, and burning is
paused on this mint`). After it resumes, the issuer, as **permanent delegate**,
moves 50 LSF out of an investor's account without their signature, the control
for carrying out a court order or recovering lost tokens.

Next, you read the code that creates this asset.
