Error: Transaction validaton error: Negative quantity in transaction output:

Hello everyone. I have successfully minted a token on the mainnet using this guide, but am receiving an error when attempting to send the tokens to Daedalus.

Here is the error and a few commands before:

user@mypc:~/tokens$ fee="0"
user@mypc:~/tokens$ receiver="addr1qygs8fwtl9dtjsw3lkvyleqryrt30xevnzkuf98e7xgzu8rj3xnsgr2e2lspjae2ep8y76uyrnr3mygaeg8fx0euvrsscu86e8"
user@mypc:~/tokens$ receiver_output="100000"
user@mypc:~/tokens$ txhash="149a15d21e1af068fe093aa91499d6f88361b087fc450a04523b90c36241d79b"
user@mypc:~/tokens$ txix="0"
user@mypc:~/tokens$ funds="1817603"
user@mypc~/tokens$ cardano-cli transaction build-raw  \
> --fee $fee  \
> --tx-in $txhash#$txix  \
> --tx-out $receiver+$receiver_output+"2 $policyid.$tokenname1"  \
> --tx-out $address+$output+"9999998 $policyid.$tokenname1"  \
> --out-file rec_matx.raw
Command failed: transaction build-raw  Error: Transaction validaton error: Negative quantity (-8361890) in transaction output: TxOutInAnyEra AlonzoEra (TxOut (AddressInEra (ShelleyAddressInEra ShelleyBasedEraAlonzo) (ShelleyAddress Mainnet (KeyHashObj (KeyHash "94535df8388ec9f0303f846e877f1b6be1234c1d24c656f3f59fbb56")) StakeRefNull)) (TxOutValue MultiAssetInAlonzoEra (valueFromList [(AdaAssetId,-8361890),(AssetId "2f8ca8c70732b954d90bb0b746a9d65cf1546872225b8eaa7944e226" "zipcoin",9999998)])) TxOutDatumNone)

Any ideas?

You don’t show, where $output is calculated.

It’s fairly possible that it is calculated to a negative value.

Also: There are only 1.8 ADA in the --tx-in. That will never be enough for the minimal UTxO value of two outputs with native tokens in them plus fees. You would already need 1 ADA each plus fees as input if there were no tokens involved.

Also^2: According to, there are also other tokens in that input. They will also have to be balanced, explicitly send to one of the --tx-outs.

Also^3: Perhaps, you want to use build instead of build-raw.

1 Like

Continuing to troubleshoot, I changed my output to 1000000 by using the following command:


This has successfully allowed me to build the raw transaction. will update this thread with if I am successful in mainnet submission

Thanks Hepta, I appreciate it.

I have sent 4 Cardano total to the payment.addr of this relay, split between two TxHashes. Those amounts were reduced upon minting and now they are 1817603 & 1817339 respectively.

Both Txhashes have tokens associated with them, however, I only wish to send one set of the tokens out to my Daedalus. I am able to build the transaction using an output of 1.5 ADA, but the transaction fails to submit to the mainnet with the following error:

Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (OutputTooSmallUTxO [(Addr Mainnet (KeyHashObj (KeyHash "1103a5cbf95ab941d1fd984fe40320d7179b2c98adc494f9f1902e1c")) (StakeRefBase (KeyHashObj (KeyHash "7289a7040d5957e019772ac84e4f6b841cc71d911dca0e933f3c60e1"))),Value 100000 (fromList [(PolicyID {policyID = ScriptHash "2f8ca8c70732b954d90bb0b746a9d65cf1546872225b8eaa7944e226"},fromList [("zipcoin",2)])]),SNothing),(Addr Mainnet (KeyHashObj (KeyHash "94535df8388ec9f0303f846e877f1b6be1234c1d24c656f3f59fbb56")) StakeRefNull,Value 137934 (fromList [(PolicyID {policyID = ScriptHash "2f8ca8c70732b954d90bb0b746a9d65cf1546872225b8eaa7944e226"},fromList [("zipcoin",9999998)])]),SNothing)]))),UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ValueNotConservedUTxO (Value 1817603 (fromList [(PolicyID {policyID = ScriptHash "2f8ca8c70732b954d90bb0b746a9d65cf1546872225b8eaa7944e226"},fromList [("mttt",10000000),("zipcoin",10000000)])])) (Value 417603 (fromList [(PolicyID {policyID = ScriptHash "2f8ca8c70732b954d90bb0b746a9d65cf1546872225b8eaa7944e226"},fromList [("zipcoin",10000000)])])))))])

Based on the guide and what you’re telling me, this is likely an error due to me only having 1.8 ADA associated with my token’s TxHash. I should instead have at least 10 ADA and use an output of 10000000.

Is there a simply way for me to add Cardano to that TxHash? Or should I just send 10 ADA to the payment.addr, adjust the output, and try again?

The --tx-ins/TxHashes are transaction IDs of past transactions into an address. They can’t be made bigger after the fact. In that transaction only a specific amount of ADA and tokens went into that address.

Exactly that. You can use a lot of --tx-ins in a transaction. Just give enough into it, so that you can cover all the minimal UTxO values of the --tx-outs you want to have.

As said, you will need to balance all the tokens in the --tx-ins, not just the ones that you want to do something with.

And as also said: build is simpler than build-raw with all the protocol parameter and calculate-min-fee stuff: Please use `cardano-cli transaction build` instead of `cardano-cli transaction build-raw`

1 Like