Transaction scripts

Create the transaction script file (transaction.sh for example) in a new subfolder of the transactions folder, sign it and submit it to the blockchain:

#!/bin/bash


source ../../pool-scripts/env

ADDRESS=$(cat ${NODE_HOME}/keys/payment.addr)
TRANS=$(cardano-cli query utxo ${NET} --address $ADDRESS | tail -n 1)
UTXO=$(echo ${TRANS} | awk '{print $1}')
ID=$(echo ${TRANS} | awk '{print $2}')
TXIN="${UTXO}#${ID}"

cardano-cli transaction build \
${NET} \
--witness-override 3 \
--tx-in ${TXIN} \
--change-address ${ADDRESS} \
--certificate-file ${NODE_HOME}/pool-certificates/pool-registration.cert \
--certificate-file ${NODE_HOME}/pool-certificates/stake-registration.cert \
--certificate-file ${NODE_HOME}/pool-certificates/stake-delegation.cert \
--out-file tx.raw

cardano-cli transaction sign \
--tx-body-file tx.raw \
--signing-key-file ${NODE_HOME}/pool-keys/cold.skey \
--signing-key-file ${NODE_HOME}/keys/stake.skey \
--signing-key-file ${NODE_HOME}/keys/payment.skey \
${NET} \
--out-file tx.signed

cardano-cli transaction submit \
--tx-file tx.signed \
${NET}

Last updated