SiaSia Developer Portal

Quickstart

Sia is a decentralized storage network where all data is encrypted client-side, erasure-coded into redundant shards, and distributed across independent storage providers worldwide. An indexer — hosted by sia.storage or self-hosted — coordinates uploads, downloads, and object management without ever seeing your data.

Getting to a working app takes four steps: install an SDK, connect a storage account, store an object, and download it back.

Install the SDK

sh
cargo add sia_storage

The snippets below assume a connected sdk instance. If you haven't connected yet, start with Connect a Storage Account.

Upload and pin

Storing an object is two calls: upload, which encrypts the data and distributes it across the network, and pin, which saves the upload to the user's account so it can be listed, synced, and kept healthy. The returned Object ID is the object's permanent identifier — derived from its content, and used later to download it.

rust
use sia_storage::{Object, UploadOptions}; let reader = std::io::Cursor::new(b"hello, world!"); let obj = Object::default(); let obj = sdk.upload(obj, reader, UploadOptions::default()).await?; sdk.pin_object(&obj).await?; println!("Object ID: {}", obj.id());

Download it back

Download fetches the object's encrypted pieces from storage providers, verifies integrity, and decrypts the data locally. It returns a reader that streams decrypted bytes into any destination.

rust
use sia_storage::DownloadOptions; let mut reader = sdk.download(&obj, DownloadOptions::default())?; let mut bytes = Vec::new(); tokio::io::copy(&mut reader, &mut bytes).await?; println!("Downloaded: {}", String::from_utf8_lossy(&bytes));