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

推荐订阅源

I
InfoQ
博客园_首页
美团技术团队
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
H
Help Net Security
J
Java Code Geeks
T
Tailwind CSS Blog
Jina AI
Jina AI
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
Google Developers Blog
爱范儿
爱范儿
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
宝玉的分享
宝玉的分享
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

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
TON Storage Fees, Part 2: Important Notes and Practical Tips
Salikh Osmanov · 2026-06-20 · via DEV Community

Introduction

In Part 1 we discussed how storage fees are calculated and collected.

This article focuses on practical consequences of the storage fee mechanism and several behaviors that may surprise developers who are new to TON.

If you have not read Part 1 yet, start there:

TON Storage Fees, Part 1: Understanding the Mechanism


Storage Fees Are Collected Only During Transactions

One of the most common misconceptions is that account balances continuously decrease over time.

This is not how TON works.

Storage fees are collected only when a transaction occurs and the Storage Phase is executed.

As a result:

  • an account may accumulate storage debt for months;
  • its balance may appear unchanged;
  • the actual collection happens only during the next transaction.

This distinction is important because an account can accumulate a significant due_payment value before any funds are actually deducted.


Total Fees in Explorers May Be Misleading

When examining transactions in blockchain explorers, developers often look at the reported storage fees and assume that all accumulated debt was paid.

This is not always true.

If an account does not have enough balance to pay the full storage debt:

total_storage_fee > available_balance

only part of the debt is collected.

The remaining amount is stored as:

due_payment

Therefore:

Collected Storage Fee
≠
Total Storage Debt

The value displayed by an explorer usually represents the collected portion only.

A non-zero storage debt may still remain inside the account.


Bounceable and Non-Bounceable Messages Produce Different Results

The most important practical implication of the Storage Phase is the different ordering of transaction phases.

Bounceable message:

Storage → Credit → Compute

Non-bounceable message:

Credit → Storage → Compute

As a consequence, the same incoming value can produce different results depending on the bounce mode.

Example

Assume:

Account balance: 0 TON
Storage debt: 0.5 TON
Incoming value: 1 TON

If the message is bounceable:

Storage Phase runs first.
Balance = 0 TON.
Storage fee cannot be collected.

If the message is non-bounceable:

Credit Phase runs first.
Balance becomes 1 TON.
Storage fee can be collected immediately.


Why msg_value Is Not Always the Original Message Value

Many developers assume that msg_value inside recv_internal() is always equal to the value contained in the incoming message.

This assumption is not always correct.

Storage fee collection may affect the value that eventually becomes visible during the Compute Phase.

The value passed to TVM is effectively:

msg_value_before_compute

rather than the original message value.


Why my_balance - msg_value Can Be Dangerous

A common pattern looks like:

int balance_before_msg = my_balance - msg_value;

The assumption is that:

my_balance =
balance_before_message +
msg_value

Unfortunately this assumption is not always true.

Because storage fees may be collected before the Compute Phase, both values may already have been adjusted.


Storage Debt Survives Between Transactions

Unpaid storage fees are not forgotten.

Whenever the account cannot fully pay storage debt, the remaining amount is stored internally as:

due_payment

During the next transaction:

new_storage_fee
+
previous_due_payment
=
total_storage_fee

This means storage debt accumulates until it is eventually paid.


Active Accounts Are Not Deleted Immediately

Another common misconception is that accounts are deleted as soon as storage debt becomes large enough.

The actual process is usually:

ACTIVE
  ↓
FROZEN
  ↓
DELETED

The account first becomes frozen.

Only later can it become deleted if debt conditions remain satisfied.


Frozen Accounts May Survive Much Longer Than Expected

When an account becomes frozen, TON removes most of the stored state.

The account retains only a compact representation containing hashes of the original code and data.

As a result:

Frozen state size
<<
Active state size

Storage fees continue accumulating, but much more slowly.


Freezing or Deletion Does Not Necessarily Mean TVM Execution

Depending on account state and available balance:

  • TVM may execute;
  • TVM may be skipped;
  • Compute Phase may be recorded with a skip reason.

Examples include:

sk_no_state
sk_no_gas


Practical Tips

Use Non-Bounceable Messages When Funding Contracts

If the purpose of the transfer is simply to fund a contract, a non-bounceable message is often preferable.

Include Existing Storage Debt in Reservations

raw_reserve(
    MIN_TONS_FOR_STORAGE +
    my_storage_due(),
    2
);

Ignoring storage debt may leave the contract underfunded.

Monitor due_payment

Storage debt can silently accumulate for a long time.

Monitoring my_storage_due() helps avoid unpleasant surprises.

Do Not Assume msg_value Equals Incoming Value

Whenever precise accounting is required, remember that the value visible inside TVM may differ from the original incoming message value.


Related Article

TON Storage Fees, Part 1: Understanding the Mechanism


Useful Links