Created
August 16, 2017 09:01
-
-
Save shapeshed/cc5c5058c4bb5d4ef3e19f0f5d385e78 to your computer and use it in GitHub Desktop.
ethup - bring up an eth cluster and unlock accounts
This file contains 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 | |
set -eEu -o pipefail | |
NODES=(node0 node1) | |
ETHDATA=~/.ethraft | |
GETH=/home/go/.gvm/pkgsets/go1.8.1/global/src/github.com/ethereum/go-ethereum/build/bin/geth | |
VERBOSITY=9 | |
for n in ${NODES[@]}; do | |
# clear any chain data and re-init | |
rm -Rf ${ETHDATA}/${n}/geth/chaindata | |
geth --datadir ${ETHDATA}/${n}/ init ${ETHDATA}/${n}/genesis.json | |
if [[ ${NODES[0]} == ${n} ]]; then | |
tmux new -s ethraft -d | |
tmux rename-window -t ethraft cluster | |
tmux send-keys -t cluster "${GETH} --config ${ETHDATA}/${n}/config.toml --verbosity ${VERBOSITY}" C-m | |
tmux new-window -n console -t ethraft:2 | |
tmux send-keys -t console "sleep 2 && ${GETH} --exec 'loadScript(\"${ETHDATA}/${n}/scripts/unlock.js\")' attach ipc:${ETHDATA}/${n}/geth.ipc" C-m | |
tmux send-keys -t console "${GETH} attach ipc:${ETHDATA}/${n}/geth.ipc" C-m | |
else | |
tmux split-window -v -t cluster | |
tmux send-keys -t cluster "${GETH} --config ${ETHDATA}/${n}/config.toml --verbosity ${VERBOSITY}" C-m | |
tmux split-window -v -t console | |
tmux send-keys -t console "sleep 2 && geth --exec 'loadScript(\"${ETHDATA}/${n}/scripts/unlock.js\")' attach ipc:${ETHDATA}/${n}/geth.ipc" C-m | |
tmux send-keys -t console "${GETH} attach ipc:${ETHDATA}/${n}/geth.ipc" C-m | |
fi | |
done | |
tmux attach -t ethraft |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment