Crust Wiki

Crust Wiki

  • 文档
  • Shadow
  • 贡献
  • Languages icon中文
    • English
    • Help Translate

›Crosschain Storage Solution

概览

  • Crust 概述
  • Crust Grants
  • Crust 生态成长计划
  • CRU 认领
  • 锁定的CRU 认领
  • 锁定的CRU 解锁
  • Bridge

    • Ethereum Bridge
    • Elrond Bridge
  • Crust 钱包
  • Crust 术语
  • CRU18 担保
  • 参数表
  • 贡献

学习

  • 账户
  • Crust 通证
  • 新增绑定
  • 担保人
  • 验证人
  • GPoS
  • sWorker

    • 概览
    • 入网
    • 工作量
  • 去中心化存储市场
  • 存储商户
  • 链上身份
  • 链上治理指南

构建

  • Builder's Portal
  • Crust Storage 101
  • Basics

    • Developer faucet
    • Crust Rocky Network
    • 代码示例:使用Crust存储文件
    • Store file with Crust IPFS Pinning Service API

    Crosschain Storage Solution

    • 基于XCMP的跨链存储解决方案
    • 基于平行链的跨链存储解决方案
    • 基于原生IPFS的跨链存储解决方案
    • 基于智能合约的跨链存储解决方案

    Integration Guide

    • DApp的部署和运行
    • NFT数据存储
    • 内容存储与分发

    Node Guide

    • Crust 节点
    • Crust Storage Manager

    Toolkits

    • Crust Pinner Github Action
    • Crust Pinner NPM Package
    • IPFS W3Auth Gateway
    • IPFS W3Auth Pinning Service

基于EVM构建

  • Overview
  • Build With EVM 101
  • Chains

    • Ethereum
    • Optimism
    • Arbitrum
    • zkSync

    Toolkits

    • SDK

基于Algorand构建

  • Overview
  • Build With Algorand 101
  • Algorand applications

基于TON构建

  • Overview
  • Build With TON 101
  • TON applications

节点

  • 节点概要
  • 节点硬件指南
  • Owner 节点
  • Member 节点
  • Isolation 节点
  • 验证人指南
  • 担保人指南
  • sWorker 版本
  • 节点权益
  • 配置 QoS

存储

  • 概览
  • 存储用户指南
  • 存储商户指南
  • 存储订单清算指南
  • 存储市场权益
  • 使用Crust Apps 存储的问题

Q&A

  • 基础知识
  • 验证人和候选人
  • 担保人
  • 奖励和惩罚
  • 节点基本问题
  • Member节点相关
  • 组相关
  • 修复不稳定链
  • 应用
  • EPID & ECDSA
  • 其它
Translate

基于智能合约的跨链存储解决方案

Introduction

Decentralized storage(dStorage) is the fundamental of Web3 ecosystem. As a supplement to the costly on-chain storage, dStorage can scale horizontally as distributed network and store unlimited data theoretically.

Ethereum's Web3 stack lists some important considerations about dStorage:

  • Persistence mechanism and incentive structure
  • Data retention enforcement
  • Decentrality
  • Consensus

Based on these thoughts, dStorage projects are usually a standalone blockchain with consensus supporting data retention ability, incentive mechanism, and data persistence. The chart below shows an analysis of several mainstream Storage projects and their strategies for data retention and data persistence.

As the fundamental of Web3 ecosystem, dStorage is designed to serve the entire web3 ecosystem, including DApp hosting, NFT metadata storage, GameFi and social media data storage, even hosting the Metaverse. So we want to use a single web3 identity for DApps and personal data storage rather than multiple accounts. It's very similar to SSO(Single Sign-On) in Web2 world.

There are many smart contract platforms such as Ethereum, Polkadot, Near, Polygon, Solana... Every platform has its own DApp ecosystem. Web3 users use different identities to call smart contracts on each blockchain. And providing dStorage to users on different blockchains becomes a basic requirement for dStorage projects.

