Skip to main content

Appendix B: Transaction Quick Reference

As a stake pool operator, you need to understand the logic of creating transactions in the Cardano ecosystem. Therefore, the How to Set Up a Cardano Stake Pool guide explains how to create transactions manually using the transaction build-raw command.

Cardano CLI also includes functionality to create transactions calculating the fee and change automatically. The transaction build command uses the following syntax, where <UTXOToSpend> is the transaction hash and index of the UTXO to consume; <ReceivingAddress> is the payment address receiving funds in the transaction; <ReceivingAmount> is the amount in Lovelace that the transaction sends to <ReceivingAddress>; and, <ChangeAddress> is the payment address receiving the change from the transaction:

cardano-cli conway transaction build \
--tx-in <UTXOToSpend> \
--tx-out <ReceivingAddress>+<ReceivingAmount> \
--change-address <ChangeAddress> \
--out-file tx.raw

To withdraw rewards using the transaction build command, type the following command where <StakeAddress> is the stake address collecting rewards and <RewardBalance> is the entire balance of rewards in the account, in Lovelace:

cardano-cli conway transaction build \
--tx-in <UTXOToSpend> \
--withdrawal <StakeAddress>+<RewardBalance> \
--change-address <ChangeAddress> \
--witness-override 2 \
--out-file tx.raw

As long as you have a current copy of the protocol parameters file—named params.json throughout the How to Set Up a Cardano Stake Pool guide—the transaction build-raw allows you to build transactions offline. To calculate the transaction fee, the transaction build command obtains protocol parameters in real time, requiring a connection to an active Cardano Node instance.

Note
Note

Using the --invalid-hereafter or --invalid-before option is optional. No time limit exists for submitting transactions that you build without using either option.

In alphabetical order by description, Table 1 lists certificate files required to build transactions, as well as signing key files required to sign transactions, for each type of transaction included in the How to Set Up a Cardano Stake Pool guide.

Appendix B also includes the following sections:

Note
Note

Cardano CLI commands throughout the How to Set Up a Cardano Stake Pool guide may use the ‑‑mainnet option. If you are working in a Testnet environment, then remember to replace each instance of the ‑‑mainnet option with ‑‑testnet‑magic <MagicNumber> where <MagicNumber> is the network magic number for the Testnet that you use.

Appendix B uses the following file name extensions:

  • SKEY—Secret signing key file
  • VKEY—Public verification key file
  • CERT—Certificate file
Table 1 Transaction Quick Reference

Description

Required --certificate-file Option(s)

Required --signing-key-file Option(s)

Sending Funds

N/A

payment.skey

Registering a Stake Address

stake.cert

payment.skey

stake.skey

Delegating to a Stake Pool

deleg.cert

payment.skey

stake.skey

Delegating to a Representative

vote-deleg.cert

payment.skey

stake.skey

Registering a Stake Pool

pool.cert

deleg.cert

payment.skey

stake.skey

node.skey

Updating Stake Pool Metadata

pool.cert

deleg.cert

payment.skey

stake.skey

node.skey

Withdrawing Rewards

N/A

payment.skey

stake.skey

Retiring a Stake Pool

pool.dereg

payment.skey

node.skey

Generating Certificates

The following section provides templates for commands used to generate various certificates involved in operating a stake pool.

Stake Address Registration Certificate stake.cert

cardano-cli conway stake-address registration-certificate \
--stake-verification-key-file stake.vkey \
--key-reg-deposit-amt 2000000 \
--out-file stake.cert

Stake Address Vote Delegation Certificate vote-deleg.cert

cardano-cli conway stake-address vote-delegation-certificate \
--stake-verification-key-file stake.vkey \
--always-abstain \
--out-file vote-deleg.cert

Stake Delegation Certificate deleg.cert

cardano-cli conway stake-address stake-delegation-certificate \
--stake-verification-key-file stake.vkey \
--cold-verification-key-file node.vkey \
--out-file deleg.cert
OR
cardano-cli conway stake-address stake-delegation-certificate \
--stake-verification-key-file stake.vkey \
--stake-pool-id 9769cbc0c7c6dbdf1b50010434224ff0173c194af9b29894fc8f49c8 \
--out-file deleg.cert

Stake Pool Deregistration Certificate pool.dereg

cardano-cli conway stake-pool deregistration-certificate \
--cold-verification-key-file node.vkey \
--epoch $(bc <<< "$(curl -s -H 'Accept: application/json' http://localhost:12788/cardano-node | jq -r '.cardano.node.metrics.epoch_int.val') + 1") \
--out-file pool.dereg

Stake Pool Registration Certificate pool.cert

cardano-cli conway stake-pool registration-certificate \
--cold-verification-key-file node.vkey \
--vrf-verification-key-file vrf.vkey \
--pool-pledge 100000000 \
--pool-cost 170000000 \
--pool-margin 0.15 \
--pool-reward-account-verification-key-file stake.vkey \
--pool-owner-stake-verification-key-file stake.vkey \
--mainnet \
--single-host-pool-relay relaynode1.pool.example.net \
--pool-relay-port 6000 \
--metadata-url https://pool.example.net/metadata.json \
--metadata-hash $(cardano-cli conway stake-pool metadata-hash --pool-metadata-file metadata.json) \
--out-file pool.cert

Signing and Submitting Transactions

The following procedures provide templates for commands to sign and submit transactions.

To sign a transaction:

  1. Using removable media, copy the tx.raw file for the transaction from the computer where you built the transaction to your air-gapped, offline computer.
  2. Using a terminal window on the air-gapped, offline computer type:
    cardano-cli conway transaction sign \
    --tx-body-file tx.raw \
    --signing-key-file payment.skey \
    --mainnet \
    --out-file tx.signed

To submit a transaction:

  1. Using removable media, copy the tx.signed file for the transaction from your air-gapped, offline computer to the block-producing node in your stake pool configuration.
  2. Using a terminal window on the block-producing node, type:
    cardano-cli conway transaction submit \
    --tx-file tx.signed \
    --mainnet

Viewing Transactions

To display a draft, unsigned or signed transaction file using a human-readable format:

  • Using a terminal window, type the following command where <TransactionFileName> is the path to the transaction file that you want to inspect:
    cardano-cli debug transaction view --tx-file <TransactionFileName>