Cardano cli transaction error

Is this correct?

cardano-cli transaction build --testnet-magic 1 \
--tx-in 2d30e396e5785dc87e1607a2d3c52a85cd86c26b6dcad10243657028b5b8af28#0 \
--tx-out addr_test1qzp3swy8at73yh8myqp0jal2p9na7dae30wvv4gq0972auq4gcgwxzupnzp90lych2a3lp2dlv7njyqntuyy07vn6m0q0mr7rm+"50000000 lovelace + TxOutDatumNone" \
--change-address addr_test1vqr8s3zxjy3rphluynzyvsra6l3f533zm60azw6ays8w50g374zzk \
--out-file ./_account/tx.unsigned

nope, you did not included the asset, and the utxo has 1073190 ada not 5000000; should look something like this

--tx-out addr_test1qzp3swy8at73yh8myqp0jal2p9na7dae30wvv4gq0972auq4gcgwxzupnzp90lych2a3lp2dlv7njyqntuyy07vn6m0q0mr7rm+"1073190 lovelace + 1000000 9c8e9da7f81e3ca90485f32ebefc98137c8ac260a072a00c4aaf142d.4d657368546f6b656e" \

probably not enough amount so you will need to take few lovelace from another utxo so, it should be.

cardano-cli transaction build --testnet-magic 1 \
--tx-in 2d30e396e5785dc87e1607a2d3c52a85cd86c26b6dcad10243657028b5b8af28#0 \
--tx-in 1b87abbe6bc0373c6f56ed27e80f1c371289a2acb6ebcc4d176f399f9a79f39c#0 \
--tx-out addr_test1qzp3swy8at73yh8myqp0jal2p9na7dae30wvv4gq0972auq4gcgwxzupnzp90lych2a3lp2dlv7njyqntuyy07vn6m0q0mr7rm+"1500000 lovelace + 1000000 9c8e9da7f81e3ca90485f32ebefc98137c8ac260a072a00c4aaf142d.4d657368546f6b656e" \
--change-address addr_test1vqr8s3zxjy3rphluynzyvsra6l3f533zm60azw6ays8w50g374zzk \
--out-file ./_account/tx.unsigned

Ok I ran that command and there was no errors but there hasn’t been any transaction made, do I need to do something else?

check again; check if you still have the small utxo present

sign the transaction and submit it

This is the latest query

                          TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
1b87abbe6bc0373c6f56ed27e80f1c371289a2acb6ebcc4d176f399f9a79f39c     0        50000000 lovelace + TxOutDatumNone
2d30e396e5785dc87e1607a2d3c52a85cd86c26b6dcad10243657028b5b8af28     0        1073190 lovelace + 1000000 9c8e9da7f81e3ca90485f32ebefc98137c8ac260a072a00c4aaf142d.4d657368546f6b656e + TxOutDatumNone
a8af6208e0e421a4e9201e7294354ca0d10282f5e1e73c4ca7bcd88cf9cfdc5f     0        50000000 lovelace + TxOutDatumNone

and I signed the transaction and submitted it but I got an error

Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (ValueNotConservedUTxO (Value 0 (fromList [])) (Value 2946578 (fromList []))))),UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (BadInputsUTxO (fromList [TxIn (TxId {_unTxId = SafeHash "a8aee1922a07592941da9c04de801b7b4324846665215b57b91fa240c95d3639"}) (TxIx 0)]))))])

This tells you that you put a --tx-in a8aee1922a07592941da9c04de801b7b4324846665215b57b91fa240c95d3639#0 in your command.
But that input does not appear in the query utxo you showed in the message before that.
The UTxO is probably already spent and cannot be used again.

use

cardano-cli transaction build --testnet-magic 1 \
--tx-in a8af6208e0e421a4e9201e7294354ca0d10282f5e1e73c4ca7bcd88cf9cfdc5f#0 \
--tx-in 2d30e396e5785dc87e1607a2d3c52a85cd86c26b6dcad10243657028b5b8af28#0 \
--tx-out addr_test1qzp3swy8at73yh8myqp0jal2p9na7dae30wvv4gq0972auq4gcgwxzupnzp90lych2a3lp2dlv7njyqntuyy07vn6m0q0mr7rm+"1500000 lovelace + 1000000 9c8e9da7f81e3ca90485f32ebefc98137c8ac260a072a00c4aaf142d.4d657368546f6b656e" \
--change-address addr_test1vqr8s3zxjy3rphluynzyvsra6l3f533zm60azw6ays8w50g374zzk \
--out-file ./_account/tx.unsigned

Ok I got this back

Estimated transaction fee: Lovelace 175093

This just means that the transaction was successfully built and you can sign and submit it.

But when I sign it and submit it I get an error. this is what I am using to sign and submit

cardano-cli transaction sign \
--tx-body-file ./_account/tx/tx.draft \
--signing-key-file ./_account/keys/payment.skey  \
--testnet-magic 1 \
--out-file ./_account/tx/tx.signed
cardano-cli transaction submit \
--tx-file ./_account/tx/tx.signed \
--testnet-magic 1

but you saved the draft transaction

--out-file ./_account/tx.unsigned

you are trying to sign/submit an older file… be careful with the files name… don’t mixt them

Ok so I changed it to this

cardano-cli transaction sign \
--tx-body-file ./_account/tx/tx.unsigned \
--signing-key-file ./_account/keys/payment.skey  \
--testnet-magic 1\
--out-file ./_account/tx/tx.signed

then submitted the transaction and still got an error

Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (ValueNotConservedUTxO (Value 50000000 (fromList [])) (Value 52000000 (fromList []))))),UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (BadInputsUTxO (fromList [TxIn (TxId {_unTxId = SafeHash "a8aee1922a07592941da9c04de801b7b4324846665215b57b91fa240c95d3639"}) (TxIx 0)]))))])

This is still not

It has an additional tx/ in it.

but the path for draft transaction is --out-file ./_account/tx.unsigned
did u change also the path for the draft transaction?

Sorry my fault, it was meant to be --tx-body-file ./_account/tx/tx.unsigned \ instead of --tx-body-file ./_account/tx.unsigned \

It worked thanks you both!!