Move Data Storages

There are 3 popular options to store persistent data in Move smart contract:

1. Resources within an Account

Resources within an account form the bedrock of Move's storage, tied directly to an account or address. They are uniquely stored per account type, accessible through specific functions like move_to for storage and borrow_global for retrieval. While they offer a straightforward way to attach state to accounts, their storage is limited by gas costs and the size constraints of a single resource. To circumvent these limitations, structs can contain other structs or vectors, though this introduces its own complexities.

2. Tables

Tables in Move provide a flexible key, value storage mechanism, distinct from resources by allowing multiple instances of the same struct type without collision risks. They're particularly useful for applications requiring efficient, deterministic access to large datasets. Aptos enhances tables with structures like BigVector and SmartVector for scalable data handling, and SmartTable for condensed storage, optimizing space and access efficiency in global storage.

3. Objects

Objects offer a nuanced approach to data storage, allowing resources to be owned and controlled by accounts or other objects, enhancing the compositional capabilities of on-chain data. This model facilitates the management of multiple resource instances under a single account or contract, streamlining the development of complex applications across various domains by leveraging object ownership and transferability.