I want to do some transaction with custom metadata and was wondering if I have to install another instance of cardano-node
or if it's possible to use the already installed version by Daedalus.
1 Answer
Yes, it is possible.
First, you need to install cardano-cli
binary (you can find it in the Hydra build system, depending on your OS which might be Linux, Windows or Mac OS.
After you have your cardano-cli
installed, you now need to set your CARDANO_NODE_SOCKET_PATH
environmental variable to the location of your cardano-node
socket file that is being run by Daedalus.
This code snippet will do just that, extract the path to the socket file from the cardano-wallet
instance.
Depending on the network, you will execute the following for testnet:
export CARDANO_NODE_SOCKET_PATH=$(ps ax | grep -v grep | grep cardano-wallet | grep testnet | sed -r 's/(.*)node-socket //')
# Check var it must be path for file of node socket and not empty
echo $CARDANO_NODE_SOCKET_PATH
Or the following for mainnet:
# Create var CARDANO_NODE_SOCKET_PATH
export CARDANO_NODE_SOCKET_PATH=$(ps ax | grep -v grep | grep cardano-wallet | grep mainnet | sed -r 's/(.*)node-socket //')
# Check var it must be path for file of node socket and not empty
echo $CARDANO_NODE_SOCKET_PATH
After you have done that, you can now try to query the network using your cardano-cli
, for testnet:
$ cardano-cli get-tip --testnet-magic 1097911063
Or for mainnet:
$ cardano-cli get-tip --mainnet
Source: this useful gist
-
Could you expand some more on how to use this? It's not immediately clear to me from just looking at the Gist.– ValentinCommented Jun 2, 2021 at 10:50
-
@ValentinWalter can you check now? I tried to elaborate it a little bit more. Commented Jun 2, 2021 at 11:00
-
I found on Mac OS that the sed -r option doesn't work, but using -E does.– marcel_gCommented Jun 23, 2021 at 4:28