Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[FR] - Balance existing transaction

Aperta
#867 19 commenti 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
haskell
Ambito
blockchain, cli

Direzione di ricerca

Inizia esaminando il workflow esistente di cardano-cli transaction build e il modo in cui vengono gestiti gli envelope delle transazioni, i redeemer e le chiavi di firma. Il lavoro è completo quando una transazione redatta esternamente viene bilanciata calcolando i costi degli script e le commissioni, selezionando gli input per le commissioni, aggiungendo il resto e scrivendo il risultato su disco o su stdout usando i dati del nodo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs investigation Stale

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

Lingua principale
Haskell
Stelle
72
Fork
25
Merge medio
2g 1h
PR unite (30g)
8

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di IntersectMBO/cardano-cli

Tutte le issue di IntersectMBO/cardano-cli

Issue simili

Altre issue su Haskell

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.