Cardano Node CLI Reference
The command line interface (CLI) provides a collection of tools for generating keys, constructing transactions, creating certificates, and performing other important tasks. It is organized in a hierarchy of subcommands, and each level comes with its own built-in documentation of command syntax and options.
This section provides a reference of the core cardano-cli
commands and their associated subcommands:
cardano-cli
The set of cardano-cli
commands includes:
address
: payment address commandsstake-address
: stake address commandstransaction
: transaction commandsnode
: node operation commandsstake-pool
: stake pool commandsquery
: node query commands. Commands in this group query the local node whose Unix domain socket is obtained from the CARDANO_NODE_SOCKET_PATH environment variable.genesis
: genesis block commandstext-view
: commands for dealing with text view files that are stored on disk, such as transactions or addressesgovernance
: governance commands
cardano-cli address
The address
command contains the following subcommands:
key-gen
: creates a single address key pairkey-hash
: prints the hash of an address to stdoutbuild
: builds a payment address, with optional delegation to a stake addressinfo
: prints details about the address
cardano-cli stake-address
The stake-address
command contains the following subcommands:
key-gen
: creates a single address key pairbuild
: builds a stake addresskey-hash
: prints the hash of a stake verification keyregistration-certificate
: creates a registration certificatedelegation-certificate
: creates a stake address delegation certificatederegistration-certificate
: creates a de-registration certificate
cardano-cli transaction
The transaction
command contains the following subcommands:
build-raw
: builds a low-level transaction (uses the--cardano-mode
,--byron-mode
,--shelley-mode
flags)build
: builds an automatically balanced transaction (automatically calculates fees)sign
: signs the transactionassemble
: combines and assembles the transaction witness(es) with a transaction body to create a transactionwitness
: witnesses a transactionsubmit
: submits the transaction to the local node whose Unix domain socket is obtained from the CARDANO_NODE_SOCKET_PATH environment variable (uses the--cardano-mode
,--byron-mode
,--shelley-mode
flags)calculate-min-fee
: calculates the minimum fee for the transactioncalculate-min-required-utxo
: calculates the minimum required ada for a transaction outputhash-script-data
: calculates the hash of script data (datums)txid
: retrieves the transaction IDpolicyid
: retrieves the policy IDview
: pretty prints a transaction
cardano-cli node
The node
command contains the following subcommands:
key-gen
: creates a key pair for a node operator's offline key and a new certificate issue counterkey-gen-KES
: creates a key pair for a node KES operational keykey-gen-VRF
: creates a key pair for a node VRF operational keykey-hash-VRF
: creates a key hash for a node VRF operational keynew-counter
: keeps track of the number of KES evolutions for a given operational certificate hot keyissue-op-cert
: issues a node operational certificate
cardano-cli stake-pool
The stake-pool
command contains the following subcommands:
registration-certificate
: creates a stake pool registration certificatede-registration-certificate
: creates a stake pool de-registration certificateid
: builds pool id from the offline keymetadata-hash
: retrieves the metadata hash
cardano-cli query
The query
command contains the following subcommands:
protocol-parameters
(advanced): retrieves the node's current pool parameters (a raw dump ofLedger.ChainDepState
).tip
: gets the node's current tip (slot number, hash, and block number)stake-pools
: gets the node's current set of stake pool idsutxo
: retrieves the node's current UTxO, filtered by addressledger-state
(advanced): dumps the current state of the node (a raw dump ofLedger.NewEpochState
)*stake-distribution
: gets the node's current set of stake pool idsprotocol-state
(advanced): dumps the node's current protocol statestake-address-info
: gets the current delegations and reward accounts filtered by stake address.stake-distribution
: gets the node's current aggregated stake distributionstake-snapshot
(advanced): gets the stake snapshot information for a stake poolpool-params
(advanced): gets the current and future parameters for a stake poolleadership-schedule
: gets the slots in which the node is slot leader for the current or following epochkes-period-info
(advanced): returns diagnostic information about your operational certificatetx-mempool info
: returns details about a node's mempool's resource usagetx-mempool next-tx
: returns the next transaction to be processedtx-mempool tx-exists
: queries whether or not a transaction is in the node's mempool
cardano-cli governance
The governance
command contains the following subcommands:
create-mir-certificate
: creates an MIR (move instantaneous rewards) certificatecreate-update-proposal
: creates an update proposalcreate-genesis-key-certificate
: retrieves the genesis key certificate
cardano-cli genesis
The genesis
command contains the following subcommands:
key-gen-genesis
: creates a genesis key pairkey-gen-delegate
: creates a genesis delegate key pairkey-gen-utxo
: creates a genesis UTxO key pairkey-hash
: prints the identifier, or hash, of a public keyget-ver-key
: derives verification key from a signing keyinitial-addr
: gets the address for an initial UTxO based on the verification keyinitial-txin
: gets the transaction ID for an initial UTxO based on the verification key.create
: creates a genesis file from a genesis template, as well as genesis keys, delegation keys, and spending keys.create-staked
: creates a staked genesis filehash
: retrieves the hash value
cardano-cli text-view
The text-view
command contains the following subcommand:
decode-cbor
: prints a text view file as decoded CBOR.
Advanced Commands
query kes-period-info
: This command runs the following checks on your operational certificate and your operational certificate issue counter:
- Do the counters of the issue counter and operational certificate match?
- Do the counters match what is currently in the node state?
- Does the KES key period specified in your operational certificate fall within the current KES key period? The Cardano node will check the predicates of the OCERT rule in the cardano-ledger specification, and print additional diagnostic information as follows:
✓ The operational certificate counter agrees with the node protocol state counter
✓ Operational certificate's kes period is within the correct KES period interval
{
"qKesNodeStateOperationalCertificateNumber": 6,
"qKesCurrentKesPeriod": 404,
"qKesOnDiskOperationalCertificateNumber": 6,
"qKesRemainingSlotsInKesPeriod": 3760228,
"qKesMaxKESEvolutions": 62,
"qKesKesKeyExpiry": "2022-03-20T21:44:51Z",
"qKesEndKesInterval": 434,
"qKesStartKesInterval": 372,
"qKesSlotsPerKesPeriod": 129600
}
query leadership-schedule
: This command can calculate the leadership slots in the current epoch or the following epoch for an SPO with output as follows:
SlotNo UTC Time
-------------------------------------------------------------
4073 2021-12-29 17:26:54.998001755 UTC
4126 2021-12-29 17:27:00.298001755 UTC
4206 2021-12-29 17:27:08.298001755 UTC
4256 2021-12-29 17:27:13.298001755 UTC
4309 2021-12-29 17:27:18.598001755 UTC
4376 2021-12-29 17:27:25.298001755 UTC
4423 2021-12-29 17:27:29.998001755 UTC
4433 2021-12-29 17:27:30.998001755 UTC
transaction build ... --calculate-plutus-script-cost
: Using the --calculate-plutus-script-cost
flag with the transaction build
command will calculate the cost of the Plutus script(s) within the transaction body and output it as JSON.
[
{
"executionUnits": {
"memory": 1700,
"steps": 476468
},
"lovelaceCost": 133,
"scriptHash": "67f33146617a5e61936081db3b2117cbf59bd2123748f58ac9678656"
}
]