FilSwan开发文档
中文(简体)
  • 开始
    • FilSwan 概览
    • 协议栈
      • 跨链共识层
      • Peer-to-Peer (P2P) 网络
      • 支付频道
      • Service Discovery
      • 数据市场
      • 索引和缓存市场
      • Web3 任务bid市场
      • 存储层
      • 计算层
      • CDN 层
      • 治理
    • 联系我们
      • 社交账号&社区
      • 商业合作
  • Filswan Platform
    • 概览
      • FilSwan 竞价系统
      • Web3自动交易匹配
      • 信誉系统
    • 主要功能
      • 任务管理
        • 创建新任务
        • Navigate Tasks
        • 更新任务
        • 分配任务
      • 我的资料
        • 注册成为存储提供商
      • 寻找存储提供商
        • 存储提供商详情
      • DataCap订单续期服务
  • Multichain.Storage
    • 概览
      • Flink
    • Multichain.Storage 用户指南
      • 公链测试网
      • 设置MetaMask
      • 用Alchemy RPC URL配置MetaMask
    • 开发人员快速入门
      • SDK
        • js mcs SDK
          • 开始
          • 上传文件
          • 支付存储费用
          • 铸造NFT
          • 文件列表
          • 获取文件详情
          • 获取文件在Filecoin上的状态
          • SDK安装视频教程
        • python mcs SDK
          • 开始
          • 上传文件
          • Stream Upload Files
          • 支付存储费用
          • 铸造NFT
          • 文件列表
          • 获取文件详情
      • 更多资源
    • 运行Multichain.Storage节点
    • Multichain Storage 概述
      • Flink
      • Multichain.Storage Mumbai测试网用户指南
      • Multichain.Storage Polygon 主网用户指南
    • 开发人员快速入门
      • SDK
        • js-mcs-sdk
          • 开始
          • 上传文件
          • 支付数据存储费用
          • Mint NFTs资产
          • 列出文件
          • 获取文件详细信息
          • 获取文件的Filecoin状态
      • 其他资源
  • Swan Provider
    • 概览
    • 功能
    • 使用指南
      • 前提条件
      • 安装
      • 配置并运行
      • Swan Provider 视频教程
    • 常见问题
      • 1. Storage Provider 绑定新账号
      • 2. 如何检查您的 Storage Provider 连通性/稳定性
      • 3. 如何暂停接受自动竞价订单
      • 4. aria2_download_dir 和aria2_candidate_dirs 的区别
      • 5. Boostd 正常运行情况下如何配置从 Swan Provider 接收订单
      • 6. 接单过程中总出现拒绝信息
      • 7. 如何检查 aria2 是否在运行?
      • 8. Swan Platform 无响应
      • 9. Storage Provider 状态显示“Offline/离线”
      • 10. 如何检查任务状态
      • 11. 如何配置 Storage Provider Market
      • 12. 如何设置接单条件
  • SWAN CLIENT
    • 概览
    • 基本概念须知
    • 使用指南
      • Filecoin 交易发送引擎
        • 安装
        • 配置
        • 前提条件
        • 生成 CAR 文件
        • Meta-CAR
        • 上传 CAR 文件到 IPFS
        • 创建任务
      • 区块链 RPC 服务
        • 部署 RPC 服务
        • RPC 命令
      • Swan Client 视频教程
  • FS3
    • 概览
    • Setup your FS3
      • 前提
      • 安装 FS3
      • FS3安装视频教程
    • FS3 User Guide
    • FS3 User Guide (Cloud Version)
    • FS3手册中文版
  • 开发资源
    • Swan Token 合约
      • Acquire Testnet USDC and MATIC tokens
    • FilSwan API
    • MCS API
    • MCS 2.0 API
    • Flink API
    • FS3 API
    • API密钥
    • 有关FilSwan的常见问题
Powered by GitBook
On this page
  • System Design
  • How does MCS work?
  • Modules
  • How Can I Start Building
  • Prerequisites
  • Installation
  • After Installation
  • Configuration
  1. Multichain.Storage

开发人员快速入门

Previous用Alchemy RPC URL配置MetaMaskNextSDK

Last updated 2 years ago

Multi-Chain Storage (hereinafter called the 'MCS') is a suite of Ethereum scaling solutions that enables high-throughput, low cost smart contracts while remaining trustworthy secure.

The following documentation describes how to use MCS, which is currently live on Polygon Mumbai Testnet. Whether you're a developer that just wants to start building or you're curious into digging deeper into the internals of MCS and how it works, this site is the right place for you.

System Design

How does MCS work?

Modules

Token Swap: Token Swap module is in charge of swap the user's token to wrapped token, it can be USDC or other tokens.

  1. Users pay USDC or other tokens, which are called user tokens, when uploading a file.

  2. MCS uses FIL, which is called wrapped token, to pay when store data to Filecoin network.

  3. User tokens should be changed to wrapped token by this module and this step is called token exchange(swap).

  4. Token exchange(swap) is done through Sushi Swap which is a DEX.

