Skip to content
Permalink
Browse files

feat: change script to extract genesis

  • Loading branch information...
etienne-napoleone committed Jun 5, 2019
1 parent 366fd57 commit 4d5d9861ff925a8aa76341e66c24f5929e7c9451
Showing with 33 additions and 13 deletions.
  1. +1 −0 .gitignore
  2. +32 −13 AWS/private_network/quickstart.sh
@@ -1,2 +1,3 @@
*.pem
.env
genesis.json
@@ -1,38 +1,57 @@
#/usr/bin/env bash

GENESIS_PATH="$(pwd)/genesis.json"

# check if the network name was specified
if [ ! -z $1 ]
then
# if yes, check that there is a corresponsing genesis
genesis_path="${HOME}/.puppeth/${1}"
if [ -f "$genesis_path" ]
# if yes, check that there is a corresponsing puppeth network
echo " Finding puppet network ${1}"
puppet_network_path="${HOME}/.puppeth/${1}"
if [ -f "$puppet_network_path" ]
then
echo "! | Found a genesis for network ${1}"

echo " Found ${puppet_network_path}"
echo " Extracting genesis"
genesis=$(jq '.genesis' $puppet_network_path)
if [ ! -z "$genesis" ]
then
echo $genesis > $GENESIS_PATH
echo " Created ${GENESIS_PATH}"
else
echo "! The file doesn't contain a genesis"
exit 1
fi

else
echo "x | No genesis found with that network name"
echo " | Please create one with puppeth"
echo "! No puppeth network found with the name ${1}"
exit 1
fi
else
echo "x | Please provide a network name"
echo "! Please provide a network name"
exit 1
fi

# create the container with the right startup options
echo " | Creating your masternode container"
echo " Creating your masternode container"
# ask for private key
echo "? | Please enter your masternode coinbase private key"
private_key=$(read -sp "> | "); echo ""
echo "? Please enter your masternode coinbase private key"
private_key=$(read -sp "> (input is hidden) "); echo ""

exit
# this is not correct yet
docker create \
--name "${1}01" \
-e IDENTITY="${1}01" \
-e PRIVATE_KEY="${private_key}" \
-e NETWORK_ID="$(jq .genesis.config.chainId ${genesis_path})" \
-e NETWORK_ID="$(jq .config.chainId ${GENESIS_PATH})" \
-e VERBOSITY=3 \
-e GENESIS_PATH="/tomochain/genesis.json" \
-v ${genesis_path}:/tomochain/genesis.json \
-v ${GENESIS_PATH}:/tomochain/genesis.json \
tomochain/node:stable

if [ $? -eq 0 ]
then
echo " Container ${1}01 created"
else
echo "x Could not create container ${1}01"
fi

0 comments on commit 4d5d986

Please sign in to comment.
You can’t perform that action at this time.