@@ -6,15 +6,15 @@ you need to run a vm with enough CPU/RAM/DISK, accessible via ssh using only pri
66
77a default user will be used for deployment (currently: igx)
88
9- Here is a VM preparation example for pn3 host
9+ Here is a VM preparation example for pn2 host
1010``` sh
11- export REMOTE_HOST=" pn3 .dev.push.org"
11+ export REMOTE_HOST=" pn2 .dev.push.org"
1212ssh $REMOTE_HOST
1313
1414# app will hold chain binary
1515mkdir ~ /app
1616# .push will hold home directory with /config and /data
17- mkdir ~ /.push
17+ mkdir ~ /.pchaind
1818# add to path
1919echo ' export PATH="$HOME/app:$PATH"' >> ~ /.bashrc
2020
@@ -29,13 +29,21 @@ telnet $REMOTE_HOST 26656
2929```
3030OK - VM is ready
3131
32- ## Make 1st node
32+ ## Build binary
33+ ``` shell
34+ git clone https://github.com/push-protocol/push-chain.git
35+ cd deploy
36+ # for amd64 os
37+ ./build-code.sh # OR ./build-code-on-arm-target-amd64.sh for macos m1
38+ ```
39+
40+ ## Setup 1st node
3341``` sh
3442# upload binary
3543scp " ../build/pchaind" " pn1.dev.push.org:~/app/pchaind"
3644# upload scripts
3745scp -r test-push-chain/scripts/* " pn1.dev.push.org:~/app/"
38- # upload make_first_node.sh
46+ # !!! upload make_first_node.sh (edit this file in-place on the remote and insert 3 genesis wallets - see '!!!PUT MNEMONIC1 HERE!!!')
3947scp make_first_node.sh " pn1.dev.push.org:~/app/"
4048
4149#
@@ -56,20 +64,20 @@ CHAIN_ID="push_501-1" MONIKER=pn1 HOME_DIR="~/.pchain" BLOCK_TIME="1000ms" CLEAN
5664# CTRL-C to stop
5765
5866# run in the backgr
59- . /start.sh
67+ ~ /app /start.sh
6068
6169# check logs
62- . /showLogs.sh
70+ ~ /app /showLogs.sh
6371```
6472
65- ## Make 2nd node
73+ ## Setup 2nd node (or 3rd, 4th, etc - all steps are the same)
6674``` sh
6775# ----------------- step1: upload files
6876# upload binary
6977scp " ../build/pchaind" " pn2.dev.push.org:~/app/pchaind"
70- # upload scripts
78+ # upload scripts from git
7179scp -r test-push-chain/scripts/* " pn2.dev.push.org:~/app/"
72- # ??? upload configs (genesis + toml-s )
80+ # upload configs from git (genesis, toml files are not being used, they are here only for reference )
7381scp -r test-push-chain/config/* " pn2.dev.push.org:~/app/config-tmp"
7482
7583# remote ssh
@@ -79,20 +87,21 @@ chmod u+x ~/app/pchaind
7987chmod u+x ~ /app/* .sh
8088
8189# ----------------- step2: generate configs
82- export HOME_DIR =" $HOME /.pchain"
83- # get python3
84- sudo apt install python3-pip
90+ export CHAIN_DIR =" $HOME /.pchain"
91+ # get python3 + tomlkit lib
92+ sudo apt install python3 python3 -pip
8593pip install tomlkit
86- # setup initial configs & edit toml files with proper values (check the script manually)
94+ pyton3 -version # check python is there
95+ # setup initial configs & edit toml files with proper values (check the script manually before running)
8796~ /app/updateConfigs.sh
8897# set moniker (this is the node name)
89- python3 $HOME /app/toml_edit.py " $HOME_DIR /config/config.toml" " moniker" " pn2"
98+ python3 $HOME /app/toml_edit.py " $CHAIN_DIR /config/config.toml" " moniker" " pn2"
9099# wallet @ url for the initial (seed) nodes to connect to the rest of the network
91100# note : execute this cmd on the remote node to get it's id : pchaind tendermint show-node-id
92101export pn1_url=" bc7105d5927a44638ac2ad7f6986ec98dacc5ac6@pn1.dev.push.org:26656"
93- python3 toml_edit.py $HOME_DIR /config/config.toml " p2p.persistent_peers" " $pn1_url "
94- # copy genesis.json from the 1st node
95- cp ~ /app/config-tmp/genesis.json " $HOME_DIR /config/"
102+ python3 toml_edit.py $CHAIN_DIR /config/config.toml " p2p.persistent_peers" " $pn1_url "
103+ # copy genesis.json from the 1st node (currently all values arrive from git)
104+ cp ~ /app/config-tmp/genesis.json " $CHAIN_DIR /config/"
96105
97106# ----------------- step3: run (non-validator) blockchain node an sync it
98107# stop if running
@@ -103,14 +112,86 @@ cp ~/app/config-tmp/genesis.json "$HOME_DIR/config/"
103112tail -n 100 ~ /app/chain.log
104113# wait for full node sync (manually or via this script)
105114~ /app/waitFullSync.sh
115+ # wait for: 'The Node has been fully synced '
106116```
107117
108- Faucet - Step4
118+ Step4: Generate cmd for registering
109119``` shell
110120# show new node id
111121pchaind tendermint show-node-id
112122
113123# mint some tokens via Faucet
124+ export VALIDATOR_PUBKEY=$( pchaind comet show-validator)
125+ export ONE_PUSH=000000000000000000npush
126+ export VALIDATOR_NAME=\" pn2\"
127+ cat << EOF > register-validator.json
128+ {
129+ "pubkey": $VALIDATOR_PUBKEY ,
130+ "amount": "20000$ONE_PUSH ",
131+ "moniker": $VALIDATOR_NAME ,
132+ "website": "example.com",
133+ "security": "swein2@gmail.com",
134+ "details": "a test validator",
135+ "commission-rate": "0.1",
136+ "commission-max-rate": "0.2",
137+ "commission-max-change-rate": "0.01",
138+ "min-self-delegation": "1"
139+ }
140+ EOF
141+ echo " validator name: $VALIDATOR_NAME , pubkey is $VALIDATOR_PUBKEY "
142+ echo " json cmd is "
143+ cat register-validator.json
114144
115-
116145```
146+ Generate node wallet & Register & Check (from another node or Faucet wallet)
147+ ``` sh
148+ # ----------------- Step5: Generate node wallet
149+ # this example does not use the keys pre-created in genesis.json, this allows to show a more generic case when a new node is being added
150+ # to the already established network
151+ export KEYRING=" test"
152+ export NODE_OWNER_WALLET_NAME=acc21
153+ # write & save mnemonic for future use
154+ pchaind keys add $NODE_OWNER_WALLET_NAME --keyring-backend " $KEYRING "
155+
156+
157+ # # ----------------- Step 6: Transfer funds from Faucet
158+ # faucet wallet (you need it's priv key)
159+ export FAUCET_WALLET=push1gjaw568e35hjc8udhat0xnsxxmkm2snrexxz20
160+ # node wallet (from the cmd above: pchaind tendermint show-node-id)
161+ export NODE_OWNER_WALLET=push1upvlrjlsvxpgk03nz327szz9wgcjh8afhk26k0
162+ export ONE_PUSH=000000000000000000npush
163+ export CHAIN_ID=" push_501-1"
164+
165+ # we transfer 20k PUSH
166+ # does not work
167+ pchaind tx bank send " $FAUCET_WALLET " " $NODE_OWNER_WALLET " " 20000$ONE_PUSH " --fees 1000000000000000npush --chain-id " $CHAIN_ID " --keyring-backend " $KEYRING "
168+ # check to have 20k PUSH
169+ pchaind query bank balances $NODE_OWNER_WALLET --chain-id $CHAIN_ID --keyring-backend $KEYRING
170+
171+ # ----------------- Step7: Register new validator with new wallet in the network
172+ # 2 register validator with stake
173+ # pn1.dev.push.org - is the existing public node with api
174+ pchaind tx staking create-validator register-validator.json --chain-id $CHAIN_ID --fees " 1$ONE_PUSH " --gas " 1000000" --from $NODE_OWNER_WALLET_NAME --node=tcp://pn1.dev.push.org:26657
175+ # check that tx was successful
176+ # check that code=0 and raw_log=""
177+ export TX_ID= # from above
178+ pchaind query tx $TX_ID --chain-id $CHAIN_ID --output json | jq ' {code, raw_log}'
179+ # check that validator got bonded tokens
180+ # the output should contain
181+ # moniker: YOUR VALIDATOR NAME
182+ # status: BOND_STATUS_BONDED
183+ # replace pn2 with validator name:
184+ pchaind query staking validators --output json | jq ' .validators[] | select(.description.moniker=="pn2")'
185+ ```
186+ Restart the node, check logs
187+ ``` sh
188+ # ----------------- Step8: restart the new node process
189+ # 3 restart the chain process
190+ ssh pn2.dev.push.org
191+ # stop if running
192+ ~ /app/stop.sh
193+ # start
194+ ~ /app/start.sh
195+ # check that node is syncing
196+ tail -n 100 ~ /app/chain.log
197+ ```
0 commit comments