#!/bin/bash # # Copyright (c) 2020 The Decred developers # Use of this source code is governed by an ISC # license that can be found in the LICENSE file. # # Tmux script that sets up a testnet vspd deployment with multiple voting wallets. # # To use the script simply run `./harness.sh` from the repo root. # # The script makes a few assumptions about the system it is running on: # - tmux is installed # - dcrd, dcrwallet and vspd are available on $PATH # - Decred testnet chain is already downloaded and sync'd # - dcrd transaction index is already built # - /tmp directory exists # - The following files exist: # - ${HOME}/.dcrd/rpc.cert # - ${HOME}/.dcrd/rpc.key # - ${HOME}/.dcrwallet/rpc.cert # - ${HOME}/.dcrwallet/rpc.key set -e TMUX_SESSION="vspd-harness" HARNESS_ROOT=/tmp/vspd-harness RPC_USER="user" RPC_PASS="pass" NUMBER_OF_WALLETS=3 DCRD_RPC_CERT="${HOME}/.dcrd/rpc.cert" DCRD_RPC_KEY="${HOME}/.dcrd/rpc.key" WALLET_PASS="12345" WALLET_RPC_CERT="${HOME}/.dcrwallet/rpc.cert" WALLET_RPC_KEY="${HOME}/.dcrwallet/rpc.key" VSPD_FEE_XPUB="tpubVppjaMjp8GEWzpMGHdXNhkjqof8baKGkUzneNEiocnnjnjY9hQPe6mxzZQyzyKYS3u5yxLp8KrJvibqDzc75RGqzkv2JMPYDXmCRR1a39jg" tmux new-session -d -s $TMUX_SESSION if [ -d "${HARNESS_ROOT}" ]; then while true; do read -p "Wipe existing harness dir? " yn case $yn in [Yy]* ) rm -R "${HARNESS_ROOT}"; break;; [Nn]* ) break;; * ) echo "Please answer yes or no.";; esac done fi ################################################# # Setup dcrd. ################################################# tmux rename-window -t $TMUX_SESSION 'dcrd' echo "Writing config for dcrd" mkdir -p "${HARNESS_ROOT}/dcrd" cat > "${HARNESS_ROOT}/dcrd/dcrd.conf" < "${HARNESS_ROOT}/dcrwallet-${i}/dcrwallet.conf" < "${HARNESS_ROOT}/vspd/vspd.conf" <