Last active
January 4, 2018 01:08
-
-
Save mslipper/6205c25b870c49f5931bedddddc3253a to your computer and use it in GitHub Desktop.
Runs a local Grin net as per the Grin advanced docs.
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 | |
# see https://github.com/mimblewimble/grin/blob/master/doc/local_net.md | |
set -E | |
trap "kill 0" SIGINT | |
for i in `seq 1 3`; | |
do | |
dir="./.local_net/node_$i" | |
mkdir -p ${dir} | |
cp -f ./grin.toml ${dir} | |
if [ -f "$dir/wallet.seed" ]; then | |
echo "Found existing wallet at $dir." | |
else | |
cd ${dir} | |
../../target/debug/grin wallet init | |
cd ../../ | |
fi | |
done | |
cyan=6; green=2; yellow=3; blue=4; pink=5; | |
prefix_cmd () { | |
{ | |
eval "RUST_BACKTRACE=1 ../../target/debug/grin $3" || kill 0 | |
} 2>&1 | sed -e "s/\(.*\)/$(tput setaf $2)[$1] \1$(tput sgr0)/" | |
} | |
echo "Starting nodes." | |
( | |
cd ./.local_net/node_1 | |
prefix_cmd "node_1_genesis" ${cyan} 'wallet -p "password" -a "http://127.0.0.1:10001" listen --port 15000' | |
) & | |
sleep 1 | |
( | |
cd ./.local_net/node_1/ | |
prefix_cmd "node_1_miner" ${green} 'server -m -p 10000 -a 10001 -w "http://127.0.0.1:15000" run' | |
) & | |
sleep 1 | |
( | |
cd ./.local_net/node_2 | |
prefix_cmd "node_2_validator" ${yellow} 'server -s "127.0.0.1:10000" -p 20000 -a 20001 run' | |
) & | |
sleep 1 | |
( | |
cd ./.local_net/node_3 | |
prefix_cmd "node_3_server" ${blue} 'server -s "127.0.0.1:20000" -p 30000 -a 30001 run' | |
) & | |
sleep 1 | |
( | |
cd ./.local_net/node_3 | |
prefix_cmd "node_3_wallet" ${pink} 'wallet -p "password" -a "http://127.0.0.1:30001" listen --port 35000' | |
) & | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment