-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtwo-chainz-no-okc
executable file
·91 lines (75 loc) · 3.01 KB
/
two-chainz-no-okc
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
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
# two-chainz creates two gaiad chains and configures the relayer to
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
GAIA_DATA="$(pwd)/data"
RELAYER_DIR="$(dirname $SCRIPTDIR)"
RELAYER_CONF="$HOME/.relayer"
start=$1
killbyname() {
NAME=$1
ps -ef|grep "$NAME"|grep -v grep |awk '{print "kill -9 "$2", "$8}'
ps -ef|grep "$NAME"|grep -v grep |awk '{print "kill -9 "$2}' | sh
echo "All <$NAME> killed!"
}
# Ensure jq is installed
if [[ ! -x "$(which jq)" ]]; then
echo "jq (a tool for parsing json in the command line) is required..."
echo "https://stedolan.github.io/jq/download/"
exit 1
fi
# Ensure user understands what will be deleted
#if [[ -d $GAIA_DATA ]] && [[ ! "$1" == "skip" ]]; then
# read -p "$(basename $0) will delete \$(pwd)/data and \$HOME/.relayer folders. Do you wish to continue? (y/n): " -n 1 -r
# echo
# if [[ ! $REPLY =~ ^[Yy]$ ]]; then
# exit 1
# fi
#fi
# Delete data from old runs
rm -rf $GAIA_DATA &> /dev/null
rm -rf $RELAYER_CONF &> /dev/null
# Stop existing gaiad processes
set -e
# start gaiad
killbyname gaiad
killbyname akash &> /dev/null
killbyname simd &> /dev/null
chainid0=ibc-0
chainid1=ibc-1
echo "Generating gaia configurations..."
mkdir -p $GAIA_DATA && cd $GAIA_DATA && cd ../
./one-chain-ibc.sh gaiad $chainid0 ./data 6657 6656 6060 9090 10000 $start
./one-chain-ibc.sh gaiad $chainid1 ./data 16657 16656 6061 9091 10001 $start
## start okc
#killbyname exchaind
#killbyname exchaincli
#(cd $(go env GOPATH)/src/github.com/okex/exchain && make install Venus1Height=1)
#chainid0="exchain-100"
#chainid1="exchain-101"
#echo "Generating exchain configurations..."
#mkdir -p $GAIA_DATA && cd $GAIA_DATA && cd ../
#./start.sh $chainid0 ./data 26657 26656 26659 9090 8084 $start
#./start.sh $chainid1 ./data 36657 36656 36659 9090 8084 $start
#
pwd=${PWD}
rm -rf ~/.relayer
cd ${pwd}
echo "Generating rly configurations..."
rly config init
rly chains add-dir configs/demo/chains
#SEED0=$(jq -r '.mnemonic' $GAIA_DATA/exchain-100/key_seed.json)
#SEED1=$(jq -r '.mnemonic' $GAIA_DATA/exchain-101/key_seed.json)
#echo "Key $(rly keys restore exchain-100 admin16 "$SEED0") imported from exchain-100 to relayer..."
#echo "Key $(rly keys restore exchain-101 admin16 "$SEED1") imported from exchain-101 to relayer..."
rly keys restore exchain-65 testkey "crime dove school toast excite capable page wheat charge valley gloom audit"
rly keys restore exchain-64 testkey "crime dove school toast excite capable page wheat charge valley gloom audit"
rly keys restore exchain-67 testkey "crime dove school toast excite capable page wheat charge valley gloom audit"
SEED_CM_0=$(jq -r '.mnemonic' $GAIA_DATA/ibc-0/key_seed.json)
SEED_CM_1=$(jq -r '.mnemonic' $GAIA_DATA/ibc-1/key_seed.json)
echo "Key $(rly keys restore ibc-0 testkey "$SEED_CM_0") imported from ibc-0 to relayer..."
echo "Key $(rly keys restore ibc-1 testkey "$SEED_CM_1") imported from ibc-1 to relayer..."
rly paths add-dir configs/demo/paths
echo "current pathes"
rly paths list
echo "current chains "
rly chains list