Smart Space Management
This section describes how storage space in CESS network is classified and managed.
Space classification
The storage space in the CESS network is divided into three classes: unverified space, idle space, and active space.
Unverified space: Unverified space refers to the space reported by the storage node itself, which is specified by the miner through its set up configuration to indicate how much space from the hard disk can be used for CESS network. The larger the specified space, the more CESS tokens are staked. However, this portion of unverified space does not bring any rewards.
Idle space: Idle space is a verified space. In terms of CESS network, it refers to the space that can be purchased; in terms of users, it refers to the remaining space that can store data; in terms of storage nodes, it refers to the space that stores idle file, and can earn rewards.
Active space: Active space is a verified space, which refers to the space where user data is stored. Active space can earn more rewards for a storage node.
Whole network space management
Storage nodes are a globally distributed network, with each node providing unequal storage and computing power. In order to ensure that the data in storage nodes are verifiable, CESS proposed a space management mechanism that reports all storage nodes' spaces to the chain. The spaces are managed by the chain to prevent storage nodes from committing malicious acts.
The space management mechanism is divided into three stages:
Filling stage: A storage node searches for TEE worker to fill its space. TEE worker generates a unique and verifiable data for the storage node in TEE. The storage node reports the data hash to the CESS chain, which records and add the idle space to the storage node.
Usage stage: When a storage node has idle space, it can receive user data for storage, and the data will be cut to the same size as its idle data. Once the storage node confirms that the user data has been successfully stored, it will randomly delete the idle space of the same size, and report this action to the CESS chain. The CESS chain will increase the active space and reduce the idle space of the storage node .
Challenge stage: When a storage node has idle or active space, the CESS chain will challenge it at irregular intervals. The storage node must complete the corresponding data challenge (proof of data calculation) within a specified time, and report the proof to the CESS chain. The CESS chain will verify the proof, and reward the storage node if the verification is successful, and punish the storage node if the verification fails.
Storage node space management
Storage node space management will regularly check the status of the hard disk, calculate the available space on the hard disk and the space used by the storage node. It will also check the data on the storage node. The action serves the following two main purposes:
Ensure that the storage node does not occupy space that exceeds the configured capacity for the hard disk. When the available hard disk space is less than 2GB, even if the configured capacity is not reached, the storage node will still stop storing idle file;
Regularly clean up invalid data, including malformed data, expired cache, and challenge failed data, to ensure that the data stored in the storage node is valid.
Please do not store your own data under the working directory specified for storage nodes to prevent data from being cleared.
Before storing idle data, storage node will read its hard disk status. Only when the available space of the hard disk is greater than 2GB and the configured capacity is not reached yet, can storage of idle data earn some rewards.
After the storage node stores user data, it randomly selects an idle data for deletion and reports the event to the network.
The storage node will periodically clear invalid data, and users can also manually run the clear command bucket tidy
. This command will identify all files under the configuration directory and delete those files that do not meet the format or size requirements.