load_env(){ GIT_OPENETHEREUM=${GIT_OPENETHEREUM:-https://github.com/openethereum/openethereum} default_openethereum_chain="kitabu" # bloxberg | kitabu export OPENETHEREUM_CHAIN=${INSTALL_EVM:-$default_openethereum_chain} OPENETHEREUM_PATH=${OPENETHEREUM_PATH:-$HOME/.local/bin/openethereum} openethereum_dir=`realpath $(dirname $OPENETHEREUM_PATH)` default_openethereum_config=$HOME/.config/io.parity.ethereum/$OPENETHEREUM_CHAIN export OPENETHEREUM_CONFIG=${OPENETHEREUM_CONFIG:-$default_openethereum_config} default_openethereum_type="binary" # source | binary export OPENETHEREUM_TYPE=${OPENETHEREUM_TYPE:-$default_openethereum_type} } download_openethereum() { dbg $dbg_debug "downloading openethereum node" openethereum_version="3.3.3" if [ ! -f "$PWD/openethereum-linux-v$openethereum_version.zip" ]; then wget https://github.com/openethereum/openethereum/releases/download/v$openethereum_version/openethereum-linux-v$openethereum_version.zip fi unzip openethereum-linux-v$openethereum_version.zip rm openethereum-linux-v$openethereum_version.zip ./openethereum --version mv ./openethereum $openethereum_dir/openethereum export OPENETHEREUM_PATH=$openethereum_dir/openethereum } build_openethereum() { dbg $dbg_debug "building bloxberg node" t=`mktemp -d` pushd $t install_env=1 git clone $GIT_OPENETHEREUM cd openethereum git checkout 2662d1925ec794f3ad7c5759b2412ff5128d259b rustup install 1.47.0 cargo build --release --features final cp -v $t/target/release/parity $openethereum_dir/openethereum export OPENETHEREUM_PATH=$openethereum_dir/openethereum } . aux/bdbg/bdbg.sh . setup_path.sh # set -o xtrace load_env install_env= if [ ! -f $OPENETHEREUM_PATH ]; then # Download and Build parity from git $GIT_OPENETHEREUM if [ "$OPENETHEREUM_TYPE" = "source" ]; then build_openethereum else download_openethereum fi else dbg $dbg_info "found evm node executable in $OPENETHEREUM_PATH" fi #OPENETHEREUM_CONFIG=$HOME/.config/io.parity.ethereum/$OPENETHEREUM_CHAIN if [ ! -d $OPENETHEREUM_CONFIG ]; then install_dir=$(pwd) mkdir -vp $OPENETHEREUM_CONFIG cd $OPENETHEREUM_CONFIG touch ./bootnode.pwd read -p "enter a passphrase for your keyfile: " PASSPHRASE VANITY_STRING=${VANITY_STRING:-"Kitabu Sarafu Karibu Sana"} echo -n "$VANITY_STRING" > ./.vanity truncate ./.vanity -s 32 && \ hexdump -v -n 32 -e '1/1 "%02x"' ./.vanity > ./.extra WALLET_PASSPHRASE=$PASSPHRASE eth-keyfile -0 > ./keyfile_validator.json WALLET_PASSPHRASE=$PASSPHRASE eth-sign-msg -0 -f ./keyfile_validator.json `cat ./.extra` > ./.sig WALLET_PASSPHRASE=$PASSPHRASE eth-keyfile -0 -d ./keyfile_validator.json >> ./.extra cat ./.sig >> ./.extra echo $PASSPHRASE > ./bootnode.pwd chmod -v 400 ./bootnode.pwd mkdir -vp $OPENETHEREUM_CONFIG/data/keys/kitabu_sarafu cp -v ./keyfile_validator.json $OPENETHEREUM_CONFIG/data/keys/kitabu_sarafu/ echo Changing back to $install_dir cd $install_dir # config.json export DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=${DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER:-"0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C"} export DEV_ETH_GENESIS_START_GAS=${DEV_ETH_GENESIS_START_GAS:-"0x204fce5e3e25026110000000"} export DEV_ETH_ACCOUNT_VALIDATOR="0x$(eth-keyfile -d $OPENETHEREUM_CONFIG/keyfile_validator.json)" # export DEV_ETH_ACCOUNT_VALIDATOR="0xFA14198a6dc184D758F3B7308a2a85F361123e85" # export DEV_ETH_GENESIS_EXTRA_DATA="0x$(cat $OPENETHEREUM_CHAIN/.extra)" cp -v var/$OPENETHEREUM_CHAIN/$OPENETHEREUM_CHAIN.json > $OPENETHEREUM_CONFIG/$OPENETHEREUM_CHAIN.json # Bootnode.toml export SIGNER_ADDRESS=$DEV_ETH_ACCOUNT_VALIDATOR ./aux/bash-templater/templater.sh var/$OPENETHEREUM_CHAIN/bootnode.toml > $OPENETHEREUM_CONFIG/bootnode.toml if [ -f var/$OPENETHEREUM_CHAIN/bootnodes.txt ] ; then cp -v var/$OPENETHEREUM_CHAIN/bootnodes.txt $OPENETHEREUM_CONFIG/ fi # Systemd ./aux/bash-templater/templater.sh systemd/node.service > $HOME/.config/systemd/user/$OPENETHEREUM_CHAIN.service ./aux/bash-templater/templater.sh systemd/env/01-$OPENETHEREUM_CHAIN.conf > $HOME/.config/environment.d/01-$OPENETHEREUM_CHAIN.conf systemctl --user daemon-reload systemctl --user enable $OPENETHEREUM_CHAIN systemctl --user start $OPENETHEREUM_CHAIN else echo Found $OPENETHEREUM_CONFIG directory! Skipping fi update_path $openethereum_dir if [ ! -z "$install_env" ]; then popd fi