Skip to content

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.

ShortLongTypeDescriptionDefault
-v--verbosityintVerbosity level 0–10WARNING
-V--versionflagPrint build information and exitnone
-h--helpflagPrint help and exitnone
-I--ipIP:PORTPublic IP and UDP port for ADNL. Use :<PORT> for client mode (binds to 127.0.0.1)none
-p--control-portuint16TCP port for storage-daemon-cli connections0
-C--global-configpathTON global config filenone
-D--dbpathDatabase root directorynone
-d--daemonizeflagSet SIGHUP handler (detach from terminal)none
-l--lognamepathWrite logs to filenone
-P--storage-providerflagEnable the storage provider subsystemdisabled
ShortLongTypeDescription
-h--helpflagPrint help and exit
-v--verbosityintVerbosity level 0–20
-V--versionflagPrint build information and exit
-I--ipIP:PORTAddress of the running storage-daemon control port
-k--keypathClient private key file (<DB>/cli-keys/client)
-p--pubpathServer public key file (<DB>/cli-keys/server.pub)
-c--cmdstringExecute one command and exit (repeatable)

Bags are identified by BagID (64-character hex string) or by list index from list.

CommandArgumentsDescription
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
CommandArgumentsDescription
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

These commands require the daemon to run with --storage-provider. See storage provider for setup instructions.

CommandArgumentsDescription
import-pk<FILE>Import wallet private key from file
deploy-providernoneDeploy a new provider smart contract
init-provider<SMC_ADDR>Attach to an existing provider contract
remove-storage-providernoneDetach 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-allnoneSend 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
CommandArgumentsDescription
setverbosity<LEVEL>Set log verbosity (0–10)
help[provider]Print command help; help provider shows provider commands
exit / quitnoneExit the CLI

Source: storage/storage-daemon/smc-util.cpp.

MethodReturnsDescription
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 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

Source: storage/storage-daemon/smc-util.cpp and StorageProvider.h.

ParameterDefaultDescription
accept_new_contractsfalseMust be set to true before accepting clients
rate_per_mb_day1,000,000 nanoTONPrice per MB per day (1 MB = 10⁶ bytes)
max_span86,400 sMaximum seconds between proof submissions
min_file_size1,048,576 bytes (2²⁰)Minimum bag size
max_file_size1,073,741,824 bytes (2³⁰)Maximum bag size
max_contracts (local)1,000Maximum active storage contracts managed by the daemon
max_total_size (local)137,438,953,472 bytes (128 GiB)Maximum total bytes across all contracts

The dns_storage_address record type is documented in the TON DNS reference.