Cardano Academy

Configuring Cardano CLI

Make sure you have a cardano node running on testnet, and it's synced with other nodes. If you don't have one, check the previous chapter to set it up.
In this tutorial, I'm using cardano-cli 1.26.1, if you are using other version, the commands might be different.
First, let's create a cli-workspace/testnet directory as our workspace, you can create this directory anywhere.
mkdir -p cli-workspace/testnet
cd cli-workspace/testnet
Create a file to store some environment configurations.
Add following lines to
export CARDANO_NODE_PATH=path_to_your_cardano_node_directory
alias cardano-cli=$CARDANO_NODE_PATH/cardano-cli
export CARDANO_NODE_SOCKET_PATH=$CARDANO_NODE_PATH/node-ipc/testnet/node.socket
export TESTNET_MAGIC=1097911063
  • The path_to_your_cardano_node_directory is the directory where cardano-cli executable is located.
  • If you were following the last chapter to set up cardano node, your node socket path should be $CARDANO_NODE_PATH/node-ipc/testnet/node.socket.
  • The testnet magic can be found in testnet-shelley-genesis.json file in networkMagic field, if you were following the last chapter to set up your cardano node, the networkMagic should be 1097911063.
To load configurations in current terminal, run:
Note that everytime you open a new console, you need to run source command.
Now, make sure your cardano node is running at background, then let's test if cardano-cli is working:
cardano-cli query protocol-parameters --testnet-magic $TESTNET_MAGIC
if you see console output like this, your cardano-cli should be configured correctly:
"txFeePerByte": 44,
"minUTxOValue": 1000000,
"stakePoolDeposit": 500000000,
"decentralization": 0,
"poolRetireMaxEpoch": 18,
"extraPraosEntropy": null,
"stakePoolTargetNum": 500,
"maxBlockBodySize": 65536,
"maxTxSize": 16384,
"treasuryCut": 0.2,
"minPoolCost": 340000000,
"maxBlockHeaderSize": 1100,
"protocolVersion": {
"minor": 0,
"major": 4
"txFeeFixed": 155381,
"stakeAddressDeposit": 2000000,
"monetaryExpansion": 3.0e-3,
"poolPledgeInfluence": 0.3