Skip to content

Commit

Permalink
Major MainNet Update with new CDDL-Format, CardanoApp 4.0.0 (Breaking…
Browse files Browse the repository at this point in the history
… Change)

This update introduces a breaking change and requires theses minimum Versions:

* cardano-node/cli 1.34.1
* cardano-hw-cli 1.10.0
* Cardano-App on Ledger Nano 4.0.0
* Firmware on Trezor Model-T 2.4.3

- Main Update to the new and future proof CDDL format for TxBody/Tx files and handling

- CardanoApp/Trezor supports now Alonzo Transactions / SmartContracts

- Improved TxBody autocorrection with additional outputs of the corrected TxBody

- Enhanced UTXO Output to directly show the value in CommaSeparated ADA in addition to the normal Lovelace-Output.

- Default Transaction-Explorer for the Testnet is now testnet.cardanoscan.io, was explorer.cardano-testnet.iohkdev.io before.

- Corrected the 03b_regStakingAddrCert script, because there is no stake.skey needed for such a registration

- Changed the internal Tx-Workflow from build->sign to the futureproof method build->witness->assemble for most of the transactions.
  • Loading branch information
gitmachtl committed Apr 26, 2022
1 parent e895bff commit 4d54d90
Show file tree
Hide file tree
Showing 15 changed files with 221 additions and 113 deletions.
20 changes: 11 additions & 9 deletions cardano/mainnet/00_common.sh
Expand Up @@ -75,7 +75,8 @@ tokenMetaServer_testnet="https://metadata.cardano-testnet.iohkdev.io/metadata/"

#URLS for the Transaction-Explorers
transactionExplorer_mainnet="https://cardanoscan.io/transaction/"
transactionExplorer_testnet="https://explorer.cardano-testnet.iohkdev.io/en/transaction?id="
transactionExplorer_testnet="https://testnet.cardanoscan.io/transaction/"
#transactionExplorer_testnet="https://explorer.cardano-testnet.iohkdev.io/en/transaction?id="

#Pool-Importhelper Live-API-Helper
poolImportAPI="https://api.crypto2099.io/v1/pool/"
Expand All @@ -90,11 +91,11 @@ if [[ -f "$HOME/.common.inc" ]]; then source "$HOME/.common.inc"; fi
if [[ -f "common.inc" ]]; then source "common.inc"; fi

#Don't allow to overwrite the needed Versions, so we set it after the overwrite part
minNodeVersion="1.32.1" #minimum allowed node version for this script-collection version
minNodeVersion="1.34.1" #minimum allowed node version for this script-collection version
maxNodeVersion="9.99.9" #maximum allowed node version, 9.99.9 = no limit so far
minLedgerCardanoAppVersion="3.0.0" #minimum version for the cardano-app on the Ledger hardwarewallet
minLedgerCardanoAppVersion="4.0.0" #minimum version for the cardano-app on the Ledger hardwarewallet
minTrezorCardanoAppVersion="2.4.3" #minimum version for the cardano-app on the Trezor hardwarewallet
minHardwareCliVersion="1.9.0" #minimum version for the cardano-hw-cli
minHardwareCliVersion="1.10.0" #minimum version for the cardano-hw-cli

#Set the CARDANO_NODE_SOCKET_PATH for all cardano-cli operations
export CARDANO_NODE_SOCKET_PATH=${socket}
Expand Down Expand Up @@ -406,7 +407,7 @@ if [[ ! "${tmpEra}" == "auto" ]]; then nodeEraParam="--${tmpEra}-era"; else node

#Temporary fix to lock the transaction build-raw to mary era for
#Hardware-Wallet operations. Alonzo-Era is not yet supported, so we will lock this for now
if [[ "${nodeEraParam}" == "" ]] || [[ "${nodeEraParam}" == "--alonzo-era" ]]; then nodeEraParam="--mary-era"; fi
#if [[ "${nodeEraParam}" == "" ]] || [[ "${nodeEraParam}" == "--alonzo-era" ]]; then nodeEraParam="--mary-era"; fi


