A storage provider is a paid TON Storage service. It combines a smart contract that holds client balances with aDocumentation Index
Fetch the complete documentation index at: https://companyname-a7d5b98e-ton-storage.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
storage-daemon that downloads bags, keeps them available, and submits storage proofs.
Prerequisites
storage-daemonrunning with network connectivity and persistent storage- Wallet with at least 1 TON to deploy and fund the provider contract
- Global network config file and access to the TON blockchain (mainnet or testnet)
How the provider flow works
- The provider owner starts
storage-daemon, deploys the provider contract, and configures limits and rates. - A client packages files into a bag and generates a storage request message for the provider contract.
- The contract creates a dedicated storage contract for that bag.
- The daemon detects the request, downloads the bag, and activates the storage contract.
- The client tops up the storage contract balance. The provider submits periodic proofs to continue earning payments.
- When the balance drains or the provider declines the request, the contract deactivates and the obligation to store the bag ends.
Use an existing provider (client side)
-
Fetch provider parameters to confirm limits and rates:
The output includes whether new contracts are accepted, min/max bag size (bytes), storage rate (nanoTON per MB per day), and max proof interval.
<PROVIDER_ADDRESS>— address of the provider’s smart contract
-
Create a bag and generate the storage request body:
<BAG_ID>— 64-character hex bag ID<OUTPUT_FILE>— file path to write the generated message body- Large bags can take time to process.
- The message body is saved to
<OUTPUT_FILE>; it is not a full internal message. - Query ID can be any
0to2^64-1. The provider will echo it back. - The generated body embeds the provider’s current rate and max span. Regenerate the message if the provider changes these before sending.
-
Send the generated body as an internal message to
<PROVIDER_ADDRESS>from any wallet. On success the storage contract returns a message withop=0xbf7bd0c1. After the provider downloads the bag it sendsop=0xd4caedcd.
Track balance and close a contract
- The storage contract balance decreases over time according to the provider’s rate and the bag size.
- Top up at any time by transferring TON to the storage contract address.
- Read the current balance with the
get_storage_contract_datagetter (balanceis the second value). - Close voluntarily by sending a message with
op=0x79f937eafrom the client’s wallet; reuse any query ID.
Run a provider (operator side)
-
Start
storage-daemonwith provider mode enabled: -
Deploy the provider contract from
storage-daemon-cli: -
Set local limits to control daemon behavior:
max contracts— maximum concurrent storage contractsmax total size— total size of bags the provider accepts
-
Set on-chain parameters before accepting clients:
- Omit any flag to keep its current value.
- Avoid running several
set-provider-paramscommands back to back; wait for on-chain updates to finalize. - Fund the provider contract with more than 1 TON to cover future transactions, but avoid large deposits during initial non-bounceable setup.
accept is set to 1, the provider contract starts creating storage contracts for incoming requests. The daemon automatically downloads bags, seeds them, and submits proofs.
Operate and withdraw
-
List active contracts and balances:
Client$shows client-provided funds;Contract$shows total contract funds. The difference is the provider’s earnings. -
Withdraw earnings:
-
<ADDRESS>— destination TON account to receive funds -
Close a contract explicitly:
-
<CONTRACT_ADDRESS>— address of the storage contract to close Closing transfers available funds to the main provider contract. Bags are deleted unless shared by other active contracts. -
Send TON from the provider contract to any address:
-
<AMOUNT_NANOTON>— amount in nanotons to transfer