Am trying to send the remaining 1310316 tAda Lovelace from payment.addr to my paymentwithstake.addr
cardano-cli query utxo payment.addr
cardano-cli query utxo \
--address $(cat payment.addr) \
--testnet-magic 1097911063
TxHash TxIx Amount
33933aa41be6fb2cbb6c651bb63fdd0f2afeba5567b5c3cd0bf592327c3a408e 0 1310316 lovelace + 2 6b8d07d69639e9413dd637a1a815a7323c69c86abbafb66dbfdb1aa7 + TxOutDatumHashNone
Build raw transaction
cardano-cli transaction build-raw \
--tx-in 33933aa41be6fb2cbb6c651bb63fdd0f2afeba5567b5c3cd0bf592327c3a408e#0 \
--tx-out $(cat paymentwithstake.addr)+0 \
--invalid-hereafter 0 \
--fee 0 \
--out-file tx.raw
Calculate fee
cardano-cli transaction calculate-min-fee \
--tx-body-file tx.raw \
--tx-in-count 1 \
--tx-out-count 1 \
--witness-count 1 \
--byron-witness-count 0 \
--testnet-magic 1097911063 \
--protocol-params-file protocol.json
171177
Find paymentwithstake.addr receiving amount
expr 1310316 - 171177
1139139
cardano-cli query tip
cardano-cli query tip --testnet-magic 1097911063
{
“epoch”: 157,
“hash”: “656344881d5742e442d2e23b091bbaad7b493086264b1640b4ce0b06c9cd38c8”,
“slot”: 37706305,
“block”: 2925642,
“era”: “Alonzo”,
“syncProgress”: “100.00”
}
cardano-cli transaction build-raw
cardano-cli transaction build-raw \
--tx-in 33933aa41be6fb2cbb6c651bb63fdd0f2afeba5567b5c3cd0bf592327c3a408e#0 \
--tx-out $(cat paymentwithstake.addr)+1139139 \
--invalid-hereafter 37706505 \
--fee 171177 \
--out-file tx.raw
Sign the transaction
cardano-cli transaction sign \
--tx-body-file tx.raw \
--signing-key-file payment.skey \
--testnet-magic 1097911063 \
--out-file tx.signed
Submit transaction
cardano-cli transaction submit \
--tx-file tx.signed \
--testnet-magic 1097911063
Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ValueNotConservedUTxO (Value 1310316 (fromList [(PolicyID {policyID = ScriptHash “6b8d07d69639e9413dd637a1a815a7323c69c86abbafb66dbfdb1aa7”},fromList [(“”,2)])])) (Value 1310316 (fromList )))))])
I was told that ValueNotConservedUTxO is the result of
Value not Conserved: (Input UTXO ≠ Fee + Amount sent + Change)
But the value I calculated adds up to 0 as I am trying to send out all my tAda. What am I doing wrong?
Please help, thanks in advance!