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

推荐订阅源

WordPress大学
WordPress大学
B
Blog
M
MIT News - Artificial intelligence
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Proofpoint News Feed
C
Check Point Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
博客园 - 叶小钗
S
SegmentFault 最新的问题
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
Microsoft Security Blog
Microsoft Security Blog
小众软件
小众软件
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
腾讯CDC
博客园 - Franky
博客园 - 聂微东
V
Visual Studio Blog
GbyAI
GbyAI
Martin Fowler
Martin Fowler
罗磊的独立博客
Y
Y Combinator 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
Token-2022 Feels Like Middleware for Money
Tobi Ayinmiro · 2026-06-17 · via DEV Community

Tobi Ayinmiro

As a Web2 developer, I naturally compare new technologies to tools I've already used.

After spending a week exploring Solana's Token-2022 program, I realized the best analogy is middleware.

Instead of wrapping requests, you're wrapping assets.

With Token-2022 extensions, behaviors that would normally require custom smart contracts can be attached directly to a token mint. Over the past few days, I created three different Token-2022 mints on devnet and experimented with transfer fees, interest accrual, and non-transferability.


Day 50–51: Transfer Fee Token

Mint Address

2Ak24WKZZrvjE4KGWr8YMovGBsWB5bptcQekFycn5jpd

Create Token

spl-token --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb \
  create-token \
  --transfer-fee-basis-points 100 \
  --transfer-fee-maximum-fee 1000000 \
  --decimals 6

Test Transfers

export MINT=2Ak24WKZZrvjE4KGWr8YMovGBsWB5bptcQekFycn5jpd

spl-token mint $MINT 1000000

spl-token transfer \
  --expected-fee 10 \
  $MINT 1000 $RECIPIENT \
  --allow-unfunded-recipient

Harvest Collected Fees

spl-token withdraw-withheld-tokens \
  $MY_TA \
  $RECIPIENT_TA

The Transfer Fee extension automatically withholds a percentage of every transfer. In a traditional Web2 application, implementing this would typically require backend logic, payment processing, and accounting systems. With Token-2022, the rule is enforced directly by the token itself.

Potential use cases include protocol fees, creator royalties, treasury funding, and community currencies.


Day 52: Interest-Bearing Token

Mint Address

86D7eecNMkJMofFabFq9GMFPPUVYrwLbLx3KA6vnAyee

Create Token

spl-token create-token \
  --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb \
  --decimals 6 \
  --transfer-fee-basis-points 100 \
  --transfer-fee-maximum-fee 1000000 \
  --interest-rate 5000

Observe Interest Accrual

spl-token accounts $MINT --verbose

sleep 30

spl-token accounts $MINT --verbose

This extension surprised me the most.

Unlike traditional interest-bearing assets, the underlying token balance does not increase over time. Instead, Token-2022 adjusts the displayed UI amount to reflect accrued interest.

The result is a token that appears to grow while maintaining the same underlying balance. This allows applications to represent yield without continuously minting new tokens.


Day 54: Non-Transferable Token

Mint Address

Ek7ViTTtLeMCXGgBBuxUcnbxNweN58EJhTAkzcfkKi8k

Create Token

spl-token create-token \
  --program-2022 \
  --enable-non-transferable

Attempt a Transfer

spl-token transfer $MINT 1 $RECIPIENT --allow-unfunded-recipient

Actual Result

The transfer failed exactly as expected.

Transfer 1 tokens
  Sender: AUVDPscnF5YwhSd5oKKVFiASVLJvzix9v9rT6SFiUaTk
  Recipient: A8MAafu4XrCxetfZhMWtSoSMXarzUBeXX5yUrcHqdCxq
  Recipient associated token account: 4BkZZy8r1uaraL4PRu6CgNAvA8HhBEhcBMcmPgexB46C

Error: Client(Error {
  request: Some(SendTransaction),
  kind: RpcError(RpcResponseError {
    code: -32002,
    message: "Transaction simulation failed:
    Error processing Instruction 0:
    custom program error: 0x25",
    data: SendTransactionPreflightFailure(
      RpcSimulateTransactionResult {
        err: Some(
          UiTransactionError(
            InstructionError(0, Custom(37))
          )
        ),
        logs: [
          "Program log: Instruction: TransferChecked",
          "Program log: Transfer is disabled for this mint"
        ]
      }
    )
  })
})

The important part of the error is:

Program log: Transfer is disabled for this mint

This confirms that the Non-Transferable extension was functioning exactly as designed. The Token-2022 program prevented the asset from being transferred between wallets, enforcing the restriction at the protocol level rather than relying on application logic.

Unlike standard SPL tokens, these assets are intended to remain attached to the wallet that receives them.

Potential use cases include:

  • Educational certificates
  • Membership badges
  • Event attendance proofs
  • Reputation systems
  • Identity credentials
  • Soul-bound tokens

Rather than functioning as currency, these tokens act as verifiable digital records tied to a specific wallet.


Why This Matters

What stood out to me throughout this exercise was how much functionality can be configured without writing a custom Solana program.

In a typical Web2 architecture, implementing these features would likely require:

  • APIs
  • Databases
  • Background jobs
  • Access-control logic
  • Payment processing systems

With Token-2022, many of these behaviors can be embedded directly into the asset itself.

A transfer fee becomes part of the token.

Interest accrual becomes part of the token.

Transfer restrictions become part of the token.

The asset carries the logic.


Final Thoughts

Token-2022 has changed how I think about digital assets on Solana.

Instead of building applications around tokens, developers can increasingly build behavior into the tokens themselves.

Over the course of these experiments, I created:

  • A token that collects fees
  • A token that accrues interest
  • A token that cannot be transferred

All without deploying a custom smart contract.

For a Web2 developer, the closest analogy remains middleware—but middleware for money.

The most interesting lesson from this week was seeing how different token behaviors can be achieved through configuration alone. Features that would traditionally require custom contracts, backend services, or application-level enforcement can be attached directly to the asset at mint creation.

That's a powerful shift in how we think about designing digital assets.