CrustNetwork
Published in

CrustNetwork

Crust Storage 101 for Developers

Want to store files on Crust but still get confused? No worries, this article will give you a brief introduction to the storage process of Crust Network! You’ll learn:

  1. How to upload your file to IPFS and pin the file on Crust
  2. How to add balance and extend the expiry of your storage order
  3. How to check the storage status of your file

The following pictures show the Crust storage process in general:

STEP 1. Upload file to IPFS

First, you need to upload the file to the IPFS network(cached on a long-running IPFS node). There are 2 ways to upload the file to IPFS:

  1. Upload the file to IPFS Gateway through IPFS HTTP API
  2. Pin the file to a local IPFS node through IPFS P2P protocol

For the 1st way, Crust provides a web3-oriented gateway, which is provided by Crust storage nodes for free and 100% compatible with standard IPFS HTTP interfaces. More details in below:

  • Learn how to upload files through the Web3Auth gateway with code on LINK
  • Learn the tech detail of the Web3Auth gateway on LINK
  • Get all FREE usable gateways on LINK
  • Learn the gateways’ performance on LINK
  • More IPFS HTTP APIs on LINK

For the 2nd way, you need to install IPFS and keep it running background. More details can be referred to IPFS docs:

  • Learn how to install IPFS on LINK
  • Learn how to pin(add) file on LINK

After uploading the file to IPFS, you will get a cid, which is the unique identity of the file. Crust storage nodes also use cid to retrieve the file.

STEP 2. Pin the file on-chain and add balance

Then, you need to “tell” Crust storage nodes that the file is ready to be stored! To accomplish that, you need to send a transaction on the Crust chain. There are 2 different ways:

  1. Directly send the transaction with Crust on-chain interface
  2. Send cross-chain transaction with Crust IPFS pinning service

For the 1st way, you can simply follow the steps below to communicate with the Crust chain:

  1. Create a Crust account on LINK
  2. Get free storage quota:

a. Join Crust discord

b. Follow the pinned message on 📦free-storage channel

2. Send a transaction with typescript code on LINK

The 2nd way is for cross-chain, most public chains support directly calling Crust storage interface through standard IPFS pinning service, More details can be referred below:

  • Learn how to call Crust cross-chain storage API with code on LINK
  • Learn Crust’s cross-chain solution(How Crust IPFS pinning service work) on LINK
  • Supported platforms:

All Ethereum-compatible chains: Polygon, Moonriver, BSC, …

All substrate-compatible chains: Polkadot, Kusama, Acala, Clover, …

Others: Elrond, Solana, Flow, and Near

After you “told” Crust storage nodes, they’re starting pulling the file through the IPFS network. After a few minutes, you can query the file’s storage status on-chain:

  • How many replicas of the file exist on the IPFS through Crust Network
  • Which nodes are storing your file
  • How long will the file be guaranteed to be stored on Crust Network
  • How much is the file valued

The default storage time for a single transaction(order) is 6 months. If you want to extend the storage duration, Crust provides a pre-paid pool for you to customize the file’s storage time, it allows you to add balance and automatically extend the file’s expiry time. You can learn more details about the pre-paid pool below:

  • Learn how to add balance to the pre-paid pool on LINK
  • Learn more about Crust’s pricing model on LINK
  • Get real-time Crust storage price on LINK

STEP 3. Visually check storage status

At last, you can visually check the file’s storage states via IPFS Scan. IPFS Scan is a DApp that shows rich information of files on IPFS, including:

  1. How is the file distributed in the world
  2. Where to retrieve the file
  3. Which nodes are storing the file
  4. In which incentive layers the file are stored(Crust/Filecoin/Arweave)
  5. How much the file valued

The 1st page of IPFS Scan shows 1–2

And the 2nd page shows 3–5

With IPFS Scan, you can easily track the status of files on decentralized storage networks and monitor files’ on-chain status in incentive layers.

At last

That’s a brief introduction to Crust’s storage process, but in the Crust world, we offer much more than that! The following toolkits and some example cases may give you some ideas on how to integrate Crust into your project.

Toolkits

  1. IPFS W3Auth gateway uploader Github action: Auto-deploy the DApp/website through Github action
  2. Crust Pinner Github action: Decentralized pin(send tx) to Crust chain through Github action
  3. Crust Pinner node package: Node.js package module provides decentralized pin(send tx) to Crust chain function
  4. Crust CLI: Crust command-line tool, provides pin to local IPFS, pin to Crust(send tx), and query on-chain storage status function

Case Examples

  1. Uniswap release process with Crust Pinner Github action
  2. AAVE deploy process with Crust Pinner Github action
  3. Polkadot deploy process with Crust Pinner node package
  4. Crust Files — the E2E storage process

Demos/Code Tutorials

  1. Crust demo on LINK
  2. Crust workshop on LINK

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Crust Network

Crust Network

CRUST implements the incentive layer protocol for decentralized storage, and vision to building a decentralized cloud ecosystem.