#-------------------------------------------------------
Expand Down Expand Up @@ -945,15 +946,16 @@ esac
#Check if the function was set to be only available on a specified manufacturer hw wallet
if [ ! "${onlyForManu}" == "" ] && [ ! "${onlyForManu}" == "${walletManu^^}" ]; then echo -e "\n\e[35mError - This function is NOT available on this type of Hardware-Wallet, only available on a ${onlyForManu} device at the moment!\e[0m\n"; exit 1; fi

echo -ne "\r\033[1A\e[0mCardano App Version \e[32m${versionApp}\e[0m found on your \e[32m${walletManu}\e[0m device!\033[K\n\e[32mPlease approve the action on your Hardware-Wallet (abort with CTRL+C) \e[0m... \033[K"
echo -ne "\r\033[1A\e[0mCardano App Version \e[32m${versionApp}\e[0m (HW-Cli Version \e[32m${versionHWCLI}\e[0m) found on your \e[32m${walletManu}\e[0m device!\033[K\n\e[32mPlease approve the action on your Hardware-Wallet (abort with CTRL+C) \e[0m... \033[K"
}

#-------------------------------------------------------

#-------------------------------------------------------
#Convert the given lovelaces $1 into ada (divide by 1M)
convertToADA() {
echo $(bc <<< "scale=6; ${1} / 1000000" | sed -e 's/^\./0./') #divide by 1M and add a leading zero if below 1 ada
#echo $(bc <<< "scale=6; ${1} / 1000000" | sed -e 's/^\./0./') #divide by 1M and add a leading zero if below 1 ada
printf "%'.6f" "${1}e-6" #return in ADA format (with 6 commas)
}


Expand All @@ -978,8 +980,8 @@ versionCheck "${minHardwareCliVersion}" "${versionHWCLI}"
if [[ $? -ne 0 ]]; then majorError "Version ERROR - Please use a cardano-hw-cli version ${minHardwareCliVersion} or higher !\nYour version ${versionHWCLI} is no longer supported for security reasons or features, please upgrade - thx."; exit 1; fi

#do the correction
tmp=$(${cardanohwcli} transaction transform-raw --tx-body-file ${txBodyFile} --out-file ${txBodyTmpFile} 2> /dev/stdout) #old default format
#tmp=$(${cardanohwcli} transaction transform --tx-file ${txBodyFile} --out-file ${txBodyTmpFile} 2> /dev/stdout) #new cddl format
#tmp=$(${cardanohwcli} transaction transform-raw --tx-body-file ${txBodyFile} --out-file ${txBodyTmpFile} 2> /dev/stdout) #old default format
tmp=$(${cardanohwcli} transaction transform --tx-file ${txBodyFile} --out-file ${txBodyTmpFile} 2> /dev/stdout) #new cddl format

if [[ $? -ne 0 ]]; then echo -e "\n${tmp}"; exit 1; fi
tmp_lastline=$(echo "${tmp}" | tail -n 1)
Expand Down
36 changes: 24 additions & 12 deletions cardano/mainnet/01_claimRewards.sh
Expand Up @@ -156,7 +156,9 @@ echo
utxoHashIndex=${utxoHashIndexArray[${tmpCnt}]}
utxoAmount=${utxoLovelaceArray[${tmpCnt}]} #Lovelaces
totalLovelaces=$(bc <<< "${totalLovelaces} + ${utxoAmount}" )
echo -e "Hash#Index: ${utxoHashIndex}\tAmount: ${utxoAmount}"; if [[ ! "${utxoDatumHashArray[${tmpCnt}]}" == null ]]; then echo -e " DatumHash: ${utxoDatumHashArray[${tmpCnt}]}"; fi
# echo -e "Hash#Index: ${utxoHashIndex}\tAmount: ${utxoAmount}";
echo -e "Hash#Index: ${utxoHashIndex}\tADA: $(convertToADA ${utxoAmount}) \e[90m(${utxoAmount} lovelaces)\e[0m";
if [[ ! "${utxoDatumHashArray[${tmpCnt}]}" == null ]]; then echo -e " DatumHash: ${utxoDatumHashArray[${tmpCnt}]}"; fi
assetsEntryCnt=${assetsEntryCntArray[${tmpCnt}]}

