Skip to content
Draft
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,6 @@
"foundations/shards",
"foundations/limits",
"foundations/config",
"foundations/services",
{
"group": "Merkle proofs",
"pages": [
Expand All @@ -622,6 +621,21 @@
"foundations/glossary"
]
},
{
"group": "Open network",
"pages": [
"services/overview",
{
"group": "TON Storage",
"pages": [
"services/storage/overview",
"services/storage/daemon",
"services/storage/provider",
"services/storage/faq"
]
}
]
},
{
"group": "Contribute",
"pages": [
Expand Down Expand Up @@ -676,12 +690,12 @@
},
{
"source": "/v3/concepts/dive-into-ton/ton-ecosystem/blockchain-tech",
"destination": "/foundations/services",
"destination": "/services/overview",
"permanent": true
},
{
"source": "/v3/concepts/dive-into-ton/go-from-ethereum/blockchain-services",
"destination": "/foundations/services",
"destination": "/services/overview",
"permanent": true
},
{
Expand Down Expand Up @@ -1156,7 +1170,7 @@
},
{
"source": "/v3/documentation/dapps/defi/ton-payments",
"destination": "/foundations/services",
"destination": "/services/overview",
"permanent": true
},
{
Expand Down Expand Up @@ -2116,12 +2130,12 @@
},
{
"source": "/guidelines/web3-guidelines",
"destination": "/foundations/services",
"destination": "/services/overview",
"permanent": true
},
{
"source": "/v3/guidelines/web3/overview",
"destination": "/foundations/services",
"destination": "/services/overview",
"permanent": true
},
{
Expand Down Expand Up @@ -2174,24 +2188,29 @@
"destination": "https://old-docs.ton.org/v3/guidelines/web3/ton-proxy-sites/running-your-own-ton-proxy",
"permanent": true
},
{
"source": "/foundations/services",
"destination": "/services/overview",
"permanent": true
},
{
"source": "/guidelines/ton-storage",
"destination": "https://old-docs.ton.org/guidelines/ton-storage",
"destination": "/services/storage/overview",
"permanent": true
},
{
"source": "/v3/guidelines/web3/ton-storage/storage-daemon",
"destination": "https://old-docs.ton.org/v3/guidelines/web3/ton-storage/storage-daemon",
"destination": "/services/storage/daemon",
"permanent": true
},
{
"source": "/v3/guidelines/web3/ton-storage/storage-provider",
"destination": "https://old-docs.ton.org/v3/guidelines/web3/ton-storage/storage-provider",
"destination": "/services/storage/provider",
"permanent": true
},
{
"source": "/v3/guidelines/web3/ton-storage/storage-faq",
"destination": "https://old-docs.ton.org/v3/guidelines/web3/ton-storage/storage-faq",
"destination": "/services/storage/faq",
"permanent": true
},
{
Expand Down
3 changes: 3 additions & 0 deletions foundations/services.mdx → services/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Web3 services"
sidebarTitle: "Overview"
---

import { Image } from '/snippets/image.jsx';
Expand Down Expand Up @@ -32,6 +33,8 @@ The TON Distributed Hash Table (DHT) plays a crucial role in the networking comp

TON Storage allows users to share and store files using _The Open Network_. Since storing files on-chain isn't practical, TON Storage only stores Merkle proofs for file content on-chain. It uses TON DHT to find the nodes that have a copy of a required file (e.g., a snapshot of the state of a shardchain, or an old block). Then, one might essentially create a torrent for this file and use TON DHT as a "distributed torrent tracker" for this torrent.

Read more: [TON Storage](/services/storage/overview)

## TON Proxy

TON Proxy provides a protocol where nodes wishing to offer their services (with or without compensation) as tunnels for ADNL network traffic can register. Those needing them can then choose one of these nodes based on the price, latency, and bandwidth offered. Since ADNL traffic is encrypted, Proxy can't access tunneled data, meaning that this protocol is secure.
Expand Down
115 changes: 115 additions & 0 deletions services/storage/daemon.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
title: "Run storage daemon"
sidebarTitle: "Storage daemon"
---

import { Aside } from "/snippets/aside.jsx";

`storage-daemon` downloads and shares TON Storage bags. `storage-daemon-cli` is the console client used to control it.

## Prerequisites

- Linux, macOS, or Windows host with at least a dual-core 1 GHz CPU, 2 GB RAM, 2 GB SSD (plus space for bags), and stable 10 Mb/s bandwidth with a public/static IP
- Global network config file, for example `global.config.json` from the [TON configs](https://ton-blockchain.github.io/)

## Install storage-daemon

- Download prebuilt `storage-daemon` and `storage-daemon-cli` binaries from [TON auto builds](https://github.com/ton-blockchain/ton/releases/latest) (built from the `testnet` branch).
- Or build from source in the [`ton-blockchain/ton`](https://github.com/ton-blockchain/ton/tree/testnet) repository (target: `storage-daemon` and `storage-daemon-cli`).

## Start the daemon

Run the daemon with explicit ports and a data directory:

```bash
storage-daemon -v 3 -C global.config.json -I <IP>:3333 -p 5555 -D storage-db
```

- `-v` — log verbosity (`3` = INFO)
- `-C` — path to the global network config
- `-I` — ADNL IP and port
- `-p` — TCP port for the console interface
- `-D` — path to the daemon database; CLI keys are generated inside `<db>/cli-keys/` on first start

<Aside type="tip">
Open the console port in your firewall only when needed. Keep it bound to `localhost` if the CLI runs on the same host.
</Aside>

## Connect with storage-daemon-cli

Point the CLI at the console port and keypair generated by the daemon:

```bash
storage-daemon-cli -I 127.0.0.1:5555 -k storage-db/cli-keys/client -p storage-db/cli-keys/server.pub
```

- `-I` — daemon host and console port
- `-k` — client private key path
- `-p` — server public key path (CLI option, not a port)

`storage-daemon-cli` can also run non-interactively:

```bash
storage-daemon-cli ... -c "add-by-meta bag-meta.bag" -c "list --hashes"
```

## Add bags for download

Download by bag ID hash or by meta file:

```bash
add-by-hash <BAG_ID> -d <download-dir>
add-by-meta <meta-file> -d <download-dir>
```

- `BAG_ID` — 64-character hex bag ID
- If `-d` is omitted, files are saved to the daemon's default storage directory.

`list` shows added bags; `list --hashes` prints full IDs. Use either the numeric ordinal from `list` (valid only for the current session) or the full ID in other commands.

### Inspect and control transfers

- `get <BAG_ID>` — show description, size, speed, and file list
- `get-peers <BAG_ID>` — list connected peers
- `download-pause <BAG_ID>` / `download-resume <BAG_ID>` — control downloads
- `upload-pause <BAG_ID>` / `upload-resume <BAG_ID>` — control uploads
- `remove <BAG_ID>` — remove the bag
- `remove --remove-files <BAG_ID>` — remove the bag and files (files are always removed if stored in the daemon's internal directory)

## Partial downloads and priorities

Download only selected files by setting priorities:

```bash
add-by-hash <BAG_ID> -d <download-dir> --partial file1 file2
add-by-meta <meta-file> -d <download-dir> --partial file1 file2
```

Each file has a priority `0–255`; `0` disables download. `--partial` sets listed files to `1` and all others to `0`.

Update priorities after adding the bag:

- `priority-all <BAG_ID> <priority>` — set the same priority for every file
- `priority-idx <BAG_ID> <index> <priority>` — set by file index from `get`
- `priority-name <BAG_ID> <name> <priority>` — set by file name

Priorities can be set before the full file list loads.

## Create and share a bag

Create a bag from a file or directory and start seeding:

```bash
create <path> -d "Description of the bag"
```

Options:

- `--no-upload` — create the bag without uploading; enable later with `upload-resume`
- `--copy` — copy files into the daemon's internal directory before seeding

After creation the CLI prints the bag ID. Share the meta file if others need a `.torrent`-like descriptor:

```bash
get-meta <BAG_ID> <meta-file>
```
46 changes: 46 additions & 0 deletions services/storage/faq.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: "TON Storage FAQ"
sidebarTitle: "FAQ"
---

## Assign a TON domain to a TON Storage bag

1. [Create and upload a bag](/services/storage/daemon#create-and-share-a-bag) and copy its bag ID `<BAG_ID>` (64-character hex).
1. Open Google Chrome.
1. Install a wallet browser extension:
- [TON Wallet](https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd)
- [MyTonWallet](https://chrome.google.com/webstore/detail/mytonwallet/fldfpgipfncgndfolcbkdeeknbbbnhcc)
1. Import the wallet that owns the domain using the recovery phrase.
1. Go to [dns.ton.org](https://dns.ton.org), open the domain, and select **Edit**.
1. Paste `<BAG_ID>` into the **Storage** field and save.

## Host a static TON Site from TON Storage

1. Place your static site files in a folder that includes `index.html`.
1. [Create a bag](/services/storage/daemon#create-and-share-a-bag) from the folder and upload it. Copy the bag ID.
1. Install TON Wallet or MyTonWallet in Chrome and import the domain owner's wallet.
1. Go to [dns.ton.org](https://dns.ton.org), open the domain, and select **Edit**.
1. Paste `<BAG_ID>` into the **Site** field, choose **Host in TON Storage**, and save.

## Migrate NFT content to TON Storage

For the [standard NFT collection contract](https://github.com/ton-blockchain/token-contract/blob/main/nft/nft-collection-editable.fc), update the content prefix by sending a message from the collection owner's wallet to the collection contract.

- Old prefix example: `https://mysite/my_collection/`
- New prefix format: `tonstorage://<BAG_ID>/`

After updating the prefix, upload refreshed metadata to TON Storage using the new bag ID.

## Low-level DNS records for TON Storage

Assign a bag to the DNS record with key `sha256("storage")`:

```tlb
dns_storage_address#7473 bag_id:uint256 = DNSRecord;
```

Assign a static site bag directly to the DNS record with key `sha256("site")`:

```tlb
dns_storage_address#7473 bag_id:uint256 = DNSRecord;
```
38 changes: 38 additions & 0 deletions services/storage/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: "TON Storage overview"
sidebarTitle: "Overview"
---

import { Aside } from "/snippets/aside.jsx";

TON Storage is TON's torrent-like distributed file storage layer. It lets services and users publish **bags of files** and retrieve them over [ADNL and RLDP](/foundations/whitepapers/ton#3-1-abstract-datagram-network-layer) with verifiable [Merkle proofs](/foundations/serialization/merkle). Bags stay off-chain; Merkle proofs let you pair storage logic with smart contracts for storage providers - when enforceable on-chain terms are needed.

## What TON Storage delivers

- Distribute large files without placing data on-chain
- Prove that a storage provider still holds a bag through on-chain proofs
- Attach bags to TON DNS domains for human-readable access and TON Sites
- Run private or public providers that charge for storage

## Core pieces

- **Bag of files**: a torrent-like package. Its Merkle root (the **bag ID**) uniquely identifies the bag. The meta file (`.bag` equivalent) contains torrent info and header data.
- **storage-daemon** and **storage-daemon-cli**: download, seed, and manage bags. The CLI controls a running daemon.
- **Storage provider contracts**: smart contracts that accept paid storage requests, manage balances, and verify proofs.
- **Networking**: data travels over ADNL using RLDP. Each bag uses its own overlay network, and peers are discovered through TON DHT.

<Aside type="note">
TON Storage reuses torrent-style terms (torrent, bag, pieces) but transports data over ADNL/RLDP instead of BitTorrent.
</Aside>

## When to use TON Storage

- Host static TON Sites directly from TON Storage
- Distribute application assets, media, or snapshots with verifiable integrity
- Operate a paid storage service with proof-of-storage guarantees

## Next steps

- Run the daemon and work with bags: [Storage daemon](/services/storage/daemon)
- Operate or consume paid storage: [Storage provider](/services/storage/provider)
- Common flows and DNS records: [TON Storage FAQ](/services/storage/faq)
Loading