Skip to content

Instantly share code, notes, and snippets.

@gmelodie
Created April 14, 2022 17:46
Show Gist options
  • Save gmelodie/429f2c49eefbcb9016e4f987371320ba to your computer and use it in GitHub Desktop.
Save gmelodie/429f2c49eefbcb9016e4f987371320ba to your computer and use it in GitHub Desktop.
Instructions to locally setup and make deals through Boost using Estuary
  1. Clone boost, run make to compile boostd and the react app for the UI (you'll use them later), make devnet and ./devnet (might fail, if so just run again)

  2. Clone lotus and checkout boost/main, then make debug, sudo make install and finally sudo install -C ./lotus-seed /usr/local/bin/lotus-seed

  3. On a new window run this (note down the FULLNODE_API_INFO that this command outputs). If you had done this before already, make sure to clean up the directory rm -rf ~/.lotusmarkets && rm -rf ~/.lotus && rm -rf ~/.lotusminer && rm -rf ~/.genesis_sectors

unset MINER_API_INFO
unset FULLNODE_API_INFO
export ENV_MINER_API_INFO=`../lotus/lotus-miner auth api-info --perm=admin`
export ENV_FULLNODE_API_INFO=`../lotus/lotus auth api-info --perm=admin`

export MINER_API_INFO=`echo $ENV_MINER_API_INFO | awk '{split($0,a,"="); print a[2]}'`
export FULLNODE_API_INFO=`echo $ENV_FULLNODE_API_INFO | awk '{split($0,a,"="); print a[2]}'`

echo MINER_API_INFO=$MINER_API_INFO
echo FULLNODE_API_INFO=$FULLNODE_API_INFO

export DEFAULT_WALLET=`./lotus wallet list | tail -1 | awk '{print $1}'`
export COLLAT_WALLET=`./lotus wallet new bls`
export PUBMSG_WALLET=`./lotus wallet new bls`
export CLIENT_WALLET=`./lotus wallet new bls`

./lotus send --from $DEFAULT_WALLET $COLLAT_WALLET 10
./lotus send --from $DEFAULT_WALLET $PUBMSG_WALLET 10
./lotus send --from $DEFAULT_WALLET $CLIENT_WALLET 10
  1. Run this cmd until 10 FIL is in all the three new wallets
./lotus wallet list
  1. Run this (why?)
# Tell lotus miner to designate the publish message wallet as a control wallet
./lotus-miner actor control set --really-do-it $PUBMSG_WALLET

# Add funds to escrow for client
./lotus wallet market add --from $DEFAULT_WALLET --address $CLIENT_WALLET 5
./lotus wallet market add --address $COLLAT_WALLET 5
  1. On the same terminal (remember the env vars) go to the boost directory and run this. After daemon startup, kill it.
rm -rf ~/.boost

./boostd -vv init --api-sealer=$MINER_API_INFO --api-sector-index=$MINER_API_INFO --wallet-publish-storage-deals=$PUBMSG_WALLET --wallet-collateral-pledge=$COLLAT_WALLET --max-staging-deals-bytes=2000000000

./boostd -vv run
  1. Edit ~/.boost/config.toml and set the ListenAddresses under [Libp2p] to TCP port 50000 and restart boostd

  2. Node down the peer ID that boostd outputs (Boost libp2p node listening {"maddr": "{HERE}") and stop boostd again.

  3. Run these to tell the chain where to find Boost (on the same terminal with the env vars)

lotus-miner actor set-peer-id <boost peer ID from above>
lotus-miner actor set-addrs /ip4/127.0.0.1/tcp/50000
  1. Disable verified deals on Estuary:
--- a/handlers.go
+++ b/handlers.go
@@ -1431,7 +1431,7 @@ func (s *Server) handleMakeDeal(c echo.Context, u *User) error {
                return err
        }
 
-       id, err := s.CM.makeDealWithMiner(ctx, cont, addr, true)
+       id, err := s.CM.makeDealWithMiner(ctx, cont, addr, false)
        if err != nil {
                return err
        }
--- a/replication.go
+++ b/replication.go
@@ -1211,7 +1211,7 @@ func (cm *ContentManager) ensureStorage(ctx context.Context, content Content, do
        ))
        defer span.End()
 
-       verified := true
+       verified := false
 
        if content.AggregatedIn > 0 {
                // This content is aggregated inside another piece of content, nothing to do here
  1. Get the value of the FULLNODE_API_INFO environment variable that was output on step 3 above, and run estuary with that env var.
make clean all && rm -rf mystorage && mkdir mystorage && ./estuary setup && FULLNODE_API_INFO=PASTE-HERE ./estuary --datadir=mystorage --logging --announce=/ip4/127.0.0.1/tcp/6744/p2p/<ESTUARY PEER ID>
  1. Note down estuary's wallet address Wallet adderss is: COPY-FROM-HERE
  2. Add 5000 FIL to Estuary's wallet in the devnet:
lotus send --from=$DEFAULT_WALLET <estuary client wallet address> 5000
  1. Use sqlite3 to edit estuary.db and replace the miners in estuary's db with the boost miner t01000
sqlite3 estuary.db
.mode quote
.head on
delete from storage_miners where id > 1;
update storage_miners set address = 't01000' where id=1;
  1. Build the react frontend for boost with make react and restart ./boostd -vv run (remember all of these have to be in the same window with env vars)
  2. Open localhost:8080 to see the Boost web UI > settings > set Price and Verified Price to zero.

You should now be able to make deals from estuary with Boost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment