diff --git a/scripts/deploy-devnet.sh b/scripts/deploy-devnet.sh deleted file mode 100755 index c1b82933c..000000000 --- a/scripts/deploy-devnet.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env bash - -############ -## Settings -GENESIS_HOST=root@147.75.80.29 -BOOTSTRAPPERS=( root@147.75.80.17 ) - -############ - -read -p "You are about to deploy new DevNet, killing bootstrap nodes. Proceed? (y/n)? " r -case "$r" in - y|Y ) echo "Proceding";; - n|N ) exit 0;; - * ) exit 1;; -esac - -log() { - echo -e "\e[33m$1\e[39m" -} - -rm -f build/bootstrap/*.pi - -log '> Generating genesis' - -make - -GENPATH=$(mktemp -d) - -log 'staring temp daemon' - -./lotus --repo="${GENPATH}" daemon --lotus-make-random-genesis="${GENPATH}/devnet.car" & -GDPID=$! - -sleep 3 - -log 'Extracting genesis miner prvate key' - -ADDR=$(./lotus --repo="${GENPATH}" wallet list) -./lotus --repo="${GENPATH}" wallet export "$ADDR" > "${GENPATH}/wallet.key" - -kill "$GDPID" - -wait - -log '> Creating genesis binary' -cp "${GENPATH}/devnet.car" build/genesis/devnet.car -rm -f build/bootstrap/*.pi - -make - -log '> Deploying and starting genesis miner' - -ssh $GENESIS_HOST 'systemctl stop lotus-daemon' & -ssh $GENESIS_HOST 'systemctl stop lotus-storage-miner' & - -wait - -ssh $GENESIS_HOST 'rm -rf .lotus' & -ssh $GENESIS_HOST 'rm -rf .lotusstorage' & - -scp -C lotus "${GENESIS_HOST}":/usr/local/bin/lotus & -scp -C lotus-storage-miner "${GENESIS_HOST}":/usr/local/bin/lotus-storage-miner & - -wait - -log 'Initializing genesis miner repo' - -ssh $GENESIS_HOST 'systemctl start lotus-daemon' - -scp scripts/bootstrap.toml "${GENESIS_HOST}:.lotus/config.toml" & -ssh < "${GENPATH}/wallet.key" $GENESIS_HOST '/usr/local/bin/lotus wallet import' & -wait - -ssh $GENESIS_HOST "echo -e '[Metrics]\nNickname=\"Boot-genesis\"' >> .lotus/config.toml" - -ssh $GENESIS_HOST 'systemctl restart lotus-daemon' - -log 'Starting genesis mining' - -ssh $GENESIS_HOST '/usr/local/bin/lotus-storage-miner init --genesis-miner --actor=t0101' -ssh $GENESIS_HOST 'systemctl start lotus-storage-miner' - - -log 'Getting genesis addr info' - -ssh $GENESIS_HOST 'lotus net listen' | grep -v '/10' | grep -v '/127' > build/bootstrap/root.pi - -log '> Creating bootstrap binaries' -make - - -for host in "${BOOTSTRAPPERS[@]}" -do - ./scripts/deploy-bootstrapper.sh $host -done - -log 'Updating genesis node with bootstrapable binaries' - -ssh "$GENESIS_HOST" 'systemctl stop lotus-daemon' & -ssh "$GENESIS_HOST" 'systemctl stop lotus-storage-miner' & -wait - -scp -C lotus "${GENESIS_HOST}":/usr/local/bin/lotus & -scp -C lotus-storage-miner "${GENESIS_HOST}":/usr/local/bin/lotus-storage-miner & -wait - -ssh "$GENESIS_HOST" 'systemctl start lotus-daemon' & -ssh "$GENESIS_HOST" 'systemctl start lotus-storage-miner' & -wait diff --git a/scripts/init-network.sh b/scripts/init-network.sh new file mode 100755 index 000000000..29e16d77c --- /dev/null +++ b/scripts/init-network.sh @@ -0,0 +1,115 @@ +#!/usr/bin/env bash + +set -xeo + +NUM_SECTORS=2 +SECTOR_SIZE=1024 + + +sdt0111=$(mktemp -d) +sdt0222=$(mktemp -d) +sdt0333=$(mktemp -d) + +staging=$(mktemp -d) + +make debug + +./lotus-seed --sectorbuilder-dir="${sdt0111}" pre-seal --miner-addr=t0111 --sector-offset=0 --sector-size=${SECTOR_SIZE} --num-sectors=${NUM_SECTORS} & +./lotus-seed --sectorbuilder-dir="${sdt0222}" pre-seal --miner-addr=t0222 --sector-offset=0 --sector-size=${SECTOR_SIZE} --num-sectors=${NUM_SECTORS} & +./lotus-seed --sectorbuilder-dir="${sdt0333}" pre-seal --miner-addr=t0333 --sector-offset=0 --sector-size=${SECTOR_SIZE} --num-sectors=${NUM_SECTORS} & + +wait + +./lotus-seed aggregate-manifests "${sdt0111}/pre-seal-t0111.json" "${sdt0222}/pre-seal-t0222.json" "${sdt0333}/pre-seal-t0333.json" > "${staging}/genesis.json" + +lotus_path=$(mktemp -d) + +./lotus --repo="${lotus_path}" daemon --lotus-make-random-genesis="${staging}/devnet.car" --genesis-presealed-sectors="${staging}/genesis.json" --bootstrap=false & +lpid=$! + +sleep 3 + +kill "$lpid" + +wait + +cp "${staging}/devnet.car" build/genesis/devnet.car + +make debug + +ldt0111=$(mktemp -d) +ldt0222=$(mktemp -d) +ldt0333=$(mktemp -d) + +sdlist=( "$sdt0111" "$sdt0222" "$sdt0333" ) +ldlist=( "$ldt0111" "$ldt0222" "$ldt0333" ) + +for (( i=0; i<${#sdlist[@]}; i++ )); do + preseal=${sdlist[$i]} + fullpath=$(find ${preseal} -type f -iname 'pre-seal-*.json') + filefull=$(basename ${fullpath}) + filename=${filefull%%.*} + mineraddr=$(echo $filename | sed 's/pre-seal-//g') + + wallet_raw=$(jq -rc ".${mineraddr}.Key" < ${preseal}/${filefull}) + wallet_b16=$(./lotus-shed base16 "${wallet_raw}") + wallet_adr=$(./lotus-shed keyinfo --format="{{.Address}}" "${wallet_b16}") + wallet_adr_enc=$(./lotus-shed base32 "wallet-${wallet_adr}") + + mkdir -p "${ldlist[$i]}/keystore" + cat > "${ldlist[$i]}/keystore/${wallet_adr_enc}" <