Solution

Crust Network provides storage smart contract integrations for various smart contract platforms.

It is a combination of:

  • Storage Smart Contract: users can place order on various platforms
  • Merchant node: service node which runs monitoring and order processes provided by Crust Network

smart contract

1. Storage Smart Contract

Storage Smart Contract is deployed by Crust Network on various blockchain platforms. Currently, the Storage Smart Contract has been deployed on following platforms:

  • Ethereum
  • Arbitrum one
  • Polygon
  • Astar
  • Aptos
  • Elrond
Storage Smart Contract main functions

Funtions for contract owner

  1. add_order_node: Add merchant service node
  2. remove_order_node: Remove merchant service node
  3. set_order_price: Set order price which includes order base price and byte price
  4. set_size_limit: Set file size limit
  5. set_service_rate: Set merchant service fee rate

Functions for users

  1. get_price: Get file price by size, file_price = base_price + byte_price * size / 1024^2, price = file_price * (service_price_rate + 100) / 100
  2. place_order: Place order with cid
  3. place_order_with_node: Place order with indicated node

JS Code sample(Ethereum compatible):

// Place order in ethereum compatible platform, you can get the storageOrder contract instance by ethers.js or web3.js as you like
// For more information please refer to allow "https://docs.ethers.io/v5/" and "https://web3js.readthedocs.io/en/v1.7.3/"
const fileCid = "QmfH5zLmBtptUxRSGWazaumGwSsCW3n6P164eRXpbFatmJ";
const fileSize = 5246268;

// Firstly get price in ETH with file size
const StorageOrderABI = [
  "function getPrice(uint size) public view returns (uint price)",
  "function placeOrder(string cid, uint size) external payable",
  "function placeOrderWithNode(string cid, uint size, address nodeAddress) public payable",
  "event Order(address customer, address merchant, string cid, uint size, uint price)",
]

// Astar's ABI is different
// const StorageOrderABI = [
//   "function getPrice(uint size) public view returns (uint price)",
//   "function placeOrder(string cid, uint64 size) external payable",
// ]

// Take Ethereum for example
const StorageOrderAddress = "0x6e9469673257e21b3e75bb9292c9ab009bc481d4";
const provider = new ethers.providers.JsonRpcProvider();
const signer = provider.getSigner()
const storageOrder = new ethers.Contract(StorageOrderAddress, StorageOrderABI, provider);
const storageOrderSigner = storageOrder.connect(signer);
const price = await storageOrderSigner.getPrice(fileSize);

// Secondly placeOrder with cid, size and price 
await storageOrderSigner.placeOrder(fileCid, fileSize, {value: price})
// You can also place order with an indicated node
// const order_node = "0xc582Bc0317dbb0908203541971a358c44b1F3766";
// await storageOrderSigner.placeOrderWithNode(fileCid, fileSize, order_node, {value: price})

For Aptos sample, please refer to this doc

For Elrond sample, please refer to this doc

2. Merchant node

Everyone can start a storage contract node to provide a place order service as a merchant node.

Merchant node helps customers place storage orders on Crust Network and obtains a service fee in return decided by service price rate(service_fee = file_price * service_price_rate / 100).

Cases now

Storage Smart Contract has already been used by several platforms including:

  • [Smart Contract] Ethereum
  • [Smart Contract] Arbitrum one
  • [Smart Contract] Polygon
  • [Smart Contract] Astar
  • [Smart Contract] Aptos
  • [Smart Contract] Elrond
← 基于原生IPFS的跨链存储解决方案DApp的部署和运行 →
  • Introduction
  • Solution
  • Cases now
Docs
Getting StartedCRU ClaimsWebsite Hosting with CrustNFT Data Storage with Crust
Community
DiscordTwitterTelegram
More
CooperationGitHub
Copyright © 2025 Crust Network