Payment Module:

  1. After a file is uploaded, the money to be paid is estimated based on the

    • the average price of all the swan miners;

    • file size;

    • duration;

  2. In refund step, the overpayment part that is locked will be returned to user wallet

DAO Signature: If DAO detects that the file uploaded has been chained, it will trigger a signature operation

How Can I Start Building

Prerequisites

  • OS: Ubuntu 20.04 LTS

  • Mysql5.5+

Lotus Node

  • Lotus node is used for making car files and sending offline deals.

  • Install lotus node or louts lite node in the same machine as MCS.

  • Lotus full node is too heavy compared with lotus lite node, so lotus lite node is preferred.

  • Lotus lite node depends on a lotus node, so ensure that a lotus node exists somewhere when using lotus lite node.

Installation

wget https://github.com/filswan/multi-chain-payment/releases/tag/v1.0.1/install.sh
./install.sh

Option2️⃣ Source Code

🔔go 1.16+ is required

git clone https://github.com/filswan/multi-chain-payment.git
cd multi-chain-payment
git checkout <release_branch>
./build_from_source.sh

After Installation

  • Before executing, you should check your configuration in ~/.swan/mcp/config.toml to ensure it is right.

vi ~/.swan/mcp/config.toml
  • Before executing, you should check your enviornment variable in ~/.swan/mcp/.env to ensure it is right.

vi ~/.swan/mcp/.env
  • After set your config and env variable in the related files, you can run multi-chain-payment in ./build directory.

./build/multi-chain-payment

Note

  • Logs are in directory ./logs

  • You can add nohup before ./multi-chain-payment to ignore the HUP (hangup) signal and therefore avoid stop when you log out.

  • You can add >> mcp.log in the command to let all the logs output to mcp.log.

  • You can add & at the end of the command to let the program run in background.

  • Such as:

nohup ./multi-chain-payment-0.2.1-rc1-unix >> mcp.log &   #After installation from Option 1
nohup ./build/multi-chain-payment >> ./build/mcp.log &    #After installation from Option 2

Configuration

You need to modify the config file and input your config params, the configuration items will be introduced below:

config.toml

  • port: Web api port.

  • release: When work in release mode: set this to true, otherwise to false and environment. variable GIN_MODE not to release.

  • swan_platform_fil_wallet: The wallet address used to pay on the Filecoin network.

  • filink_url: Deals data can be searched from here.

[lotus]

[ipfs_server]

  • download_url_prefix: IPFS server url prefix, such as: http://[ip]:[port]. Store car files for downloading by storage provider. Car file url will be [download_url_prefix]/ipfs/[file_hash]

  • upload_url_prefix: IPFS server url for uploading files, such as http://[ip]:[port]

[swan_task]

  • dir_deal: Output directory for saving generated Car files and CSVs.

  • verified_deal: [true/false] Whether deals in this task are going to be sent as verified.

  • fast_retrieval: [true/false] Indicates that data should be available for fast retrieval.

  • start_epoch_hours: start_epoch for deals in hours from current time.

  • expired_days: expected completion days for storage provider sealing data.

  • max_price: Max price willing to pay per GiB/epoch for offline deal.

  • generate_md5: [true/false] Whether to generate MD5 for each car file, note: this is a resource consuming action.

[polygon]

  • rpc_url: your polygon network RPC URL.

  • payment_contract_address: swan payment gateway address on polygon to lock money.

  • sushi_dex_address: sushi address on polygon.

  • usdc_wFil_pool_contract: address to get exchange rate between USDC and wFil from sushi on polygon.

  • dao_contract_address: swan DAO address on polygon, to receive DAO signatures.

  • mcp_payment_receiver_address: MCS wallet address to receive money from unlock operation.

  • gas_limit: gas limit for transaction.

  • unlock_interval_minute: unlock interval in minutes between 2 unlock operations, in cannot be less than 1.

.env

  • privateKeyOnPolygon: private key of the wallet used to execute contract methods on the polygon network and pay for gas.

If you're looking to discover how MCS works, the best place to begin is by the section, which gives a high level overview of MCS's internals. From there, you can jump into more detailed explainers on various components of the system.

Then the estimated amount of money will be locked to the payment contract address, see .

In unlock step, the amount pay to Filecoin network by swan platform FIL wallet, will be transferred to MCS payment receiver address, see .

Swan Client API: More information can be found .

Data DAO: More information can be found at .

IPFS: More information can be found .

Filecoin Storage: More information can be found .

Option1️⃣

Option2️⃣

Option1️⃣ Prebuilt package: See

client_api_url: URL of lotus client web api, such as: http://[ip]:[port]/rpc/v0, generally the [port] is 1234. See

client_access_token: Access token of lotus client web api. It should have admin access right. You can get it from your lotus node machine using command lotus auth create-token --perm admin. See

Want to learn more? Check out the and . Join the team on .

User Guide
Configuration
Configuration
here
Flink
here
here
Lotus Node
IPFS Client
install a lotus full node
install a lotus lite node
release assets
Lotus API
Obtaining Tokens
open source code
API
Discord