This commit is contained in:
Sami Mäkelä 2020-07-20 18:05:17 +03:00
parent 3cc3c9a34e
commit 510b9cfac6
2 changed files with 0 additions and 182 deletions

View File

@ -1,74 +0,0 @@
#!/bin/bash
sleep 20
lotus wait-api
lotus chain head
export MAIN=$(cat ../localnet2.json | jq -r '.Accounts | .[0] | .Meta .Owner')
# Send funds to root key
lotus send --from $MAIN $ROOT 5000000
export VERIFIER=$(lotus wallet new)
export CLIENT=$(lotus wallet new)
# Send funds to verifier
lotus send --from $MAIN $VERIFIER 5000000
# Send funds to client
lotus send --from $MAIN $CLIENT 5000000
while [ "5000000 FIL" != "$(lotus wallet balance $VERIFIER)" ]
do
sleep 1
lotus wallet balance $ROOT
done
# export PARAM=$(lotus-shed verifreg add-verifier --dry t01001 100000000000000000000000000000000000000000)
export PARAM=824300e907440076adf1
# Add verifier
# lotus-shed verifreg add-verifier --from $ROOT t01001 100000000000000000000000000000000000000000
lotus msig propose --from $MAIN t080 t06 0 2 $PARAM
lotus msig inspect t080
lotus-shed verifreg list-verifiers
# Add verified client
lotus-shed verifreg verify-client --from $VERIFIER $CLIENT 10000
lotus-shed verifreg list-clients
# Remove verifier datacap
lotus-shed verifreg add-verifier --from $ROOT t01001 0
lotus-shed verifreg list-verifiers
export DATA=$(lotus client import dddd | awk '{print $NF}')
lotus client local
# Client can make a verified deal
lotus client deal --verified-deal --from $CLIENT $DATA t01000 0.005 100000
while [ "3" != "$(lotus-miner sectors list | wc -l)" ]
do
sleep 10
lotus-miner sectors list
done
curl -H "Content-Type: application/json" -H "Authorization: Bearer $(cat ~/.lotusminer/token)" -d '{"id": 1, "method": "Filecoin.SectorStartSealing", "params": [2]}' localhost:2345/rpc/v0
lotus-miner info
lotus-miner sectors list
while [ "3" != "$(lotus-miner sectors list | grep Proving | wc -l)" ]
do
sleep 5
lotus-miner sectors list | tail -n 1
lotus-miner info | grep "Actual Power"
done
sleep 300000

View File

@ -1,108 +0,0 @@
#!/usr/bin/env bash
__PWD=$PWD
__DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
__PARENT_DIR=$(dirname $__DIR)
LOTUS_PATH="${1:-$__PARENT_DIR}"
LOTUS_PURGE_LOCALDIR=${LOTUS_PURGE_LOCALDIR:-false}
LOTUS_COMPILE=${LOTUS_COMPILE:-false}
LOTUS_BIN="$LOTUS_PATH/lotus"
LOTUS_SEED="$LOTUS_PATH/lotus-seed"
LOTUS_MINER="$LOTUS_PATH/lotus-miner"
##### Functions
configure_lotus() {
echo -e "\nDownloading the 2048 byte parameters:\n"
$LOTUS_BIN fetch-params 2048
echo -e "\nPre-seal some sectors:\n"
$LOTUS_SEED pre-seal --sector-size 2KiB --num-sectors 2
# $LOTUS_SEED pre-seal --sector-size 2KiB --num-sectors 2 --miner-addr t01001
# export ROOT=$(cat ~/.genesis-sectors/pre-seal-t01001.json | jq -r '.t01001 | .Owner')
export MINER=$(cat ~/.genesis-sectors/pre-seal-t01000.json | jq -r '.t01000 | .Owner')
echo -e "\nCreate the genesis block and start up the first node:\n"
$LOTUS_SEED genesis new $LOTUS_PATH/localnet.json
$LOTUS_SEED genesis add-miner $LOTUS_PATH/localnet.json ~/.genesis-sectors/pre-seal-t01000.json
# $LOTUS_SEED genesis add-msigs $LOTUS_PATH/localnet.json test.csv
jq --arg root $MINER '. + {VerifregRootKey: {Meta: {Signers: [$root], Threshold: 1 }, Type: "multisig", Balance: "50000000000000000000000000"}}' ../localnet.json > $LOTUS_PATH/localnet2.json
# cp $LOTUS_PATH/localnet.json $LOTUS_PATH/localnet2.json
# jq --arg root $ROOT '. + {RootKey: $root}' ../localnet.json > $LOTUS_PATH/localnet2.json
# jq --arg root $MINER '.Accounts |= . + [{Type: "multisig", Balance: "50000000000000000000000000", Meta: { Signers: [$root], Threshold: 1 }}]' ../localnet.json > $LOTUS_PATH/localnet2.json
tmux new-session -s lotus -n script -d bash balances.sh
sleep 5
tmux new-window -t lotus:1 -n daemon -d $LOTUS_BIN daemon --lotus-make-genesis=dev.gen --genesis-template=$LOTUS_PATH/localnet2.json --bootstrap=false
# $LOTUS_BIN daemon --lotus-make-genesis=dev.gen --genesis-template=$LOTUS_PATH/localnet2.json --bootstrap=false || exit
sleep 5
echo -e "\nImporting the genesis miner key:\n"
$LOTUS_BIN wallet import ~/.genesis-sectors/pre-seal-t01000.key
# $LOTUS_BIN wallet import ~/.genesis-sectors/pre-seal-t01001.key
sleep 3
echo -e "\nSetting up the genesis miner:\n"
$LOTUS_MINER init --genesis-miner --actor=t01000 --sector-size=2KiB \
--pre-sealed-sectors=~/.genesis-sectors \
--pre-sealed-metadata=~/.genesis-sectors/pre-seal-t01000.json --nosync
sleep 3
echo -e "\nStarting up the miner:\n"
tmux new-window -t lotus:2 -n miner -d $LOTUS_MINER run --nosync
}
purge_local_dirs() {
echo -e "\nRemoving local state\n"
rm -rf ~/.lotus || true
rm -rf ~/.lotusstorage || true
rm -rf ~/.lotusminer || true
rm -rf ~/.genesis-sectors || true
}
compile_lotus() {
echo -e "\nCompiling lotus binary for devnet usage\n"
make clean && make 2k all
sudo make install
}
main() {
echo -e "\nUsing Lotus Path: $LOTUS_PATH \n"
if [[ "$LOTUS_PURGE_LOCALDIR" = true ]]; then
echo -e "Purging"
purge_local_dirs
fi
if [[ "$LOTUS_COMPILE" = true ]]; then
compile_lotus
fi
if [[ ! -f $LOTUS_BIN ]]; then
echo -e "Lotus binary doesn't exist"
echo -e "Please visit https://docs.lotu.sh/en+getting-started for compiling Lotus"
echo -e "Please remember to compile lotus with the 2k flag:"
echo -e "make 2k"
exit 1
fi
configure_lotus
}
#### Main
main