-
-
Save os11k/75cfb9d2b883a99f19a66955c6be602e to your computer and use it in GitHub Desktop.
#######!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!####### | |
# PLEASE MAKE SURE DURING BUILD TRANSACTION STEP YOU PUT YOUR OWN POOL ID after required-signer-hash!!!!!!!!!!!!!!!! | |
# PLEASE MAKE SURE DURING BUILD TRANSACTION STEP YOU PUT YOUR OWN POOL ID after required-signer-hash!!!!!!!!!!!!!!!! | |
# PLEASE MAKE SURE DURING BUILD TRANSACTION STEP YOU PUT YOUR OWN POOL ID after required-signer-hash!!!!!!!!!!!!!!!! | |
#######!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!####### | |
# first make sure we have json with our voting, like this: | |
# ls -alt /tmp/CIP-0094_d8c1b1d871a27d74fbddfa16d28ce38288411a75c5d3561bb74066bcd54689e2-poll-answer.json | |
# it should contain something like this: | |
# cat /tmp/CIP-0094_d8c1b1d871a27d74fbddfa16d28ce38288411a75c5d3561bb74066bcd54689e2-poll-answer.json | |
#{ | |
# "94": { | |
# "map": [ | |
# { | |
# "k": { | |
# "int": 2 | |
# }, | |
# "v": { | |
# "bytes": "62c6be72bdf0b5b16e37e4f55cf87e46bd1281ee358b25b8006358bf25e71798" | |
# } | |
# }, | |
# { | |
# "k": { | |
# "int": 3 | |
# }, | |
# "v": { | |
# "int": 2 | |
# } | |
# } | |
# ] | |
# } | |
#} | |
# If we have this file in place and it contains proper info, then we can move on. | |
# First lets find out a tip | |
currentSlot=$(cardano-cli query tip --testnet-magic 1 | jq -r '.slot') | |
echo Current Slot: $currentSlot | |
#Find your balance and UTXOs. | |
cardano-cli query utxo \ | |
--address $(cat payment.addr) \ | |
--testnet-magic 1 > fullUtxo.out | |
tail -n +3 fullUtxo.out | sort -k3 -nr > balance.out | |
cat balance.out | |
tx_in="" | |
total_balance=0 | |
while read -r utxo; do | |
in_addr=$(awk '{ print $1 }' <<< "${utxo}") | |
idx=$(awk '{ print $2 }' <<< "${utxo}") | |
utxo_balance=$(awk '{ print $3 }' <<< "${utxo}") | |
total_balance=$((${total_balance}+${utxo_balance})) | |
echo TxHash: ${in_addr}#${idx} | |
echo ADA: ${utxo_balance} | |
tx_in="${tx_in} --tx-in ${in_addr}#${idx}" | |
done < balance.out | |
txcnt=$(cat balance.out | wc -l) | |
echo Total ADA balance: ${total_balance} | |
echo Number of UTXOs: ${txcnt} | |
# PLEASE MAKE SURE DURING BUILD TRANSACTION STEP YOU PUT YOUR OWN POOL ID after required-signer-hash!!!!!!!!!!!!!!!! | |
#build raw transaction: | |
cardano-cli transaction build-raw \ | |
${tx_in} \ | |
--tx-out $(cat ./payment.addr)+${total_balance} \ | |
--invalid-hereafter $(( ${currentSlot} + 10000)) \ | |
--fee 0 \ | |
--json-metadata-detailed-schema \ | |
--required-signer-hash 54977486bc076ef24dab6f34652c1d33113f871ebc5e863b2488e03c \ | |
--metadata-json-file /tmp/CIP-0094_d8c1b1d871a27d74fbddfa16d28ce38288411a75c5d3561bb74066bcd54689e2-poll-answer.json \ | |
--out-file tx.tmp | |
#calculate min-fee: | |
fee=$(cardano-cli transaction calculate-min-fee \ | |
--tx-body-file tx.tmp \ | |
--tx-in-count ${txcnt} \ | |
--tx-out-count 1 \ | |
--testnet-magic 1 \ | |
--witness-count 2 \ | |
--byron-witness-count 0 \ | |
--protocol-params-file params.json | awk '{ print $1 }') | |
echo fee: $fee | |
#Calculate your change output. | |
txOut=$((${total_balance}-${fee})) | |
echo txOut: ${txOut} | |
# PLEASE MAKE SURE DURING BUILD TRANSACTION STEP YOU PUT YOUR OWN POOL ID after required-signer-hash!!!!!!!!!!!!!!!! | |
#build transaction | |
cardano-cli transaction build-raw \ | |
${tx_in} \ | |
--tx-out $(cat ./payment.addr)+${txOut} \ | |
--invalid-hereafter $(( ${currentSlot} + 10000)) \ | |
--fee ${fee} \ | |
--json-metadata-detailed-schema \ | |
--required-signer-hash 54977486bc076ef24dab6f34652c1d33113f871ebc5e863b2488e03c \ | |
--metadata-json-file /tmp/CIP-0094_d8c1b1d871a27d74fbddfa16d28ce38288411a75c5d3561bb74066bcd54689e2-poll-answer.json \ | |
--out-file tx.raw | |
#sign the transaction | |
cardano-cli transaction sign \ | |
--tx-body-file tx.raw \ | |
--signing-key-file payment.skey \ | |
--signing-key-file $HOME/cold-keys/node.skey \ | |
--testnet-magic 1 \ | |
--out-file tx.signed | |
#send the transaction | |
cardano-cli transaction submit \ | |
--tx-file tx.signed \ | |
--testnet-magic 1 |
but it always errors with "Error in $: key "protocolVersion" not found
I'm not 100% sure when you get that error, but if you are trying to start 8.0.0-untested and it doesn't start, then you need to add following lines in config file(even if you just re-downloaded them from book.world.dev.cardano.org):
"ConwayGenesisFile": "conway-genesis.json",
"ConwayGenesisHash": "f28f1c1280ea0d32f8cd3143e268650d6c1a8e221522ce4a7d20d62fc09783e1",
additionally you will need conway-genesis.json file which you can download like this:
wget https://raw.githubusercontent.com/input-output-hk/cardano-world/8.x-integration/nix/cardano/environments/preview/conway-genesis.json
If you still getting that error, maybe you can provide more details, what are you doing(exact commands) when you are getting that error?
What are you using for your params.json file on line 78? I've pointed to config.json as it lists the configs for alnozo, shelley, byron genis files, etc., but it always errors with "Error in $: key "protocolVersion" not found. Curled all preprod config files new from https://developers.cardano.org/docs/get-started/running-cardano/
cardano-cli query protocol-parameters \
--testnet-magic 1 \
--out-file protocol.json
Seems we don't need to sign with stake.skey, but I will leave it here, because it is how I tested and it worked for me.
What are you using for your params.json file on line 78? I've pointed to config.json as it lists the configs for alnozo, shelley, byron genis files, etc., but it always errors with "Error in $: key "protocolVersion" not found. Curled all preprod config files new from https://developers.cardano.org/docs/get-started/running-cardano/