• lotus 存储数据 2k 本地测试网


    1. 导入数据生成DAG

    # lotus client import f1.txt
    Import 1660877215125943727, Root bafkqabtimvwgy3yk
    
    • 1
    • 2
    • payload CID 有效负载数据CID bafkqabtimvwgy3yk

    1.1 查看导入数据历史记录

    # lotus client local
    1660877215125943727: bafkqabtimvwgy3yk @/root/f1.txt (import)
    
    • 1
    • 2

    2. 交互式交易流程

    # lotus client deal
    Data CID (from lotus client import): bafkqabtimvwgy3yk
    .. calculating data size
    Deal duration (days): 70
    Miner Addresses (f0.. f0..), none to find: t01003
    .. querying miner asks
    -----
    Proposing from t3q643kqvcwytttalpp7gissoqdguy5w3s2ouhpafd6r4m7aulu34twtyo6sjosi5igi6dc3inqgz7qdg434iq
    	Balance: 4500829.999997486590436988 FIL
    
    Piece size: 128B (Payload size: 49B)
    Duration: 1680h0m0s
    Total price: ~0.000000000089208 FIL (0.000000000000000059 FIL per epoch)
    Verified: false
    
    Accept (yes/no): yes
    .. executing
    Deal (t01003) CID: bafyreibj5th5grj3uc5mp2lgbrdskroldhfi74yfec5yspqq45s4dtdfn4
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    3. 检查交易状态

    # lotus client list-deals --show-failed
    DealCid      DealId  Provider  State                     On Chain?  Slashed?  PieceCID     Size   Price                     Duration  Verified
    ...s4dtdfn4  0       t01003    StorageDealError          N          N         ...pyzedona  127 B  0.000000000089297326 FIL  1513514   false
      Message: unexpected deal status while waiting for data request: 11 (StorageDealFailing). Provider message: deal rejected: invalid deal end epoch 1705897: cannot be more than 1555200 past current epoch 19590
    ...hp2ngrle  0       t01003    StorageDealError          N          N         ...pyzedona  127 B  0.000000000038290174 FIL  648986    false
      Message: unexpected deal status while waiting for data request: 11 (StorageDealFailing). Provider message: deal rejected: piece size less than minimum required size: 128 < 256
    ...ygqr4mvm  0       t01003    StorageDealClientFunding  N          N         ...lylzz4ii  508 B  0.000000000155119832 FIL  651764    false
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    4. 数据传输

    4.1 交互发送交易

    # lotus client import f1.txt
    Import 1660877215125943730, Root bafk2bzacebyimduo6cnnerejxe6k2rff6kdcto437ma7nk4ynvgfrvwfzft7a
    
    # lotus client deal
    Data CID (from lotus client import): bafk2bzacebyimduo6cnnerejxe6k2rff6kdcto437ma7nk4ynvgfrvwfzft7a
    .. calculating data size
    Deal duration (days): 30
    Miner Addresses (f0.. f0..), none to find: t01003
    .. querying miner asks
    -----
    Proposing from t3q643kqvcwytttalpp7gissoqdguy5w3s2ouhpafd6r4m7aulu34twtyo6sjosi5igi6dc3inqgz7qdg434iq
    	Balance: 4500829.999997057980985512 FIL
    
    Piece size: 512B (Payload size: 462B)
    Duration: 720h0m0s
    Total price: ~0.000000000154224 FIL (0.000000000000000238 FIL per epoch)
    Verified: false
    
    Accept (yes/no): yes
    .. executing
    Deal (t01003) CID: bafyreiaw3nirmpu3sfkctdwsxxfqpkggacjujdob3dbj6ehmvmygqr4mvm
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

    4.2 命令发送交易

    lotus client deal bafk2bzacebyimduo6cnnerejxe6k2rff6kdcto437ma7nk4ynvgfrvwfzft7a t01003 0.000000000000000238 518400
    
    • 1

    4.3 查看交易数据传输

    lotus client list-transfers
    
    • 1
    • 交易数据会传输到miner,交易扇区数据封装好了之后会自动清空
    $LOTUS_MINER_PATH/deal-staging
    
    • 1

    5. 离线数据交易

    5.1 生成car文件

    lotus client generate-car f1.txt f1.car
    
    • 1
    # lotus client commP f1.car
    CID:  baga6ea4seaqptzgfgsyo25o2v33wd2bnvfmdfmkcvfvbgxtgeyi4vi3lylzz4ii
    Piece size:  508 B
    
    • 1
    • 2
    • 3
    • 错误用法
    # lotus-miner storage-deals import-data baga6ea4seaqptzgfgsyo25o2v33wd2bnvfmdfmkcvfvbgxtgeyi4vi3lylzz4ii /root/f1.car
    ERROR: failed getting deal baga6ea4seaqptzgfgsyo25o2v33wd2bnvfmdfmkcvfvbgxtgeyi4vi3lylzz4ii: No state for /baga6ea4seaqptzgfgsyo25o2v33wd2bnvfmdfmkcvfvbgxtgeyi4vi3lylzz4ii: datastore: key not found
    
    • 1
    • 2
    # lotus client commP f1.car
    CID:  baga6ea4seaqptzgfgsyo25o2v33wd2bnvfmdfmkcvfvbgxtgeyi4vi3lylzz4ii
    Piece size:  508 B
    
    # lotus client import --car /root/f1.car
    Import 1660877215125943732, Root bafk2bzacebyimduo6cnnerejxe6k2rff6kdcto437ma7nk4ynvgfrvwfzft7a
    
    # lotus client deal bafk2bzacebyimduo6cnnerejxe6k2rff6kdcto437ma7nk4ynvgfrvwfzft7a t01003 0.000000000000000238 518400
    bafyreiatfsnpfy45uqklut5zu4a3tkbcdmtnattmtpcdnsqfu7jcrpvenu
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    # lotus-miner info
    
    Sectors:
    	WaitDeals: 1
    
    • 1
    • 2
    • 3
    • 4
    # lotus-miner storage-deals import-data bafyreiatfsnpfy45uqklut5zu4a3tkbcdmtnattmtpcdnsqfu7jcrpvenu /root/f1.car
    
    • 1

    6. 交易管理

    # lotus-miner storage-deals get-ask
    Price per GiB/Epoch  Verified           Min. Piece Size (padded)  Max. Piece Size (padded)  Expiry (Epoch)  Expiry (Appx. Rem. Time)  Seq. No.
    0.0000000005 FIL     0.00000000005 FIL  256 B                     2 KiB                     1001111         1086h43m12s               0
    
    • 1
    • 2
    • 3
    # lotus client query-ask t01003
    Ask: t01003
    Price per GiB: 0.0000000005 FIL
    Verified Price per GiB: 0.00000000005 FIL
    Max Piece size: 2 KiB
    Min Piece size: 256 B
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    # lotus-miner storage-deals list -v
    
    • 1
    # lotus-miner info
         Publish: 1   512 B  (Verified: 0 0 B)
    
    • 1
    • 2

    6.1 待发布交易,手动发布交易

    # lotus-miner storage-deals pending-publish
    Publish period:             1h0m0s (ends in 34m26s)
    First deal queued at:       2022-08-19 14:32:51.319608057 +0800 CST
    Deals will be published at: 2022-08-19 15:32:51.319608057 +0800 CST
    1 deals queued to be published:
    ProposalCID                                                  Client                                                                                  Size
    bafyreiatfsnpfy45uqklut5zu4a3tkbcdmtnattmtpcdnsqfu7jcrpvenu  t3q643kqvcwytttalpp7gissoqdguy5w3s2ouhpafd6r4m7aulu34twtyo6sjosi5igi6dc3inqgz7qdg434iq  512B
    
    # lotus-miner storage-deals pending-publish --publish-now
    triggered deal publishing
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    lotus-miner storage-deals set-ask \
        --price 0.0000000 \
        --verified-price 0.0000000  \
        --min-piece-size 256KiB \
        --max-piece-size 32GB
    
    • 1
    • 2
    • 3
    • 4
    • 5

    7. 离线交易

    • --manual-stateless-deal 需要设置存储报价为0
    # lotus client deal --manual-stateless-deal=true --manual-piece-cid=baga6ea4seaqptzgfgsyo25o2v33wd2bnvfmdfmkcvfvbgxtgeyi4vi3lylzz4ii --manual-piece-size=508 baga6ea4seaqptzgfgsyo25o2v33wd2bnvfmdfmkcvfvbgxtgeyi4vi3lylzz4ii t01003 0.000000000000000238 518400
    ERROR: when manual-stateless-deal is enabled, you must also provide a 'price' of 0 and specify 'manual-piece-cid' and 'manual-piece-size'
    
    • 1
    • 2

    7.1 查看存储报价

    # lotus-miner storage-deals get-ask
    Price per GiB/Epoch  Verified           Min. Piece Size (padded)  Max. Piece Size (padded)  Expiry (Epoch)  Expiry (Appx. Rem. Time)  Seq. No.
    0.0000000005 FIL     0.00000000005 FIL  256 B                     2 KiB                     1001111         1084h40m0s                0
    
    • 1
    • 2
    • 3
    # lotus client query-ask t01003
    Ask: t01003
    Price per GiB: 0.0000000005 FIL
    Verified Price per GiB: 0.00000000005 FIL
    Max Piece size: 2 KiB
    Min Piece size: 256 B
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    7.2 设置存储报价为0

    lotus-miner storage-deals set-ask --price 0.0000000 --verified-price 0.0000000 --max-piece-size 2KiB --min-piece-size 256B
    
    • 1
    # lotus client query-ask t01003
    Ask: t01003
    Price per GiB: 0 FIL
    Verified Price per GiB: 0 FIL
    Max Piece size: 2 KiB
    Min Piece size: 256 B
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    7.3 发送离线订单

    # lotus client generate-car f1.txt f1.car
    # lotus client commP /root/f1.car
    CID:  baga6ea4seaqptzgfgsyo25o2v33wd2bnvfmdfmkcvfvbgxtgeyi4vi3lylzz4ii
    Piece size:  508 B
    # lotus client deal --manual-stateless-deal --manual-piece-cid=baga6ea4seaqptzgfgsyo25o2v33wd2bnvfmdfmkcvfvbgxtgeyi4vi3lylzz4ii --manual-piece-size 508 baga6ea4seaqptzgfgsyo25o2v33wd2bnvfmdfmkcvfvbgxtgeyi4vi3lylzz4ii t01003 0 518400
    bafyreifwlkxr6mteheh2jejr3zdzqrvy3alkewrphrfszozs23dt4yyd3m
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    7.4 Piece size 大小

    # cat piece_size.sh
    #!/bin/bash
    #usage method:(bash ./piece_size.sh 3.969 GiB)
    Size=$1
    Type=$2
    mm=`echo $Size|awk -F"." '{print $1}'`
    for (( i=1;i<=10;i++ )) ; do  let "n=2**$i" ; if [ $mm -le $n ] ; then PieceSize_=$n ; break ; fi ; done
    if [[ $Type == "GiB" ]];then let "PieceSize=$PieceSize_*254*1024*1024*1024/256" ; elif [[ $Type == "MiB" ]];then let "PieceSize=$PieceSize_*254*1024*1024/256" ; elif [[ $Type == "KiB" ]];then let "PieceSize=$PieceSize_*254*1024/256" ; elif [[ $Type == "B" ]];then let "PieceSize=$PieceSize_*254/256" ; else  echo "Type is err" ; fi
    echo manual-piece-size=$PieceSize
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    # bash piece_size.sh 462 B
    manual-piece-size=508
    
    • 1
    • 2

    7.5 查看交易状态

    • StorageDealWaitingForData 等待数据
    # lotus-miner storage-deals list
    ...dt4yyd3m  0       StorageDealWaitingForData     t3q643kqvcwytttalpp7gissoqdguy5w3s2ouhpafd6r4m7aulu34twtyo6sjosi5igi6dc3inqgz7qdg434iq  512B  0 FIL                     520270
    
    • 1
    • 2

    7.6 mienr手动导入离线数据

    lotus-miner storage-deals import-data bafyreifwlkxr6mteheh2jejr3zdzqrvy3alkewrphrfszozs23dt4yyd3m /root/f1.car
    
    • 1

    8. 矿工地址发布到网络中

    [Libp2p]
      ListenAddresses = ["/ip4/192.168.2.30/tcp/3333"]
      AnnounceAddresses = ["/ip4/192.168.2.30/tcp/3333"]
    
    • 1
    • 2
    • 3
    # lotus-miner actor set-addrs /ip4/192.168.2.30/tcp/3333
    Requested multiaddrs change in message bafy2bzaced3oasehq2khyumv3sjqcg774uv2hgflelnesx6uizfzt5eqawrqu
    
    • 1
    • 2
    # lotus-miner net reachability
    
    • 1
    # lotus-miner net listen
    /ip4/192.168.2.30/tcp/3333/p2p/12D3KooWD5qUSj8GrN3bwgMnSZw8UFXf5V5aHMYn5Wfa6pPJTZEb
    
    • 1
    • 2

    9. 其它节点查询报价

    root@ubuntu-05:~# lotus client query-ask t01003
    Ask: t01003
    Price per GiB: 0 FIL
    Verified Price per GiB: 0 FIL
    Max Piece size: 2 KiB
    Min Piece size: 256 B
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    9.1 发布交易

    # lotus client import f2.txt
    Import 1660892473222112702, Root bafk2bzaceamepf7hlecxfwlcskwi2hzld2hmzsepbg6yfi5uduu5gby2qqj3q
    
    • 1
    • 2
    # lotus client deal
    Data CID (from lotus client import): bafk2bzaceamepf7hlecxfwlcskwi2hzld2hmzsepbg6yfi5uduu5gby2qqj3q
    .. calculating data size
    Deal duration (days): 30
    Miner Addresses (f0.. f0..), none to find: t01003
    .. querying miner asks
    -----
    Proposing from t3q5w7yszzglbjdgvrjpuirmxcwwupfdybm2zycod2moaqinf6cgssdri3te5mvkcody7cnqotf5zqcjvsklra
    	Balance: 453911 FIL
    
    Piece size: 512B (Payload size: 472B)
    Duration: 720h0m0s
    Total price: ~0 FIL (0 FIL per epoch)
    Verified: false
    
    Accept (yes/no): yes
    .. executing
    Deal (t01003) CID: bafyreigsrjqg7atnnk75jtf3u5nfhykqlebb4tp73jb25rnfk3uhrcygxu
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    # lotus client deal bafk2bzaceamepf7hlecxfwlcskwi2hzld2hmzsepbg6yfi5uduu5gby2qqj3q t01003 0 518400
    
    • 1

    9.2 car文件

    # lotus client generate-car f2.txt f2.car
    
    • 1
    # lotus client import --car f2.car
    Import 1660892473222112704, Root bafk2bzaceamepf7hlecxfwlcskwi2hzld2hmzsepbg6yfi5uduu5gby2qqj3q
    
    • 1
    • 2
    # lotus client deal
    Data CID (from lotus client import): bafk2bzaceamepf7hlecxfwlcskwi2hzld2hmzsepbg6yfi5uduu5gby2qqj3q
    .. calculating data size
    Deal duration (days): 30
    Miner Addresses (f0.. f0..), none to find: t01003
    .. querying miner asks
    -----
    Proposing from t3q5w7yszzglbjdgvrjpuirmxcwwupfdybm2zycod2moaqinf6cgssdri3te5mvkcody7cnqotf5zqcjvsklra
    	Balance: 453911 FIL
    
    Piece size: 512B (Payload size: 472B)
    Duration: 720h0m0s
    Total price: ~0 FIL (0 FIL per epoch)
    Verified: false
    
    Accept (yes/no): yes
    .. executing
    Deal (t01003) CID: bafyreibrfxh5vtvmplh6mjgakewlv7qhuwz63ms2o6vbrqg73rqpwfj34e
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    # lotus client deal bafk2bzaceamepf7hlecxfwlcskwi2hzld2hmzsepbg6yfi5uduu5gby2qqj3q  t01003 0 518400
    
    • 1

    9.3 离线交易

    • 客户端,发布离线交易
    # lotus client generate-car /data/f3.txt /data/f3.car
    # lotus client commP /data/f3.car
    CID:  baga6ea4seaqdi7dqjyxexcptitihnc3iv22w6gwgr3n2ug4hp4akwqgi6ezagpi
    Piece size:  508 B
    
    # lotus client deal --manual-stateless-deal --manual-piece-cid=baga6ea4seaqdi7dqjyxexcptitihnc3iv22w6gwgr3n2ug4hp4akwqgi6ezagpi --manual-piece-size 508 baga6ea4seaqdi7dqjyxexcptitihnc3iv22w6gwgr3n2ug4hp4akwqgi6ezagpi t01003 0 518400
    bafyreibu57rafkmc46huskhmqx2lejif6uqjn5einwjyd5wmuqv5pslhkq
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 矿工,StorageDealWaitingForData 等待数据导入
    # lotus-miner storage-deals list
    
    • 1
    ...v5pslhkq  0       StorageDealWaitingForData  t3q5w7yszzglbjdgvrjpuirmxcwwupfdybm2zycod2moaqinf6cgssdri3te5mvkcody7cnqotf5zqcjvsklra  512B  0 FIL                     521925
    
    • 1
    • 数据需要矿工可以访问,NFS挂载数据目录到矿工
    192.168.2.196:/data   nfs4       98G     0   93G   0% /ubuntu-05-data
    
    • 1
    • 矿工导入离线交易数据
    # lotus-miner storage-deals import-data bafyreibu57rafkmc46huskhmqx2lejif6uqjn5einwjyd5wmuqv5pslhkq /ubuntu-05-data/f3.car
    
    • 1

    参考

    1. Store data
    2. Manage storage deals
  • 相关阅读:
    [激光原理与应用-36]:《光电检测技术-3》- 光学测量基础 - 光电效应与光电探测器的基本原理
    Unity与IOS⭐Unity接入IOS SDK的流程图
    HTTPS的工作流程
    《Redis篇》Another Redis DeskTop Manager 超详细安装教程
    c++中如何利用VA_LIST 和单体模式,构建自己的log小系统
    ThinkPHP6综合业务管理系统
    JavaScript基础 JavaScript第一天 1. JavaScript介绍
    okcc呼叫中心的订单管理时怎么样的
    Java- 继承 和 实现 、组合
    【数据库系统】单表数据查询
  • 原文地址:https://blog.csdn.net/u010953692/article/details/126420585