# How It Works

## Architecture Overview

Stonest operates as a three-layer protocol: the Encryption Layer, the Distribution Layer, and the Verification Layer.

{% stepper %}
{% step %}

### Upload & Encrypt

When a user uploads a file to Stonest:

1. The file is encrypted client-side using AES-256-GCM
2. The encrypted file is split into multiple shards using erasure coding
3. Each shard is assigned a unique content identifier (CID) based on its cryptographic hash
4. Encryption keys remain exclusively with the user — they never leave the client device
   {% endstep %}

{% step %}

### Shard & Distribute

Encrypted shards are distributed across the Stonest network:

1. The protocol selects optimal storage nodes based on geographic diversity, uptime history, and available capacity
2. Each shard is replicated across a minimum of 8 nodes (configurable up to 32 for critical data)
3. Node selection ensures geographic distribution — no two replicas are stored in the same region
4. Storage deals are recorded on-chain, creating an immutable record of where data resides
   {% endstep %}

{% step %}

### Verify & Seal

The network continuously verifies data integrity:

1. Node operators submit Proof-of-Storage proofs at regular intervals (every \~30 minutes)
2. Proofs are verified on-chain by the Stonest validator network
3. Operators who fail to prove storage face slashing penalties on their staked tokens
4. Successfully verified data is "sealed" — cryptographically committed to permanent storage
   {% endstep %}
   {% endstepper %}

### Data Retrieval

When a user requests their data:

1. The client identifies which nodes hold the required shards via on-chain storage records
2. Shards are retrieved from the nearest/fastest available nodes
3. An intelligent caching layer serves frequently accessed data from edge nodes
4. The client reassembles shards and decrypts the file locally

### Node Operator Requirements

Anyone can become a Stonest node operator by:

* Staking a minimum of 10,000 tokens
* Providing verifiable storage capacity (minimum 1 TB)
* Maintaining 99.5%+ uptime
* Running the Stonest node software on reliable hardware


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://stonest.gitbook.io/stonest-docs/how-it-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
