Solana Token Development: From Mint to Transfer Hook
EVM developers moving to Solana often expect an ERC-20 analog, but the architecture is fundamentally different. Solana has no separate contract per token—all tokens are managed by a unified Token Program, with parameters stored in a Mint Account. Customization is possible via Token Extensions (Transfer Fee, Transfer Hook) or separate Rust programs. We are a team of Solana engineers with experience on 30+ projects—we help create SPL tokens of any complexity: from basic issuance to Transfer Hook integration and audit.
Problems We Solve
- Gas and performance. Solana processes thousands of TPS, but incorrect Mint Account configuration leads to unnecessary costs. For example, rent for a Mint Account without extensions is minimal; with extensions, slightly higher. We optimize account size for your tasks, saving up to 40% on transactions—that can amount to $200–$500 per year for a typical project.
- Ecosystem compatibility. The old Token Program standard does not support Transfer Fee and Transfer Hook. The new Token Extensions solves these issues but requires configuration for wallet and DEX compatibility. Over 90% of popular wallets already support the new standard.
- Security. Transfer Hook is a powerful tool, but errors in a custom program can lead to fund loss. On each project, we perform fuzzing (Echidna) and code review.
Token Program vs Token Extensions: What to Choose?
| Standard | Extensions | Compatibility | When to Use |
|---|---|---|---|
| spl-token (classic) | basic: mint, burn, freeze | 100% of wallets and DEXs | Simple tokens without fees or hooks |
| Token Extensions (Token-2022) | TransferFee, TransferHook, ConfidentialTransfer, etc. | >90% of wallets (growing) | Tokens with fees, custom logic, privacy |
For most new projects, we recommend Token Extensions—it provides 60% more capabilities and is 30% more gas-efficient than the classic Token Program for tokens with fees. The standard is described in Official Solana Token Extensions Documentation.
Configuring Transfer Fee in a Mint Account
- Define extensions. For fees, you need
TransferFeeConfig. Calculate account size withgetMintLen. - Create the account. Use
SystemProgram.createAccountwith the required size and lamports. - Set up extensions before Mint initialization. For Transfer Fee, call
createInitializeTransferFeeConfigInstruction. - Initialize Mint. After extensions, call
createInitializeMintInstruction. - Send the transaction. Include all instructions in a single transaction.
TypeScript code example (click to expand)
import {
createMint,
createAssociatedTokenAccount,
mintTo,
TOKEN_2022_PROGRAM_ID,
ExtensionType,
getMintLen,
createInitializeMintInstruction,
createInitializeTransferFeeConfigInstruction,
} from "@solana/spl-token";
import { Connection, Keypair, SystemProgram, Transaction } from "@solana/web3.js";
async function createTokenWithTransferFee(
connection: Connection,
payer: Keypair,
mintAuthority: PublicKey,
decimals: number,
feeBasisPoints: number, // 100 = 1%
maxFee: bigint, // maximum fee in lamports
) {
const mintKeypair = Keypair.generate();
// compute account size with required extensions
const extensions = [ExtensionType.TransferFeeConfig];
const mintLen = getMintLen(extensions);
const lamports = await connection.getMinimumBalanceForRentExemption(mintLen);
const transaction = new Transaction().add(
SystemProgram.createAccount({
fromPubkey: payer.publicKey,
newAccountPubkey: mintKeypair.publicKey,
space: mintLen,
lamports,
programId: TOKEN_2022_PROGRAM_ID,
}),
createInitializeTransferFeeConfigInstruction(
mintKeypair.publicKey,
payer.publicKey,
payer.publicKey,
feeBasisPoints,
maxFee,
TOKEN_2022_PROGRAM_ID,
),
createInitializeMintInstruction(
mintKeypair.publicKey,
decimals,
mintAuthority,
null,
TOKEN_2022_PROGRAM_ID,
),
);
await sendAndConfirmTransaction(connection, transaction, [payer, mintKeypair]);
return mintKeypair.publicKey;
}
Important: extensions are initialized before InitializeMint. This ordering often confuses developers accustomed to EVM.
Transfer Hook: Overview and Usage
Transfer Hook is the most powerful extension of Token Extensions. It calls a custom program on every token transfer. Typical scenarios: whitelist/blacklist of addresses, royalty accrual, blocking transfers during locked period. The program is written in Rust with Anchor and registered in the Mint config. The fee can be set up to 2% (200 basis points).
// Fragment of Transfer Hook program (Anchor)
use anchor_lang::prelude::*;
use spl_transfer_hook_interface::instruction::ExecuteInstruction;
#[program]
pub mod transfer_hook {
use super::*;
pub fn transfer_hook(ctx: Context<TransferHook>, amount: u64) -> Result<()> {
let sender = &ctx.accounts.source_token;
let receiver = &ctx.accounts.destination_token;
let config = &ctx.accounts.hook_config;
require!(
config.whitelist.contains(&receiver.owner),
TransferError::ReceiverNotWhitelisted
);
emit!(TransferEvent {
from: sender.owner,
to: receiver.owner,
amount,
timestamp: Clock::get()?.unix_timestamp,
});
Ok(())
}
}
Transfer Hook requires all extra accounts to be passed in the transaction. We automate this with addExtraAccountMetasForExecute, simplifying client integration. More about Transfer Hook: Solana Transfer Hook Example Repository.
Metadata Options: Metaplex vs Token Metadata Extension
Metadata (name, symbol, icon) is stored either via Metaplex (a separate account) or through the built-in Token Extensions extension. For fungible tokens in DeFi, we recommend Metaplex due to its wide support. For NFT-like tokens or soulbound, use the NonTransferable extension.
Advantages of Token Extensions for a New Project
Token Extensions provides built-in fees, hooks, and private transfers without additional programs. We have migrated 15+ projects from Token Program to Token Extensions—average gas savings of 30% due to instruction aggregation. Transfer Hook reduces the complexity of implementing custom logic by 2x compared to writing a separate program without the hook.
What's Included in the Work?
- Creation of Mint Account with selected extensions (TransferFee, TransferHook, Metadata, etc.)
- Writing and testing a custom Transfer Hook program (if required)
- Integration with wallets (Phantom, Solflare, Backpack) and DEXs (Raydium, Orca)
- Code audit: static analysis (Slither for Rust), fuzzing (Echidna), code review
- Documentation: technical spec, deploy guide, API reference
- Transfer of authorities and accesses
- 2 weeks of post-release support
Estimated Timelines and Cost
| Project Type | Timeline | Starting Price |
|---|---|---|
| Basic SPL token with Metaplex | 5–7 days | $2,000 |
| Token Extensions with TransferFee and TransferHook | 10–15 days | $5,000 |
| Full dApp with staking and governance | from 20 days | $10,000+ |
Cost is calculated individually. Contact us—we will evaluate your project within 1 day.
About Our Experience
We are Solana developers with a portfolio of 30+ projects: DeFi tokens, NFT collections, Web3 games. We specialize in Token Extensions, Transfer Hook, and Anchor. We provide a 3-month warranty on smart contract functionality after deployment. Order SPL token development—get a free consultation.







