filswan / go-swan-provider

A golang implementation for Swan Service provider.
Apache License 2.0
36 stars 29 forks source link

Change to run the swan-provider with `Boost` #230

Open Kirameta opened 1 year ago

Kirameta commented 1 year ago

Change to run the swan-provider with Boost

Step 1: set market_version in $SWAN_PATH/provider/config.toml

[main]
market_version = "1.2"                          # Send deal type, 1.1 or 1.2, config(market_version=1.1) is DEPRECATION, will REMOVE SOON (default: "1.1"), If set to 1.2, you need to set the [market] section

Step 2: When market_version = "1.2", the storage provider will import deals using the Market like Boost, so you must ensure the storage provider is reachable. The following steps are:

Step 3: Disable the markets subsystem in miner config:

vi $LOTUS_MINER_PATH/config.toml
[Subsystems] 
 EnableMarkets = false

Step 4: Config the [market] section in the $SWAN_PATH/provider/config.toml

Step 5: Initialize the Market repo to the $SWAN_PATH/provider/boost:

export SWAN_PATH="/data/.swan"
swan-provider daemon 

Step 6: Config the [Libp2p] section

(1) Ensure that the swan-provider and boostd are not running

 kill -9 $(ps -ef | grep -E 'swan-provider|boostd' | grep -v grep | awk '{print$2}' )

(2) Edit the boost configuration in the $SWAN_PATH/boost/config.toml:

 [Libp2p]
     ListenAddresses = ["/ip4/0.0.0.0/tcp/24001", "/ip6/::/tcp/24001"]   # Binding address for the libp2p host
      AnnounceAddresses = ["/ip4/209.94.92.3/tcp/24001"]                  # Addresses to explicitly announce to other peers. If not specified, all interface addresses are announced

(3) Run swan-provider in the background.

 ulimit -SHn 1048576
 export SWAN_PATH="/data/.swan"
 nohup swan-provider daemon >> swan-provider.log 2>&1 & 

Step 7: Publish Storage Provider's Multiaddrs and PeerID:

Step 8: Acquired from boostd --boost-repo=$SWAN_PATH/provider/boost net listen

  lotus-miner actor set-addrs /ip4/<ip>/tcp/<port>   

Step 9: Acquired from boostd --boost-repo=$SWAN_PATH/provider/boost net id

  lotus-miner actor set-peer-id <PeerID> 

Step 10: Set the storage provider's ask

 export SWAN_PATH="/data/.swan"
 swan-provider set-ask --price=0 --verified-price=0 --min-piece-size=1048576 --max-piece-size=34359738368

Step 11: Set the [market].publish_wallet as a control address:

 export OLD_CONTROL_ADDRESS=`lotus-miner actor control list  --verbose | awk '{print $3}' | grep -v key | tr -s '\n'  ' '`
 lotus-miner actor control set --really-do-it $[market].publish_wallet $OLD_CONTROL_ADDRESS

Step 12: Add funds to the collateral_wallet Market Actor

 lotus wallet market add --from=<YOUR_WALLET> --address=<collateral_wallet> <amount>

How to check if it worked

image

Shekelme commented 1 year ago

Can the swan-provider work with a "normal" boost, not some separate copy, which is mentioned in the instructions (Step 8,9)?