惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
A
About on SuperTechFans
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
Netflix TechBlog - Medium
Microsoft Security Blog
Microsoft Security Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
博客园 - Franky
D
Docker
Martin Fowler
Martin Fowler
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
Last Week in AI
Last Week in AI
U
Unit 42
F
Fortinet All Blogs
H
Help Net Security
Blog — PlanetScale
Blog — PlanetScale
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
P
Proofpoint News Feed
月光博客
月光博客
G
Google Developers Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Transfer Fees, Metadata, and Soulbound Tokens: A Tour of ...
Mubarak Yakubu · 2026-06-18 · via DEV Community

In Web2, adding a transfer fee means building middleware. On Solana, it's a flag. I built four tokens in six days. Here's what I learned.

A few weeks ago, I knew nothing about Solana tokens. I'd used Solana for transfers and read account data, but tokens felt like a black box. I wanted to understand how they actually work, not just copy-paste commands but know what each flag does and why it matters.

The Basic Mint

My first token was barebones. No name. No symbol. Just an address.

spl-token create-token

That's it. One command. A mint account appeared on devnet with a 9-decimal default.

I created a token account to hold it, then minted 100 tokens to myself.

spl-token create-account <MINT>
spl-token mint <MINT> 100

What surprised me: You can't receive tokens directly into your wallet. You need a token account for each token type. One per token, per wallet.

The mint is the factory. The token account is your bucket.

Giving It an Identity

A token without metadata is just an address. Phantom would show a random string. No one would know what it is.

I needed a name, symbol and URI.

But the original Token Program (Tokenkeg...) doesn't support metadata on the mint itself. You'd need a separate account.

So I used Token Extensions Program (Token-2022) at TokenzQdBN.... It stores metadata directly on the mint.

spl-token create-token \
  --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb \
  --enable-metadata \
  --decimals 6

spl-token initialize-metadata <MINT> "100daysofsol" "100DSOL" <URI>

One mint. Multiple extensions possible. No separate accounts.

The URI points to a JSON file with description and image. Wallet UIs read it automatically.

Adding Transfer Fees

In Web2, charging a fee on every transaction means building middleware. Handling edge cases. Making sure no one bypasses it.

On Solana, it's a flag.

I used Token-2022 again, this time with --transfer-fee-basis-points.

spl-token create-token \
  --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb \
  --transfer-fee-basis-points 200 \
  --transfer-fee-maximum-fee 5000 \
  --enable-metadata \
  --decimals 9

100 basis points = 1%. I set 200 (2%) with a cap of 5000 displayed tokens.

Then I minted 1000, transferred 100 to a second wallet, and watched the fee get withheld.

spl-token transfer <MINT> 100 <RECIPIENT> --expected-fee 2

Recipient got 98. 2 tokens withheld in their token account. They couldn't touch it.

Only the withdrawal authority (me) could collect it.

spl-token withdraw-withheld-tokens <MY_ACCOUNT> <RECIPIENT_ACCOUNT>

I swept the fee back. Balance went from 900 to 902.

The fee logic lives in the mint. Every transfer respects it. No application code required.

Soulbound Tokens

Not all tokens should be transferable.

A course completion certificate. A KYC verification. An employee badge. They're credentials, not currency.

Token-2022 has an extension for this: --enable-non-transferable.

spl-token create-token \
  --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb \
  --enable-non-transferable

I minted 10 tokens to myself. Then tried to transfer 5 to a second wallet.

It failed.
Program log: Transfer is disabled for this mint

The blockchain itself rejected the transaction. No client-side check. No middleware. Protocol-level enforcement.

But I could still burn them.

spl-token burn <ACCOUNT> 3

Balance went from 10 to 7. The holder can destroy tokens but cannot send them away.

This is how credentials should work on-chain. They prove something about the wallet that holds them. Trading them defeats the purpose.

What Surprised Me

What surprised me most: the protocol doesn't care about intent. It just enforces rules. When I tried to transfer a non-transferable token, the program rejected it without explanation beyond "Transfer is disabled." No appeal. No admin override. The rules are the rules.

What's Next

I've built tokens. Now I'm moving to programs.

I want to build something that does more than transfer value—something that enforces custom logic on-chain. A game. A marketplace. A DAO.

Follow along. I'm documenting everything.