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

# Permissioned Burn

> Create a Token-2022 mint with the permissioned burn extension so every burn requires a co-signature from a configured burn authority, then burn tokens with the permissioned burn instructions.

## What Is Permissioned Burn?

The Token Extension Program's `PermissionedBurnConfig` mint extension
requires a configured burn authority to co-sign every burn for the mint.

While the burn authority is set:

- The standard `Burn` and `BurnChecked` instructions fail with
  `TokenError::InvalidInstruction`.
- Burns must use `PermissionedBurnInstruction::Burn` or
  `PermissionedBurnInstruction::BurnChecked`, signed by both the burn
  authority and the token account's owner or delegate.

The burn authority is a co-signer, not a replacement for the owner. The
authority alone cannot burn tokens from someone else's token account, and a
token account owner cannot burn without the authority's signature. A permanent
delegate must also use the permissioned burn instructions and still needs the
burn authority's co-signature.

This lets an issuer keep token supply in sync with an offchain record, for
example a tokenized asset that must stay backed 1:1, by preventing holders from
unilaterally burning tokens.

The burn authority can be rotated later with `SetAuthority` using
`AuthorityType::PermissionedBurn`. Setting the authority to `None` disables
permissioned burning and re-enables the standard burn instructions. The
extension data itself stays on the mint.

## Before you start

