Crust Wiki

Crust Wiki

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

›Integration Guide

概览

  • 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

DApp的部署和运行

Currenly, Crust provides 3 ways to host DApps/websites:

  1. 💻 Crust Command Line: Allows user to publish website to Crust Network through terminal command line.
  2. 📦 Crust Pin Nodejs Package: Allows user to write javascript code to publish website to Crust Network through javascript code.
  3. 🔗 Crust IPFS Pin Github Action: Allows user to integrate standard Github Action to publish website to Crust Network.

In this guide, we will host a simple React website as an example and show how to deploy and host it on Crust Network use 3 different ways.

Create a Website

  1. Create a React app
npx create-react-app hello-crust
  1. Build it
cd hello-crust/
PUBLIC_URL=./ npm run build

Deploy to Crust IPFS Network

1. [Local Mode] Through Crust CLI

In the local mode, please make sure you have IPFS running locally, refer to this to install and run.

  • Login with seeds

SEEDS are 12 secret words of your Crust Account. You can refer to this to create your Crust Account.

npx crust-cli login [SEEDS]
  • Pin build/
npx crust-cli pin build/

You'll get an IPFS cid in this step, like QmYene5icko1cusFCG9D92YUyfonN4hmRPNdPkxvJkNjTb.

  • Publish build/
npx crust-cli publish QmYene5icko1cusFCG9D92YUyfonN4hmRPNdPkxvJkNjTb

Now your website is published into Crust Network. Storage nodes in Crust Network will get notified and try to pull your website to store.

  • Monitor website status

You can query your website's status by calling the command below, it will show you how many IPFS nodes are hosted your site.

npx crust-cli status QmYene5icko1cusFCG9D92YUyfonN4hmRPNdPkxvJkNjTb

2. [Script] Through Crust Pin Nodejs Package

We take typescript as an example, in the script mode, please make sure you have IPFS running in your code environment, refer to this to install and run.

  • Create an deploy project
mkdir site-deployer && cd site-deployer
yarn init
  • Install dependencies
yarn add ipfs-http-client @crustio/crust-pin
  • Pin site to IPFS
const IpfsHttpClient = require('ipfs-http-client');
const { globSource } = IpfsHttpClient;

/**
 * 
 * @param folderPath Site files path
 * @returns IPFS CID
 */
async function pin(path: string): Promise<string> {
    // 1. Create IPFS client
    const ipfs = IpfsHttpClient();

    // 2. Pin it
    const { cid } = await ipfs.add(globSource(path, '**/*'));

    return cid;
}

pin('./build/');
  • Publish site
import CrustPinner from '@crustio/crust-pin';

/**
 * 
 * @param cid IPFS cid
 */
async function publish(cid: string) {
    // 1. Create CrustPinner
    const crustPinner = new CrustPinner(process.env.CRUST_SEEDS);
    
    // 2. Publish to Crust
    await crustPinner.pin(cid);
}

publish('QmP71MVoZBWzuh7BLXSPTnGSm7ykhfxYEsD6YNThqQ3go7');

This deploy code sample can be found on Github.

3. [Github Action] Crust IPFS Pin

Crust also provides standard Github Action to help host website, you can refer ipfs-crust-pinner's template workflow to config your own Github CD.

It uses 2 Github Actions provided by Crust Network:

  • Crust IPFS Upload: This action helps to upload website onto Public IPFS Gateway - gw.crustfiles.app, this action also can be replaced by some pin services, such as Pinata Workflow, IPFS Cluster Workflow, ...
  • Crust IPFS Pin: This action helps to place a storage order(IPFS CID) on Chain, then the storage nodes will pull the file from local/gateway's IPFS and decentralized stored by the whole network.

[Optional] Link a domain

Once you deployed your website to Crust Network and since Crust is a standard IPFS Network, you can refer this doc to link your domain with IPFS CID.

Also, there is a standard Github Workflow to help automatically update the DNS Record of Cloudflare.

Cases

There's already some project used Crust Network to host their website application.

  • 🦄 Uniswap: Use Crust IPFS Pin Github Action
  • 🟣 Polkadot Apps: Uses Crust Pin Nodejs package
  • 🟠 Crust Apps: Use Crust IPFS Pin Github Action
  • More

Resources

  • Uniswap
  • Crust Apps
  • crust-pin
  • ipfs-crust-action
  • ipfs-upload-action
  • ipfs-crust-pinner
  • website-hosting-demo
  • ipfs-http-client
← 基于智能合约的跨链存储解决方案NFT数据存储 →
  • Create a Website
  • Deploy to Crust IPFS Network
    • 1. [Local Mode] Through Crust CLI
    • 2. [Script] Through Crust Pin Nodejs Package
    • 3. [Github Action] Crust IPFS Pin
  • [Optional] Link a domain
  • Cases
  • Resources
Docs
Getting StartedCRU ClaimsWebsite Hosting with CrustNFT Data Storage with Crust
Community
DiscordTwitterTelegram
More
CooperationGitHub
Copyright © 2025 Crust Network