From cc5c0fe1c50fefb334779269d47591630f6cfdae Mon Sep 17 00:00:00 2001
From: TONresistor <240980241+TONresistor@users.noreply.github.com>
Date: Tue, 20 Oct 2026 11:52:55 +0200
Subject: [PATCH 01/10] fix: recognize index pages in upstream URL checks
---
scripts/check-redirects.mjs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/check-redirects.mjs b/scripts/check-redirects.mjs
index b66e32276..8ad681c00 100644
--- a/scripts/check-redirects.mjs
+++ b/scripts/check-redirects.mjs
@@ -447,9 +447,11 @@ const checkUpstream = async (localConfig) => {
};
const upstreamNavLinks = Object.freeze(new Set(findUnignoredMdxUpstream()));
- const localNavLinks = getNavLinksSet();
+ const localNavLinks = new Set([...getNavLinksSet()].map((it) => it.replace(/\/index$/, '')));
- const upstreamOnlyLinks = [...upstreamNavLinks].filter((it) => !localNavLinks.has(it));
+ const upstreamOnlyLinks = [...upstreamNavLinks].filter(
+ (it) => !localNavLinks.has(it.replace(/\/index$/, '')),
+ );
if (upstreamOnlyLinks.length === 0) {
return { ok: true };
}
From e056f46f63e24f198ff8aaa506d0f1333e960fb0 Mon Sep 17 00:00:00 2001
From: TONresistor <240980241+TONresistor@users.noreply.github.com>
Date: Tue, 20 Oct 2026 11:52:56 +0200
Subject: [PATCH 02/10] feat(web3): expand TON DNS documentation
---
content/foundations/web3/ton-dns.mdx | 93 ----
content/foundations/web3/ton-dns/domains.mdx | 61 +++
content/foundations/web3/ton-dns/index.mdx | 67 +++
.../web3/ton-dns/manage-domains.mdx | 210 +++++++++
content/foundations/web3/ton-dns/meta.json | 10 +
.../foundations/web3/ton-dns/reference.mdx | 412 ++++++++++++++++++
6 files changed, 760 insertions(+), 93 deletions(-)
delete mode 100644 content/foundations/web3/ton-dns.mdx
create mode 100644 content/foundations/web3/ton-dns/domains.mdx
create mode 100644 content/foundations/web3/ton-dns/index.mdx
create mode 100644 content/foundations/web3/ton-dns/manage-domains.mdx
create mode 100644 content/foundations/web3/ton-dns/meta.json
create mode 100644 content/foundations/web3/ton-dns/reference.mdx
diff --git a/content/foundations/web3/ton-dns.mdx b/content/foundations/web3/ton-dns.mdx
deleted file mode 100644
index 9658acd6b..000000000
--- a/content/foundations/web3/ton-dns.mdx
+++ /dev/null
@@ -1,93 +0,0 @@
----
-title: "TON DNS"
-description: "On-chain hierarchical domain name service for TON Network"
----
-
-TON DNS is a service for translating human-readable domain names (such as `example.ton` or `mysite.temp.ton`) into TON smart contract addresses, ADNL addresses used by services on the TON Network, and other network entities.
-
-## What TON DNS resolves
-
-TON DNS records can point to several types of addresses:
-
-- **Wallet addresses**: on-chain smart contract addresses stored under the `wallet` category, allowing users to send cryptocurrency directly to a human-readable domain name instead of a raw address.
-- **ADNL addresses**: used to locate TON Sites running on the TON Network.
-- **TON Storage Bag IDs**: identifiers for files and data stored via TON Storage.
-- **Next resolver references**: delegation of subdomains to another DNS smart contract.
-- **Text records**: arbitrary UTF-8 text associated with a domain name.
-
-## Implementation
-
-TON DNS is built as a tree of DNS smart contracts. The root contract lives on the masterchain; its address is stored in blockchain configuration parameter #4. `.ton` is the only first-level domain. Each `.ton` domain is an NFT following the TEP-0081 standard: the resolver contract acts as an NFT collection and each registered domain is an NFT item, making domains transferable through any NFT-compatible wallet or marketplace.
-
-The `.t.me` namespace operates as a delegated sub-resolver on the same infrastructure, implementing the same `dnsresolve` interface and supporting the same record types as `.ton` domains.
-
-Every DNS smart contract exposes a `dnsresolve` get-method:
-
-```func
-(int, cell) dnsresolve(slice subdomain, int category)
-```
-
-`subdomain` is the portion of the domain name remaining to be resolved. `category` is the SHA-256 hash of the record category name, or `0` to retrieve all records. The method returns the number of bits consumed and a cell containing the DNS record. If fewer bits were consumed than the full subdomain length, the returned cell is a `dns_next_resolver` pointing to the contract that handles the remainder.
-
-## DNS record types
-
-DNS record values are described by TL-B schemas. The following record types are defined:
-
-- `dns_adnl_address`: stores a 256-bit ADNL address for network services such as TON Sites. An optional protocol list describes supported protocols.
-
- ```tlb
- dns_adnl_address#ad01 adnl_addr:bits256 flags:(## 8) { flags <= 1 }
- proto_list:flags . 0?ProtoList = DNSRecord;
- ```
-
-- `dns_smc_address`: stores any smart contract address on the TON Blockchain, including wallets. An optional capability list describes the capabilities of the contract. Under the standard `wallet` category, this record enables sending funds to a domain name.
-
- ```tlb
- dns_smc_address#9fd3 smc_addr:MsgAddressInt flags:(## 8) { flags <= 1 }
- cap_list:flags . 0?SmcCapList = DNSRecord;
- ```
-
-- `dns_next_resolver`: delegates resolution of subdomains to another DNS smart contract at the specified address.
-
- ```tlb
- dns_next_resolver#ba93 resolver:MsgAddressInt = DNSRecord;
- ```
-
-- `dns_storage_address`: stores a 256-bit TON Storage Bag ID, allowing domain names to be assigned to files stored via TON Storage.
-
- ```tlb
- dns_storage_address#7473 bag_id:bits256 = DNSRecord;
- ```
-
-- `dns_text`: stores arbitrary UTF-8 text using the `Text` chunked encoding defined in the block layout specification.
-
- ```tlb
- dns_text#1eda _:Text = DNSRecord;
- ```
-
-### Record categories
-
-When querying a DNS contract, the caller specifies a category to select which record type to retrieve. Categories are identified by the SHA-256 hash of a UTF-8 category name string. The standard categories defined by TEP-0081 are:
-
-| Category name | Purpose |
-| ------------------- | ------------------------------------------ |
-| `wallet` | Default wallet address (`dns_smc_address`) |
-| `site` | TON Site ADNL address (`dns_adnl_address`) |
-| `dns_next_resolver` | Subdomain delegation (`dns_next_resolver`) |
-| `storage` | TON Storage Bag ID (`dns_storage_address`) |
-
-Passing category `0` retrieves all records stored for the domain.
-
-## Domain lifecycle
-
-Registered domains must be renewed annually by sending 0.015 GRAM to the domain contract. There is no grace period: once a domain has gone more than one year without renewal, anyone can trigger its release by calling `dns_balance_release` on the contract with a minimum payment. The domain then re-enters auction for one week, with the caller as the initial bidder.
-
-## Ecosystem integration
-
-TON domain names such as `.ton` domains are recognized by wallet applications and explorers in the TON ecosystem. Users can send cryptocurrency to a TON DNS domain name instead of copying a 256-bit account identifier.
-
-TON DNS also integrates with other TON services:
-
-- [TON Sites](/foundations/web3/ton-sites): a `dns_adnl_address` record pointing to an ADNL address gives a site a human-readable `.ton` domain.
-- [TON Storage](/foundations/web3/ton-storage): a `dns_storage_address` record maps a domain name to a Bag ID, making stored files addressable by name.
-- [TON Proxy](/foundations/web3/ton-proxy): resolves `.ton` domains to ADNL addresses before routing HTTP traffic to the target site.
diff --git a/content/foundations/web3/ton-dns/domains.mdx b/content/foundations/web3/ton-dns/domains.mdx
new file mode 100644
index 000000000..fbf49acbf
--- /dev/null
+++ b/content/foundations/web3/ton-dns/domains.mdx
@@ -0,0 +1,61 @@
+---
+title: ".ton domains"
+sidebarTitle: ".ton domains"
+---
+
+Names directly under `.ton` follow the registration, auction, and renewal rules of the official domain collection. These rules apply independently of the application used to manage the domain. Use [dns.ton.org](/foundations/web3/ton-dns/manage-domains) for registration and management through the website.
+
+## Registration rules
+
+The label before `.ton` must contain 4 to 126 characters: lowercase ASCII letters (`a-z`), digits (`0-9`), or hyphens. A hyphen cannot be the first or last character. For example, `example.ton` has the label `example`.
+
+These restrictions apply to registration in the `.ton` collection. The broader name format in [TEP-81](/foundations/web3/ton-dns/reference#name-encoding) also supports names served by other resolvers. Delegated subdomains follow their resolver's rules.
+
+## Minimum first bids
+
+The minimum opening bid depends on the label's length, excluding `.ton`:
+
+| Characters | Minimum first bid (GRAM) |
+| ---------: | -----------------------: |
+| 4 | 100 |
+| 5 | 50 |
+| 6 | 40 |
+| 7 | 30 |
+| 8 | 20 |
+| 9 | 10 |
+| 10 | 5 |
+| 11–126 | 1 |
+
+Transaction fees are additional. The final price depends on competing bids.
+
+## Auctions
+
+Registration starts an auction for an unregistered name. New-domain auctions initially last one hour. Each competing bid must be at least 5% higher than the previous bid, with integer rounding in nanograms. A bid in the final hour extends the deadline to one hour after that bid.
+
+The collection deploys the domain contract and forwards the remaining message value after fees. The accepted first bid can therefore differ from the submitted value.
+
+After the deadline, the highest bidder can take ownership. Ownership is recorded when a further successful transaction finalizes the auction. The website displays the winner before that finalization; an owner record update can finalize it. See the [finalization interface](/foundations/web3/ton-dns/reference#auction-finalization) for contract behavior.
+
+## Ownership
+
+Each domain is a transferable [non-fungible token (NFT)](/foundations/glossary#non-fungible-token-nft). Its owner controls the DNS records and can transfer the domain to another account.
+
+Ownership and payment routing are separate: the `wallet` record can point to an account other than the owner. Transferring ownership keeps the existing DNS records, so a new owner must review payment and delegation destinations.
+
+## Renewal
+
+A domain's renewal period is 366 days from its last qualifying transaction. A successful owner record update, content replacement, ownership transfer, or balance top-up resets that period. An empty-body top-up qualifies after auction finalization. The [renewal interface](/foundations/web3/ton-dns/reference#renewal-interface) specifies the eligible messages.
+
+Renewal starts a new period from execution time. It does not add 366 days to the previous deadline. A payment to the domain's resolved wallet address does not necessarily reach or renew the domain contract.
+
+## Expiration
+
+Expiration does not automatically release the domain or remove its DNS records. After more than 366 days without renewal, anyone can start a new auction if none is active. Until that auction starts, the current owner can still renew.
+
+An expired-domain auction removes the previous owner's control and records the opening bidder. It initially lasts one week; subsequent bids follow the same extension rules as new-domain auctions. The domain address and DNS records remain unchanged. Ownership is assigned through finalization after the auction ends.
+
+## Sources
+
+- [Collection contract](https://github.com/ton-blockchain/dns-contract/blob/d08131031fb659d2826cccc417ddd9b98476f814/func/nft-collection.fc): registration and deployment.
+- [Naming and pricing](https://github.com/ton-blockchain/dns-contract/blob/d08131031fb659d2826cccc417ddd9b98476f814/func/dns-utils.fc): label validation and minimum bids.
+- [Domain contract](https://github.com/ton-blockchain/dns-contract/blob/d08131031fb659d2826cccc417ddd9b98476f814/func/nft-item.fc): auctions, ownership, renewal, and expiration.
diff --git a/content/foundations/web3/ton-dns/index.mdx b/content/foundations/web3/ton-dns/index.mdx
new file mode 100644
index 000000000..590068b35
--- /dev/null
+++ b/content/foundations/web3/ton-dns/index.mdx
@@ -0,0 +1,67 @@
+---
+title: "TON DNS overview"
+sidebarTitle: "Overview"
+description: "Human-readable names for addresses and services on TON"
+---
+
+TON DNS (Domain Name System) associates human-readable domain names with addresses and services on TON. Applications use names such as `example.ton` to find payment recipients, websites, and stored files.
+
+Smart contracts store domain records and expose a common interface for looking them up.
+
+## Domain registration and ownership
+
+
+
+Names directly under `.ton`, such as `example.ton`, are registered through auctions. Each registered domain is a [non-fungible token (NFT)](/foundations/glossary#non-fungible-token-nft). Its owner controls the domain’s DNS records and can transfer ownership.
+
+Domain ownership requires renewal. If a domain remains unrenewed beyond its renewal period, another participant can start a new auction. The [.ton domain rules](/foundations/web3/ton-dns/domains) cover registration, auctions, renewal, and expiration.
+
+Owning a domain and receiving payments through it are separate roles. The owner configures the payment address, which can belong to a different account.
+
+## DNS records
+
+
+
+TON DNS records associate a domain name with addresses, content identifiers, or another resolver. A domain can contain several records:
+
+- **Wallet addresses:** wallet or other smart contract addresses stored under the `wallet` category, allowing compatible applications to use a domain name as a payment recipient.
+- **ADNL addresses:** [Abstract Datagram Network Layer (ADNL)](/foundations/network/adnl) addresses that identify network services such as TON Sites.
+- **TON Storage BagIDs:** identifiers of files or directories shared through [TON Storage](/foundations/web3/ton-storage).
+- **Next resolver references:** smart contract addresses that delegate subdomain resolution to another DNS resolver.
+- **Text records:** UTF-8 text associated with a domain, using a category and encoding understood by the application.
+
+Applications request the category corresponding to their purpose. The [record reference](/foundations/web3/ton-dns/reference#dns-record-types) defines the record types and categories.
+
+## Subdomains and delegation
+
+
+
+A domain owner can delegate resolution of names such as `app.example.ton` to another smart contract, called a _resolver_. The parent domain stores a record pointing to that resolver.
+
+The delegated resolver defines how subdomains are created and managed. Subdomains do not automatically inherit the `.ton` collection’s NFT ownership, auction, or renewal rules.
+
+## Name resolution
+
+
+
+Resolution is the process of finding a domain’s requested record. Applications follow a hierarchy of resolver contracts, starting with the root resolver.
+
+For `example.ton`, the root resolver points to the `.ton` resolver, which points to the domain’s contract. The domain contract returns the requested record, if one exists. For a delegated subdomain, the application continues to the designated resolver.
+
+The official root resolver supports the `.ton` and `.t.me` namespaces.
+
+Applications read records through the [`dnsresolve` get-method](/foundations/web3/ton-dns/reference#dns-protocol). Reading requires no wallet signature or on-chain transaction. Registering a domain, changing its records, and transferring ownership require transactions.
+
+After resolution, the application uses the returned destination to send a payment, connect to a site, or retrieve files.
+
+## Next steps
+
+- [.ton domains](/foundations/web3/ton-dns/domains): names, minimum bids, auctions, and renewal rules.
+- [Manage domains](/foundations/web3/ton-dns/manage-domains): register, configure, and renew `.ton` domains.
+- [TON DNS reference](/foundations/web3/ton-dns/reference): resolver interfaces, record formats, getters, and contract messages.
diff --git a/content/foundations/web3/ton-dns/manage-domains.mdx b/content/foundations/web3/ton-dns/manage-domains.mdx
new file mode 100644
index 000000000..b89248011
--- /dev/null
+++ b/content/foundations/web3/ton-dns/manage-domains.mdx
@@ -0,0 +1,210 @@
+---
+title: "How to manage domains on dns.ton.org"
+sidebarTitle: "Manage domains"
+---
+
+Register, configure, and renew `.ton` domains on [dns.ton.org](https://dns.ton.org/).
+
+## Prerequisites
+
+- A compatible non-custodial wallet on mainnet, with funds for bids and transaction fees.
+- Ownership of the domain for record changes, subdomain delegation, or renewal.
+
+
+ Transactions on this site use mainnet and cannot be rolled back. Check the domain, amount, and values before confirming in the wallet. Changing a wallet record changes the payment recipient.
+
+
+## Connect a wallet
+
+1. Open [dns.ton.org](https://dns.ton.org/).
+1. Select Connect wallet and approve the connection in the wallet.
+1. Search for the domain to manage. Check whether it is available, being auctioned, or already owned.
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Register a domain
+
+1. Find an available name or an auction in progress. Check the [registration rules](/foundations/web3/ton-dns/domains#registration-rules) and [minimum first bid](/foundations/web3/ton-dns/domains#minimum-first-bids).
+1. Select Place bid, enter at least the displayed minimum, and confirm the transaction in the wallet.
+1. Wait for the page to display the accepted bid and bidder address. Follow the deadline and highest bidder.
+1. After the auction ends, check that the winning address matches the connected wallet. If it matches, open Manage domain and save the intended wallet address to configure the domain and finalize ownership.
+1. After the transaction succeeds, reload the page and check the owner and saved wallet address.
+
+When outbid, the contract returns the previous bid, subject to its available balance.
+
+Bids near the deadline can [extend the auction](/foundations/web3/ton-dns/domains#auctions). Saving the first record after winning also [finalizes ownership](/foundations/web3/ton-dns/domains#auctions).
+
+
+
+
+
+
+
+
+
+## Manage records
+
+| Field on dns.ton.org | Value |
+| -------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
+| Wallet address | Wallet or smart contract address that should receive payments. |
+| TON Site | The site's [Abstract Datagram Network Layer (ADNL)](/foundations/network/adnl) address in hexadecimal. |
+| TON Site with Hosting in TON Storage enabled | The site's TON Storage Bag ID. |
+| TON Storage | A Bag ID for stored files, separate from the site record. |
+| Subdomains | The address of a DNS resolver contract. |
+
+1. Select Manage domain with the owner's wallet connected.
+1. Enter the value in the corresponding field. For a site stored in TON Storage, enable Hosting in TON Storage and enter the Bag ID in TON Site.
+1. Select Save for that field, check the transaction details, and confirm in the wallet.
+1. Reload the page and check the saved value.
+
+To remove a record, clear its field and select Save, then confirm in the wallet. This does not delete the domain. The TON Site and TON Storage fields store separate records; changing one does not update the other.
+
+
+
+
+
+
+
+
+
+### Delegate subdomains
+
+Enter an existing [resolver contract's](/foundations/web3/ton-dns/reference#subdomain-resolvers) address in Subdomains, select Save, and confirm. The resolver must already contain the subdomain records; this field only delegates resolution.
+
+Test the full name, such as `app.example.ton`, in the application that uses it. Clear the field to remove delegation.
+
+
+
+The site has no text-record field. Text records require a [contract message](/foundations/web3/ton-dns/reference#record-updates).
+
+
+
+
+
+
+
+
+
+## Renew a domain
+
+1. Search for the domain with the owner's wallet connected and check its expiration date. The site shows the renewal button within 180 days of expiration or after expiration.
+1. Select Renew this domain. Check the requested 0.015 GRAM payment and transaction fees before confirming in the wallet.
+1. Reload the page and verify that the expiration date has advanced.
+
+Renewal starts a new 366-day period from the transaction time. Record updates also [renew the domain](/foundations/web3/ton-dns/domains#renewal).
+
+
+
+
+
+
+
+
+
+## Start an auction for an expired domain
+
+A release starts a new auction after more than 366 days without renewal, provided no auction is active. Expiration alone does not release the domain: the current owner can still renew until the auction starts.
+
+1. Search for the domain and check its expiration date and auction status.
+1. Connect a wallet other than the current owner's. The site hides the release action from the owner.
+1. Select Place a bid to start the auction.
+1. Enter at least the displayed minimum and confirm the transaction in the wallet. The amount sent becomes the opening bid.
+1. Reload the page and verify the accepted bid, bidder address, and auction deadline.
+
+Once the transaction succeeds:
+
+- The previous owner loses control of the domain.
+- The sending wallet becomes the first bidder, not the new owner.
+- A one-week auction begins. Bids in the final hour extend the deadline to one hour after that bid.
+- The domain address and existing DNS records remain unchanged.
+
+The contract attempts to return its previous balance above a 1 GRAM reserve to the previous owner. This excludes the opening bid; fees affect the amount received.
+
+Follow the auction and finalize ownership after winning, as described in [Register a domain](#register-a-domain).
+
+
+
+## Verify the changes
+
+Each procedure ends with a check on the domain page. If the transaction fails or its result is unclear, inspect it in a block explorer before retrying.
+
+
+
+After changing a wallet record, enter the domain in a compatible wallet and compare the recipient without sending funds. For a site record, open the domain through a compatible TON Proxy.
+
+
+
+## Troubleshoot
+
+| Issue | Check |
+| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
+| Bid is too small | Refresh the domain page and check the updated minimum. |
+| Management controls are unavailable | Check that the connected wallet owns the domain and the auction has ended. |
+| Invalid address or Bag ID | Check the field, value format, and Hosting in TON Storage setting. |
+| Transaction or update fails | Check the wallet result and current domain state before retrying. |
+| Renew this domain is absent | Check ownership and the [website's renewal window](#renew-a-domain). |
+| Expired-domain auction is absent | Check expiration, connected ownership, and whether an auction has already started. The site hides this action from owners. |
+| Subdomain does not resolve | Check the delegation address and the records configured in that resolver. |
diff --git a/content/foundations/web3/ton-dns/meta.json b/content/foundations/web3/ton-dns/meta.json
new file mode 100644
index 000000000..94825c921
--- /dev/null
+++ b/content/foundations/web3/ton-dns/meta.json
@@ -0,0 +1,10 @@
+{
+ "$schema": "../../../../meta-schema.json",
+ "title": "TON DNS",
+ "pages": [
+ "index",
+ "domains",
+ "manage-domains",
+ "reference"
+ ]
+}
diff --git a/content/foundations/web3/ton-dns/reference.mdx b/content/foundations/web3/ton-dns/reference.mdx
new file mode 100644
index 000000000..69263aebd
--- /dev/null
+++ b/content/foundations/web3/ton-dns/reference.mdx
@@ -0,0 +1,412 @@
+---
+title: "TON DNS reference"
+sidebarTitle: "Reference"
+---
+
+Domain Name System (DNS) resolver interface, record schemas, and messages of the `.ton` domain contracts. For names, prices, auctions, and renewal periods, see [.ton domains](/foundations/web3/ton-dns/domains).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## DNS protocol
+
+TON DNS is built as a tree of DNS smart contracts. The [root resolver](https://github.com/ton-blockchain/dns-contract/blob/d08131031fb659d2826cccc417ddd9b98476f814/func/root-dns.fc) lives on the masterchain; its address is stored in blockchain configuration parameter #4.
+
+Every DNS smart contract exposes a `dnsresolve` get-method:
+
+```func
+(int, cell) dnsresolve(slice subdomain, int category)
+```
+
+`subdomain` contains the remaining name in its internal encoding. `category` is an unsigned 256-bit key, usually the SHA-256 hash of a category name. Category `0` requests all records.
+
+### Name encoding
+
+TON Enhancement Proposal 81 (TEP-81) defines names as UTF-8 strings of at most 126 bytes, excluding byte values `0` through `32`. Applications normalize names to lowercase. Individual resolvers can impose additional registration restrictions.
+
+Reverse the dot-separated labels and terminate each with a zero byte: `app.example.ton` becomes `ton\0example\0app\0`. Each resolver returns the number of bits consumed; pass the remaining bytes to the next resolver. Do not strip a leading zero byte from that remainder.
+
+A single zero byte refers to the resolver itself. When starting a lookup directly on a non-root resolver, prefix the internal name with a zero byte. For a record on the domain contract itself, pass `\0`.
+
+### Resolution results
+
+| Result | Meaning |
+| ----------------------------------- | ----------------------------------------------------------------------------------------- |
+| Get-method failure | Resolution failed. |
+| Zero bits consumed | No matching prefix was resolved. |
+| Full name consumed, record returned | The requested record was found. |
+| Full name consumed, null returned | No record exists for the requested category. |
+| Partial name consumed | Continue through the returned `dns_next_resolver`. A missing delegation stops resolution. |
+| Category `0`, full name consumed | The result is the category dictionary, which can be empty. |
+
+
+
+
+
+### DNS record types
+
+Record values use the following [TL-B](/foundations/tlb/overview) schemas:
+
+- `dns_adnl_address`: stores a 256-bit [Abstract Datagram Network Layer (ADNL)](/foundations/network/adnl) address for network services such as TON Sites. An optional protocol list describes supported protocols.
+
+ ```tlb
+ dns_adnl_address#ad01 adnl_addr:bits256 flags:(## 8) { flags <= 1 }
+ proto_list:flags . 0?ProtoList = DNSRecord;
+ ```
+
+- `dns_smc_address`: stores any smart contract address on the TON Blockchain, including wallets. An optional capability list describes the capabilities of the contract. Under the standard `wallet` category, this record enables sending funds to a domain name.
+
+ ```tlb
+ dns_smc_address#9fd3 smc_addr:MsgAddressInt flags:(## 8) { flags <= 1 }
+ cap_list:flags . 0?SmcCapList = DNSRecord;
+ ```
+
+- `dns_next_resolver`: delegates resolution of subdomains to another DNS smart contract at the specified address.
+
+ ```tlb
+ dns_next_resolver#ba93 resolver:MsgAddressInt = DNSRecord;
+ ```
+
+- `dns_storage_address`: stores a 256-bit TON Storage Bag ID, allowing domain names to be assigned to files stored via TON Storage.
+
+ ```tlb
+ dns_storage_address#7473 bag_id:bits256 = DNSRecord;
+ ```
+
+- `dns_text`: stores arbitrary UTF-8 text using the `Text` chunked encoding defined in the block layout specification.
+
+ ```tlb
+ dns_text#1eda _:Text = DNSRecord;
+ ```
+
+
+
+#### Record categories
+
+Categories select records independently of their TL-B type. Their keys are SHA-256 hashes of UTF-8 names.
+
+| Category | Record type | Definition or use |
+| ------------------- | ------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
+| `wallet` | `dns_smc_address` | Defined by TEP-81. |
+| `site` | `dns_adnl_address` or `dns_storage_address` | Site destination. |
+| `dns_next_resolver` | `dns_next_resolver` | Defined by TEP-81. |
+| `storage` | `dns_storage_address` | Used by the official DNS interface for a separate storage record; not a standard category listed in TEP-81. |
+
+TEP-81 defines the ADNL form. The [official proxy](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/rldp-http-proxy/DNSResolver.cpp#L69-L93) accepts both ADNL addresses and Bag IDs in the `site` category. The DNS interface also supports both.
+
+TEP-81 does not define a standard text category. Applications must agree on the category used for a `dns_text` value.
+
+#### Text encoding
+
+For `dns_text`, prefix the value with constructor `0x1eda` (16 bits), then encode `Text`:
+
+```tlb
+chunk_ref$_ {n:#} ref:^(TextChunks (n + 1)) = TextChunkRef (n + 1);
+chunk_ref_empty$_ = TextChunkRef 0;
+text_chunk$_ {n:#} len:(## 8) data:(bits (len * 8)) next:(TextChunkRef n) = TextChunks (n + 1);
+text_chunk_empty$_ = TextChunks 0;
+text$_ chunks:(## 8) rest:(TextChunks chunks) = Text;
+```
+
+`chunks` counts the text chunks. Each chunk carries its byte length and data; a reference leads to the remaining chunks. Encode the text as UTF-8. This is not the same serialization as appending a string directly after `0x1eda`.
+
+
+
+### Subdomain resolvers
+
+The parent domain's `dns_next_resolver` category stores a record of the same type, containing the delegated contract's address. The `.ton` domain contract returns this record when resolving a subdomain. Updating or deleting it uses the [record update message](#record-updates).
+
+The delegated contract must implement `dnsresolve`. Subdomain creation, permissions, and payments depend on that contract; the `.ton` collection's registration rules do not automatically apply to it.
+
+Official implementations include [manual DNS](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/crypto/smartcont/dns-manual-code.fc), managed through signed requests, and [automatic DNS](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/crypto/smartcont/dns-auto-code.fc), which implements registration and expiration rules.
+
+## .ton contracts
+
+
+
+### Domain ownership
+
+Each `.ton` domain is a transferable non-fungible token (NFT) item following [TEP-62](https://github.com/ton-blockchain/TEPs/blob/fe8a154e4dad9f5c0bf7240df278cb50ec6cd908/text/0062-nft-standard.md). The collection and domain contracts implement DNS resolution following [TEP-81](https://github.com/ton-blockchain/TEPs/blob/fe8a154e4dad9f5c0bf7240df278cb50ec6cd908/text/0081-dns-standard.md).
+
+
+
+
+
+### Domain contract address
+
+The NFT index is `slice_hash` of the cell containing the label without `.ton`. The collection's `get_nft_address_by_index` returns the corresponding domain address, including before deployment.
+
+| Account state | Meaning |
+| --------------- | ------------------------------------------------------------------------------ |
+| `uninitialized` | No active domain contract at this address. |
+| `active` | Read the NFT and auction state to determine ownership or bidding availability. |
+| `frozen` | Stop the registration flow. |
+
+
+
+
+
+
+
+### Getters
+
+| Getter | Returns |
+| --------------------------------- | --------------------------------------------------------------------------------------- |
+| `get_nft_address_by_index(index)` | Domain address, queried on the collection. |
+| `get_nft_data()` | Initialization flag, NFT index, collection address, owner address, and content cell. |
+| `get_domain()` | Label as a slice, without `.ton`. |
+| `get_auction_info()` | Highest bidder, accepted bid in nanograms, and deadline as a Unix timestamp in seconds. |
+| `get_last_fill_up_time()` | Renewal timestamp in Unix seconds. |
+
+
+
+
+
+
+
+### Registration constraints
+
+The collection enforces the [label restrictions](/foundations/web3/ton-dns/domains#registration-rules) and [minimum opening bids](/foundations/web3/ton-dns/domains#minimum-first-bids).
+
+
+
+
+
+
+
+
+
+
+
+### Auction messages
+
+The destination and body distinguish new registrations from competing bids. Both follow the [auction deadlines and extension rules](/foundations/web3/ton-dns/domains#auctions).
+
+| Operation | Destination | Message body |
+| --------------------- | --------------- | ----------------------------------------------------------- |
+| Start an auction | Collection | Opcode `0` (32 bits), followed by the label without `.ton`. |
+| Place a competing bid | Domain contract | Empty body. |
+
+The collection deploys the domain contract and forwards the remaining message value after fees. The accepted first bid can therefore differ from the value sent to the collection.
+
+The minimum competing bid is `previousBid * 105 / 100`, using integer division in nanograms. Another bid can change this threshold between reading the state and processing a transaction.
+
+
+
+
+
+
+
+
+
+### Auction finalization
+
+After the deadline, a successful internal `get_static_data` message finalizes the auction without changing DNS records. An empty message does not finalize ownership. A request before the deadline returns static data without finalizing the auction.
+
+| Message | Opcode | Fields after the opcode |
+| -------------------- | ------------ | ---------------------------------------------------------------------- |
+| `get_static_data` | `0x2fcb26a2` | `query_id:uint64` |
+| `report_static_data` | `0x8b771735` | `query_id:uint64`, `index:uint256`, `collection_address:MsgAddressInt` |
+
+Opcodes occupy 32 bits. The response is sent to the request sender. Attach enough value for execution and outgoing-message fees; this payment is not another bid.
+
+An authorized record update after the deadline also finalizes ownership. A wallet record is not required to own the domain.
+
+After finalization, `get_nft_data` returns the winning wallet as owner. `get_auction_info` returns a null bidder, zero bid, and zero deadline. A wallet signature or broadcast confirmation alone does not establish these results.
+
+
+
+
+
+### Record updates
+
+Send `change_dns_record` to the domain contract from its owner's wallet:
+
+| Field | Encoding |
+| ------------ | ------------------------------------------------------------------------------- |
+| Opcode | `0x4eb1f0f9`, 32 bits. |
+| Query ID | Unsigned 64-bit integer. |
+| Category key | Unsigned 256-bit integer. |
+| Value | Reference to the serialized DNS record, or no reference to delete the category. |
+
+The contract stores the referenced cell without validating its DNS record type. Encode the expected schema before sending. An absent reference deletes the category; a reference to an empty cell stores an empty cell instead. A successful update refreshes `last_fill_up_time`.
+
+For `dns_text` values, use the [Text encoding](#text-encoding).
+
+
+
+### Renewal interface
+
+The following successful owner operations reset `last_fill_up_time`:
+
+| Operation | Message |
+| ----------------------------- | ----------------------------------------------------- |
+| Update or remove a DNS record | `change_dns_record`. |
+| Edit the domain content | `edit_content`. |
+| Transfer ownership | NFT `transfer`. |
+| Top up the domain contract | Empty body or opcode `0`, after auction finalization. |
+
+Each operation starts a new 366-day renewal period from its execution time. It does not add 366 days to the previous deadline. The contract does not enforce a fixed renewal payment; messages must fund their execution fees.
+
+Failed transactions and static-data requests do not reset the timestamp. A payment sent to a domain name's wallet record goes to that recipient, not necessarily to the domain contract.
+
+
+
+### Expired domain auctions
+
+Send `dns_balance_release` to the existing domain contract when `now() - last_fill_up_time > 31622400` (366 days) and no auction is active. Any sender can call it, including the owner.
+
+| Field | Encoding |
+| -------- | ------------------------ |
+| Opcode | `0x4ed14b65`, 32 bits. |
+| Query ID | Unsigned 64-bit integer. |
+
+The attached message value is the opening bid and must meet the [minimum first bid](/foundations/web3/ton-dns/domains#minimum-first-bids) for the label's length. Query ID is an unsigned 64-bit value.
+
+On success, the contract:
+
+- Clears the owner address to `addr_none`.
+- Records the sender as the highest bidder and the message value as the bid.
+- Sets the auction deadline to `now() + 604800` (1 week) and resets the renewal timestamp.
+- Keeps the domain address and DNS records unchanged.
+- Attempts to return the existing balance above the 1 GRAM reserve to the previous owner. This excludes the opening bid; message fees affect the received amount.
+
+Subsequent bids follow the [auction rules](#auction-messages). Ownership is assigned through [auction finalization](#auction-finalization).
+
+
+
+### Contract errors
+
+| Contract | Exit code | Meaning |
+| ---------- | --------- | ------------------------------------------------------------------- |
+| Collection | `200` | Label shorter than four characters. |
+| Collection | `201` | Label longer than 126 characters. |
+| Collection | `202` | Invalid label byte alignment or comment continuation structure. |
+| Collection | `203` | Invalid label characters. |
+| Collection | `204` | First bid below the minimum. |
+| Collection | `205` | Domain index present in the governance configuration. |
+| Domain | `407` | Bid below the required minimum. |
+| Domain | `414` | The renewal period has not elapsed or an auction is already active. |
+
+Check both compute and action results when investigating a failed transaction.
+
+
+
+## Sources
+
+- [Collection contract](https://github.com/ton-blockchain/dns-contract/blob/d08131031fb659d2826cccc417ddd9b98476f814/func/nft-collection.fc).
+- [Domain contract](https://github.com/ton-blockchain/dns-contract/blob/d08131031fb659d2826cccc417ddd9b98476f814/func/nft-item.fc).
+- [Naming and pricing](https://github.com/ton-blockchain/dns-contract/blob/d08131031fb659d2826cccc417ddd9b98476f814/func/dns-utils.fc).
+- [TEP-81](https://github.com/ton-blockchain/TEPs/blob/fe8a154e4dad9f5c0bf7240df278cb50ec6cd908/text/0081-dns-standard.md).
+- [DNS and Text schemas](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/crypto/block/block.tlb#L951-L975).
+- [Official DNS interface](https://github.com/ton-blockchain/dns/blob/429f58774b05d8f3cfa05bd22f0e18df615daa01/src/index.js).
+- [Release message payload](https://github.com/ton-blockchain/dns/blob/429f58774b05d8f3cfa05bd22f0e18df615daa01/src/utils.js#L515-L520).
From daf0a1b6d6629b4a598a638b0af5d3d3ec222399 Mon Sep 17 00:00:00 2001
From: TONresistor <240980241+TONresistor@users.noreply.github.com>
Date: Tue, 20 Oct 2026 11:52:56 +0200
Subject: [PATCH 03/10] feat(web3): expand TON Storage documentation
---
content/foundations/web3/ton-storage.mdx | 314 -----------------
.../web3/ton-storage/get-started.mdx | 174 +++++++++
.../foundations/web3/ton-storage/index.mdx | 98 ++++++
.../foundations/web3/ton-storage/meta.json | 10 +
.../web3/ton-storage/provider-lifecycle.mdx | 68 ++++
.../web3/ton-storage/providers/meta.json | 9 +
.../web3/ton-storage/reference.mdx | 331 ++++++++++++++++++
.../web3/ton-storage/run-provider.mdx | 169 +++++++++
.../web3/ton-storage/store-with-provider.mdx | 85 +++++
src/dictionaries/custom.txt | 5 +
10 files changed, 949 insertions(+), 314 deletions(-)
delete mode 100644 content/foundations/web3/ton-storage.mdx
create mode 100644 content/foundations/web3/ton-storage/get-started.mdx
create mode 100644 content/foundations/web3/ton-storage/index.mdx
create mode 100644 content/foundations/web3/ton-storage/meta.json
create mode 100644 content/foundations/web3/ton-storage/provider-lifecycle.mdx
create mode 100644 content/foundations/web3/ton-storage/providers/meta.json
create mode 100644 content/foundations/web3/ton-storage/reference.mdx
create mode 100644 content/foundations/web3/ton-storage/run-provider.mdx
create mode 100644 content/foundations/web3/ton-storage/store-with-provider.mdx
diff --git a/content/foundations/web3/ton-storage.mdx b/content/foundations/web3/ton-storage.mdx
deleted file mode 100644
index d38409d08..000000000
--- a/content/foundations/web3/ton-storage.mdx
+++ /dev/null
@@ -1,314 +0,0 @@
----
-title: "TON Storage"
-description: "Distributed file storage for the TON Blockchain using torrent-like technology and on-chain payment contracts"
----
-
-TON Storage is a distributed file storage system on the TON Network. Files are shared using a torrent-like protocol, with optional on-chain smart contracts for paid storage guarantees. The TON Blockchain uses TON Storage to distribute archive copies of blocks and state snapshots.
-
-The [storage provider guide](#run-a-storage-provider) below explains how to deploy, configure, and operate a TON Storage provider.
-
-## Bags
-
-Files are organized into _bags_, each identified by a unique 256-bit `BagID` (the hash of the torrent info cell). A bag can contain a single file or a directory.
-
-Files in a bag are split into **128 KiB chunks**. A Merkle tree built from SHA-256 hashes allows verification of individual chunks without downloading the full bag. Bag metadata can be exported as a metafile.
-
-## Peer discovery
-
-Nodes that store a bag register in the TON DHT under a key derived from the `BagID`. Clients query the DHT to find seeder addresses for a given bag.
-
-## Storage daemon
-
-`storage-daemon` is the official implementation, distributed as part of the TON software suite. To start:
-
-```bash
-storage-daemon -v 3 -C global.config.json -I :3333 -p 5555 -D storage-db
-```
-
-There,
-
-- `-v` - log verbosity, where `3` = INFO
-- `-C` - path to the global network config
-- `-I` - ADNL listen IP and port, where `` is the public or reachable address of the host
-- `-p` - TCP port for the console interface
-- `-D` - path to the daemon database — CLI keys are generated inside the `cli-keys/` subdirectory on first start
-
-### Manage bags
-
-| Command | Description |
-| ---------------------------------- | ---------------------------------------------------------- |
-| `create -d "description"` | Create a new bag from a file or directory |
-| `add-by-hash -d ` | Add a bag by its `BagID` |
-| `add-by-meta -d ` | Add a bag from a metafile |
-| `list` | List all bags |
-| `list --hashes` | List bags with their `BagID`s |
-| `get ` | Show full bag information |
-| `get-peers ` | Show peers connected for a bag |
-| `get-meta ` | Export the bag metafile |
-| `download-pause ` | Pause a download |
-| `download-resume ` | Resume a download |
-| `priority-name ` | Set download priority for a file (0 = skip, 255 = highest) |
-
-To download only specific files from a bag, use the `--partial` flag when adding:
-
-```bash
-add-by-hash --partial file1.txt file2.txt
-```
-
-Files not listed are assigned priority 0 and are not downloaded.
-
-## Storage providers
-
-A storage provider is a node that stores bags for a fee, backed by an on-chain smart contract. The provider system has two components:
-
-- Smart contract: deployed on the TON Blockchain, stores the Merkle tree hash of each bag, issues proof challenges, and manages client payments.
-- `storage-daemon`: runs on the provider's machine, downloads bags, serves data to peers, and submits storage proofs to the contract.
-
-Provider workflow:
-
-1. The provider deploys a main smart contract and shares its address with clients.
-1. A client creates a bag and sends a storage request to the provider contract.
-1. The provider contract deploys a per-bag storage contract and notifies the client.
-1. The provider downloads the bag and activates the per-bag contract.
-1. The client transfers payment. The provider submits periodic Merkle proofs to prove data possession.
-1. When the client balance reaches zero or either party closes the contract, remaining funds return to the client and the contract self-destructs.
-
-Storage pricing is expressed in **nanogram per megabyte per day**.
-
-## Integration with TON DNS
-
-A `.ton` domain can point to a bag using the `dns_storage_address` record:
-
-```tlb
-dns_storage_address#7473 bag_id:bits256 = DNSRecord;
-```
-
-See [TON DNS](/foundations/web3/ton-dns#dns-record-types) for all record types.
-
-## Ecosystem use cases
-
-- NFT metadata: NFT collections can reference off-chain media and metadata stored as bags, using the `BagID` as a stable content identifier. Individual files within a bag are addressed using the `tonstorage:///path` URI scheme.
-- [Static TON Sites](/foundations/web3/ton-sites): a bag containing HTML and static assets can be served as a TON Site by combining TON Storage, [TON DNS](/foundations/web3/ton-dns), and [TON Proxy](/foundations/web3/ton-proxy).
-
-## Run a storage provider
-
-Run the `storage-daemon` in provider mode, deploy its main contract, and manage paid storage contracts.
-
-
- Provider commands deploy contracts, transfer funds, close storage contracts, and may delete local bag files. Test the complete workflow on testnet first. Mainnet transactions and contract closures cannot be rolled back.
-
- Keep independent backups of required files, verify every address and network, and use a small initialization transfer.
-
-
-### Prerequisites
-
-- `storage-daemon` and `storage-daemon-cli` from the same [TON release](https://github.com/ton-blockchain/ton/releases/tag/v2026.08)
-- A global configuration file for the target network: [mainnet](https://ton-blockchain.github.io/global.config.json) or [testnet](https://ton-blockchain.github.io/testnet-global.config.json)
-- A funded wallet on the target network
-- A public IP address and reachable [ADNL](/foundations/network/adnl) port
-
-### Start provider mode
-
-1. Start the `storage-daemon` with `-P`:
-
- ```bash
- storage-daemon -v 3 -P \
- -C \
- -I : \
- -p \
- -D \
- ```
-
- There,
-
- - `` is the target network's global configuration file.
- - `` and `` identify the public ADNL endpoint.
- - `` is the local CLI control port.
- - `` is the daemon's persistent data directory.
-
- On its first launch, the daemon creates CLI keys under `/cli-keys`.
-
-1. Connect `storage-daemon-cli` to the control interface:
-
- ```bash
- storage-daemon-cli \
- -I 127.0.0.1: \
- -k /cli-keys/client \
- -p /cli-keys/server.pub
- ```
-
-### Deploy the provider contract
-
-Run the deployment command inside `storage-daemon-cli`:
-
-```bash
-deploy-provider
-```
-
-
- Use testnet for the first deployment. The command prints an address that requires a non-bounceable initialization message containing 1 GRAM. Verify the network and address before sending funds. A transfer to the wrong network or address cannot be recovered.
-
-
-Do not attach a large balance to the initialization message. Verify the deployed provider:
-
-```bash
-get-provider-info
-```
-
-Fund the deployed provider contract separately to cover later transaction fees. Increase the balance only after verifying the deployment.
-
-### Configure capacity
-
-Set the maximum number and total size of managed storage contracts:
-
-```bash
-set-provider-config \
- --max-contracts \
- --max-total-size
-```
-
-There,
-
-- `` is the maximum number of concurrent storage contracts.
-- `` is the maximum combined bag size in bytes.
-
-### Configure contract terms
-
-Keep new requests disabled while configuring the on-chain terms:
-
-```bash
-set-provider-params --accept 0 \
- --rate \
- --max-span \
- --min-file-size \
- --max-file-size
-```
-
-There,
-
-- `` is the price per megabyte per day in nanograms.
-- `` is the maximum interval between storage proofs.
-- `` and `` define the accepted bag-size range.
-
-Omitted flags retain their prior values. Wait for each on-chain update and verify it with `get-provider-info` before submitting another update.
-
-Enable requests after verifying every parameter:
-
-```bash
-set-provider-params --accept 1
-```
-
-The daemon then downloads accepted bags, distributes them to peers, and submits storage proofs.
-
-### Request storage from a provider
-
-1. Inspect a provider's on-chain terms by its contract address:
-
- ```bash
- get-provider-params
- ```
-
- The result states whether the provider accepts contracts, its bag-size limits, its rate, and its maximum proof interval.
-
-1. Create a bag with the [storage daemon bag commands](/foundations/web3/ton-storage#manage-bags), record its `BagID`, and generate a request body:
-
- ```bash
- new-contract-message \
- \
- --query-id \
- --provider
- ```
-
- There,
-
- - `` is the bag's 256-bit identifier.
- - `` receives the internal message body, not a complete message.
- - `` is an integer from `0` through `2^64 - 1`.
-
- Large bags can take longer to process. Review the rate and proof interval printed by the command before sending the body. The provider contract rejects the request if its parameters change before processing.
-
-1. Send the generated body in a bounceable internal message to the provider contract. A successful deployment returns [`0xbf7bd0c1`](https://github.com/ton-blockchain/ton/blob/v2026.08/storage/storage-daemon/smartcont/constants.fc#L4) with the original query ID. After the provider downloads the bag and activates the contract, it returns [`0xd4caedcd`](https://github.com/ton-blockchain/ton/blob/v2026.08/storage/storage-daemon/smartcont/constants.fc#L5).
-
-### Monitor the client balance
-
-The storage contract deducts provider earnings from the client balance according to the configured rate. The initial balance comes from the storage request message. Any wallet can top up the storage contract with a transfer.
-
-Call [`get_storage_contract_data`](https://github.com/ton-blockchain/ton/blob/v2026.08/storage/storage-daemon/smartcont/storage-contract.fc#L222) to inspect the contract. Its second return value, `balance`, is the unpaid client balance.
-
-A storage contract can close when:
-
-- The provider declines it before activation.
-- Its client balance reaches `0`.
-- The provider closes it.
-- The client sends [`0x79f937ea`](https://github.com/ton-blockchain/ton/blob/v2026.08/storage/storage-daemon/smartcont/constants.fc#L3) with any 64-bit query ID from the client's wallet.
-
-### Operate active contracts
-
-List active contracts and their balances:
-
-```bash
-get-provider-info --contracts --balances
-```
-
-`Client$` is the unpaid client balance. The difference between `Contract$` and `Client$` is available provider earnings.
-
-Withdraw earnings from one per-bag storage contract managed by the provider:
-
-```bash
-withdraw
-```
-
-Withdraw from every contract with at least 1 GRAM available:
-
-```bash
-withdraw-all
-```
-
-### Close a storage contract
-
-
- Closing a contract may delete its local bag files when no other active contract uses the bag. Keep an independent copy before closing the contract. The on-chain closure cannot be rolled back.
-
-
-Close one provider-managed contract:
-
-```bash
-close-contract
-```
-
-Closing transfers available provider earnings to the main provider contract.
-
-### Transfer provider funds
-
-
- Test transfers with a small amount on testnet. Verify the destination, amount, and network before sending. Mainnet transfers cannot be rolled back.
-
-
-Transfer nanograms from the main provider contract:
-
-```bash
-send-coins
-send-coins --message ""
-```
-
-There,
-
-- `` is the receiving account.
-- `` is the transferred amount in nanograms.
-- `` is an optional text message.
-
-### Protect provider data
-
-The `list` command shows all bags managed by the daemon. Do not remove these bags or use the provider daemon to manage unrelated bags. Keep independent copies of data that must remain available after a storage contract closes.
diff --git a/content/foundations/web3/ton-storage/get-started.mdx b/content/foundations/web3/ton-storage/get-started.mdx
new file mode 100644
index 000000000..dfdb09032
--- /dev/null
+++ b/content/foundations/web3/ton-storage/get-started.mdx
@@ -0,0 +1,174 @@
+---
+title: "Get started with TON Storage"
+sidebarTitle: "Get started"
+description: "Start a storage daemon, share a bag, and download files"
+---
+
+Start the official TON Storage daemon, create and share a bag, and download files from another peer.
+
+## Prerequisites
+
+- `storage-daemon` and `storage-daemon-cli` from the same [TON release](https://github.com/ton-blockchain/ton/releases/tag/v2026.08)
+- A global configuration file for the target network: [mainnet](https://ton-blockchain.github.io/global.config.json) or [testnet](https://ton-blockchain.github.io/testnet-global.config.json)
+- A public IP address and reachable [Abstract Datagram Network Layer (ADNL)](/foundations/network/adnl) port
+- A file or directory to share, and disk space for the copied and downloaded files
+- A BagID supplied by another publisher, or a second daemon to download the bag created below
+
+## Start the daemon
+
+Start [`storage-daemon`](/foundations/web3/ton-storage/reference#daemon-and-cli-options):
+
+```bash
+storage-daemon -v 3 \
+ -C \
+ -I : \
+ -p \
+ -D
+```
+
+There,
+
+- `` is the target network's global configuration file.
+- `` and `` identify the public ADNL endpoint.
+- `` is the local CLI control port.
+- `` is the daemon's persistent data directory.
+
+On its first launch, the daemon creates CLI keys under `/cli-keys`.
+
+
+ `/cli-keys/client` is a private key that authorizes control of the daemon. Keep this file confidential and restrict access to it.
+
+
+## Connect the CLI
+
+Connect [`storage-daemon-cli`](/foundations/web3/ton-storage/reference#daemon-and-cli-options) to the control interface:
+
+```bash
+storage-daemon-cli \
+ -I 127.0.0.1: \
+ -k /cli-keys/client \
+ -p /cli-keys/server.pub
+```
+
+Run the remaining commands inside `storage-daemon-cli` on the same host as the daemon. Run `list` to check the connection; a new database has no bags.
+
+## Create and share a bag
+
+Replace `` with the absolute path to the file or directory:
+
+```bash
+create --copy ""
+```
+
+The CLI prints “Bag created” followed by the bag information, including `BagID =` and its 64-character hexadecimal identifier. Use this identifier as `` below.
+
+[`--copy`](/foundations/web3/ton-storage/reference#bag-command-options) copies the files into the daemon's storage directory. Allow enough disk space for this additional copy. Sharing is enabled by default.
+
+Keep the daemon running to serve the bag. Creating a bag does not automatically arrange paid storage with a provider.
+
+Inspect the bag:
+
+```bash
+get
+```
+
+Check that the file list matches the source and that `Downloaded:` shows “(completed)”. An `Upload speed:` line indicates that sharing is enabled; a speed of zero can mean that no peer is requesting data.
+
+Share the BagID with a recipient. A successful download on another daemon verifies that the bag is reachable. To publish changed files, create a new bag from the updated source and distribute its new BagID.
+
+## Download a bag
+
+Use a BagID from another publisher, or connect to a second daemon configured for the same network to download the bag created above. Do not add a bag that the daemon already manages.
+
+Replace `` with the bag's 64-character hexadecimal identifier and `` with an absolute destination directory:
+
+```bash
+add-by-hash -d ""
+```
+
+The CLI prints “Bag added” and the bag information; downloading starts in the background.
+
+Downloaded data is shared with other peers by default.
+
+## Verify
+
+Inspect download progress and the file list:
+
+```bash
+get
+```
+
+Wait for `Downloaded:` to show “(completed)”. The `Dir name:` field identifies the bag's directory under ``; the file list shows paths within it.
+
+Inspect connected peers if the download is not progressing:
+
+```bash
+get-peers
+```
+
+A BagID alone does not guarantee availability. Peers must be online and serving the required pieces.
+
+## Additional bag operations
+
+Run these commands inside the connected `storage-daemon-cli`. Importing a metafile or adding selected files requires a bag not already managed by that daemon.
+
+### Export a metafile
+
+Run `get-meta ` to export the bag metadata. `` is an absolute output file path on the CLI host.
+
+The CLI prints “Saved meta” with the number of bytes written. A metafile does not replace the peers serving the file contents.
+
+### Import a metafile
+
+`` is an absolute input file path on the CLI host:
+
+```bash
+add-by-meta "" -d ""
+```
+
+The CLI prints “Bag added” and the BagID; downloading starts in the background. Use the returned BagID for subsequent commands.
+
+### Download selected files
+
+When adding a bag, use [`--partial`](/foundations/web3/ton-storage/reference#bag-command-options) followed by exact file names within the bag. Replace `` with a path supplied by the publisher:
+
+```bash
+add-by-hash -d "" --partial ""
+```
+
+List multiple file paths after `--partial`. Put all other options before it: every following argument is treated as a file name. Unlisted files receive priority `0` and are excluded from the download.
+
+For a bag already added to the daemon, use the [file priority commands](/foundations/web3/ton-storage/reference#manage-bags). Do not add the same bag again to change its selection.
+
+Use `get ` to verify the selected files. “(completed)” refers to the selected download, not necessarily the entire bag.
+
+### Pause or resume sharing
+
+Run `upload-pause ` to stop sharing the bag, or `upload-resume ` to resume.
+
+Pausing uploads does not remove copies already downloaded by other peers.
+
+### Pause or resume downloads
+
+Run `download-pause ` to pause the download, or `download-resume ` to resume.
+
+These commands do not pause uploads. To stop sharing downloaded data, use [Pause or resume sharing](#pause-or-resume-sharing).
+
+## Troubleshoot
+
+| Problem | Check |
+| -------------------------------------- | --------------------------------------------------------------------------------------------------------- |
+| “Invalid path” when creating a bag | Use an existing source path accessible to the CLI and daemon. |
+| “Upload paused” in the bag information | Run `upload-resume `. |
+| A recipient cannot download the bag | Keep the daemon online, check its ADNL connectivity, and confirm that uploads are enabled. |
+| “Invalid BagID” | Copy the complete hexadecimal BagID without a URL prefix or file path. |
+| “Download paused” | Run `download-resume `. |
+| No peers or no progress | Check connectivity and ask the publisher to keep a complete copy online with sharing enabled. |
+| “Failed to read meta” | Check the metafile path and read permissions on the CLI host. |
+| “Failed to write meta” | Check that the output directory exists and the CLI can write to it. |
+| A selected file does not download | Compare its name with the file list from `get ` once the header is available. Check its priority. |
+
+The [bag command reference](/foundations/web3/ton-storage/reference#bag-commands) lists syntax, options, and defaults.
diff --git a/content/foundations/web3/ton-storage/index.mdx b/content/foundations/web3/ton-storage/index.mdx
new file mode 100644
index 000000000..320962345
--- /dev/null
+++ b/content/foundations/web3/ton-storage/index.mdx
@@ -0,0 +1,98 @@
+---
+title: "TON Storage overview"
+sidebarTitle: "Overview"
+description: "Distributed file sharing and paid storage on TON"
+---
+
+TON Storage distributes files between peers on the TON network. A publisher shares files from a storage daemon, and other peers download and share copies of those files. The files remain on the participating peers' disks.
+
+File sharing does not require an on-chain transaction. Optional storage contracts allow clients to pay providers to retain a copy of the data.
+
+## Bags and BagIDs
+
+
+
+
+
+A _bag_ is the unit of content shared through TON Storage. It contains a file or directory together with metadata describing the files and allowing their contents to be verified.
+
+Each bag has a _BagID_, a 256-bit identifier derived from its data and metadata. A publisher shares this identifier so that other peers can find and download the bag. The BagID identifies the content independently of which peer supplies it.
+
+The bag's header records the directory name, file paths, and positions of file data. Identical file contents alone do not guarantee identical BagIDs: the file paths, directory name, and bag description also contribute to the identifier.
+
+## File distribution
+
+
+
+The official implementation provides two tools: `storage-daemon` stores files and exchanges data with peers, while `storage-daemon-cli` controls the running daemon.
+
+When a daemon creates a bag, it makes the bag available to other peers if uploading is enabled. A receiving daemon uses the BagID to join the bag's overlay, a group of peers associated with that bag. Peer discovery uses the [distributed hash table (DHT)](/foundations/network/dht); the DHT stores discovery information rather than file contents.
+
+Peers exchange the bag's metadata and advertise which pieces they have. The receiving daemon requests missing pieces from those peers and verifies each piece before accepting it. Different pieces can come from different peers. When uploading is enabled, downloaded pieces can also be shared before the entire bag is complete.
+
+In the C++ implementation, peer queries use version 2 of the [Reliable Large Datagram Protocol (RLDP2)](/foundations/network/rldp) over the [Abstract Datagram Network Layer (ADNL)](/foundations/network/adnl).
+
+## Pieces and integrity
+
+The serialized header and file contents form a continuous data stream, divided into pieces. A piece can contain the end of one file and the beginning of another. Consequently, downloading a selected file can also transfer bytes from an adjacent, unselected file. The last piece can be shorter than the others.
+
+Each piece has a SHA-256 hash. These hashes form a [Merkle tree](/foundations/serialization/merkle) whose root is recorded in the `TorrentInfo` cell, together with the header hash and other [bag metadata](/foundations/web3/ton-storage/reference#bag-formats). The hash of that cell is the BagID.
+
+When starting from a BagID, the daemon checks that the received `TorrentInfo` cell hashes to that identifier. It then validates proofs of piece hashes against the Merkle root. For each received piece, it calculates the SHA-256 hash of the bytes and compares it with the expected hash. The header is also checked against its hash in `TorrentInfo`.
+
+These checks connect the file layout and downloaded bytes to the expected BagID, without a paid storage contract.
+
+## Metafiles and partial downloads
+
+A _metafile_ supplies bag metadata that a daemon would otherwise obtain from peers. It contains `TorrentInfo` and can optionally include the header and a Merkle proof. It does not contain the file contents or replace the peers serving them.
+
+A daemon can [download selected files](/foundations/web3/ton-storage/get-started#additional-bag-operations) from a bag. It uses the header to map file paths to the required pieces. Selecting files changes which pieces are requested, not the BagID or verification rules.
+
+## Availability and updates
+
+
+
+Integrity means that received data matches the expected BagID. Availability requires reachable peers that retain and serve every piece needed for the requested files. A valid BagID or metafile does not guarantee that those pieces are currently available.
+
+Updating files creates a new bag rather than changing an existing bag's identity. Copies already downloaded by other peers remain copies of the old bag. A [TON DNS record](/foundations/web3/ton-dns/manage-domains#manage-records) can point to the new BagID while keeping the same domain name.
+
+## Paid storage
+
+A [storage provider](/foundations/web3/ton-storage/provider-lifecycle) retains and serves bags in exchange for payment. The client funds an on-chain storage agreement, and the provider submits proofs of the stored data to earn payments.
+
+These proofs establish possession of the challenged data; the contract does not verify that the provider serves download requests.
+
+## Ecosystem integration
+
+- [TON DNS](/foundations/web3/ton-dns): associates a domain name with a BagID.
+- [TON Sites](/foundations/web3/ton-sites): uses bags to store static website files, accessed through a Storage gateway.
+- [Blockchain archives](/nodes/cpp/run-archive-liteserver): uses TON Storage to distribute historical blocks and state snapshots.
+- Non-fungible token (NFT) collections can reference off-chain media and metadata stored as bags, using the BagID as a stable content identifier.
+
+## Next steps
+
+- [Get started](/foundations/web3/ton-storage/get-started) to run a daemon, share a bag, and download files.
+- [Store with a provider](/foundations/web3/ton-storage/store-with-provider) to request paid storage.
+- [Reference](/foundations/web3/ton-storage/reference) for formats, commands, and storage contracts.
+
+## Sources
+
+- [Header layout](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/TorrentHeader.h#L49)
+- [Torrent info serialization and BagID](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/TorrentInfo.cpp#L27)
+- [Stream construction and piece hashing](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/TorrentCreator.cpp#L117)
+- [Torrent info, header, and piece verification](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/Torrent.cpp)
+- [Merkle proof validation](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/MerkleTree.cpp#L104)
+- [Bag overlay identifier](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/StorageManager.cpp#L27)
+- [Peer discovery and query transport](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/PeerManager.h)
+- [Peer information and piece exchange](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/PeerActor.cpp)
+- [File priorities and piece selection](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/NodeActor.cpp#L334)
+- [Metafile contents](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/TorrentMeta.cpp)
+- [Paid storage contracts](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/smartcont/storage-contract.fc)
diff --git a/content/foundations/web3/ton-storage/meta.json b/content/foundations/web3/ton-storage/meta.json
new file mode 100644
index 000000000..c0a431c9c
--- /dev/null
+++ b/content/foundations/web3/ton-storage/meta.json
@@ -0,0 +1,10 @@
+{
+ "$schema": "../../../../meta-schema.json",
+ "title": "TON Storage",
+ "pages": [
+ "index",
+ "get-started",
+ "providers",
+ "reference"
+ ]
+}
diff --git a/content/foundations/web3/ton-storage/provider-lifecycle.mdx b/content/foundations/web3/ton-storage/provider-lifecycle.mdx
new file mode 100644
index 000000000..106b97172
--- /dev/null
+++ b/content/foundations/web3/ton-storage/provider-lifecycle.mdx
@@ -0,0 +1,68 @@
+---
+title: "Storage provider lifecycle"
+sidebarTitle: "Provider lifecycle"
+description: "Storage agreements, activation, proofs, payments, and closure"
+---
+
+A storage provider retains and serves a bag in exchange for payment. The client funds an on-chain agreement, while the provider daemon stores the files and submits proofs. The storage contract verifies those proofs and accounts for payments.
+
+## Participants and contracts
+
+The client supplies the bag and funds its storage. The provider operator runs the daemon and sets the storage terms.
+
+Two types of contract manage the agreement:
+
+- The main provider contract exposes the operator's terms, deploys storage contracts, and receives withdrawn provider earnings.
+- A storage contract records one agreement between the client and provider, identifying the bag, agreed terms, and unpaid client balance.
+
+The provider daemon monitors these agreements, manages local files, and sends activation, proof, withdrawal, and closure messages through the main provider contract.
+
+The files remain off-chain. Their distribution and download verification are described in [TON Storage overview](/foundations/web3/ton-storage#bag-contents-and-identity).
+
+## Request and activation
+
+The client [requests storage](/foundations/web3/ton-storage/reference#contract-messages) for a published bag at the provider's advertised rate and proof interval. The provider contract checks whether requests are enabled, whether the bag size is within its limits, and whether the expected terms match its current terms. It then deploys an inactive storage contract funded by the request.
+
+The daemon separately applies its local limits on contract count and total bag size. If those limits are exceeded, it starts closing the new agreement. Deployment therefore does not guarantee acceptance by the daemon.
+
+For an accepted agreement, the daemon downloads the complete bag and verifies it against the storage-proof root supplied in the request. After this check, it enables uploads and requests activation. The storage contract accepts activation only from the provider address and only while inactive.
+
+The full-download and root checks belong to the daemon. The activation message itself does not prove to the contract that a complete download occurred. [Store with a provider](/foundations/web3/ton-storage/store-with-provider) covers the client procedure and activation checks.
+
+## Storage challenges and proofs
+
+Before activation, the daemon builds a Merkle tree from 64-byte microchunks of the bag's data stream, including its header. This tree is used for storage proofs and is distinct from the piece-hash tree used to verify downloads.
+
+The contract records a byte position to challenge. The daemon builds a Merkle proof revealing the corresponding microchunk and submits it through the provider contract. The storage contract checks that the agreement is active, that the sender is the provider, and that the proof matches its stored root and requested position.
+
+An accepted proof updates the client balance and proof timestamp and selects a new challenge position at random.
+
+A proof verifies the challenged data against the committed root. It does not verify that the provider answers peer download requests or achieves a particular download speed.
+
+## Payments and balances
+
+The unpaid client balance is an accounting value inside the storage contract, separate from the contract's actual coin balance. A valid proof reduces that accounting balance according to the bag size, agreed rate, and elapsed time, capped by `max_span`. The exact calculation and units are defined in [Payment accounting](/foundations/web3/ton-storage/reference#payment-accounting).
+
+A late proof can still be accepted, but time beyond `max_span` is not paid.
+
+Accepting a proof does not immediately transfer the earned amount to the provider. Earnings remain in the storage contract until withdrawn or distributed at closure. Withdrawals send the available earnings to the main provider contract. The operator can transfer funds from there to a wallet. The reserve calculation and the effect of a withdrawal with no remaining client balance are described in [Payment accounting](/foundations/web3/ton-storage/reference#payment-accounting).
+
+The client balance can be topped up to fund further storage. The contract's actual balance also covers transaction costs, so subtracting the client balance from it does not give the exact withdrawable earnings. For payment units and withdrawal commands, see the [Storage reference](/foundations/web3/ton-storage/reference#storage-providers) and [Run a storage provider](/foundations/web3/ton-storage/run-provider#operate-active-contracts).
+
+## Closure and data retention
+
+The [client](/foundations/web3/ton-storage/store-with-provider#close-the-agreement) or [provider](/foundations/web3/ton-storage/run-provider#close-a-storage-contract) can request closure. When the daemon observes a zero client balance on an active agreement, it starts the closure procedure; the contract does not close spontaneously when that balance reaches zero.
+
+For an inactive agreement, closure sends the remaining contract funds to the client. For an active agreement, the contract sends a refund message for the unpaid client balance and sends the remaining funds to the provider. These transfers incur blockchain fees; closure does not calculate an additional payment for time since the last accepted proof.
+
+After detecting that the storage contract has been deleted, the daemon removes it from its records. If no other tracked contract references the same BagID, it also requests removal of the local bag and its files. Other peers' copies are unaffected.
+
+## Sources
+
+- [Agreement creation and request validation](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/smartcont/storage-provider.fc#L20)
+- [Client balance, activation, closure, withdrawals, and proof processing](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/smartcont/storage-contract.fc)
+- [Request preparation from a complete bag](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/storage-daemon.cpp#L562)
+- [Microchunk size](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/MicrochunkTree.h#L34) and [tree construction](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/MicrochunkTree.cpp#L200)
+- [Daemon acceptance, download checks, and activation](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/StorageProvider.cpp#L315)
+- [Daemon closure, file removal, and proof scheduling](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/StorageProvider.cpp#L543)
+- [Provider withdrawals and wallet transfers](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/StorageProvider.cpp#L812)
diff --git a/content/foundations/web3/ton-storage/providers/meta.json b/content/foundations/web3/ton-storage/providers/meta.json
new file mode 100644
index 000000000..13340a53b
--- /dev/null
+++ b/content/foundations/web3/ton-storage/providers/meta.json
@@ -0,0 +1,9 @@
+{
+ "$schema": "../../../../../meta-schema.json",
+ "title": "Storage providers",
+ "pages": [
+ "[Provider lifecycle](/foundations/web3/ton-storage/provider-lifecycle)",
+ "[Store with a provider](/foundations/web3/ton-storage/store-with-provider)",
+ "[Run a provider](/foundations/web3/ton-storage/run-provider)"
+ ]
+}
diff --git a/content/foundations/web3/ton-storage/reference.mdx b/content/foundations/web3/ton-storage/reference.mdx
new file mode 100644
index 000000000..1b9f2a092
--- /dev/null
+++ b/content/foundations/web3/ton-storage/reference.mdx
@@ -0,0 +1,331 @@
+---
+title: "TON Storage reference"
+sidebarTitle: "Reference"
+description: "Bag formats, daemon commands, and storage provider behavior"
+---
+
+## Daemon and CLI options
+
+
+
+`storage-daemon` options used in the guides:
+
+| Option | Meaning |
+| ---------------------------- | ------------------------------------------------------------------------------------------------------------ |
+| `-v ` | Log verbosity; `3` selects INFO. |
+| `-C ` | Path to the target network's global configuration file. |
+| `-I :` | Public [Abstract Datagram Network Layer (ADNL)](/foundations/network/adnl) address and UDP port. |
+| `-p ` | TCP port for the CLI control interface. |
+| `-D ` | Persistent daemon database directory. CLI keys are generated in its `cli-keys/` subdirectory on first start. |
+| `-P` | Enable storage provider mode. |
+
+For `storage-daemon-cli`, `-I ` is the control endpoint, `-k ` is the client private key, and `-p ` is the server public key. The CLI `-p` option is a key path, not a port. [Connect the CLI](/foundations/web3/ton-storage/get-started#connect-the-cli) shows the connection command.
+
+## Bag commands
+
+
+
+Run these commands inside a connected `storage-daemon-cli`. `` is the bag's 64-character hexadecimal identifier; `` is an absolute destination directory.
+
+| Command | Description |
+| ----------------------------------------------- | ----------------------------------------------------------- |
+| `create ` | Create a new bag from a file or directory |
+| `add-by-hash -d ` | Add a bag by its `BagID` |
+| `add-by-meta -d ` | Add a bag from a metafile |
+| `list` | List all bags |
+| `list --hashes` | List bags with their `BagID`s |
+| `get ` | Show full bag information |
+| `get-peers ` | Show peers connected for a bag |
+| `get-meta ` | Export the bag metafile |
+| `download-pause ` | Pause a download |
+| `download-resume ` | Resume a download |
+| `priority-name ` | Set download priority for a file (0 = skip, 255 = highest) |
+| `upload-pause ` | Pause sharing a bag with peers |
+| `upload-resume ` | Resume sharing a bag with peers |
+| `priority-all ` | Set the priority of every file (0 to 255; 0 excludes files) |
+
+### Bag command options
+
+| Option | Commands | Behavior |
+| ----------------------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------- |
+| `--copy` | `create` | Copy source files into the daemon's storage directory; without it, serve the original files in place. |
+| `--no-upload` | `create`, `add-by-hash`, `add-by-meta` | Disable sharing when adding the bag. Sharing is enabled by default. |
+| `-d ` | `create` | Store a description in the torrent info. |
+| `-d ` | `add-by-hash`, `add-by-meta` | Set the download root directory; defaults to the daemon's internal storage. |
+| `--paused` | `add-by-hash`, `add-by-meta` | Add the bag without starting its download. |
+| `--partial ` | `add-by-hash`, `add-by-meta` | Download only the named files. All arguments after this flag are file names. |
+
+Paths passed to `create` must be accessible to both the CLI and daemon. The CLI reads and writes metafile data. When the CLI and daemon run on different hosts, download paths must also exist on the daemon host; the CLI creates and resolves the destination directory locally before sending the request.
+
+The [bag operations guide](/foundations/web3/ton-storage/get-started#additional-bag-operations) provides usage examples.
+
+## Bag formats
+
+
+
+The BagID is the 256-bit hash of the `TorrentInfo` cell. Its fields are serialized in this order:
+
+| Field | Encoding | Meaning |
+| ------------- | ---------- | ------------------------------------------------------------- |
+| `piece_size` | `uint32` | Piece size in bytes; `storage-daemon` creates 128 KiB pieces. |
+| `file_size` | `uint64` | Total stream size in bytes, including the header. |
+| `root_hash` | `bits256` | Root hash of the piece-hash Merkle tree. |
+| `header_size` | `uint64` | Serialized header size in bytes. |
+| `header_hash` | `bits256` | SHA-256 hash of the serialized header. |
+| `description` | `CellText` | Bag description. |
+
+The [TON Storage overview](/foundations/web3/ton-storage#bag-contents-and-identity) explains stream layout and verification.
+
+### Metafiles
+
+A metafile serializes `TorrentInfo` as a [bag of cells (BoC)](/foundations/serialization/boc) and can include a root proof and the serialized header. It starts with a 32-bit flags field: bit `0` indicates a root proof, and bit `1` indicates a header. These are followed by the 32-bit size of the info BoC and, if present, the root-proof BoC size, then the info BoC, optional proof BoC, and optional header. File contents are not included.
+
+## Provider commands
+
+
+
+[Storage provider lifecycle](/foundations/web3/ton-storage/provider-lifecycle) explains contract roles, proofs, payments, and closure.
+
+Run these commands inside `storage-daemon-cli`. `` is the main provider contract; `` is a per-bag storage contract.
+
+The following entries cover the commands used in the provider guides. `get-provider-params` and `new-contract-message` are client commands. The remaining commands require provider mode (`-P`); except for `deploy-provider`, they also require an initialized provider.
+
+| Command | Purpose |
+| --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
+| `get-provider-params ` | Read a provider's on-chain terms. |
+| `new-contract-message --provider ` | Write a storage request body as a BoC file on the CLI host. |
+| `deploy-provider` | Prepare the provider contract and print its [initialization address](/foundations/web3/ton-storage/run-provider#deploy-the-provider-contract). |
+| `get-provider-info` | Show the local provider's address, contract count, and capacity. |
+| `set-provider-config` | Update local capacity limits using the options below. |
+| `set-provider-params` | Update on-chain terms using the options below. |
+| `withdraw ` | Request withdrawal from one provider-managed storage contract. |
+| `withdraw-all` | Request withdrawals from eligible active contracts. |
+| `close-contract ` | Request closure of a provider-managed storage contract. |
+| `send-coins ` | Transfer the specified nanogram amount from the main provider contract to the destination account. |
+
+`withdraw-all` selects active contracts where `Contract$ - Client$` is at least 1 GRAM. This threshold does not subtract reserves or transaction fees.
+
+
+ Provider updates, withdrawals, closures, and transfers send blockchain messages and incur fees. Verify the network and destination before sending; mainnet transactions cannot be rolled back. Keep independent backups because closure can also remove local bag files; see [Protect provider data](/foundations/web3/ton-storage/run-provider#protect-provider-data).
+
+
+### Command options
+
+| Command | Option | Meaning |
+| ------------------------------------------ | ----------------------- | --------------------------------------------------------------------------------- |
+| `get-provider-params`, `get-provider-info` | `--json` | Return JSON output. |
+| `get-provider-info` | `--contracts` | Include individual storage contracts and their states. |
+| `get-provider-info` | `--balances` | Include the main contract balance and, with `--contracts`, per-contract balances. |
+| `new-contract-message` | `--query-id ` | Unsigned 64-bit request identifier; defaults to `0`. |
+| `send-coins` | `--message ""` | Attach the specified text comment to the transfer. |
+
+`Client$` is the unpaid client balance; `Contract$` is the storage contract's actual coin balance. Their difference is not the exact withdrawable earnings.
+
+`new-contract-message` reads the rate and proof interval from `--provider`. `` is an output file path, not a destination address. Generating the body does not send it; see [Send a storage request](#send-a-storage-request).
+
+### Provider parameters
+
+`set-provider-config` changes daemon limits. `set-provider-params` changes the main contract's terms for new agreements. Both commands require at least one option and retain omitted values.
+
+| Command | Option | Meaning |
+| --------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------ |
+| `set-provider-config` | `--max-contracts ` | Maximum number of tracked storage contracts. |
+| `set-provider-config` | `--max-total-size ` | Maximum combined bag size in bytes. |
+| `set-provider-params` | `--accept ` | Accept new requests when `` is `1`; reject them when it is `0`. |
+| `set-provider-params` | `--rate ` | Price in nanograms per 1,048,576 bytes per day. |
+| `set-provider-params` | `--max-span ` | Maximum elapsed time paid per accepted proof, in seconds. Later proofs remain valid. |
+| `set-provider-params` | `--min-file-size ` | Minimum accepted bag stream size in bytes, including the header. |
+| `set-provider-params` | `--max-file-size ` | Maximum accepted bag stream size in bytes, including the header. |
+
+## Storage contracts
+
+### Contract messages
+
+Operation codes occupy the first 32 bits of the message body. `uint64` and `bits256` below denote fixed-width fields; `Coins` uses TON coin serialization.
+
+| Message | Opcode | Fields after the opcode | Route |
+| ----------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
+| Storage request | `0x107c49ef` | `query_id:uint64`, reference to `TorrentInfo`, microchunk root `bits256`, expected rate `Coins`, expected `max_span:uint32` | Client wallet to main provider contract. |
+| Close agreement | `0x79f937ea` | `query_id:uint64` | Client or main provider contract to storage contract. |
+| Deployment notification | `0xbf7bd0c1` | Original `query_id:uint64`, BagID `bits256` | Storage contract to client. |
+| Activation notification | `0xd4caedcd` | Current logical time `uint64`, BagID `bits256` | Storage contract to client. |
+| Closure notification | `0xb6236d63` | Current logical time `uint64`, BagID `bits256` | Storage contract to client and, when active, main provider contract. |
+
+A non-bounced transfer with an empty body or opcode `0` adds the received value to the storage contract's client balance, regardless of the sender. Opcode `0` permits a text-comment body and requires no query ID.
+
+### Storage contract data
+
+`get_storage_contract_data` returns these values in order:
+
+| Position | Field | Stored type | Meaning |
+| -------: | ----------------- | ------------ | ----------------------------------------------------------------------------- |
+| 1 | `active` | `int1` | Agreement active flag. |
+| 2 | `balance` | `Coins` | Unpaid client balance in nanograms. |
+| 3 | `provider` | `MsgAddress` | Main provider contract address. |
+| 4 | `merkle_hash` | `uint256` | Storage-proof microchunk-tree root. |
+| 5 | `file_size` | `uint64` | Bag stream size in bytes, including the header. |
+| 6 | `next_proof` | `uint64` | Challenged byte position; initialized to zero. |
+| 7 | `rate_per_mb_day` | `Coins` | Nanograms per 1,048,576 bytes per day. |
+| 8 | `max_span` | `uint32` | Maximum elapsed time paid per proof, in seconds. |
+| 9 | `last_proof_time` | `uint32` | Proof accounting timestamp in Unix seconds; initialized at contract creation. |
+| 10 | `client` | `MsgAddress` | Client wallet address. |
+| 11 | `torrent_hash` | `uint256` | BagID. |
+
+### Payment accounting
+
+At deployment, the storage contract credits the received value minus 2 notification allowances of 20,000,000 nanograms each. Blockchain fees reduce the amount forwarded by the main provider contract.
+
+For each accepted proof, the contract computes:
+
+```text
+elapsed = min(now - last_proof_time, max_span)
+bounty = floor(file_size * rate_per_mb_day * elapsed / (86400 * 1048576))
+balance = max(0, balance - bounty)
+```
+
+`file_size` is the bag stream size in bytes, `elapsed` is in seconds, and `bounty` and `balance` are in nanograms. The initial `last_proof_time` is set when the storage contract's initial state is built; activation does not reset it. Each accepted proof sets it to the current Unix time.
+
+A withdrawal while `balance` is positive requests a reserve of that balance plus 10,000,000 nanograms before forwarding the remaining funds to the main provider contract. The reserve uses the amount available if the requested amount exceeds it. [Payments and balances](/foundations/web3/ton-storage/provider-lifecycle#payments-and-balances) distinguishes accounting balance from earnings.
+
+When `balance` is zero, a successful withdrawal transfers the remaining funds to the main provider contract and deletes the storage contract.
+
+### Contract errors
+
+| Code | Meaning |
+| ------ | ----------------------------------------------------------------------- |
+| `401` | Sender is not authorized for the requested storage contract operation. |
+| `1001` | Storage request attaches less than 60,000,000 nanograms. |
+| `1002` | Storage proof does not match the committed root and challenge. |
+| `1003` | Withdrawal or proof submission requires an active storage contract. |
+| `1004` | Requested bag size is below the provider's minimum. |
+| `1005` | Requested bag size exceeds the provider's maximum. |
+| `1006` | Provider does not accept new storage contracts. |
+| `1007` | Activation requested for an already active storage contract. |
+| `1009` | Expected rate or `max_span` differs from the provider's on-chain terms. |
+
+## Integration examples
+
+
+ The request example transfers funds to a mainnet provider. The closure example deletes a storage agreement and distributes its remaining funds. Verify the network, destination, and amount before confirming; mainnet transactions cannot be rolled back. Keep an independent copy of required files before closing an agreement.
+
+
+### Send a storage request
+
+The following helper uses `@ton/core` 0.63.1 with an existing [TON Connect application](/applications/ton-connect/how-to/connect). It builds a mainnet request with 1 GRAM attached. The provider contract requires at least 0.06 GRAM for a deployment request; fees and notification messages reduce the balance available for storage.
+
+```typescript
+import { Address, Cell, toNano } from '@ton/core';
+
+export function storageRequest(provider: Address, sender: Address, body: Cell) {
+ return {
+ validUntil: Math.floor(Date.now() / 1000) + 300,
+ network: '-239' as const,
+ from: sender.toRawString(),
+ messages: [{
+ address: provider.toString({ bounceable: true }),
+ amount: toNano('1').toString(),
+ payload: body.toBoc().toString('base64'),
+ }],
+ };
+}
+```
+
+Integration excerpt, not a standalone application: `tonConnectUi` is the connected TON Connect UI instance, `provider` and `sender` are `Address` values, and `BODY_BASE64` is the base64-encoded contents of the BoC file generated by `new-contract-message`.
+
+```typescript
+// Not runnable: requires storageRequest and a connected TON Connect application.
+const body = Cell.fromBase64(BODY_BASE64);
+const request = storageRequest(provider, sender, body);
+await tonConnectUi.sendTransaction(request);
+```
+
+The response from TON Connect is not confirmation that the storage contract is deployed or active. Verify the on-chain result.
+
+### Read a storage contract
+
+This helper returns a subset of [the getter fields](#storage-contract-data), naming `client` as `owner`, `rate_per_mb_day` as `rate`, and `torrent_hash` as `bagId`.
+
+Use `@ton/ton` 16.3.0 with `@ton/core` 0.63.1. Supply a `TonClient` configured for mainnet using [TON Center API v2](/api/v2/rpc/json-rpc-endpoint) and the storage contract address obtained from the deployment notification.
+
+```typescript
+import { Address } from '@ton/core';
+import { TonClient } from '@ton/ton';
+
+export async function readStorageContract(client: TonClient, address: Address) {
+ const { stack } = await client.runMethod(address, 'get_storage_contract_data');
+ const active = stack.readBoolean();
+ const balance = stack.readBigNumber();
+ const provider = stack.readAddress();
+ stack.readBigNumber();
+ stack.readBigNumber();
+ stack.readBigNumber();
+ const rate = stack.readBigNumber();
+ const maxSpan = stack.readNumber();
+ stack.readNumber();
+ const owner = stack.readAddress();
+ const bagId = stack.readBigNumber().toString(16).padStart(64, '0');
+ return { active, balance, provider, rate, maxSpan, owner, bagId };
+}
+
+```
+
+Call `readStorageContract(client, address)`. The returned `bagId` is a 64-character hexadecimal string; `active: false` means the provider has not activated the agreement. Units are listed in [Storage contract data](#storage-contract-data).
+
+### Close a storage contract
+
+Use `@ton/core` 0.63.1 with a connected mainnet TON Connect wallet. `contract` is the per-bag storage contract, `sender` is its client wallet, `amount` is the attached value in nanograms to cover transaction fees, and `queryId` is an unsigned 64-bit integer.
+
+```typescript
+import { Address, beginCell } from '@ton/core';
+
+export function storageCloseRequest(
+ contract: Address,
+ sender: Address,
+ amount: bigint,
+ queryId: bigint,
+) {
+ const body = beginCell()
+ .storeUint(0x79f937ea, 32)
+ .storeUint(queryId, 64)
+ .endCell();
+ return {
+ validUntil: Math.floor(Date.now() / 1000) + 300,
+ network: '-239' as const,
+ from: sender.toRawString(),
+ messages: [{
+ address: contract.toString({ bounceable: true }),
+ amount: amount.toString(),
+ payload: body.toBoc().toString('base64'),
+ }],
+ };
+}
+```
+
+Pass the returned request to the connected `tonConnectUi.sendTransaction` instance. Verify that `sender` is the contract's client and review the attached amount before sending. Closure distributes the remaining funds and deletes the contract; see [Closure and data retention](/foundations/web3/ton-storage/provider-lifecycle#closure-and-data-retention).
+
+## Sources
+
+- [Daemon startup options](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/storage-daemon.cpp#L982)
+- [Contract opcodes and error codes](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/smartcont/constants.fc)
+- [CLI command parsing and options](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/storage-daemon-cli.cpp#L322)
+- [CLI command execution and output](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/storage-daemon-cli.cpp#L995)
+- [Bag completion and file selection](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/Torrent.cpp#L444)
+- [Copying bag files](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/Torrent.cpp#L708)
+- [Storage contract messages, payments, and getters](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/smartcont/storage-contract.fc)
+- [Provider deployment and request validation](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/smartcont/storage-provider.fc)
+- [Provider daemon lifecycle](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/storage-daemon/StorageProvider.cpp#L650)
+- [Torrent info serialization and BagID](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/TorrentInfo.cpp#L27)
+- [Merkle proof validation](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/MerkleTree.cpp#L104)
+- [Metafile serialization](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/storage/TorrentMeta.cpp#L56)
diff --git a/content/foundations/web3/ton-storage/run-provider.mdx b/content/foundations/web3/ton-storage/run-provider.mdx
new file mode 100644
index 000000000..eae2af8d4
--- /dev/null
+++ b/content/foundations/web3/ton-storage/run-provider.mdx
@@ -0,0 +1,169 @@
+---
+title: "How to run a TON Storage provider"
+sidebarTitle: "Run a storage provider"
+description: "Deploy and operate a paid storage provider"
+---
+
+Run the `storage-daemon` in provider mode, deploy its main contract, and manage paid storage contracts on mainnet.
+
+
+ Provider commands deploy contracts, transfer funds, close storage contracts, and may delete local bag files. Mainnet transactions and contract closures cannot be rolled back.
+
+ Keep independent backups of required files, verify every address and network, and use a small initialization transfer.
+
+
+## Prerequisites
+
+- `storage-daemon` and `storage-daemon-cli` from the same [TON release](https://github.com/ton-blockchain/ton/releases/tag/v2026.08)
+- The [mainnet global configuration file](https://ton-blockchain.github.io/global.config.json)
+- A funded mainnet wallet
+- A public IP address and reachable [ADNL](/foundations/network/adnl) port
+
+## Start provider mode
+
+
+
+Follow [Start the daemon](/foundations/web3/ton-storage/get-started#start-the-daemon), adding `-P` to the daemon startup command. Use a dedicated database directory for the provider.
+
+The `list` command shows all bags managed by the daemon. Do not remove these bags or use the provider daemon to manage unrelated bags. Keep independent copies of data that must remain available after a storage contract closes.
+
+Run the commands below inside the connected `storage-daemon-cli`, one command per line.
+
+## Deploy the provider contract
+
+Run the [deployment command](/foundations/web3/ton-storage/reference#provider-commands) inside `storage-daemon-cli`:
+
+```bash
+deploy-provider
+```
+
+
+ The command prints an address that requires a non-bounceable initialization message containing 1 GRAM. Verify the network and address before sending funds. A transfer to the wrong network or address cannot be recovered.
+
+
+Do not attach a large balance to the initialization message. Verify the deployed provider:
+
+```bash
+get-provider-info
+```
+
+Fund the deployed provider contract separately to cover later transaction fees. Increase the balance only after verifying the deployment.
+
+## Configure capacity
+
+Set the maximum number and total size of managed storage contracts:
+
+```bash
+set-provider-config --max-contracts --max-total-size
+```
+
+`` is the contract-count limit; `` is the combined bag-size limit in bytes. These are daemon limits, separate from the [on-chain terms](/foundations/web3/ton-storage/reference#provider-parameters).
+
+## Configure contract terms
+
+Keep new requests disabled while configuring the on-chain terms:
+
+```bash
+set-provider-params --accept 0 --rate --max-span --min-file-size --max-file-size
+```
+
+Set [``](/foundations/web3/ton-storage/reference#provider-parameters) to the price per 1,048,576 bytes per day. `` is the maximum paid interval between proofs. `` and `` bound the bag stream size, including its header.
+
+Omitted flags retain their prior values. After each on-chain update, read the terms with `get-provider-params ` before submitting another update. Use the main contract address printed during deployment as ``.
+
+## Enable and verify requests
+
+Enable requests after verifying every parameter:
+
+```bash
+set-provider-params --accept 1
+```
+
+Run `get-provider-params ` again and confirm that requests are enabled and all terms match the intended configuration.
+
+The daemon downloads accepted bags, distributes them to peers, and submits storage proofs.
+
+## Monitor agreements and withdraw earnings
+
+
+
+List tracked contracts, their states, and their balances:
+
+```bash
+get-provider-info --contracts --balances
+```
+
+`Client$` is the unpaid client balance. The difference between `Contract$` and `Client$` includes provider earnings, storage reserves, and transaction funds; it is not the exact withdrawable amount.
+
+Withdraw earnings from one per-bag storage contract managed by the provider:
+
+```bash
+withdraw
+```
+
+Request withdrawals from active contracts meeting the [CLI threshold](/foundations/web3/ton-storage/reference#provider-commands):
+
+```bash
+withdraw-all
+```
+
+A withdrawal with a zero client balance can also delete the storage contract; see [Payment accounting](/foundations/web3/ton-storage/reference#payment-accounting).
+
+## Transfer provider funds
+
+
+ Start with a small transfer. Verify the destination, amount, and network before sending. Mainnet transfers cannot be rolled back.
+
+
+Transfer nanograms from the main provider contract:
+
+```bash
+send-coins
+```
+
+To include a text message, append `--message ""` to this command.
+
+There,
+
+- `` is the receiving account.
+- `` is the transferred amount in nanograms.
+- `` is an optional text message.
+
+## Close a storage contract
+
+
+ Closing a contract may delete its local bag files when no other tracked contract uses the bag. Keep an independent copy before closing the contract. The on-chain closure cannot be rolled back.
+
+
+Close one provider-managed contract:
+
+```bash
+close-contract
+```
+
+[Closing an active agreement](/foundations/web3/ton-storage/provider-lifecycle#closure-and-data-retention) transfers available provider earnings to the main provider contract. Before activation, the remaining funds return to the client.
+
+## Troubleshoot
+
+| Problem | Check |
+| -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Provider commands fail because provider mode is disabled | Restart the daemon with `-P` and its existing database directory. |
+| Contract is deployed but requests are rejected | Read the on-chain terms with `get-provider-params ` and check the [contract error](/foundations/web3/ton-storage/reference#contract-errors). |
+| Agreement starts closing before activation | Check local capacity limits and daemon logs; deployment does not guarantee daemon acceptance. |
+| `withdraw-all` prints “Nothing to withdraw” | Check contract states and the [withdrawal threshold](/foundations/web3/ton-storage/reference#provider-commands). |
diff --git a/content/foundations/web3/ton-storage/store-with-provider.mdx b/content/foundations/web3/ton-storage/store-with-provider.mdx
new file mode 100644
index 000000000..83ceec32e
--- /dev/null
+++ b/content/foundations/web3/ton-storage/store-with-provider.mdx
@@ -0,0 +1,85 @@
+---
+title: "How to store a bag with a provider"
+sidebarTitle: "Store with a provider"
+description: "Request paid storage and monitor the client balance"
+---
+
+Request paid storage for a bag on mainnet and monitor its storage contract.
+
+## Prerequisites
+
+- A running TON v2026.08 [storage daemon](/foundations/web3/ton-storage/get-started#start-the-daemon) configured for mainnet and connected CLI
+- A funded mainnet wallet
+- The provider contract address on mainnet
+
+
+ Sending a storage request or topping up its contract transfers funds. Verify the mainnet provider address, amount, and terms before sending. Mainnet transfers cannot be rolled back.
+
+
+Run the following [commands](/foundations/web3/ton-storage/reference#provider-commands) inside `storage-daemon-cli`, one command per line.
+
+## Prepare the bag
+
+[Create and share a bag](/foundations/web3/ton-storage/get-started#create-and-share-a-bag) and record its 64-character hexadecimal identifier as ``. Keep the bag available until the provider finishes downloading it.
+
+## Check provider terms
+
+Inspect the on-chain terms at ``, the main provider contract address:
+
+```bash
+get-provider-params
+```
+
+The result states whether the provider accepts contracts, its bag-size limits, its rate, and the maximum paid interval between proofs.
+
+## Request storage from a provider
+
+1. Generate a request body for the bag:
+
+ ```bash
+ new-contract-message --query-id --provider
+ ```
+
+ There,
+
+ - `` receives the internal message body, not a complete message.
+ - `` is an integer from `0` through `2^64 - 1`.
+
+ Large bags can take longer to process. Review the rate and proof interval printed by the command before sending the body. The provider contract rejects the request if its rate or proof interval changes before processing.
+
+1. Send the generated body to `` from the client wallet, using the [request example](/foundations/web3/ton-storage/reference#send-a-storage-request). The example attaches 1 GRAM to cover deployment and an initial storage balance. This is an example amount, not a fixed price or storage duration; review the provider's rate before sending.
+
+## Verify activation
+
+
+
+Find the incoming `0xbf7bd0c1` notification in the requesting wallet's transaction history. Its body contains the request query ID and BagID. The sender is the new storage contract; use that address as ``.
+
+Read the contract with the [verification helper](/foundations/web3/ton-storage/reference#read-a-storage-contract). Confirm that `owner`, `provider`, and `bagId` match the request, and that `balance` is positive. Wait for `active` to become `true` after the provider downloads the bag. Activation also sends a `0xd4caedcd` notification to the client.
+
+## Monitor and top up the balance
+
+
+
+Read `balance` with the [verification helper](/foundations/web3/ton-storage/reference#read-a-storage-contract). It is the [unpaid client balance](/foundations/web3/ton-storage/provider-lifecycle#payments-and-balances), not the contract's total coin balance.
+
+To top up, send a transfer to `` with an empty body or a text comment. Any wallet can add funds. Read the balance again after the transaction is included.
+
+## Close the agreement
+
+Send a closure request from the client wallet to ``, using the [closure example](/foundations/web3/ton-storage/reference#close-a-storage-contract). The provider's main contract address is not the destination for this request.
+
+Verify the closure notification and the contract's deletion on-chain. Refunds depend on whether the agreement was active; see [Closure and data retention](/foundations/web3/ton-storage/provider-lifecycle#closure-and-data-retention). A provider can also decline or close an agreement, including when its client balance reaches zero.
+
+## Troubleshoot
+
+| Problem | Check |
+| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
+| Request rejected after the provider changes its rate or proof interval | Read the updated terms and regenerate the request body. |
+| Contract remains inactive | Keep the bag shared and check with the provider that it can download the bag. |
+| No deployment notification | Inspect the wallet transaction for a bounced request before retrying. |
diff --git a/src/dictionaries/custom.txt b/src/dictionaries/custom.txt
index 899bf8081..5d8839920 100644
--- a/src/dictionaries/custom.txt
+++ b/src/dictionaries/custom.txt
@@ -459,9 +459,14 @@ Merkle
Mersenne
metafile
Metafile
+metafiles
+Metafiles
MetalLB
Metaverse
MEV
+microchunk
+Microchunk
+microchunks
micropayment
micropayments
Micropayments
From 62d9bfc145fd93b648f051a6497d79d2de2e6ef9 Mon Sep 17 00:00:00 2001
From: TONresistor <240980241+TONresistor@users.noreply.github.com>
Date: Tue, 20 Oct 2026 11:52:56 +0200
Subject: [PATCH 04/10] feat(web3): expand TON Proxy documentation
---
content/foundations/web3/ton-proxy.mdx | 136 ------------
.../web3/ton-proxy/forward-proxy.mdx | 98 +++++++++
content/foundations/web3/ton-proxy/index.mdx | 56 +++++
content/foundations/web3/ton-proxy/meta.json | 10 +
.../foundations/web3/ton-proxy/reference.mdx | 150 +++++++++++++
.../web3/ton-proxy/reverse-proxy.mdx | 203 ++++++++++++++++++
6 files changed, 517 insertions(+), 136 deletions(-)
delete mode 100644 content/foundations/web3/ton-proxy.mdx
create mode 100644 content/foundations/web3/ton-proxy/forward-proxy.mdx
create mode 100644 content/foundations/web3/ton-proxy/index.mdx
create mode 100644 content/foundations/web3/ton-proxy/meta.json
create mode 100644 content/foundations/web3/ton-proxy/reference.mdx
create mode 100644 content/foundations/web3/ton-proxy/reverse-proxy.mdx
diff --git a/content/foundations/web3/ton-proxy.mdx b/content/foundations/web3/ton-proxy.mdx
deleted file mode 100644
index 999f1c3d6..000000000
--- a/content/foundations/web3/ton-proxy.mdx
+++ /dev/null
@@ -1,136 +0,0 @@
----
-title: "TON Proxy"
-description: "HTTP-to-ADNL bridge for accessing and hosting TON Sites from a conventional browser"
----
-
-TON Proxy is an HTTP-to-ADNL bridge that allows ordinary web browsers to access TON Sites. It is implemented by the `rldp-http-proxy` binary, which operates as a forward proxy for clients and as a reverse proxy for servers hosting TON Sites.
-
-## How TON Proxy works
-
-`rldp-http-proxy` runs locally and listens for HTTP requests from a web browser. When a request arrives for a `.ton` domain, the proxy resolves it via TON DNS to an ADNL address, then forwards the HTTP request over RLDP to the target TON Site.
-
-By default the forward proxy only intercepts requests for `.ton`, `.adnl`, and `.bag` hostnames; all other requests pass through unchanged. Setting `-P YES` makes the proxy intercept all HTTP requests regardless of suffix.
-
-### Forward proxy (client-side)
-
-To start a local forward proxy:
-
-```bash
-rldp-http-proxy -p 8080 -c 3333 -C global.config.json
-```
-
-Configure the browser to use `127.0.0.1:8080` as an HTTP proxy. TON Sites are then reachable by their `.ton` domain names.
-
-| Flag | Long form | Description |
-| -------------- | ------------------- | ------------------------------------------------------------------------ |
-| `-p ` | `--port` | HTTP listening port for browser connections |
-| `-c ` | `--client-port` | UDP port for client ADNL queries |
-| `-C ` | `--global-config` | Path to the TON global network config file |
-| `-P ` | `--proxy-all` | Proxy all HTTP requests, not only `.ton`, `.adnl`, `.bag` (default `NO`) |
-| `-S ` | `--storage-gateway` | ADNL address of a TON Storage gateway for `.bag` resolution |
-| `-D ` | `--db` | Database root path |
-| `-d` | `--daemonize` | Daemonize the process |
-| `-l ` | `--logname` | Log file path |
-
-## Reverse proxy mode
-
-`rldp-http-proxy` also operates as a reverse proxy for servers hosting TON Sites. In this mode it accepts inbound ADNL connections and forwards HTTP requests to a local or remote web server. Two implementations are available.
-
-### Use rldp-http-proxy
-
-`rldp-http-proxy` is the reverse proxy from the official TON monorepo. Key generation is manual.
-
-**Step 1.** Generate a persistent ADNL address:
-
-```bash
-mkdir keyring
-utils/generate-random-id -m adnlid
-```
-
-The command prints two values to stdout: the hex address and its user-friendly form:
-
-```text
-45061C1D4EC44A937D0318589E13C73D151D1CEF5D3C0E53AFBCF56A6C2FE2BD vcqmha5j3ceve35ammfrhqty46rkhi455otydstv66pk2tmf7rl25f3
-```
-
-It also writes the private key to a file named after the hex address. Move it into the keyring directory:
-
-```bash
-mv 45061C1D* keyring/
-```
-
-**Step 2.** Start the reverse proxy, using the user-friendly ADNL address from step 1:
-
-```bash
-rldp-http-proxy -a :3333 -L '*' -C global.config.json -A -d -l tonsite.log
-```
-
-| Flag | Description |
-| ------------------------------------- | ------------------------------------------------------------------------------ |
-| `-a :` | Public IP and UDP port for inbound ADNL connections (published to the TON DHT) |
-| `-A ` | ADNL address generated in step 1 |
-| `-L [:]` | Forward requests for `` to `127.0.0.1` (default ports: 80, 443) |
-| `-R [:]@:` | Forward requests for `` to a remote HTTP server at `:` |
-| `-C ` | Path to the TON global network configuration file |
-| `-D ` | Database root path |
-| `-d` | Daemonize the process |
-| `-l ` | Log file path |
-
-### Use `tonutils-reverse-proxy`
-
-`tonutils-reverse-proxy` is a Go implementation that handles key generation and domain linking automatically.
-
-**Install on Linux:**
-
-```bash
-wget https://github.com/tonutils/reverse-proxy/releases/latest/download/tonutils-reverse-proxy-linux-amd64
-chmod +x tonutils-reverse-proxy-linux-amd64
-```
-
-To build from source:
-
-```bash
-git clone https://github.com/tonutils/reverse-proxy
-cd reverse-proxy && make build
-```
-
-Run with the target `.ton` domain:
-
-```bash
-./tonutils-reverse-proxy --domain .ton
-```
-
-On first run, the proxy generates a persistent ADNL key pair and displays a QR code. Scan it with a compatible TON wallet to confirm domain ownership and link the ADNL address to the domain.
-
-The web server must listen on `http://127.0.0.1:80`. The proxy adds two headers to each forwarded request:
-
-- `X-Adnl-Ip`: the IP address of the connecting client as seen by the ADNL network.
-- `X-Adnl-Id`: the ADNL node ID of the connecting client.
-
-### Domain assignment
-
-To assign the ADNL address to a `.ton` domain, open the domain in the TON DNS management interface, paste the ADNL address into the "Site" field, and confirm the transaction with the domain owner's wallet. For record types and domain assignment context, see [TON DNS](/foundations/web3/ton-dns).
-
-## Security and privacy
-
-All traffic between the proxy and the TON Site is encrypted at the ADNL layer. The server is authenticated by its ADNL address, derived from its public key.
-
-The server IP is published to the TON DHT for ADNL routing but is not exposed at the HTTP layer. The proxy does not forward client network information to the upstream web server.
-
-## Response headers
-
-The proxy adds version headers to all responses.
-
-| Header | Added by | Value format |
-| ------------------------- | --------------------------- | ----------------------------- |
-| `Ton-Proxy-Site-Version` | Reverse proxy (server-side) | `Commit: , Date: ` |
-| `Ton-Proxy-Entry-Version` | Forward proxy (client-side) | `Commit: , Date: ` |
-
-The proxy also supports the HTTP `CONNECT` method, which enables WebSocket connections and other TCP-based protocols to be tunneled over ADNL.
-
-## Related components
-
-- **ADNL**: the abstract datagram network layer used to reach TON Sites by their abstract address.
-- **RLDP**: the reliable large datagram protocol over ADNL that carries HTTP requests and responses.
-- [TON Sites](/foundations/web3/ton-sites): web services accessible through TON Proxy.
-- [TON DNS](/foundations/web3/ton-dns): resolves `.ton` domain names to ADNL addresses for request routing.
diff --git a/content/foundations/web3/ton-proxy/forward-proxy.mdx b/content/foundations/web3/ton-proxy/forward-proxy.mdx
new file mode 100644
index 000000000..0f4122be5
--- /dev/null
+++ b/content/foundations/web3/ton-proxy/forward-proxy.mdx
@@ -0,0 +1,98 @@
+---
+title: "How to run a TON forward proxy"
+sidebarTitle: "Run a forward proxy"
+description: "Connect a browser to TON Sites and TON Storage files through a local proxy"
+---
+
+Run a local forward proxy to access TON Sites and TON Storage files from a browser. Choose either Tonutils-Proxy or the C++ `rldp-http-proxy`.
+
+## Prerequisites
+
+- For C++: extract `rldp-http-proxy` from the archive for the target platform in [TON v2026.08](https://github.com/ton-blockchain/ton/releases/tag/v2026.08) into the working directory. The separate `http-proxy` download is a different program.
+- For C++: save the [mainnet global configuration](https://ton-blockchain.github.io/global.config.json) as `global.config.json` in the same directory.
+
+## Use Tonutils-Proxy
+
+[Tonutils-Proxy](https://github.com/xssnick/Tonutils-Proxy) is a community-developed open-source forward proxy.
+
+
+ Tonutils-Proxy creates `config.json` in its working directory and stores the [Abstract Datagram Network Layer (ADNL)](/foundations/network/adnl) private-key seed in [`ADNLKey`](/foundations/web3/ton-proxy/reference#tonutils-proxy-configuration). Keep this file confidential.
+
+
+On Linux (x86-64), download and run version 1.8.3:
+
+```bash
+wget https://github.com/xssnick/Tonutils-Proxy/releases/download/v1.8.3/tonutils-proxy-cli-linux-amd64
+chmod +x tonutils-proxy-cli-linux-amd64
+./tonutils-proxy-cli-linux-amd64
+```
+
+For other platforms, use the corresponding CLI binary from the [same release](https://github.com/xssnick/Tonutils-Proxy/releases/tag/v1.8.3).
+
+The proxy listens on [`127.0.0.1:8080`](/foundations/web3/ton-proxy/reference#tonutils-proxy-options) and loads the mainnet configuration automatically. It also forwards ordinary HTTP requests.
+
+## Use rldp-http-proxy
+
+
+ The C++ proxy listens on all network interfaces. For local use, block inbound TCP connections to port `8080` on non-loopback interfaces with the host firewall. Configuring the browser to use localhost does not restrict the listener.
+
+
+Run the extracted C++ binary:
+
+```bash
+chmod +x rldp-http-proxy
+./rldp-http-proxy -p 8080 -c 3333 -C global.config.json
+```
+
+The proxy uses UDP port [`3333`](/foundations/web3/ton-proxy/reference#forward-proxy-options) for ADNL traffic.
+
+## Connect the browser
+
+Keep the chosen proxy running and configure the browser's HTTP proxy to use `127.0.0.1` on port `8080`. Run only one of these proxies on that port at a time.
+
+## Verify
+
+Open `http://` in the configured browser, replacing `` with the full `.ton` name of a running TON Site. Confirm that the expected page loads.
+
+For direct access without DNS, open `http://.adnl`, replacing `` with the site's user-friendly ADNL address.
+
+## Access files over HTTP
+
+To access a file in a Storage bag, obtain its BagID and the path of the file within the bag. Keep the browser configured to use the forward proxy.
+
+With Tonutils-Proxy, continue to [Verify file access](#verify-file-access). For C++, [configure the gateway](#configure-the-gateway).
+
+### Configure the gateway
+
+For C++, obtain the user-friendly ADNL address of an existing TON Storage HTTP gateway. Stop the forward proxy and restart it with [`-S`](/foundations/web3/ton-proxy/reference#forward-proxy-options), replacing `` with that address:
+
+```bash
+./rldp-http-proxy -p 8080 -c 3333 -C global.config.json -S
+```
+
+The [HTTP listener restrictions](#use-rldp-http-proxy) also apply to this command.
+
+### Verify file access
+
+Open `http://.bag/` in the configured browser. Replace `` with the bag's hexadecimal identifier and `` with the path within the bag. Confirm that the expected file is returned.
+
+Both implementations also accept a `.ton` domain whose [`site` record contains the BagID](/foundations/web3/ton-dns/reference#record-categories): open `http:///`, using the full domain name as ``.
+
+[Create and share a bag](/foundations/web3/ton-storage/get-started#create-and-share-a-bag) to publish files for HTTP access.
+
+## Troubleshoot
+
+| Problem | Check |
+| --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Browser cannot connect to the proxy | Check that the process is running and the browser uses port `8080`. |
+| A `.ton` site cannot be reached | Check the domain's `site` record and whether its destination is online. |
+| An ordinary Internet domain is rejected | The C++ proxy accepts only `.ton`, `.adnl`, and `.bag` destinations by default. With Tonutils-Proxy, check whether [`--no-http`](/foundations/web3/ton-proxy/reference#tonutils-proxy-options) is enabled. |
+| “storage gateway is not set” | For the C++ proxy, [configure a Storage gateway](#configure-the-gateway) for a destination that resolves to a BagID. |
+| File is unavailable | Check the BagID and file path. Peers must serve the bag; with C++, the gateway must also be reachable. |
+| Domain routes to the wrong resource | Check the domain's `site` record. |
diff --git a/content/foundations/web3/ton-proxy/index.mdx b/content/foundations/web3/ton-proxy/index.mdx
new file mode 100644
index 000000000..513dae8bd
--- /dev/null
+++ b/content/foundations/web3/ton-proxy/index.mdx
@@ -0,0 +1,56 @@
+---
+title: "TON Proxy overview"
+sidebarTitle: "Overview"
+description: "Access and host TON Sites through an HTTP proxy"
+---
+
+TON Proxy connects HTTP clients to [TON Sites](/foundations/web3/ton-sites). It carries HTTP requests and responses over the TON network, while the client and web server use their existing HTTP interfaces.
+
+## Forward and reverse proxies
+
+- A **forward proxy** accepts requests from an HTTP client, such as a browser or command-line tool, and sends them to the TON Site.
+- A **reverse proxy** receives requests from the TON network and forwards them to the site's HTTP server. The server can run on the same machine or another host.
+
+The official C++ implementation, `rldp-http-proxy`, supports both roles. The community implementations [Tonutils-Proxy](/foundations/web3/ton-proxy/forward-proxy#use-tonutils-proxy) and [tonutils-reverse-proxy](/foundations/web3/ton-proxy/reverse-proxy#use-tonutils-reverse-proxy) provide the forward and reverse roles, respectively.
+
+## Request flow
+
+For a request to `http://example.ton/page`, where the domain points to a reverse proxy:
+
+1. The HTTP client sends the request to its configured forward proxy.
+1. The forward proxy resolves the domain's `site` record through [TON DNS](/foundations/web3/ton-dns/reference#resolve-a-record). The record contains the reverse proxy's [Abstract Datagram Network Layer (ADNL)](/foundations/network/adnl) address. TON's [distributed hash table (DHT)](/foundations/network/dht) provides the corresponding IP address and UDP port for reaching that proxy.
+1. The forward proxy sends the HTTP request over the [Reliable Large Datagram Protocol (RLDP)](/foundations/network/rldp), which runs over the [ADNL](/foundations/network/adnl). The reverse proxy forwards the request to its configured HTTP server.
+1. The HTTP server processes the request. Its response returns through the reverse proxy and forward proxy to the client.
+
+The [HTTP over RLDP specification](/foundations/network/rldp#rldp-http) describes the request, response, and body transfers.
+
+## Name resolution
+
+A `.ton` domain gives a TON Site a readable name. Direct access through `.adnl` uses the reverse proxy's ADNL address without a DNS lookup.
+
+The `site` record can also contain a [TON Storage BagID](/foundations/web3/ton-storage#bag-contents-and-identity). In that case, the requested path identifies a file within the bag. The same files are [accessible directly through `.bag`](/foundations/web3/ton-proxy/forward-proxy#access-files-over-http), using the hexadecimal BagID.
+
+Storage access depends on the forward proxy implementation:
+
+- The C++ proxy forwards requests to a configured TON Storage HTTP gateway.
+- Tonutils-Proxy includes a Storage client and retrieves files from the bag's peers.
+
+## Privacy and relays
+
+ADNL encrypts traffic between the forward and reverse proxies. This encryption does not cover the HTTP connection from the client to the forward proxy or from the reverse proxy to its HTTP server.
+
+A direct connection exposes the peers' network addresses to each other. [TON Tunnel](/foundations/web3/ton-tunnel) provides relays for ADNL traffic in compatible applications.
+
+## Next steps
+
+- [Run a forward proxy](/foundations/web3/ton-proxy/forward-proxy) to access TON Sites and Storage files.
+- [Run a reverse proxy](/foundations/web3/ton-proxy/reverse-proxy) to connect an HTTP server to the TON network.
+- [Reference](/foundations/web3/ton-proxy/reference) for implementation-specific options, routing, and headers.
+
+## Sources
+
+- [C++ HTTP request handling and reverse routing](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/rldp-http-proxy/rldp-http-proxy.cpp#L1061-L1212)
+- [DNS site records](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/rldp-http-proxy/DNSResolver.cpp#L68-L94)
+- [ADNL peer discovery](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/adnl/adnl-peer.cpp#L107-L149)
+- [C++ destination resolution and request transport](https://github.com/ton-blockchain/ton/blob/ed629c416f7a03cd3838697fcee9f8cd0097700b/rldp-http-proxy/rldp-http-proxy.cpp#L1354-L1443)
+- [Tonutils-Proxy Storage retrieval](https://github.com/xssnick/Tonutils-Proxy/blob/526ece06e3c6e7398df09039a5ad0e3c144fc6ec/proxy/transport/client.go#L713-L737)
diff --git a/content/foundations/web3/ton-proxy/meta.json b/content/foundations/web3/ton-proxy/meta.json
new file mode 100644
index 000000000..19eaea95e
--- /dev/null
+++ b/content/foundations/web3/ton-proxy/meta.json
@@ -0,0 +1,10 @@
+{
+ "$schema": "../../../../meta-schema.json",
+ "title": "TON Proxy",
+ "pages": [
+ "index",
+ "forward-proxy",
+ "reverse-proxy",
+ "reference"
+ ]
+}
diff --git a/content/foundations/web3/ton-proxy/reference.mdx b/content/foundations/web3/ton-proxy/reference.mdx
new file mode 100644
index 000000000..f84c632fd
--- /dev/null
+++ b/content/foundations/web3/ton-proxy/reference.mdx
@@ -0,0 +1,150 @@
+---
+title: "TON Proxy reference"
+sidebarTitle: "Reference"
+description: "Proxy options, routing, headers, and transport behavior"
+---
+
+The options and routing describe the C++ `rldp-http-proxy` and its [Abstract Datagram Network Layer (ADNL)](/foundations/network/adnl) transport, except where another implementation is named.
+
+## Forward proxy options
+
+| Flag | Long form | Description |
+| ------------------- | ------------------- | ------------------------------------------------------------- |
+| `-p ` | `--port` | HTTP listening port on all network interfaces |
+| `-c ` | `--client-port` | UDP port for client ADNL queries |
+| `-C ` | `--global-config` | Path to the TON global network config file |
+| `-P ` | `--proxy-all` | Disable the TON hostname suffix filter (default `NO`) |
+| `-S ` | `--storage-gateway` | ADNL address of a TON Storage gateway for `.bag` resolution |
+| `-D ` | `--db` | Database root path |
+| `-d` | `--daemonize` | Install the [SIGHUP handler](#data-directory-and-daemon-mode) |
+| `-l ` | `--logname` | Log file path |
+
+## Tonutils-Proxy options
+
+These options apply to the Tonutils-Proxy v1.8.3 CLI, not to `rldp-http-proxy`.
+
+| Option | Default | Description |
+| ----------------------- | ---------------------------------------------- | ---------------------------------------------------------------- |
+| `-addr ` | `127.0.0.1:8080` | HTTP listener address and port |
+| `-global-config ` | Mainnet configuration downloaded automatically | Use a local TON network configuration file |
+| `-no-http` | Disabled | Block ordinary HTTP requests instead of forwarding them directly |
+
+## Reverse proxy options
+
+| Flag | Description |
+| --------------------------------------- | --------------------------------------------------------------------------------------------------------- |
+| `-a :` | Public IP and UDP port for inbound ADNL connections (published to the TON DHT) |
+| `-A ` | Server ADNL identity; see [key generation](/foundations/web3/ton-proxy/reverse-proxy#use-rldp-http-proxy) |
+| `-L [:]` | Forward requests for `