The examples on this page run against a local validator at
`http://localhost:8899` (WebSocket `ws://localhost:8900`) and fund their
accounts with airdrops from it. Start one in a separate terminal with
[Surfpool](https://surfpool.run) (`surfpool start`), which loads the current
Token-2022 program from mainnet. `solana-test-validator` bundles an older
Token-2022 build without permissioned burn, so to use it instead, load the
current program (v11.0.0 or later) from devnet:

```shell Terminal
solana program dump -u devnet TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb token_2022.so
solana-test-validator --reset --bpf-program TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb token_2022.so
```

Each code section below lists the packages or crates it needs. The TypeScript
examples use top-level `await`, so run them as ES modules, for example with
`npx tsx index.ts` in a project whose `package.json` sets `"type": "module"`.

## How to Create a Mint and Burn With Permission

To create a mint with permissioned burn and burn tokens:

1. Calculate the mint account size and rent needed for the mint and the
   `PermissionedBurnConfig` extension.
2. Create the mint account with `CreateAccount`, initialize
   `PermissionedBurnConfig`, and initialize the mint with
   `InitializeMint`.
3. Create a token account and mint tokens.
4. Burn with `PermissionedBurnInstruction::BurnChecked` signed by both the
   token account owner and the burn authority.
5. Optionally disable permissioned burning with `SetAuthority` using
   `AuthorityType::PermissionedBurn` and a `None` authority, which
   re-enables the standard burn instructions. The full code examples below show
   this step.

<Steps>
  <Step title="Calculate account size">
    Calculate the mint account size for the base mint plus the
    `PermissionedBurnConfig` extension. This is the size used in
    `CreateAccount`.

    ```ts Example focus={15-17,19}
    const client = await createClient()
      .use(generatedPayer())
      .use(
        solanaRpc({
          rpcUrl: "http://localhost:8899",
          rpcSubscriptionsUrl: "ws://localhost:8900"
        })
      )
      .use(rpcAirdrop())
      .use(airdropPayer(lamports(1_000_000_000n)));

    const mint = await generateKeyPairSigner();
    const burnAuthority = await generateKeyPairSigner();

    const permissionedBurnExtension = extension("PermissionedBurn", {
      authority: burnAuthority.address
    });

    const mintSpace = BigInt(getMintSize([permissionedBurnExtension]));
    ```
  </Step>

  <Step title="Calculate rent">
    Calculate rent using the size needed for the mint plus the
    `PermissionedBurnConfig` extension.

    ```ts Example focus={21-23}
    const client = await createClient()
      .use(generatedPayer())
      .use(
        solanaRpc({
          rpcUrl: "http://localhost:8899",
          rpcSubscriptionsUrl: "ws://localhost:8900"
        })
      )
      .use(rpcAirdrop())
      .use(airdropPayer(lamports(1_000_000_000n)));

    const mint = await generateKeyPairSigner();
    const burnAuthority = await generateKeyPairSigner();

    const permissionedBurnExtension = extension("PermissionedBurn", {
      authority: burnAuthority.address
    });

    const mintSpace = BigInt(getMintSize([permissionedBurnExtension]));

    const mintRent = await client.rpc
      .getMinimumBalanceForRentExemption(mintSpace)
      .send();
    ```
  </Step>

  <Step title="Create the mint account">
    Create the mint account with the calculated space and lamports.

    ```ts Example focus={25-33}
    const client = await createClient()
      .use(generatedPayer())
      .use(
        solanaRpc({
          rpcUrl: "http://localhost:8899",
          rpcSubscriptionsUrl: "ws://localhost:8900"
        })
      )
      .use(rpcAirdrop())
      .use(airdropPayer(lamports(1_000_000_000n)));

    const mint = await generateKeyPairSigner();
    const burnAuthority = await generateKeyPairSigner();

    const permissionedBurnExtension = extension("PermissionedBurn", {
      authority: burnAuthority.address
    });

    const mintSpace = BigInt(getMintSize([permissionedBurnExtension]));

    const mintRent = await client.rpc
      .getMinimumBalanceForRentExemption(mintSpace)
      .send();

    await client.sendTransaction([
      getCreateAccountInstruction({
        payer: client.payer,
        newAccount: mint,
        lamports: mintRent,
        space: mintSpace,
        programAddress: TOKEN_2022_PROGRAM_ADDRESS
      })
    ]);
    ```
  </Step>

  <Step title="Initialize PermissionedBurn">
    Initialize the `PermissionedBurnConfig` extension on the mint with the burn
    authority.

    ```ts Example focus={33-36}
    const client = await createClient()
      .use(generatedPayer())
      .use(
        solanaRpc({
          rpcUrl: "http://localhost:8899",
          rpcSubscriptionsUrl: "ws://localhost:8900"
        })
      )
      .use(rpcAirdrop())
      .use(airdropPayer(lamports(1_000_000_000n)));

    const mint = await generateKeyPairSigner();
    const burnAuthority = await generateKeyPairSigner();

    const permissionedBurnExtension = extension("PermissionedBurn", {
      authority: burnAuthority.address
    });

    const mintSpace = BigInt(getMintSize([permissionedBurnExtension]));

    const mintRent = await client.rpc
      .getMinimumBalanceForRentExemption(mintSpace)
      .send();

    await client.sendTransaction([
      getCreateAccountInstruction({
        payer: client.payer,
        newAccount: mint,
        lamports: mintRent,
        space: mintSpace,
        programAddress: TOKEN_2022_PROGRAM_ADDRESS
      }),
      getInitializePermissionedBurnInstruction({
        mint: mint.address,
        authority: burnAuthority.address
      })
    ]);
    ```
  </Step>

  <Step title="Initialize the mint">
    Initialize the mint with `InitializeMint` in the same transaction.

    ```ts Example focus={37-42} expandable
    const client = await createClient()
      .use(generatedPayer())
      .use(
        solanaRpc({
          rpcUrl: "http://localhost:8899",
          rpcSubscriptionsUrl: "ws://localhost:8900"
        })
      )
      .use(rpcAirdrop())
      .use(airdropPayer(lamports(1_000_000_000n)));

    const mint = await generateKeyPairSigner();
    const burnAuthority = await generateKeyPairSigner();

    const permissionedBurnExtension = extension("PermissionedBurn", {
      authority: burnAuthority.address
    });

    const mintSpace = BigInt(getMintSize([permissionedBurnExtension]));

    const mintRent = await client.rpc
      .getMinimumBalanceForRentExemption(mintSpace)
      .send();

    await client.sendTransaction([
      getCreateAccountInstruction({
        payer: client.payer,
        newAccount: mint,
        lamports: mintRent,
        space: mintSpace,
        programAddress: TOKEN_2022_PROGRAM_ADDRESS
      }),
      getInitializePermissionedBurnInstruction({
        mint: mint.address,
        authority: burnAuthority.address
      }),
      getInitializeMintInstruction({
        mint: mint.address,
        decimals: 0,
        mintAuthority: client.payer.address,
        freezeAuthority: client.payer.address
      })
    ]);
    ```
  </Step>

  <Step title="Create a token account and mint tokens">
    Create a token account for the payer and mint tokens to it.

    ```ts Example focus={51-64} expandable
    const client = await createClient()
      .use(generatedPayer())
      .use(
        solanaRpc({
          rpcUrl: "http://localhost:8899",
          rpcSubscriptionsUrl: "ws://localhost:8900"
        })
      )
      .use(rpcAirdrop())
      .use(airdropPayer(lamports(1_000_000_000n)));

    const mint = await generateKeyPairSigner();
    const burnAuthority = await generateKeyPairSigner();

    const permissionedBurnExtension = extension("PermissionedBurn", {
      authority: burnAuthority.address
    });

    const mintSpace = BigInt(getMintSize([permissionedBurnExtension]));

    const mintRent = await client.rpc
      .getMinimumBalanceForRentExemption(mintSpace)
      .send();

    await client.sendTransaction([
      getCreateAccountInstruction({
        payer: client.payer,
        newAccount: mint,
        lamports: mintRent,
        space: mintSpace,
        programAddress: TOKEN_2022_PROGRAM_ADDRESS
      }),
      getInitializePermissionedBurnInstruction({
        mint: mint.address,
        authority: burnAuthority.address
      }),
      getInitializeMintInstruction({
        mint: mint.address,
        decimals: 0,
        mintAuthority: client.payer.address,
        freezeAuthority: client.payer.address
      })
    ]);

    const [sourceToken] = await findAssociatedTokenPda({
      mint: mint.address,
      owner: client.payer.address,
      tokenProgram: TOKEN_2022_PROGRAM_ADDRESS
    });

    await client.sendTransaction([
      await getCreateAssociatedTokenInstructionAsync({
        payer: client.payer,
        mint: mint.address,
        owner: client.payer.address
      }),
      getMintToCheckedInstruction({
        mint: mint.address,
        token: sourceToken,
        mintAuthority: client.payer,
        amount: 2n,
        decimals: 0
      })
    ]);
    ```
  </Step>

  <Step title="Burn with the burn authority">
    Burn tokens with `PermissionedBurnInstruction::BurnChecked` signed by both
    the token account owner and the burn authority.

    ```ts Example highlight={70} focus={67-74} expandable
    const client = await createClient()
      .use(generatedPayer())
      .use(
        solanaRpc({
          rpcUrl: "http://localhost:8899",
          rpcSubscriptionsUrl: "ws://localhost:8900"
        })
      )
      .use(rpcAirdrop())
      .use(airdropPayer(lamports(1_000_000_000n)));

    const mint = await generateKeyPairSigner();
    const burnAuthority = await generateKeyPairSigner();

    const permissionedBurnExtension = extension("PermissionedBurn", {
      authority: burnAuthority.address
    });

    const mintSpace = BigInt(getMintSize([permissionedBurnExtension]));

    const mintRent = await client.rpc
      .getMinimumBalanceForRentExemption(mintSpace)
      .send();

    await client.sendTransaction([
      getCreateAccountInstruction({
        payer: client.payer,
        newAccount: mint,
        lamports: mintRent,
        space: mintSpace,
        programAddress: TOKEN_2022_PROGRAM_ADDRESS
      }),
      getInitializePermissionedBurnInstruction({
        mint: mint.address,
        authority: burnAuthority.address
      }),
      getInitializeMintInstruction({
        mint: mint.address,
        decimals: 0,
        mintAuthority: client.payer.address,
        freezeAuthority: client.payer.address
      })
    ]);

    const [sourceToken] = await findAssociatedTokenPda({
      mint: mint.address,
      owner: client.payer.address,
      tokenProgram: TOKEN_2022_PROGRAM_ADDRESS
    });

    await client.sendTransaction([
      await getCreateAssociatedTokenInstructionAsync({
        payer: client.payer,
        mint: mint.address,
        owner: client.payer.address
      }),
      getMintToCheckedInstruction({
        mint: mint.address,
        token: sourceToken,
        mintAuthority: client.payer,
        amount: 2n,
        decimals: 0
      })
    ]);

    await client.sendTransaction([
      getPermissionedBurnCheckedInstruction({
        account: sourceToken,
        mint: mint.address,
        permissionedBurnAuthority: burnAuthority,
        authority: client.payer,
        amount: 1n,
        decimals: 0
      })
    ]);
    ```
  </Step>
</Steps>

<Info>
  **Instruction Order**

  `PermissionedBurnInstruction::Initialize` must come before
`InitializeMint`. `CreateAccount`,
`PermissionedBurnInstruction::Initialize`, and `InitializeMint` must
  be included in the same transaction.
</Info>

### Source Reference

| Item                                       | Description                                                                                                        | Source                                                                                                                                         |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `PermissionedBurnConfig`                   | Mint extension that stores the authority required to co-sign every burn for the mint.                              | [Source](https://github.com/solana-program/token-2022/blob/program%40v11.0.0/interface/src/extension/permissioned_burn/mod.rs#L16-L25)         |
| `PermissionedBurnInstruction::Initialize`  | Instruction that initializes the permissioned burn config before `InitializeMint`.                                 | [Source](https://github.com/solana-program/token-2022/blob/program%40v11.0.0/interface/src/extension/permissioned_burn/instruction.rs#L41-L49) |
| `PermissionedBurnInstruction::Burn`        | Burn instruction that requires signatures from the burn authority and the token account owner or delegate.         | [Source](https://github.com/solana-program/token-2022/blob/program%40v11.0.0/interface/src/extension/permissioned_burn/instruction.rs#L50-L71) |
| `PermissionedBurnInstruction::BurnChecked` | Burn instruction with a decimals check that uses the same accounts as `PermissionedBurnInstruction::Burn`.         | [Source](https://github.com/solana-program/token-2022/blob/program%40v11.0.0/interface/src/extension/permissioned_burn/instruction.rs#L72-L79) |
| `AuthorityType::PermissionedBurn`          | Authority discriminator used with `SetAuthority` to rotate or disable the burn authority on a mint.                | [Source](https://github.com/solana-program/token-2022/blob/program%40v11.0.0/interface/src/instruction.rs#L1276-L1277)                         |
| `process_initialize`                       | Processor logic that initializes `PermissionedBurnConfig` on an uninitialized mint and stores the burn authority.  | [Source](https://github.com/solana-program/token-2022/blob/program%40v11.0.0/program/src/extension/permissioned_burn/processor.rs#L29-L47)     |
| `process_burn`                             | Processor logic that rejects standard burns when the burn authority is set and verifies the authority's signature. | [Source](https://github.com/solana-program/token-2022/blob/program%40v11.0.0/program/src/processor.rs#L1114-L1179)                             |
| `process_set_authority`                    | Processor logic that validates and rotates the burn authority when `AuthorityType::PermissionedBurn` is used.      | [Source](https://github.com/solana-program/token-2022/blob/program%40v11.0.0/program/src/processor.rs#L996-L1008)                              |

### Kit

These examples use the generated Token-2022 instructions directly.

```bash Terminal
npm install @solana/kit @solana/kit-plugin-rpc @solana/kit-plugin-signer @solana-program/system @solana-program/token-2022
```

```ts Instructions highlight={58-61,110-117,121-126}
import {
  lamports,
  createClient,
  generateKeyPairSigner,
  unwrapOption
} from "@solana/kit";
import { solanaRpc, rpcAirdrop } from "@solana/kit-plugin-rpc";
import { generatedPayer, airdropPayer } from "@solana/kit-plugin-signer";
import { getCreateAccountInstruction } from "@solana-program/system";
import {
  AuthorityType,
  extension,
  fetchMint,
  fetchToken,
  findAssociatedTokenPda,
  getBurnCheckedInstruction,
  getCreateAssociatedTokenInstructionAsync,
  getInitializeMintInstruction,
  getInitializePermissionedBurnInstruction,
  getMintSize,
  getMintToCheckedInstruction,
  getPermissionedBurnCheckedInstruction,
  getSetAuthorityInstruction,
  isExtension,
  TOKEN_2022_PROGRAM_ADDRESS
} from "@solana-program/token-2022";

const client = await createClient()
  .use(generatedPayer())
  .use(
    solanaRpc({
      rpcUrl: "http://localhost:8899",
      rpcSubscriptionsUrl: "ws://localhost:8900"
    })
  )
  .use(rpcAirdrop())
  .use(airdropPayer(lamports(1_000_000_000n)));

const mint = await generateKeyPairSigner();
const burnAuthority = await generateKeyPairSigner();

const permissionedBurnExtension = extension("PermissionedBurn", {
  authority: burnAuthority.address
});
const mintSpace = BigInt(getMintSize([permissionedBurnExtension]));
const mintRent = await client.rpc
  .getMinimumBalanceForRentExemption(mintSpace)
  .send();

await client.sendTransaction([
  getCreateAccountInstruction({
    payer: client.payer, // Account funding account creation.
    newAccount: mint, // New mint account to create.
    lamports: mintRent, // Lamports funding the mint account rent.
    space: mintSpace, // Account size in bytes for the mint plus PermissionedBurnConfig.
    programAddress: TOKEN_2022_PROGRAM_ADDRESS // Program that owns the mint account.
  }),
  getInitializePermissionedBurnInstruction({
    mint: mint.address, // Mint account that stores the PermissionedBurnConfig extension.
    authority: burnAuthority.address // Authority required to co-sign every burn for the mint.
  }),
  getInitializeMintInstruction({
    mint: mint.address, // Mint account to initialize.
    decimals: 0, // Number of decimals for the token.
    mintAuthority: client.payer.address, // Authority allowed to mint new tokens.
    freezeAuthority: client.payer.address // Authority allowed to freeze token accounts.
  })
]);

const [sourceToken] = await findAssociatedTokenPda({
  mint: mint.address,
  owner: client.payer.address,
  tokenProgram: TOKEN_2022_PROGRAM_ADDRESS
});

await client.sendTransaction([
  await getCreateAssociatedTokenInstructionAsync({
    payer: client.payer, // Account funding the associated token account creation.
    mint: mint.address, // Mint for the associated token account.
    owner: client.payer.address // Owner of the associated token account.
  }),
  getMintToCheckedInstruction({
    mint: mint.address, // Mint account that issues the tokens.
    token: sourceToken, // Token account receiving the newly minted tokens.
    mintAuthority: client.payer, // Signer authorized to mint new tokens.
    amount: 2n, // Token amount in base units.
    decimals: 0 // Decimals defined on the mint.
  })
]);

let standardBurnFailure: string | undefined;
try {
  await client.sendTransaction([
    getBurnCheckedInstruction({
      account: sourceToken, // Token account to burn from.
      mint: mint.address, // Mint with the permissioned burn configuration.
      authority: client.payer, // Token account owner signing the burn.
      amount: 1n, // Token amount in base units.
      decimals: 0 // Decimals defined on the mint.
    })
  ]);
} catch (error) {
  standardBurnFailure = error instanceof Error ? error.message : String(error);
}
if (!standardBurnFailure) {
  throw new Error("Expected the standard burn to fail");
}

await client.sendTransaction([
  getPermissionedBurnCheckedInstruction({
    account: sourceToken, // Token account to burn from.
    mint: mint.address, // Mint with the permissioned burn configuration.
    permissionedBurnAuthority: burnAuthority, // Burn authority co-signing the burn.
    authority: client.payer, // Token account owner signing the burn.
    amount: 1n, // Token amount in base units.
    decimals: 0 // Decimals defined on the mint.
  })
]);

await client.sendTransaction([
  getSetAuthorityInstruction({
    owned: mint.address, // Mint with the permissioned burn configuration.
    owner: burnAuthority, // Current burn authority signing the update.
    authorityType: AuthorityType.PermissionedBurn, // Authority type to update.
    newAuthority: null // Setting the authority to None disables permissioned burning.
  })
]);

await client.sendTransaction([
  getBurnCheckedInstruction({
    account: sourceToken, // Token account to burn from.
    mint: mint.address, // Mint with permissioned burning disabled.
    authority: client.payer, // Token account owner signing the burn.
    amount: 1n, // Token amount in base units.
    decimals: 0 // Decimals defined on the mint.
  })
]);

const sourceAccount = await fetchToken(client.rpc, sourceToken);
const mintAccount = await fetchMint(client.rpc, mint.address);
const permissionedBurnConfig = (
  unwrapOption(mintAccount.data.extensions) ?? []
).find((item) => isExtension("PermissionedBurn", item));

console.log("Mint Address:", mint.address);
console.log("Error From Failed Standard Burn:", standardBurnFailure);
console.log("Source Amount After Burns:", sourceAccount.data.amount);
console.log("Extension After Disable:", permissionedBurnConfig);
```

### Web3.js v3

These examples use the class-based `@solana/web3.js` v3 API with
`@solana-program` instruction builders.

```bash Terminal
npm install @solana/web3.js@3 @solana/kit @solana-program/token-2022
```

```ts Instructions highlight={62-65,130-137,146-151}
import {
  Connection,
  Keypair,
  LAMPORTS_PER_SOL,
  PublicKey,
  sendAndConfirmTransaction,
  SystemProgram,
  Transaction
} from "@solana/web3.js";
import { unwrapOption } from "@solana/kit";
import {
  AuthorityType,
  findAssociatedTokenPda,
  getBurnCheckedInstruction,
  getCreateAssociatedTokenInstruction,
  getInitializeMint2Instruction,
  getInitializePermissionedBurnInstruction,
  getMintDecoder,
  getMintSize,
  getMintToCheckedInstruction,
  getPermissionedBurnCheckedInstruction,
  getSetAuthorityInstruction,
  getTokenDecoder,
  TOKEN_2022_PROGRAM_ADDRESS
} from "@solana-program/token-2022";

const connection = new Connection("http://localhost:8899", "confirmed");
const latestBlockhash = await connection.getLatestBlockhash();

const feePayer = await Keypair.generate();
const mint = await Keypair.generate();
const burnAuthority = await Keypair.generate();

const airdropSignature = await connection.requestAirdrop(
  feePayer.publicKey,
  5 * LAMPORTS_PER_SOL
);
await connection.confirmTransaction({
  blockhash: latestBlockhash.blockhash,
  lastValidBlockHeight: latestBlockhash.lastValidBlockHeight,
  signature: airdropSignature
});

const mintSpace = getMintSize([
  {
    __kind: "PermissionedBurn",
    authority: burnAuthority.publicKey.toBase58()
  }
]);
const mintRent = await connection.getMinimumBalanceForRentExemption(mintSpace);

await sendAndConfirmTransaction(
  connection,
  new Transaction().add(
    SystemProgram.createAccount({
      fromPubkey: feePayer.publicKey, // Account funding account creation.
      newAccountPubkey: mint.publicKey, // New mint account to create.
      space: mintSpace, // Account size in bytes for the mint plus PermissionedBurnConfig.
      lamports: mintRent, // Lamports funding the mint account rent.
      programId: new PublicKey(TOKEN_2022_PROGRAM_ADDRESS) // Program that owns the mint account.
    }),
    getInitializePermissionedBurnInstruction({
      mint: mint.publicKey, // Mint account that stores the PermissionedBurnConfig extension.
      authority: burnAuthority.publicKey.toBase58() // Authority required to co-sign every burn for the mint.
    }),
    getInitializeMint2Instruction({
      mint: mint.publicKey, // Mint account to initialize.
      decimals: 0, // Number of decimals for the token.
      mintAuthority: feePayer.publicKey.toBase58(), // Authority allowed to mint new tokens.
      freezeAuthority: feePayer.publicKey.toBase58() // Authority allowed to freeze token accounts.
    })
  ),
  [feePayer, mint],
  { commitment: "confirmed" }
);

const [sourceToken] = await findAssociatedTokenPda({
  mint: mint.publicKey.toBase58(),
  owner: feePayer.publicKey.toBase58(),
  tokenProgram: TOKEN_2022_PROGRAM_ADDRESS
});

await sendAndConfirmTransaction(
  connection,
  new Transaction().add(
    getCreateAssociatedTokenInstruction({
      payer: feePayer, // Account funding the associated token account creation.
      ata: sourceToken, // Associated token account address to create.
      owner: feePayer.publicKey, // Owner of the associated token account.
      mint: mint.publicKey // Mint for the associated token account.
    }),
    getMintToCheckedInstruction({
      mint: mint.publicKey, // Mint account that issues the tokens.
      token: sourceToken, // Token account receiving the newly minted tokens.
      mintAuthority: feePayer, // Signer authorized to mint new tokens.
      amount: 2, // Token amount in base units.
      decimals: 0 // Decimals defined on the mint.
    })
  ),
  [feePayer],
  { commitment: "confirmed" }
);

let standardBurnFailure: string | undefined;
try {
  await sendAndConfirmTransaction(
    connection,
    new Transaction().add(
      getBurnCheckedInstruction({
        account: sourceToken, // Token account to burn from.
        mint: mint.publicKey, // Mint with the permissioned burn configuration.
        authority: feePayer, // Token account owner signing the burn.
        amount: 1, // Token amount in base units.
        decimals: 0 // Decimals defined on the mint.
      })
    ),
    [feePayer],
    { commitment: "confirmed" }
  );
} catch (error) {
  standardBurnFailure = error instanceof Error ? error.message : String(error);
}
if (!standardBurnFailure) {
  throw new Error("Expected the standard burn to fail");
}

await sendAndConfirmTransaction(
  connection,
  new Transaction().add(
    getPermissionedBurnCheckedInstruction({
      account: sourceToken, // Token account to burn from.
      mint: mint.publicKey, // Mint with the permissioned burn configuration.
      permissionedBurnAuthority: burnAuthority, // Burn authority co-signing the burn.
      authority: feePayer, // Token account owner signing the burn.
      amount: 1, // Token amount in base units.
      decimals: 0 // Decimals defined on the mint.
    })
  ),
  [feePayer, burnAuthority],
  { commitment: "confirmed" }
);

await sendAndConfirmTransaction(
  connection,
  new Transaction().add(
    getSetAuthorityInstruction({
      owned: mint.publicKey, // Mint with the permissioned burn configuration.
      owner: burnAuthority, // Current burn authority signing the update.
      authorityType: AuthorityType.PermissionedBurn, // Authority type to update.
      newAuthority: null // Setting the authority to None disables permissioned burning.
    })
  ),
  [feePayer, burnAuthority],
  { commitment: "confirmed" }
);

await sendAndConfirmTransaction(
  connection,
  new Transaction().add(
    getBurnCheckedInstruction({
      account: sourceToken, // Token account to burn from.
      mint: mint.publicKey, // Mint with permissioned burning disabled.
      authority: feePayer, // Token account owner signing the burn.
      amount: 1, // Token amount in base units.
      decimals: 0 // Decimals defined on the mint.
    })
  ),
  [feePayer],
  { commitment: "confirmed" }
);

const sourceAccountInfo = await connection.getAccountInfo(
  new PublicKey(sourceToken),
  "confirmed"
);
const sourceAccount = getTokenDecoder().decode(sourceAccountInfo!.data);
const mintAccountInfo = await connection.getAccountInfo(
  mint.publicKey,
  "confirmed"
);
const mintAccount = getMintDecoder().decode(mintAccountInfo!.data);
const permissionedBurnConfig = (unwrapOption(mintAccount.extensions) ?? []).find(
  (extension) => extension.__kind === "PermissionedBurn"
);

console.log("Mint Address:", mint.publicKey.toBase58());
console.log("Error From Failed Standard Burn:", standardBurnFailure);
console.log("Source Amount After Burns:", sourceAccount.amount);
console.log("Extension After Disable:", permissionedBurnConfig);
```

### Rust

Add these dependencies to `Cargo.toml` (tested with Rust 1.98 and 1.99).
Permissioned burn needs `spl-token-2022-interface` 3 or later, which uses the
newer Solana crates. Keep `solana-client` on the 4.3 line (Rust 1.97.1 or
later): 4.4 moved to `solana-transaction` 5, which `solana-sdk` 4 doesn't use.

```toml Cargo.toml
[dependencies]
anyhow = "1"
tokio = { version = "1", features = ["full"] }
solana-client = "~4.3"
solana-commitment-config = "3"
solana-sdk = "4"
solana-system-interface = "3"
spl-associated-token-account-interface = "2"
spl-token-2022-interface = "3"
```

```rust Rust highlight={60-64,137-145,160-167}
use anyhow::{anyhow, Result};
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;
use solana_sdk::{
    signature::{Keypair, Signer},
    transaction::Transaction,
};
use solana_system_interface::instruction::create_account;
use spl_associated_token_account_interface::{
    address::get_associated_token_address_with_program_id,
    instruction::create_associated_token_account,
};
use spl_token_2022_interface::{
    extension::{
        permissioned_burn::{instruction as permissioned_burn_ix, PermissionedBurnConfig},
        BaseStateWithExtensions, ExtensionType, StateWithExtensions,
    },
    instruction::{burn_checked, initialize_mint, mint_to_checked, set_authority, AuthorityType},
    state::{Account, Mint},
    ID as TOKEN_2022_PROGRAM_ID,
};

#[tokio::main]
async fn main() -> Result<()> {
    let client = RpcClient::new_with_commitment(
        String::from("http://localhost:8899"),
        CommitmentConfig::confirmed(),
    );
    let fee_payer = Keypair::new();
    let burn_authority = Keypair::new();

    let airdrop_signature = client
        .request_airdrop(&fee_payer.pubkey(), 5_000_000_000)
        .await?;

    loop {
        let confirmed = client.confirm_transaction(&airdrop_signature).await?;
        if confirmed {
            break;
        }
    }

    let mint = Keypair::new();

    let mint_space =
        ExtensionType::try_calculate_account_len::<Mint>(&[ExtensionType::PermissionedBurn])?;
    let mint_rent = client
        .get_minimum_balance_for_rent_exemption(mint_space)
        .await?;

    let create_mint_transaction = Transaction::new_signed_with_payer(
        &[
            create_account(
                &fee_payer.pubkey(), // Account funding account creation.
                &mint.pubkey(), // New mint account to create.
                mint_rent, // Lamports funding the mint account rent.
                mint_space as u64, // Account size in bytes for the mint plus PermissionedBurnConfig.
                &TOKEN_2022_PROGRAM_ID, // Program that owns the mint account.
            ),
            permissioned_burn_ix::initialize(
                &TOKEN_2022_PROGRAM_ID, // Token program that owns the mint.
                &mint.pubkey(), // Mint account that stores the PermissionedBurnConfig extension.
                &burn_authority.pubkey(), // Authority required to co-sign every burn for the mint.
            )?,
            initialize_mint(
                &TOKEN_2022_PROGRAM_ID, // Program that owns the mint account.
                &mint.pubkey(), // Mint account to initialize.
                &fee_payer.pubkey(), // Authority allowed to mint new tokens.
                Some(&fee_payer.pubkey()), // Authority allowed to freeze token accounts.
                0, // Number of decimals for the token.
            )?,
        ],
        Some(&fee_payer.pubkey()),
        &[&fee_payer, &mint],
        client.get_latest_blockhash().await?,
    );
    client
        .send_and_confirm_transaction(&create_mint_transaction)
        .await?;

    let source_token = get_associated_token_address_with_program_id(
        &fee_payer.pubkey(),
        &mint.pubkey(),
        &TOKEN_2022_PROGRAM_ID,
    );

    let create_token_account_transaction = Transaction::new_signed_with_payer(
        &[
            create_associated_token_account(
                &fee_payer.pubkey(), // Account funding the associated token account creation.
                &fee_payer.pubkey(), // Owner of the associated token account.
                &mint.pubkey(), // Mint for the associated token account.
                &TOKEN_2022_PROGRAM_ID, // Token program that owns the token account.
            ),
            mint_to_checked(
                &TOKEN_2022_PROGRAM_ID, // Token program that owns the mint and token account.
                &mint.pubkey(), // Mint account that issues the tokens.
                &source_token, // Token account receiving the newly minted tokens.
                &fee_payer.pubkey(), // Signer authorized to mint new tokens.
                &[&fee_payer.pubkey()], // Additional multisig signers.
                2, // Token amount in base units.
                0, // Decimals defined on the mint.
            )?,
        ],
        Some(&fee_payer.pubkey()),
        &[&fee_payer],
        client.get_latest_blockhash().await?,
    );
    client
        .send_and_confirm_transaction(&create_token_account_transaction)
        .await?;

    let standard_burn_ix = burn_checked(
        &TOKEN_2022_PROGRAM_ID, // Token program that processes the burn.
        &source_token, // Token account to burn from.
        &mint.pubkey(), // Mint with the permissioned burn configuration.
        &fee_payer.pubkey(), // Token account owner signing the burn.
        &[&fee_payer.pubkey()], // Additional multisig signers.
        1, // Token amount in base units.
        0, // Decimals defined on the mint.
    )?;

    let standard_burn_transaction = Transaction::new_signed_with_payer(
        &[standard_burn_ix],
        Some(&fee_payer.pubkey()),
        &[&fee_payer],
        client.get_latest_blockhash().await?,
    );
    let standard_burn_result = client
        .simulate_transaction(&standard_burn_transaction)
        .await?;
    let standard_burn_failure = standard_burn_result
        .value
        .err
        .ok_or_else(|| anyhow!("Expected the standard burn to fail"))?;

    let permissioned_burn_instruction = permissioned_burn_ix::burn_checked(
        &TOKEN_2022_PROGRAM_ID, // Token program that processes the burn.
        &source_token, // Token account to burn from.
        &mint.pubkey(), // Mint with the permissioned burn configuration.
        &burn_authority.pubkey(), // Burn authority co-signing the burn.
        &fee_payer.pubkey(), // Token account owner signing the burn.
        &[], // Additional multisig signers.
        1, // Token amount in base units.
        0, // Decimals defined on the mint.
    )?;

    let permissioned_burn_transaction = Transaction::new_signed_with_payer(
        &[permissioned_burn_instruction],
        Some(&fee_payer.pubkey()),
        &[&fee_payer, &burn_authority],
        client.get_latest_blockhash().await?,
    );
    client
        .send_and_confirm_transaction(&permissioned_burn_transaction)
        .await?;

    let disable_authority_transaction = Transaction::new_signed_with_payer(
        &[
            set_authority(
                &TOKEN_2022_PROGRAM_ID, // Token program that owns the mint.
                &mint.pubkey(), // Mint with the permissioned burn configuration.
                None, // Setting the authority to None disables permissioned burning.
                AuthorityType::PermissionedBurn, // Authority type to update.
                &burn_authority.pubkey(), // Current burn authority signing the update.
                &[], // Additional multisig signers.
            )?,
        ],
        Some(&fee_payer.pubkey()),
        &[&fee_payer, &burn_authority],
        client.get_latest_blockhash().await?,
    );
    client
        .send_and_confirm_transaction(&disable_authority_transaction)
        .await?;

    let standard_burn_after_disable_transaction = Transaction::new_signed_with_payer(
        &[
            burn_checked(
                &TOKEN_2022_PROGRAM_ID, // Token program that processes the burn.
                &source_token, // Token account to burn from.
                &mint.pubkey(), // Mint with permissioned burning disabled.
                &fee_payer.pubkey(), // Token account owner signing the burn.
                &[&fee_payer.pubkey()], // Additional multisig signers.
                1, // Token amount in base units.
                0, // Decimals defined on the mint.
            )?,
        ],
        Some(&fee_payer.pubkey()),
        &[&fee_payer],
        client.get_latest_blockhash().await?,
    );
    client
        .send_and_confirm_transaction(&standard_burn_after_disable_transaction)
        .await?;

    let source_account = client.get_account(&source_token).await?;
    let source_state = StateWithExtensions::<Account>::unpack(&source_account.data)?;
    let mint_account = client.get_account(&mint.pubkey()).await?;
    let mint_state = StateWithExtensions::<Mint>::unpack(&mint_account.data)?;
    let permissioned_burn_config = mint_state.get_extension::<PermissionedBurnConfig>()?;

    println!("Mint Address: {}", mint.pubkey());
    println!(
        "Error From Failed Standard Burn: {:?}",
        standard_burn_failure
    );
    println!(
        "Source Amount After Burns: {}",
        u64::from(source_state.base.amount)
    );
    println!("Extension After Disable: {:?}", permissioned_burn_config);

    Ok(())
}
```

### Web3.js (legacy)

These examples use legacy `@solana/web3.js` with `@solana/spl-token` 0.4.15 or
later, which added the permissioned burn helpers.

<Warning>
  **`@solana/web3.js` 1.x is no longer actively maintained**

  It receives critical fixes only. Use [Kit](/developers/docs/clients/official/javascript#solana-kit) for new code. To migrate existing code, follow the [Kit upgrade guide](https://www.solanakit.com/docs/upgrade-guide), or the [web3.js v3 migration guide](https://github.com/solana-foundation/solana-web3.js/blob/main/docs/web3js-v1-to-v3-migration.md) to keep the class-based API.

  To run this code, install 1.x with `npm install @solana/web3.js@1`. A plain `npm install @solana/web3.js` installs v3, which this code doesn't run on.
</Warning>

```bash Terminal
npm install @solana/web3.js@1 @solana/spl-token@^0.4.15
```

```ts Instructions highlight={58-62,136-145,154-161}
import {
  Connection,
  Keypair,
  LAMPORTS_PER_SOL,
  sendAndConfirmTransaction,
  SystemProgram,
  Transaction
} from "@solana/web3.js";
import {
  ASSOCIATED_TOKEN_PROGRAM_ID,
  AuthorityType,
  createAssociatedTokenAccountInstruction,
  createBurnCheckedInstruction,
  createInitializeMintInstruction,
  createInitializePermissionedBurnInstruction,
  createMintToCheckedInstruction,
  createPermissionedBurnCheckedInstruction,
  createSetAuthorityInstruction,
  ExtensionType,
  getAccount,
  getAssociatedTokenAddressSync,
  getMint,
  getMintLen,
  getPermissionedBurn,
  TOKEN_2022_PROGRAM_ID
} from "@solana/spl-token";

const connection = new Connection("http://localhost:8899", "confirmed");
const latestBlockhash = await connection.getLatestBlockhash();

const feePayer = Keypair.generate();
const mint = Keypair.generate();
const burnAuthority = Keypair.generate();

const airdropSignature = await connection.requestAirdrop(
  feePayer.publicKey,
  5 * LAMPORTS_PER_SOL
);
await connection.confirmTransaction({
  blockhash: latestBlockhash.blockhash,
  lastValidBlockHeight: latestBlockhash.lastValidBlockHeight,
  signature: airdropSignature
});

const mintSpace = getMintLen([ExtensionType.PermissionedBurn]);
const mintRent = await connection.getMinimumBalanceForRentExemption(mintSpace);

await sendAndConfirmTransaction(
  connection,
  new Transaction().add(
    SystemProgram.createAccount({
      fromPubkey: feePayer.publicKey, // Account funding account creation.
      newAccountPubkey: mint.publicKey, // New mint account to create.
      space: mintSpace, // Account size in bytes for the mint plus PermissionedBurnConfig.
      lamports: mintRent, // Lamports funding the mint account rent.
      programId: TOKEN_2022_PROGRAM_ID // Program that owns the mint account.
    }),
    createInitializePermissionedBurnInstruction(
      mint.publicKey, // Mint account that stores the PermissionedBurnConfig extension.
      burnAuthority.publicKey, // Authority required to co-sign every burn for the mint.
      TOKEN_2022_PROGRAM_ID // Token program that owns the mint.
    ),
    createInitializeMintInstruction(
      mint.publicKey, // Mint account to initialize.
      0, // Number of decimals for the token.
      feePayer.publicKey, // Authority allowed to mint new tokens.
      feePayer.publicKey, // Authority allowed to freeze token accounts.
      TOKEN_2022_PROGRAM_ID // Program that owns the mint account.
    )
  ),
  [feePayer, mint],
  { commitment: "confirmed" }
);

const sourceToken = getAssociatedTokenAddressSync(
  mint.publicKey,
  feePayer.publicKey,
  false,
  TOKEN_2022_PROGRAM_ID,
  ASSOCIATED_TOKEN_PROGRAM_ID
);

await sendAndConfirmTransaction(
  connection,
  new Transaction().add(
    createAssociatedTokenAccountInstruction(
      feePayer.publicKey, // Account funding the associated token account creation.
      sourceToken, // Associated token account address to create.
      feePayer.publicKey, // Owner of the associated token account.
      mint.publicKey, // Mint for the associated token account.
      TOKEN_2022_PROGRAM_ID, // Token program that owns the account.
      ASSOCIATED_TOKEN_PROGRAM_ID // Associated Token Program that creates the account.
    ),
    createMintToCheckedInstruction(
      mint.publicKey, // Mint account that issues the tokens.
      sourceToken, // Token account receiving the newly minted tokens.
      feePayer.publicKey, // Signer authorized to mint new tokens.
      2, // Token amount in base units.
      0, // Decimals defined on the mint.
      [], // Additional multisig signers.
      TOKEN_2022_PROGRAM_ID // Token program that owns the mint.
    )
  ),
  [feePayer],
  { commitment: "confirmed" }
);

let standardBurnFailure: string | undefined;
try {
  await sendAndConfirmTransaction(
    connection,
    new Transaction().add(
      createBurnCheckedInstruction(
        sourceToken, // Token account to burn from.
        mint.publicKey, // Mint with the permissioned burn configuration.
        feePayer.publicKey, // Token account owner signing the burn.
        1, // Token amount in base units.
        0, // Decimals defined on the mint.
        [], // Additional multisig signers.
        TOKEN_2022_PROGRAM_ID // Token program that owns the mint.
      )
    ),
    [feePayer],
    { commitment: "confirmed" }
  );
} catch (error) {
  standardBurnFailure = error instanceof Error ? error.message : String(error);
}
if (!standardBurnFailure) {
  throw new Error("Expected the standard burn to fail");
}

await sendAndConfirmTransaction(
  connection,
  new Transaction().add(
    createPermissionedBurnCheckedInstruction(
      sourceToken, // Token account to burn from.
      mint.publicKey, // Mint with the permissioned burn configuration.
      feePayer.publicKey, // Token account owner signing the burn.
      burnAuthority.publicKey, // Burn authority co-signing the burn.
      1, // Token amount in base units.
      0, // Decimals defined on the mint.
      [], // Additional multisig signers.
      TOKEN_2022_PROGRAM_ID // Token program that owns the mint.
    )
  ),
  [feePayer, burnAuthority],
  { commitment: "confirmed" }
);

await sendAndConfirmTransaction(
  connection,
  new Transaction().add(
    createSetAuthorityInstruction(
      mint.publicKey, // Mint with the permissioned burn configuration.
      burnAuthority.publicKey, // Current burn authority signing the update.
      AuthorityType.PermissionedBurn, // Authority type to update.
      null, // Setting the authority to None disables permissioned burning.
      [], // Additional multisig signers.
      TOKEN_2022_PROGRAM_ID // Token program that owns the mint.
    )
  ),
  [feePayer, burnAuthority],
  { commitment: "confirmed" }
);

await sendAndConfirmTransaction(
  connection,
  new Transaction().add(
    createBurnCheckedInstruction(
      sourceToken, // Token account to burn from.
      mint.publicKey, // Mint with permissioned burning disabled.
      feePayer.publicKey, // Token account owner signing the burn.
      1, // Token amount in base units.
      0, // Decimals defined on the mint.
      [], // Additional multisig signers.
      TOKEN_2022_PROGRAM_ID // Token program that owns the mint.
    )
  ),
  [feePayer],
  { commitment: "confirmed" }
);

const sourceAccount = await getAccount(
  connection,
  sourceToken,
  "confirmed",
  TOKEN_2022_PROGRAM_ID
);
const mintAccount = await getMint(
  connection,
  mint.publicKey,
  "confirmed",
  TOKEN_2022_PROGRAM_ID
);
const permissionedBurnConfig = getPermissionedBurn(mintAccount);

console.log("Mint Address:", mint.publicKey.toBase58());
console.log("Error From Failed Standard Burn:", standardBurnFailure);
console.log("Source Amount After Burns:", sourceAccount.amount);
console.log("Extension After Disable:", permissionedBurnConfig);
```
