How does storage work on Flow?

Daniela
Daniela
  • Updated

On Flow, each account has associated storage used and a storage capacity. The storage used is the byte size of all the data stored in the account's storage. The storage capacity, on the other hand, is directly tied to the amount of Flow tokens an account has. An account can use any amount of storage up to its storage capacity without any additional cost. If a transaction puts an account over storage capacity or drops an account's balance below the minimum 0.001 Flow tokens, that transaction fails and is reverted.

All data that is in an account's storage counts towards storage used. This includes metadata that marks that the account exists, an empty FLOW vault, stored receiver capability, public keys to the account if the account was created with keys, smart contracts deployed on the account if the account was created with contracts, and the value of the account’s storage used as an unsigned integer. Adding additional keys, smart contracts, capabilities, resources, etc. to the account counts towards storage used.

Data stored on the Flow blockchain is stored in a key-value ledger. Each item’s key contains the address that owns the item and the path to the item. An account can have many keys, therefore Flow considers the account key items are stored with. This means that the storage used by each item is the byte length of the item plus the byte length of the item’s key.

For large media assets such as videos and high-definition images, it usually isn’t practical to store them on the Flow blockchain due to practical constraints. Instead, decentralized storage networks such as IPFS are recommended, where you can store the content hash on the blockchain and then store the source file off-chain.

For more information, please refer to our Flow documentation on Storage and External Storage Networks.