Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 4 additions & 5 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 All @@ -14,13 +15,11 @@ Although many people refer to TON only as a blockchain, _The Open Network_ is a
- A service for assigning human-readable names to accounts, smart contracts, services, and network nodes (TON DNS)
- A platform for micro-payments (TON Payments)

This article provides a general overview of TON Services, beyond the blockchain.

## TON Network

TON Network is a peer-to-peer network used for accessing the TON Blockchain, sending transactions, and receiving updates. Also, it can support arbitrary distributed services, blockchain-related or not. The cornerstone in TON networking is the ADNL protocol, built on top of the TCP/UDP stack.

The TON Distributed Hash Table (DHT) plays a crucial role in the networking component of the TON Project, as it is used to locate other nodes in the network. You can think of it as a big, persistent key-value data storage. The keys of the TON DHT are simply 256-bit integers. In most cases, they are computed as sha256 hashes of a TL-serialized objects. The values assigned to these 256-bit keys are essentially arbitrary byte strings of limited length.
The TON Distributed Hash Table (DHT) plays a crucial role in the networking component of the TON Project, as it is used to locate other nodes in the network. It acts as a persistent key-value data storage. The keys of the TON DHT are simply 256-bit integers. In most cases, they are computed as sha256 hashes of a TL-serialized objects. The values assigned to these 256-bit keys are essentially arbitrary byte strings of limited length.

<Image
src="/resources/images/open-network/adnl.png"
Expand All @@ -30,13 +29,13 @@ The TON Distributed Hash Table (DHT) plays a crucial role in the networking comp

## TON Storage

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.
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. The [TON Storage overview](/services/storage/overview) explains how storage works in detail.

## 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.

Running TON Proxy allows you to visit TON Sites (HTTP over ADNL). This can be combined with TON DNS and other TON Services, forming together what is called "Open Network".
Running TON Proxy allows access to TON Sites (HTTP over ADNL). This can be combined with TON DNS and other TON Services, forming together what is called "Open Network".

## TON DNS

Expand Down
131 changes: 131 additions & 0 deletions services/storage/daemon.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
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 listen IP and port (`<IP>` 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

<Aside type="tip">
Open the console port in the firewall only when needed. Keep the daemon bound to `localhost` when `storage-daemon-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
- `<DOWNLOAD_DIR>` — target directory for downloaded files
- `<META_FILE>` — path to the bag meta file
- 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)

<Aside
type="caution"
>
`remove --remove-files` deletes local files. Run it only when the files are backed up or no longer needed.
</Aside>

## 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.

- `<priority>` — integer priority from `0` (do not download) to `255` (highest)
- `<index>` — file index from the `get` output
- `<name>` — file name from the `get` output

## Create and share a bag

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

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

- `<PATH>` — file or directory to include in 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>
```

- `<META_FILE>` — path to save the generated 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 the 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 storage flows pair with smart contracts, such as 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