forked from wuzhanfly/filecoin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_genesis_miner.sh
83 lines (69 loc) · 2.31 KB
/
start_genesis_miner.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#########################################################################
# File Name: start_miner.sh
# Author: tears
# mail: [email protected]
# Created Time: 2020年03月13日 星期五 20时08分07秒
#########################################################################
#!/bin/bash
lotus_path="/home/tears/filecoin/official/lotus"
sector_size="2KiB" # Default sector size
# Colorefull print
function green_print()
{
local text=$@
echo ""
echo -e "\033[1m\033[32m[$text]\033[0m" # 绿色加粗, 并复原
# echo ""
}
function blue_print()
{
local text=$@
# echo ""
echo -e "\033[1m\033[36m[$text]\033[0m" # 蓝色加粗, 并复原
# echo ""
}
function blue_print2()
{
local text=$@
# echo ""
echo -e "\033[36m[$text]\033[0m" # 蓝色, 并复原
# echo ""
}
green_print "Importing the genesis miner key..."
sleep 2s
${lotus_path}/lotus wallet import ~/.genesis-sectors/pre-seal-t01000.key
blue_print "Importing the genesis miner key finished!"
echo -e "\n"
# This step just needed in testnet/3 and later
green_print "Setting default wallet..."
sleep 2s
wallet_addr=$(${lotus_path}/lotus wallet list | grep 't3' | awk '{print $1}')
blue_print2 "Wallet address is: ${wallet_addr}"
${lotus_path}/lotus wallet set-default ${wallet_addr}
blue_print "Setting default wallet finished!"
echo -e "\n"
# Optional
# export IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
export RUST_LOG=Trace
green_print "Initializing storage miner..."
sleep 5s
${lotus_path}/lotus-miner init --genesis-miner --actor=t01000 --sector-size=${sector_size} --pre-sealed-sectors=~/.genesis-sectors --pre-sealed-metadata=~/.genesis-sectors/pre-seal-t01000.json --nosync
blue_print "Initializing storage miner finished!"
echo -e "\n"
green_print "Starting storage miner..."
sleep 5s
t=$(date +%Y_%m_%d_%H_%M)
screen -L -S miner -t miner_$t ${lotus_path}/lotus-miner run --nosync
blue_print "Starting storage miner finished!"
echo -e "\n"
green_print "Showing wallet balance..."
sleep 2s
wallet_balance=$(${lotus_path}/lotus wallet balance)
blue_print2 "Wallet balance is : ${wallet_balance}"
blue_print "Showing wallet balance finished!"
echo -e ""
green_print "Showing storage miner info..."
sleep 2s
${lotus_path}/lotus-miner info
blue_print "Showing storage miner info finished!"
echo -e ""