Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Only output valid JSON upon transaction submit result

Open
#1,216 8 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
haskell
Domain
blockchain, cli

Research direction

Start at the cardano-cli conway transaction submit entry point and compare the successful and failed output examples in this issue. Define the JSON output for both outcomes, including the transaction hash on success and error information on failure, and verify that each result is valid JSON suitable for jq.

Written by the indexing model from the issue text.

Description

Stale

When one successfully submits a transaction:

% cardano-cli conway transaction submit --tx-file build/mint-scopes.tx.signed.json --testnet-magic 1

the output is:

Transaction successfully submitted. Transaction hash is:
{"txhash":"bdaa860ac0422ad83e67f8957ab230a7f4586d3050a7ab987ed5e40aa79a3fe6"}

which cannot be directly piped into eg. a jq script as it's not valid JSON. It seems to me a single JSON object would be much more useful as part of scriptable process, something like:

{ "result": "success", "success": true, "txhash":"bdaa860ac0422ad83e67f8957ab230a7f4586d3050a7ab987ed5e40aa79a3fe6"}
  • result: a descriptive string or object in case of failures
  • success: a boolean telling whether or not the tx was accepted by the node
  • txhash: the transaction hash if success: true

Upon failure, instead of

% cardano-cli conway transaction submit --tx-file build/mint-scopes.tx.signed.json --testnet-magic 1
Command failed: transaction submit
Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraConway (ApplyTxError (ConwayUtxowFailure (UtxoFailure (UtxosFailure (CollectErrors [BadTranslation (BabbageContextError (AlonzoContextError (TranslationLogicMissingInput (TxIn (TxId {unTxId = SafeHash "2178565983a3125c608f7dea381d5b70d064be6b21879de86d4765e8ad3361f1"}) (TxIx {unTxIx = 0})))))]))) :| [ConwayUtxowFailure (UtxoFailure (ValueNotConservedUTxO (Mismatch {mismatchSupplied = MaryValue (Coin 0) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash "dd15ae2bafb5528ab7146630a40095468363b903b3cbd8c967eddcec"},fromList [("616d6172752073636f706573",1)])])), mismatchExpected = MaryValue (Coin 8730146) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash "dd15ae2bafb5528ab7146630a40095468363b903b3cbd8c967eddcec"},fromList [("616d6172752073636f706573",1)])]))}))),ConwayUtxowFailure (UtxoFailure (BadInputsUTxO (fromList [TxIn (TxId {unTxId = SafeHash "2178565983a3125c608f7dea381d5b70d064be6b21879de86d4765e8ad3361f1"}) (TxIx {unTxIx = 0})]))),ConwayUtxowFailure (UtxoFailure NoCollateralInputs),ConwayUtxowFailure (UtxoFailure (IncorrectTotalCollateralField (DeltaCoin (-8270846)) (Coin 459300))),ConwayUtxowFailure (UtxoFailure (InsufficientCollateral (DeltaCoin (-8270846)) (Coin 459300)))]))

one would have

% cardano-cli conway transaction submit --tx-file build/mint-scopes.tx.signed.json --testnet-magic 1
{"success":false, "result": "Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraConway (ApplyTxError (ConwayUtxowFailure (UtxoFailure (UtxosFailure (CollectErrors [BadTranslation (BabbageContextError (AlonzoContextError (TranslationLogicMissingInput (TxIn (TxId {unTxId = SafeHash \"2178565983a3125c608f7dea381d5b70d064be6b21879de86d4765e8ad3361f1\"}) (TxIx {unTxIx = 0})))))]))) :| [ConwayUtxowFailure (UtxoFailure (ValueNotConservedUTxO (Mismatch {mismatchSupplied = MaryValue (Coin 0) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash \"dd15ae2bafb5528ab7146630a40095468363b903b3cbd8c967eddcec\"},fromList [(\"616d6172752073636f706573\",1)])])), mismatchExpected = MaryValue (Coin 8730146) (MultiAsset (fromList [(PolicyID {policyID = ScriptHash \"dd15ae2bafb5528ab7146630a40095468363b903b3cbd8c967eddcec\"},fromList [(\"616d6172752073636f706573\",1)])]))}))),ConwayUtxowFailure (UtxoFailure (BadInputsUTxO (fromList [TxIn (TxId {unTxId = SafeHash \"2178565983a3125c608f7dea381d5b70d064be6b21879de86d4765e8ad3361f1\"}) (TxIx {unTxIx = 0})]))),ConwayUtxowFailure (UtxoFailure NoCollateralInputs),ConwayUtxowFailure (UtxoFailure (IncorrectTotalCollateralField (DeltaCoin (-8270846)) (Coin 459300))),ConwayUtxowFailure (UtxoFailure (InsufficientCollateral (DeltaCoin (-8270846)) (Coin 459300)))]))"}

or even better: A JSON representation of the error .

Dominant language
Haskell
Stars
71
Forks
24
Avg merge
1d 5h
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from IntersectMBO/cardano-cli

All issues in IntersectMBO/cardano-cli

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.