TON Storage reference
Complete reference for storage-daemon and storage-daemon-cli. Step-by-step walkthroughs live in How to use the storage daemon and How to run a storage provider.
Source: storage/storage-daemon/storage-daemon.cpp and storage/storage-daemon/storage-daemon-cli.cpp.
Daemon flags
Section titled “Daemon flags”| Short | Long | Type | Description | Default |
|---|---|---|---|---|
-v | --verbosity | int | Verbosity level 0–10 | WARNING |
-V | --version | flag | Print build information and exit | none |
-h | --help | flag | Print help and exit | none |
-I | --ip | IP:PORT | Public IP and UDP port for ADNL. Use :<PORT> for client mode (binds to 127.0.0.1) | none |
-p | --control-port | uint16 | TCP port for storage-daemon-cli connections | 0 |
-C | --global-config | path | TON global config file | none |
-D | --db | path | Database root directory | none |
-d | --daemonize | flag | Set SIGHUP handler (detach from terminal) | none |
-l | --logname | path | Write logs to file | none |
-P | --storage-provider | flag | Enable the storage provider subsystem | disabled |
storage-daemon-cli flags
Section titled “storage-daemon-cli flags”| Short | Long | Type | Description |
|---|---|---|---|
-h | --help | flag | Print help and exit |
-v | --verbosity | int | Verbosity level 0–20 |
-V | --version | flag | Print build information and exit |
-I | --ip | IP:PORT | Address of the running storage-daemon control port |
-k | --key | path | Client private key file (<DB>/cli-keys/client) |
-p | --pub | path | Server public key file (<DB>/cli-keys/server.pub) |
-c | --cmd | string | Execute one command and exit (repeatable) |
CLI commands
Section titled “CLI commands”Bags are identified by BagID (64-character hex string) or by list index from list.
Bag management
Section titled “Bag management”| Command | Arguments | Description |
|---|---|---|
create | <PATH> [-d DESC] [--no-upload] [--copy] [--json] | Create a bag from a file or directory |
add-by-hash | <BAG_ID> [-d DIR] [--paused] [--no-upload] [--partial file…] [--json] | Add a bag by BagID (hex) |
add-by-meta | <METAFILE> [-d DIR] [--paused] [--no-upload] [--partial file…] [--json] | Add a bag from a metafile |
list | [--hashes] [--json] | List all bags |
get | <BAG> [--json] | Show full bag information |
get-meta | <BAG> <FILE> | Export bag metafile to <FILE> |
get-peers | <BAG> [--json] | List peers connected for a bag |
get-pieces-info | <BAG> [--files] [--offset L] [--max-pieces M] [--json] | Show piece availability bitmap |
remove | <BAG> [--remove-files] | Remove bag; --remove-files also deletes downloaded files |
load-from | <BAG> [--meta META] [--files PATH] | Provide meta and data for an incomplete bag |
Download and upload control
Section titled “Download and upload control”| Command | Arguments | Description |
|---|---|---|
download-pause | <BAG> | Pause download |
download-resume | <BAG> | Resume download |
upload-pause | <BAG> | Pause upload |
upload-resume | <BAG> | Resume upload |
priority-all | <BAG> <P> | Set all files’ download priority to <P> (0–255; 0 = skip) |
priority-idx | <BAG> <IDX> <P> | Set download priority for file at index <IDX> |
priority-name | <BAG> <NAME> <P> | Set download priority for file named <NAME> |
get-speed-limits | [--json] | Show global download and upload speed limits |
set-speed-limits | [--download X] [--upload X] | Set global speed limits in bytes/s or unlimited |
Storage provider management
Section titled “Storage provider management”These commands require the daemon to run with --storage-provider. See storage provider for setup instructions.
| Command | Arguments | Description |
|---|---|---|
import-pk | <FILE> | Import wallet private key from file |
deploy-provider | none | Deploy a new provider smart contract |
init-provider | <SMC_ADDR> | Attach to an existing provider contract |
remove-storage-provider | none | Detach provider from daemon (on-chain contracts unaffected) |
get-provider-params | [ADDRESS] [--json] | Show provider contract parameters |
set-provider-params | [--accept 0|1] [--rate X] [--max-span X] [--min-file-size X] [--max-file-size X] | Update contract parameters |
get-provider-info | [--balances] [--contracts] [--json] | Show provider status |
set-provider-config | [--max-contracts X] [--max-total-size X] | Set local daemon limits |
withdraw | <ADDRESS> | Send earnings from one storage contract to the main contract |
withdraw-all | none | Send earnings from all contracts with balance ≥ 1 TON |
send-coins | <ADDRESS> <AMOUNT> [--message MSG] | Send nanoTON from main contract to an address |
close-contract | <ADDRESS> | Close a storage contract and remove bag |
new-contract-message | <BAG> <FILE> [--query-id ID] --provider <ADDR> | Write new-contract message body to file, fetching rate from <ADDR> |
new-contract-message | <BAG> <FILE> [--query-id ID] --rate <R> --max-span <S> | Same, with rate and span specified manually |
Utility
Section titled “Utility”| Command | Arguments | Description |
|---|---|---|
setverbosity | <LEVEL> | Set log verbosity (0–10) |
help | [provider] | Print command help; help provider shows provider commands |
exit / quit | none | Exit the CLI |
Provider contract get-methods
Section titled “Provider contract get-methods”Source: storage/storage-daemon/smc-util.cpp.
| Method | Returns | Description |
|---|---|---|
get_wallet_params | (seqno: uint32, subwallet_id: uint32, public_key: bits256) | Wallet authentication parameters used to construct external messages |
get_storage_contract_data | (active: int, balance: Coins, provider: address, microchunk_hash: bits256, file_size: uint64, next_proof: uint64, rate_per_mb_day: Coins, max_span: uint32, last_proof_time: uint32, client: address, torrent_hash: bits256) | Full state of a per-bag storage contract |
Pricing format
Section titled “Pricing format”Pricing is expressed in nanoTON per MB per day, where 1 MB = 10⁶ bytes (decimal megabyte). Source: storage-daemon-cli.cpp help text --rate Price of storage, nanoTON per MB*day; field name rate_per_mb_day in ProviderParams (StorageProvider.h).
Default rate at contract deployment: 1,000,000 nanoTON per MB per day (smc-util.cpp: store_coins(b, 1'000'000)).
Conversion example:
| Rate (nanoTON/MB/day) | Rate (TON/GB/month) |
|---|---|
| 1,000,000 | ~30 |
| 10,000,000 | ~300 |
Formula: rate_TON_per_GB_per_month = rate_nanoTON_per_MB_per_day × 1000 × 30 / 1,000,000,000
Default provider parameters
Section titled “Default provider parameters”Source: storage/storage-daemon/smc-util.cpp and StorageProvider.h.
| Parameter | Default | Description |
|---|---|---|
accept_new_contracts | false | Must be set to true before accepting clients |
rate_per_mb_day | 1,000,000 nanoTON | Price per MB per day (1 MB = 10⁶ bytes) |
max_span | 86,400 s | Maximum seconds between proof submissions |
min_file_size | 1,048,576 bytes (2²⁰) | Minimum bag size |
max_file_size | 1,073,741,824 bytes (2³⁰) | Maximum bag size |
max_contracts (local) | 1,000 | Maximum active storage contracts managed by the daemon |
max_total_size (local) | 137,438,953,472 bytes (128 GiB) | Maximum total bytes across all contracts |
DNS record
Section titled “DNS record”The dns_storage_address record type is documented in the TON DNS reference.