-
Notifications
You must be signed in to change notification settings - Fork 68
/
statesyncrock.bash
50 lines (38 loc) · 2.21 KB
/
statesyncrock.bash
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
#!/bin/bash
# microtick and bitcanna contributed significantly here.
set -uxe
# set environment variables
# don't use a / after the rpc URL's
# "RPCN == you can put N rpc's here, comma separated list"
export GOPATH=~/go
export PATH=$PATH:~/go/bin
export RPC=https://rpc-1-dig.notional.ventures:443
export RPCN=http://23.88.73.114:46657,http://78.46.174.116:46657
export APPNAME=DIGD
# Install Dig
go install -tags rocksdb ./...
# MAKE HOME FOLDER AND GET GENESIS
digd init test
cp networks/mainnets/dig-1/genesis.json ~/.digd/config
INTERVAL=1000
# GET TRUST HASH AND TRUST HEIGHT
LATEST_HEIGHT=$(curl -s $RPC/block | jq -r .result.block.header.height);
BLOCK_HEIGHT=$(($LATEST_HEIGHT-$INTERVAL))
TRUST_HASH=$(curl -s "$RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
# TELL USER WHAT WE ARE DOING
echo "TRUST HEIGHT: $BLOCK_HEIGHT"
echo "TRUST HASH: $TRUST_HASH"
# export state sync vars
export $(echo $APPNAME)_STATESYNC_ENABLE=true
export $(echo $APPNAME)_P2P_MAX_NUM_OUTBOUND_PEERS=100
export $(echo $APPNAME)_P2P_MAX_NUM_INBOUND_PEERS=500
export $(echo $APPNAME)_STATESYNC_RPC_SERVERS="$RPC,$RPCN"
export $(echo $APPNAME)_STATESYNC_TRUST_HEIGHT=$BLOCK_HEIGHT
export $(echo $APPNAME)_STATESYNC_TRUST_HASH=$TRUST_HASH
export $(echo $APPNAME)_P2P_LADDR=tcp://0.0.0.0:2220
export $(echo $APPNAME)_RPC_LADDR=tcp://127.0.0.1:2221
export $(echo $APPNAME)_GRPC_ADDRESS=127.0.0.1:2222
export $(echo $APPNAME)_API_ADDRESS=127.0.0.1:2223
export $(echo $APPNAME)_GRPC_WEB_ADDRESS=127.0.0.1:2224
export $(echo $APPNAME)_P2P_SEEDS="[email protected]:26656,[email protected]:6969,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656"
digd start --db_backend rocksdb