Skip to content

​What Is a Permanent Delegate?

The Token Extension Program’s PermanentDelegate mint extension assigns a delegate authority to the mint itself. A permanent delegate is a mint level authority that can authorize transfers and burns for any token account for that mint. It acts as a global delegate for all token accounts for the mint, and token account owners cannot revoke the permanent delegate from their token accounts. The current permanent delegate (not the mint authority) can hand the role to a new address, or clear it, with SetAuthority using AuthorityType::PermanentDelegate; the current delegate must sign.
Security: A permanent delegate can empty any accountThe delegate can transfer or burn tokens from every token account for the mint, including token accounts your program owns through a PDA. A program that accepts this mint as collateral or escrow can have its balance removed without any instruction from your program. Reject mints with PermanentDelegate unless your design accounts for that authority. Users and integrators should know who holds the delegate role.

​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 (surfpool start) or solana-test-validator. 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 and Use a Permanent Delegate

To create and use a permanent delegate:
  1. Calculate the mint account size and rent needed for the mint and the PermanentDelegate extension.
  2. Create the mint account with CreateAccount, initialize PermanentDelegate, and initialize the mint with InitializeMint.
  3. Submit TransferChecked or BurnChecked signed by the permanent delegate. The token program processes those instructions the same way as if the token account owner signed them.
1

Calculate account size

Calculate the mint account size for the base mint plus the PermanentDelegate extension. This is the size used in CreateAccount.
Example
2

Calculate rent

Calculate rent using the size needed for the mint plus the PermanentDelegate extension.
Example
3

Create the mint account

Create the mint account with the calculated space and lamports.
Example
4

Initialize PermanentDelegate

Initialize the PermanentDelegate extension on the mint.
Example
5

Initialize the mint

Initialize the mint with InitializeMint in the same transaction.
Example
6

Create token accounts and mint tokens

Create token accounts for the owner and recipient, then mint tokens to the owner token account.
Example
7

Transfer with the permanent delegate

Transfer tokens with TransferChecked signed by the permanent delegate.
Example
Instruction OrderInitializePermanentDelegate must come before InitializeMint. CreateAccount, InitializePermanentDelegate, and InitializeMint must be included in the same transaction.

​Source Reference

ItemDescriptionSource
PermanentDelegateMint extension that stores the delegate authorized across every token account for the mint.Source
InitializePermanentDelegateInstruction that initializes the permanent delegate before InitializeMint.Source
SetAuthorityBase token instruction used with AuthorityType::PermanentDelegate to rotate the delegate.Source
AuthorityType::PermanentDelegateAuthority discriminator used with SetAuthority to rotate the permanent delegate on a mint.Source
process_initialize_permanent_delegateProcessor logic that writes the permanent delegate extension onto the mint.Source
process_set_authorityProcessor logic that validates and rotates the permanent delegate when AuthorityType::PermanentDelegate is used.Source

​Kit

These examples use the generated Token-2022 instructions directly.
Terminal
Instructions

​Web3.js v3

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

​Rust

Add these dependencies to Cargo.toml (tested with Rust 1.89, 1.98, and 1.99):
Cargo.toml
Rust

​Web3.js (legacy)

These examples use legacy @solana/web3.js with @solana/spl-token.
@solana/web3.js 1.x is no longer actively maintainedIt receives critical fixes only. Use Kit for new code. To migrate existing code, follow the Kit upgrade guide, or the web3.js v3 migration guide 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.
Terminal
Instructions