I am having trouble generating and sending a stake delegation transaction via cardano-cli. Currently, I am following this manual, kindly recommended by @Alexd1985 and some other forum members. I’ve listed the commands I am running and the error (related to the UTXO) below:
- Query the UTXO:
ubnutu@nodes-ubuntu:~/cardano$ cardano-cli query utxo --address $(cat payment.addr) --testnet-magic ${TESTNET_MAGIC}
TxHash TxIx Amount
--------------------------------------------------------------------------------------
b23dc64d41bfef44c01345c5cbf13b9f6f3ab1d3a517283b1953807d2c52e35b 0 969569464 lovelace + TxOutDatumHashNone
- Generate a certificate for the pool id:
ubnutu@nodes-ubuntu:~/cardano$ cardano-cli stake-address delegation-certificate \
--stake-verification-key-file /user/stake.vkey \
--stake-pool-id 8b5060d437571746f57cbd27dab89eb8e6045a554919dc472748920c \
--out-file /user/deleg.cert
- Generate a dummy tx for calculating fee:
ubnutu@nodes-ubuntu:~/cardano$ cardano-cli transaction build-raw \
--tx-in b23dc64d41bfef44c01345c5cbf13b9f6f3ab1d3a517283b1953807d2c52e35b#0 \
--tx-out $(cat payment.addr)+969569464 \
--fee 0 \
--certificate-file /user/deleg.cert \
--out-file /user/stake.tx.tmp
- Calculate the fee:
ubnutu@nodes-ubuntu:~/cardano$ cardano-cli transaction calculate-min-fee \
--tx-body-file /user/stake.tx.tmp \
--tx-in-count 1 \
--tx-out-count 1 \
--witness-count 2 \
--byron-witness-count 0 \
--protocol-params-file /user/protocol.json \
--testnet-magic ${TESTNET_MAGIC}
180549 Lovelace
- Calculate the output. Note I want to delegate 10 ADA:
ubnutu@nodes-ubuntu:~/cardano$ expr 969569464 - 180549 - 10000000
959388915
- Build the transaction to be sent:
ubnutu@nodes-ubuntu:~/cardano$ cardano-cli transaction build-raw \
--tx-in b23dc64d41bfef44c01345c5cbf13b9f6f3ab1d3a517283b1953807d2c52e35b#0 \
--tx-out $(cat payment.addr)+959388915 \
--fee 180549 \
--certificate-file /user/deleg.cert \
--out-file /user/stake.tx
- Sign the tx:
ubnutu@nodes-ubuntu:~/cardano$ cardano-cli transaction sign \
--tx-body-file /user/stake.tx \
--signing-key-file /user/payment.skey \
--signing-key-file /user/stake.skey \
--testnet-magic ${TESTNET_MAGIC} \
--out-file /user/stake.signed
- And eventually submit:
ubnutu@nodes-ubuntu:~/cardano$ cardano-cli transaction submit \
--tx-file /user/stake.signed --testnet-magic ${TESTNET_MAGIC}
Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ValueNotConservedUTxO (Value 969569464 (fromList [])) (Value 959569464 (fromList [])))))])
What do I miss?