if [[ ${assetsEntryCnt} -gt 0 ]]; then
Expand Down Expand Up @@ -257,10 +259,10 @@ withdrawal="${stakingAddr}+${rewardsSum}"
txBodyFile="${tempDir}/dummy.txbody"
rm ${txBodyFile} 2> /dev/null
if [[ ${rxcnt} == 1 ]]; then
${cardanocli} transaction build-raw ${nodeEraParam} ${txInString} --tx-out "${sendToAddr}+0${assetsOutString}" --invalid-hereafter ${ttl} --fee 0 --withdrawal ${withdrawal} --out-file ${txBodyFile}
${cardanocli} transaction build-raw --cddl-format ${nodeEraParam} ${txInString} --tx-out "${sendToAddr}+0${assetsOutString}" --invalid-hereafter ${ttl} --fee 0 --withdrawal ${withdrawal} --out-file ${txBodyFile}
checkError "$?"; if [ $? -ne 0 ]; then exit $?; fi
else
${cardanocli} transaction build-raw ${nodeEraParam} ${txInString} --tx-out "${sendFromAddr}+0${assetsOutString}" --tx-out ${sendToAddr}+0 --invalid-hereafter ${ttl} --fee 0 --withdrawal ${withdrawal} --out-file ${txBodyFile}
${cardanocli} transaction build-raw --cddl-format ${nodeEraParam} ${txInString} --tx-out "${sendFromAddr}+0${assetsOutString}" --tx-out ${sendToAddr}+0 --invalid-hereafter ${ttl} --fee 0 --withdrawal ${withdrawal} --out-file ${txBodyFile}
checkError "$?"; if [ $? -ne 0 ]; then exit $?; fi
fi
fee=$(${cardanocli} transaction calculate-min-fee --tx-body-file ${txBodyFile} --protocol-params-file <(echo ${protocolParametersJSON}) --tx-in-count ${txcnt} --tx-out-count ${rxcnt} ${magicparam} --witness-count 2 --byron-witness-count 0 | awk '{ print $1 }')
Expand Down Expand Up @@ -292,6 +294,7 @@ if [[ ${rxcnt} == 1 ]]; then
fi

txBodyFile="${tempDir}/$(basename ${fromAddr}).txbody"
txWitnessFile="${tempDir}/$(basename ${fromAddr}).txwitness"
txFile="${tempDir}/$(basename ${fromAddr}).tx"
echo
echo -e "\e[0mBuilding the unsigned transaction body: \e[32m ${txBodyFile} \e[90m"
Expand All @@ -300,32 +303,40 @@ echo
#Building unsigned transaction body

if [[ ${rxcnt} == 1 ]]; then
${cardanocli} transaction build-raw ${nodeEraParam} ${txInString} --tx-out "${sendToAddr}+${lovelacesToReturn}${assetsOutString}" --invalid-hereafter ${ttl} --fee ${fee} --withdrawal ${withdrawal} --out-file ${txBodyFile}
${cardanocli} transaction build-raw --cddl-format ${nodeEraParam} ${txInString} --tx-out "${sendToAddr}+${lovelacesToReturn}${assetsOutString}" --invalid-hereafter ${ttl} --fee ${fee} --withdrawal ${withdrawal} --out-file ${txBodyFile}
else
${cardanocli} transaction build-raw ${nodeEraParam} ${txInString} --tx-out "${sendFromAddr}+${lovelacesToReturn}${assetsOutString}" --tx-out ${sendToAddr}+${rewardsSum} --invalid-hereafter ${ttl} --fee ${fee} --withdrawal ${withdrawal} --out-file ${txBodyFile}
${cardanocli} transaction build-raw --cddl-format ${nodeEraParam} ${txInString} --tx-out "${sendFromAddr}+${lovelacesToReturn}${assetsOutString}" --tx-out ${sendToAddr}+${rewardsSum} --invalid-hereafter ${ttl} --fee ${fee} --withdrawal ${withdrawal} --out-file ${txBodyFile}
fi

