Last active
November 26, 2020 07:25
-
-
Save khaihkd/d15510acac707f38551ed86d20114a0e to your computer and use it in GitHub Desktop.
How to run a TOMO masternode by tomo binary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
VERSION=$(curl --silent https://api.github.com/repos/tomochain/tomochain/releases/latest | grep '"tag_name":' | cut -d'"' -f4) | |
wget https://github.com/tomochain/tomochain/releases/download/${VERSION}/tomo-linux-amd64 | |
chmod +x tomo-linux-amd64 && mv tomo-linux-amd64 /usr/local/bin/tomo | |
if [ ! -f "mainnet.json" ] | |
then | |
wget https://raw.githubusercontent.com/tomochain/tomochain/master/genesis/mainnet.json | |
fi | |
touch .pwd | |
touch .env | |
PKEY=$(openssl rand -hex 32) | |
echo "YOUR COINBASE PRIVATE KEY: ${PKEY}" | |
echo "PLEASE BACKUP THIS KEY" | |
echo "PRIVATE_KEY=${PKEY}" > .env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
export $(cat .env | xargs) | |
DATADIR=$PWD | |
NODE_NAME="new-node" | |
rm -rf keystore | |
wallet=$(tomo account import --password "${DATADIR}/.pwd" --datadir "${DATADIR}" <(echo ${PRIVATE_KEY}) | awk -v FS="({|})" '{print $2}') | |
if [ ! -d "${DATADIR}/tomo/chaindata" ] | |
then | |
tomo --datadir "${DATADIR}" init "${DATADIR}/mainnet.json" | |
fi | |
tomo --datadir "${DATADIR}" --networkid 88 --port 30303 \ | |
--announce-txs "archive" --maxpeers 200 \ | |
--rpc --rpccorsdomain "*" \ | |
--ethstats "${NODE_NAME}:getty-site-pablo-auger-room-sos-blair-shin-whiz-delhi@wss://stats.tomochain.com" \ | |
--rpcaddr "0.0.0.0" --rpcport 8585 --rpcvhosts "*" \ | |
--ws --wsaddr "0.0.0.0" --wsport 8586 --wsorigins "*" \ | |
--rpcapi "eth,net,web3" \ | |
--unlock "${wallet}" \ | |
--password "${DATADIR}/.pwd" --gasprice 250000000 --targetgaslimit 8400000 --verbosity 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Step 1: Run command
bash pre-run.sh
to download latest tomo version & make some variables. Your coinbase private key store at.env
Step 2: Run masternode by command
bash run.sh