0

According to the docs,

cardano-cli and other Cardano software components need to know where the node socket file is located. We saved it to the path $HOME/cardano/db/node.socket in the previous example. The components read the shell environment variable CARDANO_NODE_SOCKET_PATH to find this.

It seems like this node socket file is specific to either the testnet or the mainnet, not both. Are you supposed to change the CARDANO_NODE_SOCKET_PATH environment variable every time you want to use the CLI tools with a different network?

2 Answers 2

3

It uses the same environment variable. I've not needed to change the node socket when I switch between testnet or mainnet.

5
  • 1
    Does that mean that carano-node's db directory should be the same for testnet than for mainnet?
    – Eric
    Oct 11, 2021 at 8:22
  • 1
    no, the test net is a different chain so it wouldn't use the same db as the mainnet. Oct 13, 2021 at 23:09
  • 1
    but it's ok for the node socket path to be in the same directory as the mainnet's db?
    – Eric
    Oct 14, 2021 at 9:37
  • yes, a node socket is only telling what port to use to communicate with a given node. So it can be the same port for a mainnet node and testnet node. Oct 14, 2021 at 13:20
  • When the node is running and you go to that directory where you have your node socket, you'll find its a text file that is made when you run the node. Oct 14, 2021 at 13:21
0

The node.socket is a mechanism called IPC (Inter-process communication) that basically helps a CLI instance connect to the active node which is currently syncing the blockchain to your PC (local node instance).

Refer to https://developers.cardano.org/docs/get-started/running-cardano/ and search for "--socket-path:" to jump to the relevant section which tells you more about this.

Assuming that you aren't syncing BOTH the mainnet and testnet at the same time, you can provide the same node.socket path to the cardano-node or cardano-cli instance and things should work fine... (Experts, please correct me if this isn't how it works, as I haven't tried syncing both nets at the same time).

In any case, whether you sync to mainnet or testnet, the ledger data itself is downloaded to a particular path using the ----database-path option for cardano-node. As long as you specify different paths for testnet or mainnet, you should be good to go...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.