Last active
May 11, 2018 18:52
-
-
Save stnbu/90fb6f1a73a82ee0828f23ba63755fa3 to your computer and use it in GitHub Desktop.
hacky script to bootstrap test nodes for parity test net
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
#!/bin/sh | |
# hacky but useable script for quick/easy parity test node deployment. Requires commands "parity" and "tmux" | |
# Set these as required: | |
BASE_PATH=~/meth/nodes | |
BIND_IP=10.45.92.1 | |
LOG_LEVEL=info | |
# BIND_IP for example can be an openvpn tun0 interface's IP (exactly why I do this). | |
# --- | |
# example... create three peers: | |
# qp.dev-net peer0 | |
# qp.dev-net peer1 | |
# PORT=30303 WS_PORT=8546 JSONRPC_PORT=8545 UI_PORT=8180 qp.dev-net master | |
# | |
# after doing this, you must append all three nodes' "enode://" URIs to "$HOME/reserved-peers" | |
# (and SIGHUP...? do nothing? I've just been restarting peers) | |
# notes and shit | |
# https://wiki.parity.io/Private-development-chain | |
# https://github.com/paritytech/parity/issues/7470 | |
# 0x00a329c0648769a73afac7f9381e08fb43dbea72 | |
NAME=$(basename $0) | |
start_node() { | |
NAME="$1" | |
SUM="1"$(echo "$NAME" | sum | cut -d ' ' -f 1) # guaranteed > 100,000 | |
if [ -z "$PORT" ] ; then | |
PORT=$(expr $SUM / 100) | |
PORT=$(expr $PORT + 25) # in case we get a 1000. 1024 is the lowest | |
fi | |
WS_PORT="${WS_PORT:-$(expr $PORT + 1)}" | |
JSONRPC_PORT="${JSONRPC_PORT:-$(expr $PORT + 2)}" | |
UI_PORT="${UI_PORT:-$(expr $PORT + 3)}" | |
mkdir -p "$BASE_PATH/$NAME" | |
tmux new-session -d -s "parity_${NAME}" parity \ | |
--port=$PORT \ | |
--ws-port=$WS_PORT \ | |
--jsonrpc-port=$JSONRPC_PORT \ | |
--ui-port=$UI_PORT \ | |
--reserved-peers=$HOME/reserved-peers \ | |
--jsonrpc-cors=all \ | |
--config dev \ | |
--fat-db=on \ | |
--base-path="$BASE_PATH/$NAME" \ | |
--no-download \ | |
--identity="$NAME" \ | |
--force-ui \ | |
--ui-hosts=all \ | |
--no-discovery \ | |
--ui-interface="$BIND_IP" \ | |
--jsonrpc-apis=safe \ | |
--jsonrpc-hosts=all \ | |
--ws-interface="$BIND_IP" \ | |
--jsonrpc-interface="$BIND_IP" \ | |
--ws-apis=safe \ | |
--ws-hosts=all \ | |
--ipc-apis=safe \ | |
--ipfs-api-interface="$BIND_IP" \ | |
--ipfs-api-hosts=all \ | |
--no-acl-check \ | |
--secretstore-interface="$BIND_IP" \ | |
--secretstore-http-interface="$BIND_IP" \ | |
--no-color \ | |
--logging="$LOG_LEVEL" \ | |
--log-file=$HOME/logs/"$NAME".out.log \ | |
--pruning=archive | |
} | |
for N in $@ ; do | |
start_node $N | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment