Transaction Error: ValueNotConservedUTxO


I try to change the margin on the test stakepool. When I send my transaction this error happens:

Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ValueNotConservedUTxO (Value 697620862 (fromList [])) (Value 197620862 (fromList [])))))])

If found that explaination to for the error:

But I don’t understand what I am missing.
Is the calculation TxOut = Amount - StakePoolDeposit - Fee


                           TxHash                                 TxIx        Amount
fcaa300f8f8d34aad6a509e17adeedc9e974a0971dae898353ef3e3e1ea52fdf     0        697620862 lovelace + TxOutDatumHashNone

(I think it is safe to post this? Please correct me if I am wrong.)

Steps I tried:

Get balance amount

cardano-cli query utxo
–address $(cat keys/cold-keys/payment.addr)
–testnet-magic 1097911063

Get StakePool deposit

cat cardano-node/params.json | grep stakePoolDeposit

Generate transaction template

cardano-cli transaction build-raw
–tx-in TxHash#TxId
–tx-out $(cat keys/cold-keys/payment.addr)+0
–invalid-hereafter 0
–fee 0
–certificate-file pool/pool.cert
–certificate-file pool/deleg.cert
–out-file transaction/tx.tmp

Calculate the minimum fee

cardano-cli transaction calculate-min-fee
–tx-body-file transaction/tx.tmp
–tx-in-count TxInCount
–tx-out-count 1
–testnet-magic 1097911063
–witness-count 3
–byron-witness-count 0
–protocol-params-file cardano-node/params.json

Calculate TxOut

expr BalanceAmount - StakePoolDeposit - Fee

Get current slot

cardano-cli query tip --testnet-magic 1097911063

Calculate invalid after slot number

expr CurrentSlot + 10000

Build transaction

cardano-cli transaction build-raw
–tx-in TxHash#TxId
–tx-out $(cat keys/cold-keys/payment.addr)+TxOut
–invalid-hereafter InvalidAfterSlotNumber
–fee Fee
–certificate-file pool/pool.cert
–certificate-file pool/deleg.cert
–out-file transaction/tx.raw

Sign the transaction

cardano-cli transaction sign
–tx-body-file transaction/tx.raw
–signing-key-file keys/cold-keys/payment.skey
–signing-key-file keys/cold-keys/node.skey
–signing-key-file keys/cold-keys/stake.skey
–testnet-magic 1097911063
–out-file transaction/tx.signed

Send transaction

cardano-cli transaction submit
–tx-file transaction/tx.signed
–testnet-magic 1097911063

What I am doing wrong?

To change pool parameters, you don’t have to pay the the deposit again. The sum of all Tx inputs and outputs must be 0. In your case, you’d want to have …

  • the --tx-in you show above
  • a refund --tx-out to yourself
  • the --fee

refund + fees => 697620862

1 Like

That worked! Thank you very very much!