cardano-docker/scripts/cold_create
2021-02-13 10:19:38 -05:00

41 lines
1.3 KiB
Bash

#!/bin/bash
source /scripts/init_node_vars
export WAIT_FOR_SYNC=False
echo "Creating Stake Pool addresses, keys and certificates, to be submitted to the blockchain."
# If staking/ directory exists create a backup
if [ -d "${NODE_PATH}/staking/" ]; then
TIMESTAMP=$(date +%s)
BACKUPNAME="staking.${TIMESTAMP}.tar.gz"
echo "staking directory already exists."
echo "Backing up to ${BACKUPNAME}."
mkdir -p ${NODE_PATH}/backups/
tar -zcvf ${NODE_PATH}/backups/${BACKUPNAME} ${NODE_PATH}/staking/ > /dev/null
fi
# Start creation
generate_wallet owner
register_stake_address owner --cold-create
tar -zcvf wallets-hot.tar.gz --exclude='*.skey' staking/wallets/
## Generate wallets for multiple owners
if [ -n "$MULTI_OWNERS" ]; then
for i in $(echo ${MULTI_OWNERS} | sed "s/,/ /g")
do
generate_wallet $i
register_stake_address $i --cold-create
done
fi
generate_operational_certificate
generate_registration_certificates --cold-create
register_stake_pool --cold-create
echo "Archiving required files"
cd ${NODE_PATH} && tar -zcvf staking-hot.tar.gz --exclude='cold-keys' --exclude='wallets/*/*.skey' staking/
echo "Created all addresses, certificates and transactions. Upload the \`staking-hot.tar.gz\` file to your live node, and submit the registration transaction by running with the \`--cold-register\`."
read