Created
April 6, 2018 10:49
-
-
Save benjaminbollen/6e0eb979c911bf465896d49cf08e86da 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
| #!/bin/bash | |
| networkid=1409; | |
| environment=sandbox; | |
| assetPath="https://s3.amazonaws.com/assets.simpletoken.com/utility_chain/$environment"; | |
| GETH_EXEC=$(which geth); | |
| if [[ -z $GETH_EXEC ]]; then | |
| echo "geth is not installed! You need to install geth to proceed further." | |
| exit 1; | |
| fi | |
| read -p "Data dir path [$HOME]: " pathDir; | |
| if [[ -z $pathDir ]]; then | |
| pathDir=$HOME; | |
| fi | |
| if [[ ! -d $pathDir ]]; then | |
| echo "Invalid path!!!"; | |
| exit 1; | |
| fi | |
| datadir=$pathDir/uc_node_${networkid}; | |
| mkdir -p $datadir; | |
| if [[ ! -d $datadir ]]; then | |
| echo "Error creating data dir!"; | |
| exit 1; | |
| fi | |
| read -p "Network listening port (default: 30303) " port; | |
| if [[ -z $port ]]; then | |
| port=30303; | |
| fi | |
| read -p "HTTP-RPC server listening port (default: 8545) " rpcport; | |
| if [[ -z $rpcport ]]; then | |
| rpcport=8545; | |
| fi | |
| read -p "WS-RPC server listening port (default: 8546) " wsport; | |
| if [[ -z $wsport ]]; then | |
| wsport=8546; | |
| fi | |
| read -p "Extra Args if any: " extraArgs; | |
| # Download bootnode files | |
| bn_filename="uc_${networkid}_boot_nodes.txt"; | |
| bn_src="$assetPath/$bn_filename"; | |
| bn_dest=$pathDir/$bn_filename; | |
| wget -q $bn_src -O $bn_dest; | |
| if [[ $? != 0 ]]; then | |
| echo "Unable to download bootnodes file!"; | |
| exit 1; | |
| fi | |
| bootNodes=$(cat $bn_dest); | |
| if [[ -z $bootNodes ]]; then | |
| echo "Invalid boot nodes!"; | |
| exit 1; | |
| fi | |
| # rm -f $bn_dest; | |
| # Download genesis file | |
| filename="uc_${networkid}_genesis.json"; | |
| src_json="$assetPath/$filename"; | |
| dest_json=$pathDir/$filename; | |
| wget -q $src_json -O $dest_json; | |
| if [[ $? != 0 ]]; then | |
| echo "Genesis file download failed!"; | |
| exit 1; | |
| fi | |
| $GETH_EXEC --datadir $datadir init $dest_json; | |
| if [[ $? != 0 ]]; then | |
| echo "Not able to initialize genesis!"; | |
| exit 1; | |
| fi | |
| # rm -f $dest_json; | |
| $GETH_EXEC --networkid $networkid --datadir $datadir --port $port --rpc --rpcapi eth,net,web3,personal --rpcport $rpcport --ws --wsport $wsport --bootnodes $bootNodes $extraArgs; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment