Skip to content

Commit

Permalink
chore: standardize environment variable usage across mkfiles scripts
Browse files Browse the repository at this point in the history
- update the file `devnet-mkfiles.sh` to add `set -x`
- update the `mkfiles-cardano.sh` file to change the environment variables for `cardano_bin_path`, `cardano_cli`, and `cardano_node`
- modify the `mkfiles-init.sh` file to copy the `./bin` directory instead of individual files
- edit the `mkfiles-mithril-delegation.sh` file to replace all occurrences of `./cardano-cli` with `$cardano_cli`
- update the `mkfiles-mithril-era.sh` file to change all instances of `./cardano-cli` with `$cardano_cli`
- modify the `mkfiles-mithril-payment.sh` file to replace all `./cardano-cli` occurrences with `$cardano_cli`
- update the `mkfiles-pools.sh` file to replace the command `./cardano-cli` with `$cardano_cli`
- update the `mkfiles-query.sh` file to replace all occurrences of `./cardano-cli` with `$cardano_cli`
- edit the `mkfiles-start.sh` file to change all instances of `./cardano-cli` and `./cardano-node` with `$cardano_cli` and `$cardano_node` respectively. add `set -e` and `set -x` to the script.
  • Loading branch information
falcucci committed Aug 6, 2024
1 parent 512896e commit 0202606
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 61 deletions.
1 change: 1 addition & 0 deletions mithril-test-lab/mithril-devnet/devnet-mkfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -e
if [[ -n $DEBUG ]]; then
set -x
fi
set -x

# Script directory variable
SCRIPT_DIRECTORY=$(dirname $0)
Expand Down
14 changes: 8 additions & 6 deletions mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ case $UNAME in
DATE="date";;
esac

CARDANO_CLI=./cardano-cli
CARDANO_BIN_PATH=./bin
CARDANO_CLI=${CARDANO_BIN_PATH}/cardano-cli
CARDANO_NODE=${CARDANO_BIN_PATH}/cardano-node
NUM_SPO_NODES=$NUM_POOL_NODES
INIT_SUPPLY=12000000
TOTAL_SUPPLY=2000000000000
Expand Down Expand Up @@ -194,32 +196,32 @@ cp -r ${ARTIFACTS_DIR_TEMP}/utxo-keys/* addresses

for ADDR in ${UTXO_ADDRS}; do
# Payment addresses
./cardano-cli address build \
$CARDANO_CLI address build \
--payment-verification-key-file addresses/${ADDR}.vkey \
--testnet-magic ${NETWORK_MAGIC} \
--out-file addresses/${ADDR}.addr
done

for ADDR in ${USER_ADDRS}; do
# Payment address keys
./cardano-cli address key-gen \
$CARDANO_CLI address key-gen \
--verification-key-file addresses/${ADDR}.vkey \
--signing-key-file addresses/${ADDR}.skey

# Stake address keys
./cardano-cli stake-address key-gen \
$CARDANO_CLI stake-address key-gen \
--verification-key-file addresses/${ADDR}-stake.vkey \
--signing-key-file addresses/${ADDR}-stake.skey

# Payment addresses
./cardano-cli address build \
$CARDANO_CLI address build \
--payment-verification-key-file addresses/${ADDR}.vkey \
--stake-verification-key-file addresses/${ADDR}-stake.vkey \
--testnet-magic ${NETWORK_MAGIC} \
--out-file addresses/${ADDR}.addr

# Stake addresses
./cardano-cli stake-address build \
$CARDANO_CLI stake-address build \
--stake-verification-key-file addresses/${ADDR}-stake.vkey \
--testnet-magic ${NETWORK_MAGIC} \
--out-file addresses/${ADDR}-stake.addr
Expand Down
2 changes: 1 addition & 1 deletion mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if [[ "$SKIP_CARDANO_BIN_DOWNLOAD" != "true" ]]; then
rm -f cardano-bin.tar.gz
fi

cp ./bin/* "${ARTIFACTS_DIR}/" 2>/dev/null || true
cp -r ./bin "${ARTIFACTS_DIR}/" 2>/dev/null || true
rm -rf ./bin

# Switch to artifacts directory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cat >> delegate.sh <<EOF
set -e
# Get current Cardano era
CURRENT_CARDANO_ERA=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query tip \\
CURRENT_CARDANO_ERA=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query tip \\
--testnet-magic ${NETWORK_MAGIC} \\
| jq -r '.era |= ascii_downcase | .era')
echo ">>>> Current Cardano Era: \${CURRENT_CARDANO_ERA}"
Expand All @@ -16,7 +16,7 @@ if [ "${CARDANO_NODE_VERSION}" = "8.1.2" ]; then
fi
# Get the current epoch
CURRENT_EPOCH=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query tip \\
CURRENT_EPOCH=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query tip \\
--cardano-mode \\
--testnet-magic ${NETWORK_MAGIC} | jq .epoch)
echo ">>>> Current Epoch: \${CURRENT_EPOCH}"
Expand Down Expand Up @@ -48,13 +48,13 @@ for ADDR in ${USER_ADDRS}; do
if [ \$(version_lt "${CARDANO_NODE_VERSION_RELEASE}" "8.8.0") == "false" ] && [ "\${CURRENT_CARDANO_ERA}" == "conway" ]; then
KEY_REGISTRATION_DEPOSIT_ANOUNT=0
# Conway specific creation of registration certificate
./cardano-cli \${CURRENT_CARDANO_ERA} stake-address registration-certificate \
$CARDANO_CLI \${CURRENT_CARDANO_ERA} stake-address registration-certificate \
--stake-verification-key-file addresses/\${ADDR}-stake.vkey \
--out-file addresses/\${ADDR}-stake.reg.cert \
--key-reg-deposit-amt \$KEY_REGISTRATION_DEPOSIT_ANOUNT
else
# Legacy creation of registration certificate
./cardano-cli stake-address registration-certificate \
$CARDANO_CLI stake-address registration-certificate \
--stake-verification-key-file addresses/\${ADDR}-stake.vkey \
--out-file addresses/\${ADDR}-stake.reg.cert
fi
Expand All @@ -67,13 +67,13 @@ for N in ${POOL_NODES_N}; do
cat >> delegate.sh <<EOF
if [ \$(version_lte "${CARDANO_NODE_VERSION_RELEASE}" "8.1.2") == "false" ]; then
# Stake address delegation certs
./cardano-cli \${CURRENT_CARDANO_ERA} stake-address stake-delegation-certificate \
$CARDANO_CLI \${CURRENT_CARDANO_ERA} stake-address stake-delegation-certificate \
--stake-verification-key-file addresses/user${N}-stake.vkey \
--cold-verification-key-file node-pool${N}/shelley/cold.vkey \
--out-file addresses/user${N}-stake.deleg.cert
else
# Legacy stake address delegation certs
./cardano-cli \${CURRENT_CARDANO_ERA} stake-address delegation-certificate \
$CARDANO_CLI \${CURRENT_CARDANO_ERA} stake-address delegation-certificate \
--stake-verification-key-file addresses/user${N}-stake.vkey \
--cold-verification-key-file node-pool${N}/shelley/cold.vkey \
--out-file addresses/user${N}-stake.deleg.cert
Expand All @@ -88,14 +88,14 @@ for N in ${POOL_NODES_N}; do
AMOUNT_STAKED=\$(( $N*1000000 + \$DELEGATION_ROUND*1 ))
# Get the UTxO
TX_IN=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query utxo \\
TX_IN=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query utxo \\
--testnet-magic ${NETWORK_MAGIC} --address \$(cat addresses/utxo${N}.addr) --out-file /dev/stdout \\
| jq -r 'to_entries | [last] | .[0].key')
# Build the transaction
if [ "\$DELEGATION_ROUND" -eq 1 ]; then
# First delegation round, we need to include registration certificate and delegation certificate
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction build \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction build \\
--tx-in \${TX_IN} \\
--tx-out \$(cat addresses/user${N}.addr)+\${AMOUNT_STAKED} \\
--change-address \$(cat addresses/utxo${N}.addr) \\
Expand All @@ -107,7 +107,7 @@ for N in ${POOL_NODES_N}; do
--witness-override 2
else
# All other delegation rounds, we need to include only delegation certificate
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction build \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction build \\
--tx-in \${TX_IN} \\
--tx-out \$(cat addresses/user${N}.addr)+\${AMOUNT_STAKED} \\
--change-address \$(cat addresses/utxo${N}.addr) \\
Expand All @@ -119,20 +119,20 @@ for N in ${POOL_NODES_N}; do
fi
# Sign the transaction
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction sign \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction sign \\
--signing-key-file addresses/utxo${N}.skey \\
--signing-key-file addresses/user${N}-stake.skey \\
--testnet-magic ${NETWORK_MAGIC} \\
--tx-body-file node-pool${N}/tx/tx${N}-\${DELEGATION_ROUND}.txbody \\
--out-file node-pool${N}/tx/tx${N}-\${DELEGATION_ROUND}.tx
# Submit the transaction
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction submit \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction submit \\
--tx-file node-pool${N}/tx/tx${N}-\${DELEGATION_ROUND}.tx \\
--testnet-magic ${NETWORK_MAGIC}
EOF

done

chmod u+x delegate.sh
chmod u+x delegate.sh
32 changes: 16 additions & 16 deletions mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-era.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
ADDR=mithril-era

## Payment address keys
./cardano-cli address key-gen \
$CARDANO_CLI address key-gen \
--verification-key-file addresses/${ADDR}.vkey \
--signing-key-file addresses/${ADDR}.skey

## Payment addresses
./cardano-cli address build \
$CARDANO_CLI address build \
--payment-verification-key-file addresses/${ADDR}.vkey \
--testnet-magic ${NETWORK_MAGIC} \
--out-file addresses/${ADDR}.addr
Expand All @@ -27,13 +27,13 @@ function wait_for_elapsed_blocks {
CARDANO_NEXT_BLOCK_WAIT_ROUNDS_MAX=30
CARDANO_NEXT_BLOCK_WAIT_ROUNDS=1
CARDANO_NEXT_BLOCK_WAIT_ROUND_DELAY=2
CURRENT_CARDANO_BLOCK=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query tip \\
CURRENT_CARDANO_BLOCK=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query tip \\
--testnet-magic ${NETWORK_MAGIC} \\
| jq -r '.block')
while true
do
CARDANO_BLOCK_TARGET=\$(( \${CURRENT_CARDANO_BLOCK} + \${CARDANO_BLOCK_OFFSET} ))
CARDANO_BLOCK=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query tip \\
CARDANO_BLOCK=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query tip \\
--testnet-magic ${NETWORK_MAGIC} \\
| jq -r '.block')
if [ \$CARDANO_BLOCK -lt \$CARDANO_BLOCK_TARGET ] ; then
Expand All @@ -57,7 +57,7 @@ function send_funds_to_era_address {
rm -f ${MITHRIL_ERA_ERROR_FILE}
# Get current Cardano era
CURRENT_CARDANO_ERA=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query tip \\
CURRENT_CARDANO_ERA=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query tip \\
--testnet-magic ${NETWORK_MAGIC} \\
| jq -r '.era |= ascii_downcase | .era')
echo ">>>> Current Cardano Era: \${CURRENT_CARDANO_ERA}"
Expand All @@ -68,19 +68,19 @@ function send_funds_to_era_address {
fi
# Get current Cardano block
CURRENT_CARDANO_BLOCK=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query tip \\
CURRENT_CARDANO_BLOCK=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query tip \\
--testnet-magic ${NETWORK_MAGIC} \\
| jq -r '.block')
echo ">>>> Current Cardano Block: \${CURRENT_CARDANO_BLOCK}"
# Send funds to Mithril era address
## Get the UTxO of utxo${N}
TX_IN=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query utxo \\
TX_IN=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query utxo \\
--testnet-magic ${NETWORK_MAGIC} --address \$(cat addresses/utxo${N}.addr) --out-file /dev/stdout \\
| jq -r 'to_entries | [last] | .[0].key')
## Build the transaction
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction build \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction build \\
--tx-in \${TX_IN} \\
--tx-out \$(cat addresses/${ADDR}.addr)+${AMOUNT_TRANSFERRED} \\
--change-address \$(cat addresses/utxo${N}.addr) \\
Expand All @@ -89,14 +89,14 @@ function send_funds_to_era_address {
--out-file node-pool${N}/tx/tx${N}-era-funds.txbody
## Sign the transaction
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction sign \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction sign \\
--signing-key-file addresses/utxo${N}.skey \\
--testnet-magic ${NETWORK_MAGIC} \\
--tx-body-file node-pool${N}/tx/tx${N}-era-funds.txbody \\
--out-file node-pool${N}/tx/tx${N}-era-funds.tx
## Submit the transaction
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction submit \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction submit \\
--tx-file node-pool${N}/tx/tx${N}-era-funds.tx \\
--testnet-magic ${NETWORK_MAGIC}
Expand All @@ -105,7 +105,7 @@ function send_funds_to_era_address {
## Wait for all pool nodes to see the new funds
for (( i=1; i<=${NUM_POOL_NODES}; i++ )); do
AMOUNT_RETRIEVED=\$(CARDANO_NODE_SOCKET_PATH=node-pool\${i}/ipc/node.sock ./cardano-cli query utxo \\
AMOUNT_RETRIEVED=\$(CARDANO_NODE_SOCKET_PATH=node-pool\${i}/ipc/node.sock $CARDANO_CLI query utxo \\
--testnet-magic ${NETWORK_MAGIC} --address \$(cat addresses/${ADDR}.addr) --out-file /dev/stdout \\
| jq '. [] | select(.value.lovelace | . != null and . != "") | .value.lovelace')
echo ">>>>>> Era address funds retrieved on node-pool\${i}: \${AMOUNT_RETRIEVED}"
Expand Down Expand Up @@ -145,12 +145,12 @@ function write_datums_for_era_address {
rm -f ${MITHRIL_ERA_ERROR_FILE}
# Write the era datum on chain
TX_IN=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query utxo \\
TX_IN=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query utxo \\
--testnet-magic ${NETWORK_MAGIC} --address \$(cat addresses/${ADDR}.addr) --out-file /dev/stdout \\
| jq -r 'to_entries | [last] | .[0].key')
## Build the transaction
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction build \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction build \\
--tx-in \${TX_IN} \\
--tx-out \$(cat addresses/${ADDR}.addr)+${SCRIPT_TX_VALUE} \\
--tx-out-inline-datum-file \${DATUM_FILE} \\
Expand All @@ -160,14 +160,14 @@ function write_datums_for_era_address {
--out-file node-pool${N}/tx/tx${N}-era-datum.txbody
## Sign the transaction
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction sign \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction sign \\
--signing-key-file addresses/${ADDR}.skey \\
--testnet-magic ${NETWORK_MAGIC} \\
--tx-body-file node-pool${N}/tx/tx${N}-era-datum.txbody \\
--out-file node-pool${N}/tx/tx${N}-era-datum.tx
## Submit the transaction
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction submit \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction submit \\
--tx-file node-pool${N}/tx/tx${N}-era-datum.tx \\
--testnet-magic ${NETWORK_MAGIC}
Expand All @@ -176,7 +176,7 @@ function write_datums_for_era_address {
## Wait for all pool nodes to see the new era datum
for (( i=1; i<=${NUM_POOL_NODES}; i++ )); do
INLINE_DATUM=\$(CARDANO_NODE_SOCKET_PATH=node-pool\${i}/ipc/node.sock ./cardano-cli query utxo \\
INLINE_DATUM=\$(CARDANO_NODE_SOCKET_PATH=node-pool\${i}/ipc/node.sock $CARDANO_CLI query utxo \\
--testnet-magic ${NETWORK_MAGIC} --address \$(cat addresses/${ADDR}.addr) --out-file /dev/stdout \\
| jq -r '. [] | select(.inlineDatum | . != null and . != "") | .inlineDatum.fields[].bytes' | xxd -r -p)
echo ">>>>>> Era address inline datum retrieved on node-pool\${i}: \${INLINE_DATUM}"
Expand Down
22 changes: 11 additions & 11 deletions mithril-test-lab/mithril-devnet/mkfiles/mkfiles-mithril-payment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ for (( i=1; i<=${NUM_POOL_NODES}; i++ ))
ADDR_RX=mithril-rx${i}
if [ ! -f addresses/${ADDR_RX}.addr ]; then
## Payment address keys
./cardano-cli address key-gen \
$CARDANO_CLI address key-gen \
--verification-key-file addresses/${ADDR_RX}.vkey \
--signing-key-file addresses/${ADDR_RX}.skey

## Payment addresses
./cardano-cli address build \
$CARDANO_CLI address build \
--payment-verification-key-file addresses/${ADDR_RX}.vkey \
--testnet-magic ${NETWORK_MAGIC} \
--out-file addresses/${ADDR_RX}.addr
Expand All @@ -34,13 +34,13 @@ function wait_for_elapsed_blocks {
CARDANO_NEXT_BLOCK_WAIT_ROUNDS_MAX=30
CARDANO_NEXT_BLOCK_WAIT_ROUNDS=1
CARDANO_NEXT_BLOCK_WAIT_ROUND_DELAY=2
CURRENT_CARDANO_BLOCK=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query tip \\
CURRENT_CARDANO_BLOCK=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query tip \\
--testnet-magic ${NETWORK_MAGIC} \\
| jq -r '.block')
while true
do
CARDANO_BLOCK_TARGET=\$(( \${CURRENT_CARDANO_BLOCK} + \${CARDANO_BLOCK_OFFSET} ))
CARDANO_BLOCK=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query tip \\
CARDANO_BLOCK=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query tip \\
--testnet-magic ${NETWORK_MAGIC} \\
| jq -r '.block')
if [ \$CARDANO_BLOCK -lt \$CARDANO_BLOCK_TARGET ] ; then
Expand Down Expand Up @@ -72,7 +72,7 @@ do
ADDR_RX=mithril-rx${i}
cat >> payment-mithril.sh <<EOF
# Get current Cardano era
CURRENT_CARDANO_ERA=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query tip \\
CURRENT_CARDANO_ERA=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query tip \\
--testnet-magic ${NETWORK_MAGIC} \\
| jq -r '.era |= ascii_downcase | .era')
echo ">>>>>> Current Cardano Era: \${CURRENT_CARDANO_ERA}"
Expand All @@ -88,12 +88,12 @@ cat >> payment-mithril.sh <<EOF
# Send funds to Mithril receiver address
## Get the UTxO of utxo${i}
TX_IN=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query utxo \\
TX_IN=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query utxo \\
--testnet-magic ${NETWORK_MAGIC} --address \$(cat addresses/utxo${i}.addr) --out-file /dev/stdout \\
| jq -r 'to_entries | [last] | .[0].key')
## Build the transaction
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction build \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction build \\
--tx-in \${TX_IN} \\
--tx-out \$(cat addresses/${ADDR_RX}.addr)+\${AMOUNT_TRANSFERRED} \\
--change-address \$(cat addresses/utxo${i}.addr) \\
Expand All @@ -102,14 +102,14 @@ cat >> payment-mithril.sh <<EOF
--out-file node-pool${i}/tx/tx${i}-payment-funds.txbody
## Sign the transaction
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction sign \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction sign \\
--signing-key-file addresses/utxo${i}.skey \\
--testnet-magic ${NETWORK_MAGIC} \\
--tx-body-file node-pool${i}/tx/tx${i}-payment-funds.txbody \\
--out-file node-pool${i}/tx/tx${i}-payment-funds.tx
## Submit the transaction
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} transaction submit \\
CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction submit \\
--tx-file node-pool${i}/tx/tx${i}-payment-funds.tx \\
--testnet-magic ${NETWORK_MAGIC}
EOF
Expand All @@ -125,10 +125,10 @@ do
cat >> payment-mithril.sh <<EOF
## Compute the submitted transaction id
TX_ID_SUBMITTED=\$(./cardano-cli \${CURRENT_CARDANO_ERA} transaction txid --tx-file node-pool${i}/tx/tx${i}-payment-funds.tx)
TX_ID_SUBMITTED=\$($CARDANO_CLI \${CURRENT_CARDANO_ERA} transaction txid --tx-file node-pool${i}/tx/tx${i}-payment-funds.tx)
## Retrieve the on-chain transaction id
TX_IN_ON_CHAIN=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli query utxo \\
TX_IN_ON_CHAIN=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query utxo \\
--testnet-magic ${NETWORK_MAGIC} --address \$(cat addresses/utxo${i}.addr) --out-file /dev/stdout \\
| jq -r 'to_entries | [last] | .[0].key' | cut -d '#' -f 1)
Expand Down
Loading

0 comments on commit 0202606

Please sign in to comment.