cat ${txBodyFile}
dispFile=$(cat ${txBodyFile}); if ${cropTxOutput} && [[ ${#dispFile} -gt 4000 ]]; then echo "${dispFile:0:4000} ... (cropped)"; else echo "${dispFile}"; fi
echo


#If stakeaddress and payment address are from the same hardware files
paymentName=$(basename ${fromAddr} .payment) #contains the name before the .payment.addr extension
stakingName=$(basename ${stakeAddr} .staking) #contains the name before the .staking.addr extension
if [[ -f "${fromAddr}.hwsfile" && -f "${stakeAddr}.hwsfile" && "${paymentName}" == "${stakingName}" ]]; then

echo -ne "\e[0mAutocorrect the TxBody for canonical order: "
tmp=$(autocorrect_TxBodyFile "${txBodyFile}"); if [ $? -ne 0 ]; then echo -e "\e[35m${tmp}\e[0m\n\n"; exit 1; fi
echo -e "\e[32m${tmp}\e[0m\n"
echo -e "\e[32m${tmp}\e[90m\n"

dispFile=$(cat ${txBodyFile}); if ${cropTxOutput} && [[ ${#dispFile} -gt 4000 ]]; then echo "${dispFile:0:4000} ... (cropped)"; else echo "${dispFile}"; fi
echo

echo -e "\e[0mSign the unsigned transaction body with the \e[32m${fromAddr}.hwsfile\e[0m & \e[32m${stakeAddr}.hwsfile\e[0m: \e[32m ${txFile} \e[90m"
echo -e "\e[0mSign (Witness+Assemble) the unsigned transaction body with the \e[32m${fromAddr}.hwsfile\e[0m & \e[32m${stakeAddr}.hwsfile\e[0m: \e[32m ${txFile} \e[90m"
echo

#Witness and Assemble the TxFile
start_HwWallet; checkError "$?"; if [ $? -ne 0 ]; then exit $?; fi
tmp=$(${cardanohwcli} transaction sign --tx-body-file ${txBodyFile} --hw-signing-file ${fromAddr}.hwsfile --hw-signing-file ${stakeAddr}.hwsfile --change-output-key-file ${fromAddr}.hwsfile --change-output-key-file ${stakeAddr}.hwsfile ${magicparam} --out-file ${txFile} 2> /dev/stdout)
if [[ "${tmp^^}" =~ (ERROR|DISCONNECT) ]]; then echo -e "\e[35m${tmp}\e[0m\n"; exit 1; else echo -e "\e[32mDONE\e[0m\n"; fi
tmp=$(${cardanohwcli} transaction witness --tx-file ${txBodyFile} --hw-signing-file ${fromAddr}.hwsfile --hw-signing-file ${stakeAddr}.hwsfile --change-output-key-file ${fromAddr}.hwsfile --change-output-key-file ${stakeAddr}.hwsfile ${magicparam} --out-file ${txWitnessFile}-payment --out-file ${txWitnessFile}-staking 2> /dev/stdout)
if [[ "${tmp^^}" =~ (ERROR|DISCONNECT) ]]; then echo -e "\e[35m${tmp}\e[0m\n"; exit 1; else echo -ne "\e[0mWitnessed ... "; fi
checkError "$?"; if [ $? -ne 0 ]; then exit $?; fi

${cardanocli} transaction assemble --tx-body-file ${txBodyFile} --witness-file ${txWitnessFile}-payment --witness-file ${txWitnessFile}-staking --out-file ${txFile}
checkError "$?"; if [ $? -ne 0 ]; then exit $?; fi
echo -e "Assembled ... \e[32mDONE\e[0m\n";


elif [[ -f "${stakeAddr}.skey" && -f "${fromAddr}.skey" ]]; then #with the normal cli skey

echo -e "\e[0mSign the unsigned transaction body with the \e[32m${fromAddr}.skey\e[0m & \e[32m${stakeAddr}.skey\e[0m: \e[32m ${txFile} \e[90m"
Expand All @@ -337,7 +348,8 @@ echo -e "\e[35mThis combination is not allowed! A Hardware-Wallet can only be us
fi
checkError "$?"; if [ $? -ne 0 ]; then exit $?; fi
echo -ne "\e[90m"
cat ${txFile}

dispFile=$(cat ${txFile}); if ${cropTxOutput} && [[ ${#dispFile} -gt 4000 ]]; then echo "${dispFile:0:4000} ... (cropped)"; else echo "${dispFile}"; fi
echo

#If you wanna skip the Prompt, set the environment variable ENV_SKIP_PROMPT to "YES" - be careful!!!
Expand Down
5 changes: 3 additions & 2 deletions cardano/mainnet/01_queryAddress.sh
Expand Up @@ -98,7 +98,8 @@ if [[ ${typeOfAddr} == ${addrTypePayment} ]]; then #Enterprise and Base UTXO ad
utxoHashIndex=${utxoHashIndexArray[${tmpCnt}]}
utxoAmount=${utxoLovelaceArray[${tmpCnt}]} #Lovelaces
totalLovelaces=$(bc <<< "${totalLovelaces} + ${utxoAmount}" )
echo -e "Hash#Index: ${utxoHashIndex}\tAmount: ${utxoAmount}";
# echo -e "Hash#Index: ${utxoHashIndex}\tAmount: ${utxoAmount}";
echo -e "Hash#Index: ${utxoHashIndex}\tADA: $(convertToADA ${utxoAmount}) \e[90m(${utxoAmount} lovelaces)\e[0m";
if [[ ! "${utxoDatumHashArray[${tmpCnt}]}" == null ]]; then echo -e " DatumHash: ${utxoDatumHashArray[${tmpCnt}]}"; fi
assetsEntryCnt=${assetsEntryCntArray[${tmpCnt}]}

Expand Down Expand Up @@ -226,7 +227,7 @@ elif [[ ${typeOfAddr} == ${addrTypeStake} ]]; then #Staking Address
fi

#If delegated to a pool, show the current pool ID
if [[ ! ${delegationPoolID} == null ]]; then echo -e " \tAccount is delegated to a Pool with ID: \e[32m${delegationPoolID}\e[0m"; fi
if [[ ! ${delegationPoolID} == null ]]; then echo -e " \tAccount is delegated to a Pool with ID: \e[32m${delegationPoolID}\e[0m"; else echo -e " \tAccount is not delegated to a Pool !"; fi

echo

Expand Down
28 changes: 20 additions & 8 deletions cardano/mainnet/01_sendAssets.sh
Expand Up @@ -394,7 +394,9 @@ echo
utxoHashIndex=${utxoHashIndexArray[${tmpCnt}]}
utxoAmount=${utxoLovelaceArray[${tmpCnt}]} #Lovelaces
totalLovelaces=$(bc <<< "${totalLovelaces} + ${utxoAmount}" )
echo -e "Hash#Index: ${utxoHashIndex}\tAmount: ${utxoAmount}"; if [[ ! "${utxoDatumHashArray[${tmpCnt}]}" == null ]]; then echo -e " DatumHash: ${utxoDatumHashArray[${tmpCnt}]}"; fi
# echo -e "Hash#Index: ${utxoHashIndex}\tAmount: ${utxoAmount}";
echo -e "Hash#Index: ${utxoHashIndex}\tADA: $(convertToADA ${utxoAmount}) \e[90m(${utxoAmount} lovelaces)\e[0m";
if [[ ! "${utxoDatumHashArray[${tmpCnt}]}" == null ]]; then echo -e " DatumHash: ${utxoDatumHashArray[${tmpCnt}]}"; fi
assetsEntryCnt=${assetsEntryCntArray[${tmpCnt}]}

if [[ ${assetsEntryCnt} -gt 0 ]]; then
Expand Down Expand Up @@ -584,7 +586,7 @@ minReturnUTXO=$(calc_minOutUTXO "${protocolParametersJSON}" "${sendToAddr}+0${as
#Generate Dummy-TxBody file for fee calculation
txBodyFile="${tempDir}/dummy.txbody"
rm ${txBodyFile} 2> /dev/null
${cardanocli} transaction build-raw ${nodeEraParam} ${txInString} --tx-out "${sendToAddr}+0${assetsSendString}" --tx-out "${sendToAddr}+0${assetsReturnString}" --invalid-hereafter ${ttl} --fee 0 ${metafileParameter} --out-file ${txBodyFile}
${cardanocli} transaction build-raw --cddl-format ${nodeEraParam} ${txInString} --tx-out "${sendToAddr}+0${assetsSendString}" --tx-out "${sendToAddr}+0${assetsReturnString}" --invalid-hereafter ${ttl} --fee 0 ${metafileParameter} --out-file ${txBodyFile}
checkError "$?"; if [ $? -ne 0 ]; then exit $?; fi
fee=$(${cardanocli} transaction calculate-min-fee --tx-body-file ${txBodyFile} --protocol-params-file <(echo ${protocolParametersJSON}) --tx-in-count ${txcnt} --tx-out-count ${rxcnt} ${magicparam} --witness-count 1 --byron-witness-count 0 | awk '{ print $1 }')
checkError "$?"; if [ $? -ne 0 ]; then exit $?; fi
Expand All @@ -605,6 +607,7 @@ echo -e "\e[0mLovelaces to return to ${fromAddr}.addr: \e[32m $(convertToADA ${l
if [[ ${lovelacesToReturn} -lt ${minReturnUTXO} ]]; then echo -e "\n\e[35mError - Not enough funds on the source Addr! Minimum UTXO value to return is ${minReturnUTXO} lovelaces.\e[0m\n"; exit 1; fi

txBodyFile="${tempDir}/$(basename ${fromAddr}).txbody"
txWitnessFile="${tempDir}/$(basename ${fromAddr}).txwitness"
txFile="${tempDir}/$(basename ${fromAddr}).tx"

echo
Expand All @@ -613,7 +616,7 @@ echo

#Building unsigned transaction body
rm ${txBodyFile} 2> /dev/null
${cardanocli} transaction build-raw ${nodeEraParam} ${txInString} --tx-out "${sendToAddr}+${lovelacesToSend}${assetsSendString}" --tx-out "${sendFromAddr}+${lovelacesToReturn}${assetsReturnString}" --invalid-hereafter ${ttl} --fee ${fee} ${metafileParameter} --out-file ${txBodyFile}
${cardanocli} transaction build-raw --cddl-format ${nodeEraParam} ${txInString} --tx-out "${sendToAddr}+${lovelacesToSend}${assetsSendString}" --tx-out "${sendFromAddr}+${lovelacesToReturn}${assetsReturnString}" --invalid-hereafter ${ttl} --fee ${fee} ${metafileParameter} --out-file ${txBodyFile}
checkError "$?"; if [ $? -ne 0 ]; then exit $?; fi

dispFile=$(cat ${txBodyFile}); if ${cropTxOutput} && [[ ${#dispFile} -gt 4000 ]]; then echo "${dispFile:0:4000} ... (cropped)"; else echo "${dispFile}"; fi
Expand All @@ -627,13 +630,16 @@ if [[ -f "${fromAddr}.hwsfile" ]]; then

echo -ne "\e[0mAutocorrect the TxBody for canonical order: "
tmp=$(autocorrect_TxBodyFile "${txBodyFile}"); if [ $? -ne 0 ]; then echo -e "\e[35m${tmp}\e[0m\n\n"; exit 1; fi
echo -e "\e[32m${tmp}\e[0m\n"
echo -e "\e[32m${tmp}\e[90m\n"

echo -e "\e[0mSign the unsigned transaction body with the \e[32m${fromAddr}.hwsfile\e[0m: \e[32m ${txFile}\e[0m"
dispFile=$(cat ${txBodyFile}); if ${cropTxOutput} && [[ ${#dispFile} -gt 4000 ]]; then echo "${dispFile:0:4000} ... (cropped)"; else echo "${dispFile}"; fi
echo

echo -e "\e[0mSign (Witness+Assemble) the unsigned transaction body with the \e[32m${fromAddr}.hwsfile\e[0m: \e[32m ${txFile}\e[0m"
echo

#Witness and Assemble the TxFile
start_HwWallet; checkError "$?"; if [ $? -ne 0 ]; then exit $?; fi

#if rxcnt==2 that means that some funds are returned back to the hw-wallet and if its a staking address, we can hide the return
#amount of lovelaces which could cause confusion. we have to add the --change-output-key-file parameters for payment and stake if
#its a base address. this only works great for base addresses, otherwise a warning would pop up on the hw-wallet complaining about that
Expand All @@ -645,10 +651,16 @@ if [[ -f "${fromAddr}.hwsfile" ]]; then
if [[ -f "${stakeFromAddr}.hwsfile" ]]; then hwWalletReturnStr="--change-output-key-file ${fromAddr}.hwsfile --change-output-key-file ${stakeFromAddr}.hwsfile"; fi
fi

tmp=$(${cardanohwcli} transaction sign --tx-body-file ${txBodyFile} --hw-signing-file ${fromAddr}.hwsfile ${hwWalletReturnStr} ${magicparam} --out-file ${txFile} 2> /dev/stdout)
if [[ "${tmp^^}" =~ (ERROR|DISCONNECT) ]]; then echo -e "\e[35m${tmp}\e[0m\n"; exit 1; else echo -e "\e[32mDONE\e[0m\n"; fi
tmp=$(${cardanohwcli} transaction witness --tx-file ${txBodyFile} --hw-signing-file ${fromAddr}.hwsfile ${hwWalletReturnStr} ${magicparam} --out-file ${txWitnessFile} 2> /dev/stdout)
if [[ "${tmp^^}" =~ (ERROR|DISCONNECT) ]]; then echo -e "\e[35m${tmp}\e[0m\n"; exit 1; else echo -ne "\e[0mWitnessed ... "; fi
checkError "$?"; if [ $? -ne 0 ]; then exit $?; fi

${cardanocli} transaction assemble --tx-body-file ${txBodyFile} --witness-file ${txWitnessFile} --out-file ${txFile}
checkError "$?"; if [ $? -ne 0 ]; then exit $?; fi
echo -e "Assembled ... \e[32mDONE\e[0m\n";

else

echo -e "\e[0mSign the unsigned transaction body with the \e[32m${fromAddr}.skey\e[0m: \e[32m ${txFile}\e[0m"
echo
${cardanocli} transaction sign --tx-body-file ${txBodyFile} --signing-key-file ${fromAddr}.skey ${magicparam} --out-file ${txFile}
Expand Down

0 comments on commit 4d54d90

Please sign in to comment.