[FR] - Balance existing transaction
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- haskell
- Domain
- blockchain, cli
Research direction
Start by reviewing the existing cardano-cli transaction build workflow and how transaction envelopes, redeemers, and signing keys are handled. Done means balancing an externally drafted transaction by calculating script costs and fees, selecting fee inputs, adding change, and writing the result to disk or stdout using node data.
Written by the indexing model from the issue text.
Description
Internal (anyone could benefit though)
Area
Transaction building
Describe the feature you'd like
I would like to use the cardano-cli to balance a transaction that was drafted by another application. Assuming we have a transaction already built with body and witnesses (redeemers) by a DApp in a transaction envelope tx.json and some signing key wallet.sk which owns ADA to pay fees:
cardano-cli transaction balance \
--socket-path ... \ #
--testnet-magic 2 \
--unbalanced-tx tx.json \
--cardano-signing-key wallet.sk \
--out-file tx.json
Would connect to the cardano-node as usual to fetch various information (utxo owned by user, protocol parameters, system start and era history) and balance the transaction. That is:
- (Re-)calculate script costs using redeemers from the tx
- Estimate fees
- Find and add input to cover fees
- Add a change output
- Write the balanced transaction to disk (or stdout)
Alternative with slightly smaller scope: Take only an input to use for paying fees and change address, very much like transaction build.
Describe alternatives you've considered
Obvious alternative is to do all this in the DApp itself, but balancing a transaction is a generic process and not application-specific. Also, this would tie the transaction creating code very much to the "source" of where UTxO, protocol parameters etc. are fetched from. Having it in the cardano-cli, a dedicated client to the cardano-node, would keep it separated from e.g. an alternative workflow that uses blockfrost.
Additional context / screenshots
We encountered this while designing a command line tool to create certain smart contract transactions in the Hydra protocol. More details here: https://github.com/cardano-scaling/hydra/issues/1574
- Dominant language
- Haskell
- Stars
- 72
- Forks
- 25
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 8
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from IntersectMBO/cardano-cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
IntersectMBO/cardano-cli#1306 · 2 comments ·
Maintainers usually reply within 1 day
-
Ensure Plutus V4 scripts can be deserialised by cardano-cliPossibly taken @carbolymer claimed this 19 days ago. Openenhancement
IntersectMBO/cardano-cli#1448 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Upstream non-Leios commits from the Leios integration branch to masterMay be free again @palas claimed this 61 days ago, and no pull request is open. Openrefactor
IntersectMBO/cardano-cli#1414 · 1 assignee ·
Maintainers usually reply within 1 day
-
Add `transaction validate` command (online phase 1 + phase 2)Possibly taken @palas claimed this 147 days ago. Openenhancement epic
IntersectMBO/cardano-cli#1380 · 4 comments · 1 reaction · 1 assignee ·
Maintainers usually reply within 1 day
-
Investigate incorporating cquisitor-style local tx validation (phase 1 + phase 2) into cardano-cliMay be free again @palas claimed this 168 days ago, and no pull request is open. Open
IntersectMBO/cardano-cli#1367 · 6 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in IntersectMBO/cardano-cli
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
compiler-explorer/compiler-explorer#9272 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 82/100
alunduil/siren-json.hs#247 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 85/100
alunduil/network-arbitrary#196 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 82/100
alunduil/collection-json.hs#402 ·
Maintainers usually reply within 1 day
-
`--margin` still counts code points when it measures the last line of a call in `Margin.hs`Possibly taken @sherenkov claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
objectionary/phino#1871 · 2 comments ·
Maintainers usually reply within 1 day