• boost 管理存储交易 作为存储提供商 boostd


    1. 源码编译 boost

    • Go
    • Rust
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    
    • 1
    • Node 16.x
    curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
    
    • 1
    # curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
    
    ## Installing the NodeSource Node.js 16.x repo...
    
    
    ## Populating apt-get cache...
    
    + apt-get update
    Hit:1 https://mirrors.ustc.edu.cn/ubuntu bionic InRelease
    Hit:2 https://mirrors.ustc.edu.cn/ubuntu bionic-security InRelease
    Hit:3 https://mirrors.ustc.edu.cn/ubuntu bionic-updates InRelease
    Hit:4 https://mirrors.ustc.edu.cn/ubuntu bionic-backports InRelease
    Reading package lists... Done
    
    ## Confirming "bionic" is supported...
    
    + curl -sLf -o /dev/null 'https://deb.nodesource.com/node_16.x/dists/bionic/Release'
    
    ## Adding the NodeSource signing key to your keyring...
    
    + curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg >/dev/null
    
    ## Creating apt sources list file for the NodeSource Node.js 16.x repo...
    
    + echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x bionic main' > /etc/apt/sources.list.d/nodesource.list
    + echo 'deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x bionic main' >> /etc/apt/sources.list.d/nodesource.list
    
    ## Running `apt-get update` for you...
    
    + apt-get update
    Hit:1 https://mirrors.ustc.edu.cn/ubuntu bionic InRelease
    Hit:2 https://mirrors.ustc.edu.cn/ubuntu bionic-security InRelease
    Hit:3 https://mirrors.ustc.edu.cn/ubuntu bionic-updates InRelease
    Hit:4 https://mirrors.ustc.edu.cn/ubuntu bionic-backports InRelease
    Get:5 https://deb.nodesource.com/node_16.x bionic InRelease [4,584 B]
    Get:6 https://deb.nodesource.com/node_16.x bionic/main amd64 Packages [771 B]
    Fetched 5,355 B in 2s (3,015 B/s)
    Reading package lists... Done
    
    ## Run `sudo apt-get install -y nodejs` to install Node.js 16.x and npm
    ## You may also need development tools to build native addons:
         sudo apt-get install gcc g++ make
    ## To install the Yarn package manager, run:
         curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
         echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
         sudo apt-get update && sudo apt-get install yarn
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    # apt-get install -y nodejs
    
    • 1
    # node --version
    v16.17.0
    # nodejs --version
    v16.17.0
    
    • 1
    • 2
    • 3
    • 4
    • 安装依赖
    apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y
    
    • 1
    • 源码编译
    git clone https://github.com/filecoin-project/boost
    
    • 1
    git checkout v1.3.1
    
    • 1
    cd boost
    make build
    
    • 1
    • 2
    # make install
    install -C ./boost /usr/local/bin/boost
    install -C ./boostd /usr/local/bin/boostd
    install -C ./boostx /usr/local/bin/boostx
    install -C ./devnet /usr/local/bin/devnet
    
    • 1
    • 2
    • 3
    • 4
    • 5

    2. Lotus-miner 存储交易迁移到 Boost

    # lotus wallet new bls
    t3uub5z5eq54dyn47eqrdu3lzja6swrqcnqb5ioqy76jzzftd6sy5ip6mx3nk33mjy5ta352tvazu672av6aha
    # lotus wallet new bls
    t3vnlz2lkhqcqpoz4tcrz5elpb5czkivovisgdx4soo4khhu5zf7xkztwurejp2axthb27vuyqlmukt25itpma
    # lotus wallet list
    t3uub5z5eq54dyn47eqrdu3lzja6swrqcnqb5ioqy76jzzftd6sy5ip6mx3nk33mjy5ta352tvazu672av6aha  200000 FIL                      0
    t3vnlz2lkhqcqpoz4tcrz5elpb5czkivovisgdx4soo4khhu5zf7xkztwurejp2axthb27vuyqlmukt25itpma  400000 FIL                      0
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    # cat .bashrc
    # boost
    # 支付gas
    export PUBLISH_STORAGE_DEALS_WALLET=t3uub5z5eq54dyn47eqrdu3lzja6swrqcnqb5ioqy76jzzftd6sy5ip6mx3nk33mjy5ta352tvazu672av6aha
    # 交易质押钱包
    export COLLAT_WALLET=t3vnlz2lkhqcqpoz4tcrz5elpb5czkivovisgdx4soo4khhu5zf7xkztwurejp2axthb27vuyqlmukt25itpma
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    # lotus-miner actor control list
    name       ID      key           use    balance
    owner      t01001  t3q643kqv...         25889488.771194519408595749 FIL
    worker     t01002  t3r6eokq6...  other  499737.298673045941055627 FIL
    control-0  t01005  t3uub5z5e...  post   199999.999994318897462335 FIL
    
    • 1
    • 2
    • 3
    • 4
    • 5
    # lotus-miner actor control set --really-do-it t3ryaqr3yqqiqfwvzwte5kmitr6ddwfgebuvr3345jhytv7feophtfrab23rwotu7hw6dtosdx7nou2g2liqzq $PUBLISH_STORAGE_DEALS_WALLET
    
    • 1
    # lotus-miner actor control list
    name       ID      key           use    balance
    owner      t01001  t3q643kqv...         25889488.771193722464667227 FIL
    worker     t01002  t3r6eokq6...  other  499737.298673045941055627 FIL
    control-0  t01007  t3ryaqr3y...  post   372300.999865340920629146 FIL
    control-1  t01005  t3uub5z5e...  post   199999.999994318897462335 FIL
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    # lotus auth api-info --perm=admin
    FULLNODE_API_INFO=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.xkPKcf84CZoT1tkPnMcY396DHanm09YxzPLH4lewOfE:/ip4/127.0.0.1/tcp/1234/http
    # lotus-miner auth api-info --perm=admin
    MINER_API_INFO=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.m-_KmX6XxV6ZQaGtgEywXcu46nmBkG-JQOoCQf2CiNY:/ip4/192.168.2.53/tcp/2345/http
    
    • 1
    • 2
    • 3
    • 4
    # tail .bashrc
    # api
    export FULLNODE_API_INFO=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.xkPKcf84CZoT1tkPnMcY396DHanm09YxzPLH4lewOfE:/ip4/127.0.0.1/tcp/1234/http
    export MINER_API_INFO=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.m-_KmX6XxV6ZQaGtgEywXcu46nmBkG-JQOoCQf2CiNY:/ip4/192.168.2.53/tcp/2345/http
    
    • 1
    • 2
    • 3
    • 4
    # tail .bashrc
    export APISEALER=MINER_API_INFO=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.m-_KmX6XxV6ZQaGtgEywXcu46nmBkG-JQOoCQf2CiNY:/ip4/192.168.2.53/tcp/2345/http
    export APISECTORINDEX=MINER_API_INFO=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.m-_KmX6XxV6ZQaGtgEywXcu46nmBkG-JQOoCQf2CiNY:/ip4/192.168.2.53/tcp/2345/http
    
    • 1
    • 2
    • 3

    3. 备份lotus-miner

    # lotus-miner stop
    
    • 1
    # lotus-shed market export-datastore --repo $LOTUS_MINER_PATH --backup-dir /root/lotus-miner-backup
    
    • 1
    # ls -lh lotus-miner-backup/
    total 100K
    markets.datastore.backup
    
    • 1
    • 2
    • 3

    4. 初始化 boostd

    boostd --vv migrate-monolith \
           --import-miner-repo=$LOTUS_MINER_PATH \
           --api-sealer=$APISEALER \
           --api-sector-index=$APISECTORINDEX \
           --wallet-publish-storage-deals=$PUBLISH_STORAGE_DEALS_WALLET \
           --wallet-deal-collateral=$COLLAT_WALLET \
           --max-staging-deals-bytes=50000000000 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    # boostd --vv migrate-monolith \
    >        --import-miner-repo=$LOTUS_MINER_PATH \
    >        --api-sealer=$APISEALER \
    >        --api-sector-index=$APISECTORINDEX \
    >        --wallet-publish-storage-deals=$PUBLISH_STORAGE_DEALS_WALLET \
    >        --wallet-deal-collateral=$COLLAT_WALLET \
    >        --max-staging-deals-bytes=50000000000
    Opening repo '/2k/lotus-miner-local-net'
    Initializing boost repo
    Trying to connect to full node RPC
    Checking full node sync status
    Worker: 19557; Base: 87746; Target: 87747 (diff: 1)
    State: complete; Current Epoch: 87747; Todo: 0
    
    Done!
    Checking if repo exists at ~/.boost
    Checking full node version
    Creating boost repo
    Migrating datastore keys
    Importing all legacy markets datastore keys under /deals/provider
    Importing 98 legacy markets datastore keys
    Imported 98 legacy markets datastore keys under /deals/provider
    Importing all legacy markets datastore keys under /retrievals/provider
    Importing 3 legacy markets datastore keys
    Imported 3 legacy markets datastore keys under /retrievals/provider
    Importing all legacy markets datastore keys under /storagemarket
    Importing 8 legacy markets datastore keys
    Imported 8 legacy markets datastore keys under /storagemarket
    Migrating keystore
    Migrating markets config
    Sector index api info: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.m-_KmX6XxV6ZQaGtgEywXcu46nmBkG-JQOoCQf2CiNY:/ip4/192.168.2.53/tcp/2345/http
    Sealer api info: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.m-_KmX6XxV6ZQaGtgEywXcu46nmBkG-JQOoCQf2CiNY:/ip4/192.168.2.53/tcp/2345/http
    Adding miner address f01003 to datastore
    Migrating storage.json file
    dagstore directory size: 1.4 MB
    dagstore directory size is 1.4 MB. Copy [c] / Move [m] / Ignore [i]:
    c
    Copying /2k/lotus-miner-local-net/dagstore to /root/.boost/dagstore
    Boost repo successfully created at /root/.boost
    You can now start boost with 'boostd -vv run'
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40

    5. 更新 lotus-miner 配置文件

    • 在矿工配置中禁用市场子系统
    cp $LOTUS_MINER_PATH/config.toml $LOTUS_MINER_PATH/config.toml.backup
    
    • 1
    # cat config.toml
    [Subsystems]
      EnableMarkets = false
    
    • 1
    • 2
    • 3
    • 更改 Libp2p 端口
    # cat config.toml
    [Libp2p]
      #ListenAddresses = ["/ip4/192.168.2.53/tcp/3333"]
      ListenAddresses = ["/ip4/192.168.2.53/tcp/3334"]
      #AnnounceAddresses = ["/ip4/192.168.2.53/tcp/3333"]
      AnnounceAddresses = ["/ip4/192.168.2.53/tcp/3334"]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    6. 运行 lotus-miner

    nohup lotus-miner run >> /var/log/2k/miner.log 2>&1 &
    
    • 1
    # lotus-miner info
    Sectors:
    	Total: 31
    	Proving: 31
    
    Workers: Seal(1) WdPoSt(0) WinPoSt(0)
    ERROR: fatal error calling 'Filecoin.MarketListIncompleteDeals': panic in rpc method 'Filecoin.MarketListIncompleteDeals': runtime error: invalid memory address or nil pointer dereference
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 添加环境变量解决lotus-miner info 报错信息
    # tail .bashrc
    export LOTUS_MARKETS_PATH=/root/.boost
    
    • 1
    • 2

    7. boostd 运行

    # boostd --version
    boostd version 1.3.0+git.91a3053
    
    • 1
    • 2
    nohup boostd --vv run >> /var/log/2k/boostd.log 2>&1 &
    
    • 1

    8. Web UI

    # cd boost/
    # cd react/
    
    • 1
    • 2
    # npm install
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE could not resolve
    npm ERR!
    npm ERR! While resolving: apollo-link-ws@1.0.20
    npm ERR! Found: subscriptions-transport-ws@0.11.0
    npm ERR! node_modules/subscriptions-transport-ws
    npm ERR!   subscriptions-transport-ws@"^0.11.0" from the root project
    npm ERR!   peerOptional subscriptions-transport-ws@"^0.9.0 || ^0.11.0" from @apollo/client@3.5.5
    npm ERR!   node_modules/@apollo/client
    npm ERR!     @apollo/client@"^3.4.16" from the root project
    npm ERR!     @apollo/client@"latest" from @apollo/react-hooks@4.0.0
    npm ERR!     node_modules/@apollo/react-hooks
    npm ERR!       @apollo/react-hooks@"^4.0.0" from the root project
    npm ERR!
    npm ERR! Could not resolve dependency:
    npm ERR! peer subscriptions-transport-ws@"^0.9.0" from apollo-link-ws@1.0.20
    npm ERR! node_modules/apollo-link-ws
    npm ERR!   apollo-link-ws@"^1.0.20" from the root project
    npm ERR!
    npm ERR! Conflicting peer dependency: subscriptions-transport-ws@0.9.19
    npm ERR! node_modules/subscriptions-transport-ws
    npm ERR!   peer subscriptions-transport-ws@"^0.9.0" from apollo-link-ws@1.0.20
    npm ERR!   node_modules/apollo-link-ws
    npm ERR!     apollo-link-ws@"^1.0.20" from the root project
    npm ERR!
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force, or --legacy-peer-deps
    npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
    npm ERR!
    npm ERR! See /root/.npm/eresolve-report.txt for a full report.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /root/.npm/_logs/2022-08-22T07_11_33_351Z-debug-0.log
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    # npm install --force
    
    • 1
    # npm run build
    
    > boost@0.1.0 build
    > npm run relay && react-scripts build
    
    
    > boost@0.1.0 relay
    > npx relay-compiler --schema ../gql/schema.graphql --src ./src/ --watchman false $@
    
    
    Writing js
    Unchanged: 0 files
    Creating an optimized production build...
    Compiled with warnings.
    
    src/DealPublish.js
      Line 5:44:  'ShortDealID' is defined but never used  no-unused-vars
    
    Search for the keywords to learn more about each warning.
    To ignore, add // eslint-disable-next-line to the line before.
    
    File sizes after gzip:
    
      151.33 kB  build/static/js/main.9004b31a.js
      4.4 kB     build/static/css/main.0632f2d1.css
      1.67 kB    build/static/js/787.c683930d.chunk.js
    
    The project was built assuming it is hosted at /.
    You can control this with the homepage field in your package.json.
    
    The build folder is ready to be deployed.
    You may serve it with a static server:
    
      npm install -g serve
      serve -s build
    
    Find out more about deployment here:
    
      https://cra.link/deployment
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    http://localhost:8080
    
    • 1
    http://192.168.2.53:8080/
    
    • 1

    boost

    # boostd auth api-info --perm admin
    BOOST_API_INFO=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.m-_KmX6XxV6ZQaGtgEywXcu46nmBkG-JQOoCQf2CiNY:/ip4/127.0.0.1/tcp/1288/http
    root@ubuntu-03:~#
    
    • 1
    • 2
    • 3

    9. Boost 迁移到另外一台机器

    # scp boost boostd boostx root@192.168.2.3:/usr/local/bin/
    
    • 1
    # scp -r .boost root@192.168.2.3:/root/boost
    
    • 1
    # tail .bashrc
    # api
    export FULLNODE_API_INFO=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.xkPKcf84CZoT1tkPnMcY396DHanm09YxzPLH4lewOfE:/ip4/192.168.2.53/tcp/1234/http
    export MINER_API_INFO=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.m-_KmX6XxV6ZQaGtgEywXcu46nmBkG-JQOoCQf2CiNY:/ip4/192.168.2.53/tcp/2345/http
    
    • 1
    • 2
    • 3
    • 4
    root@ubuntu-05:~# ifconfig | grep inet
            inet 192.168.2.30  
            
    root@ubuntu-05:~/boost# cat config.toml
    [Libp2p]
      ListenAddresses = ["/ip4/0.0.0.0/tcp/3333"]
      AnnounceAddresses = ["/ip4/192.168.2.53/tcp/3333"]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    参考

    1. boost-docs
  • 相关阅读:
    悬镜安全在RSAC2022上斩获Global InfoSec Awards四项大奖
    【小程序】小程序开发中背景及图片图片失效处理……
    C++面向对象(一)
    头条百科是什么?创建头条百科效果怎么样?
    文章解读与仿真程序复现思路——电网技术EI\CSCD\北大核心《计及氢储能与需求响应的路域综合能源系统规划方法》
    Android约束布局ConstraintLayout的Guideline,CardView
    批量kill进程
    Tensorflow笔记——卷积神经网络
    如何在 Azure 容器应用程序上部署具有 Elastic Observability 的 Hello World Web 应用程序
    【K哥爬虫普法】网盘用的好,“艳照门”跑不了
  • 原文地址:https://blog.csdn.net/u010953692/article/details/126406623