gitlab.com/lightnet1/evrynet-node@v1.1.0/init_one_node.sh (about) 1 #!/bin/bash 2 # NOTE 3 # the first you have to grants chmod allow can read this file 4 # run ./init_one_node.sh 5 # enjoy 6 # 7 8 echo "***********************************************" 9 echo "***********************************************" 10 echo " INIT YOUR NODE MUST ENTER SOME INFOR BELOW" 11 datadir=~/evrynet 12 listAcc=$(./gev --datadir "$datadir" account list) 13 hasAccount=0 14 address='' 15 password='' 16 17 if [[ -z "$listAcc" ]]; then 18 echo " In the localhost there are not accounts, you must create or import an account" 19 else 20 echo " In the localhost there are accounts here: $listAcc " 21 hasAccount=1 22 fi 23 echo "***********************************************" 24 25 read -p " Do you have an account? (y|n): " yn 26 if [[ $yn = 'y' ]]; then 27 if [[ $hasAccount = 1 ]]; then 28 read -p " Do you want to use one of accounts above? (y|n): " yn 29 if [[ $yn = 'y' ]]; then 30 read -p " Enter your address: " address 31 read -p " Enter your passphrase to unlock: " -s password 32 ./gev --datadir "$datadir" --port 30311 --rpc --rpcaddr 'localhost' --networkid 15 --gasprice '0' --password <(echo "$password") --unlock "$address" --etherbase "$address" --mine --allow-insecure-unlock 33 exit 1 34 fi 35 fi 36 37 echo " starting import your account with private key..." 38 read -p " Enter your private key: " privateKey 39 read -p " Enter your passphrase to unlock: " -s password 40 result=$(./gev account import --datadir "$datadir" --password <(echo "$password") <(echo "$privateKey")) 41 result="$(cut -d'{' -f2 <<<"$result")" 42 address="$(cut -d'}' -f1 <<<"$result")" 43 aLength="${#address}" 44 if [[ $aLength != 40 ]]; then 45 exit 1 46 fi 47 else 48 read -p " Enter your passphrase for new account: " -s password 49 ./gev account new --datadir "$datadir" --password <(echo "$password") 50 read -p " Please enter the address have been created above to unlock and run your node: " address 51 fi 52 53 echo "***********************************************" 54 read -p " Do you want to set the "$address" as coinbase? (y|n): " yn 55 echo "***********************************************" 56 57 if [[ $yn = 'y' ]]; then 58 ./gev --datadir "$datadir" --port 30311 --rpc --rpcaddr 'localhost' --networkid 15 --gasprice '0' --password <(echo "$password") --unlock "$address" --etherbase "$address" --mine --allow-insecure-unlock 59 else 60 ./gev --datadir "$datadir" --port 30311 --rpc --rpcaddr 'localhost' --networkid 15 --gasprice '0' --password <(echo "$password") --unlock "$address" --mine --allow-insecure-unlock 61 fi