Created
May 18, 2020 07:59
-
-
Save shingonu/d4ec56863333f8c5641176b0447a19ac to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
DATADIR_1=$HOME/.pls.staking/datadir.1 # NODE#1 | |
PWD=$DATADIR_1/pwd.pass | |
GENESIS_1=$DATADIR_1/test-genesis.json | |
MANAGERS_JSON=$HOME/.pls.staking/managers.json # Manager Contracts | |
CONFIG=$DATADIR_1/test-config.json | |
JSONRPC=ws://13.231.233.189:8546 | |
API_SERVER=https://dashboard-api.tokamak.network/rinkeby | |
NAME_1="THOMAS_CLIENT" | |
WEBSITE_1="https://tokamak.network/" | |
DESCRIPTION_1="Tokamak Network is a platform that assures decentralized and secure property same as Ethereum Main chain while supporting high level of scalability and extendability." | |
rm -rf $DATADIR_1 | |
mkdir -p $DATADIR_1 | |
make geth | |
touch $PWD | |
####################### | |
# SETUP NODE 1 | |
####################### | |
# 0. unlock $KEY0 using geth account importKey | |
build/bin/geth account import-key $KEY1 --datadir $DATADIR_1 <<EOF | |
EOF | |
# 1. deploy && init RootChain | |
build/bin/geth deploy $GENESIS_1 2757 true 2 \ | |
--datadir $DATADIR_1 \ | |
--rootchain.url $JSONRPC \ | |
--unlock $ADDR1 \ | |
--password $PWD \ | |
--rootchain.sender $ADDR1 | |
build/bin/geth init $GENESIS_1 \ | |
--datadir $DATADIR_1 \ | |
--rootchain.url $JSONRPC | |
# 2. set manager contracts config | |
build/bin/geth manage-staking set-managers $MANAGERS_JSON \ | |
--datadir $DATADIR_1 | |
# get manager contracts config | |
build/bin/geth manage-staking get-managers \ | |
--datadir $DATADIR_1 | |
# 3. register RootChain | |
build/bin/geth manage-staking register \ | |
--datadir $DATADIR_1 \ | |
--rootchain.url $JSONRPC \ | |
--unlock $ADDR1 \ | |
--password $PWD \ | |
--rootchain.sender $ADDR1 | |
# 4. register root chain address | |
GENESIS="$(cat $GENESIS_1)" | |
ROOTCHAIN_REGISTRY=$(jq -n \ | |
--arg genesis $GENESIS \ | |
--arg name "$NAME_1" \ | |
--arg website "$WEBSITE_1" \ | |
--arg description "$DESCRIPTION_1" \ | |
'{genesis: $genesis, name: $name, website: $website, description: $description}') | |
curl -X POST \ | |
-H "Content-Type: application/json" \ | |
--data "$ROOTCHAIN_REGISTRY" \ | |
"$API_SERVER/operators" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment