Transaktionen allgemein

Transaktionen variieren in ihrer Komplexität, aber sie teilen sich einige gemeinsame Attribute.

  • Input - Der Output einer früheren Transaktion. Eine Transaktion kann mehrere Inputs haben.

  • Output - Wo sollen die Funds hingesendet werden? Der Output ist eine Payment Adresse und die Größe des Funds (Betrag der gesendet werden soll). Eine Transaktion kann mehrere Outputs haben.

  • Payment Adresse - Die Adresse wo die Funds hingesendet werden sollen. Wird im Output bestimmt.

  • Payment und Stake Key Pairs - Dateien mit Verification Key und Private Signing Key

  • Time To Live (TTL) - Repräsentiert einen Slot bzw. eine Deadline bis wann die Transaktion eingereicht werden soll. TTL muss auf jeden Fall größer als die aktuelle Slot Nummer sein! Eine Transaktion wird fehlerhaft wenn der gegebene TTL in der Vergangenheit liegt. Ich empfehle aktuelle SlotNo + 300

Eine RAW-Transaction erstellen

Bevor eine Transaktion eingereicht werden kann, muss diese erstellt werden. Erstelle eine raw-Datei, die alle relevanten Daten für die Transaktion enthält.

cardano-cli shelley transaction build-raw \

--tx-in TX-IN            The input transaction as TxId#TxIx where TxId is the
                         transaction hash and TxIx is the index.
--tx-out TX-OUT          The ouput transaction as Address+Lovelace where
                         Address is the Bech32-encoded address followed by the
                         amount in Lovelace.
--ttl SLOT               Time to live (in slots).
--fee LOVELACE           The fee amount in Lovelace.
--certificate-file FILE  Filepath of the certificate. This encompasses all
                         types of certificates (stake pool certificates, stake
                         key certificates etc)
--withdrawal WITHDRAWAL  The reward withdrawal as StakeAddress+Lovelace where
                         StakeAddress is the Bech32-encoded stake address
                         followed by the amount in Lovelace.
--metadata-json-file FILE
                         Filepath of the metadata file, in JSON format.
--metadata-cbor-file FILE
                         Filepath of the metadata, in raw CBOR format.
--update-proposal-file FILE
                         Filepath of the update proposal.
--out-file FILE          Output filepath of the TxBody.

Gebühren bestimmen

Jede Transaktion auf der Blockchain kostet eine kleine Gebühr, die jedes mal neu berechnet werden muss. Um die Gebühr zu bestimmen, brauchen wir eine protocol.json Datei.

cardano-cli shelley query protocol-parameters \

--shelley-mode           For talking to a node running in Shelley-only mode
                         (default).
--byron-mode             For talking to a node running in Byron-only mode.
--epoch-slots NATURAL    The number of slots per epoch (default is 21600).
--security-param NATURAL The security parameter (default is 2160).
--cardano-mode           For talking to a node running in full Cardano mode.
--epoch-slots NATURAL    The number of slots per epoch (default is 21600).
--security-param NATURAL The security parameter (default is 2160).
--mainnet                Use the mainnet magic id.
--testnet-magic NATURAL  Specify a testnet magic id.
--out-file FILE          Optional output file. Default is to write to stdout.
cardano-cli shelley transaction calculate-min-fee \

  --tx-body-file FILE      Input filepath of the TxBody.
  --mainnet                Use the mainnet magic id.
  --testnet-magic NATURAL  Specify a testnet magic id.
  --protocol-params-file FILE
                           Filepath of the JSON-encoded protocol parameters file
  --tx-in-count NATURAL    The number of transaction inputs.
  --tx-out-count NATURAL   The number of transaction outputs.
  --witness-count NATURAL  The number of Shelley key witnesses.
  --byron-witness-count NATURAL
                           The number of Byron key witnesses.

Transaktion "signen"

Eine Transaktion muss bestimmen, dass sie das Recht hat, den Input zu nutzen bzw. zu senden. In der Regel muss eine Transaktion mit den Signing Keys der Payment Adresse des Inputs "gesigned" werden.

cardano-cli shelley transaction sign \
--tx-body-file FILE      Input filepath of the TxBody.
--signing-key-file FILE  Input filepath of the signing key (one or more).
--mainnet                Use the mainnet magic id.
--testnet-magic NATURAL  Specify a testnet magic id.
--out-file FILE          Output filepath of the Tx.

Transaktion einreichen

Einreichen einer Transaktion bedeutet, dass die "gesignte" Transaktion über die lokale Node gesendet wird.

cardano-cli shelley transaction submit

--shelley-mode           For talking to a node running in Shelley-only mode
                         (default).
--byron-mode             For talking to a node running in Byron-only mode.
--epoch-slots NATURAL    The number of slots per epoch (default is 21600).
--security-param NATURAL The security parameter (default is 2160).
--cardano-mode           For talking to a node running in full Cardano mode.
--epoch-slots NATURAL    The number of slots per epoch (default is 21600).
--security-param NATURAL The security parameter (default is 2160).
--mainnet                Use the mainnet magic id.
--testnet-magic NATURAL  Specify a testnet magic id.
--tx-file FILE           Filepath of the transaction you intend to submit.

Last updated

Was this helpful?