← 返回命令列表

Linux command

cardano-cli 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Query tip

cardano-cli query tip --mainnet

Generate payment keys

cardano-cli address key-gen --verification-key-file [payment.vkey] --signing-key-file [payment.skey]

Build a payment address

cardano-cli address build --payment-verification-key-file [payment.vkey] --out-file [payment.addr] --mainnet

Query UTxOs

cardano-cli query utxo --address [addr1...] --mainnet

Build a transaction

cardano-cli transaction build --tx-in [txhash#index] --tx-out [addr]+[lovelace] --change-address [addr] --mainnet --out-file [tx.raw]

Sign a transaction

cardano-cli transaction sign --tx-body-file [tx.raw] --signing-key-file [payment.skey] --mainnet --out-file [tx.signed]

Submit a transaction

cardano-cli transaction submit --tx-file [tx.signed] --mainnet

说明

cardano-cli is the command-line interface for interacting with the Cardano blockchain. It provides functionality for key generation, address creation, transaction building, and querying the blockchain state. The tool interfaces with a running cardano-node to query blockchain data and submit transactions. It supports both mainnet and various test networks (preprod, preview). Operations include managing stake keys, delegating to stake pools, minting native tokens, and participating in on-chain governance (Conway era). Cardano uses an extended UTxO (EUTxO) model where transactions consume and produce unspent transaction outputs. The CLI handles the complexity of building valid transactions with proper fees and balancing. As of version 10.11, the default era is Conway.

参数

query
Query blockchain state (tip, utxo, protocol-parameters).
address
Address commands (key-gen, build).
transaction
Transaction commands (build, sign, submit).
stake-address
Stake address and delegation commands.
stake-pool
Stake pool operations.
governance
Governance commands: actions, DRep registration, committee, and voting (Conway era).
key
Key utility commands.
node
Node operational certificate and key-evolving signature commands.
hash
Hashing utilities for files and scripts.
genesis
Genesis block commands.
--mainnet
Use mainnet network magic.
--testnet-magic _num_
Use testnet with specific magic number.
--socket-path _path_
Path to node socket (or CARDANO_NODE_SOCKET_PATH env).
--out-file _file_
Output file for results.
--signing-key-file _file_
Private key for signing.
--verification-key-file _file_
Public key file.

FAQ

What is the cardano-cli command used for?

cardano-cli is the command-line interface for interacting with the Cardano blockchain. It provides functionality for key generation, address creation, transaction building, and querying the blockchain state. The tool interfaces with a running cardano-node to query blockchain data and submit transactions. It supports both mainnet and various test networks (preprod, preview). Operations include managing stake keys, delegating to stake pools, minting native tokens, and participating in on-chain governance (Conway era). Cardano uses an extended UTxO (EUTxO) model where transactions consume and produce unspent transaction outputs. The CLI handles the complexity of building valid transactions with proper fees and balancing. As of version 10.11, the default era is Conway.

How do I run a basic cardano-cli example?

Run `cardano-cli query tip --mainnet` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does query do in cardano-cli?

Query blockchain state (tip, utxo, protocol-parameters).