Skip to content

Instantly share code, notes, and snippets.

@ilyar
Last active October 24, 2022 14:19
Show Gist options
  • Save ilyar/49968703823f8f70ea33efa1d8ed2190 to your computer and use it in GitHub Desktop.
Save ilyar/49968703823f8f70ea33efa1d8ed2190 to your computer and use it in GitHub Desktop.
Use Daedalus socket for cardano-cli via Docker for Mainnet or Testnet the Cardano
#!/usr/bin/env bash
#########################################
# Daedalus Wallet for the Cardano Testnet
# Download https://developers.cardano.org/en/testnets/cardano/get-started/wallet/
# Run Daedalus for Testnet
# Create var CARDANO_NODE_SOCKET_PATH
export CARDANO_NODE_SOCKET_PATH=$(ps ax | grep -v grep | grep cardano-wallet | grep testnet | sed -E 's/(.*)node-socket //')
# Check var it must be path for file of node socket and not empty
echo $CARDANO_NODE_SOCKET_PATH
# Create alias cardano-cli via docker
alias cardano-cli="docker run --rm -it -u $(id -u):$(id -g) -v "$(pwd)":/data -w /data -v "$CARDANO_NODE_SOCKET_PATH":/node.socket -e CARDANO_NODE_SOCKET_PATH=/node.socket --entrypoint cardano-cli inputoutput/cardano-node"
# Check connect if yor run Daedalus for Testnet
cardano-cli get-tip --testnet-magic 1097911063
#########################################
# Daedalus Wallet for the Cardano Mainnet
# Download https://daedaluswallet.io/en/download/
# Run Daedalus for Mainnet
# Create var CARDANO_NODE_SOCKET_PATH
export CARDANO_NODE_SOCKET_PATH=$(ps ax | grep -v grep | grep cardano-wallet | grep mainnet | sed -E 's/(.*)node-socket //')
# Check var it must be path for file of node socket and not empty
echo $CARDANO_NODE_SOCKET_PATH
# Create alias cardano-cli via docker
alias cardano-cli="docker run --rm -it -u $(id -u):$(id -g) -v "$(pwd)":/data -w /data -v "$CARDANO_NODE_SOCKET_PATH":/node.socket -e CARDANO_NODE_SOCKET_PATH=/node.socket --entrypoint cardano-cli inputoutput/cardano-node"
# Check connect if yor run Daedalus for Mainnet
cardano-cli get-tip --mainnet
@xbglowx
Copy link

xbglowx commented Dec 18, 2021

I am running into the same problem.

I believe this is the docker-for-mac issue that was only worked on to get ssh-agent forwarding working.

@uArtApe
Copy link

uArtApe commented Feb 3, 2022

Hi Ilyar,
thanks for the gist, work like a charme. Do you have an idea about correct alias for submit-api (inputoutput/cardano-submit-api)?
I miss something alias cardano-submit-api="docker run -v /data -e NETWORK=mainnet inputoutput/cardano-submit-api"

@ilyar
Copy link
Author

ilyar commented Feb 3, 2022

@uArtApe I haven't had a chance to learn the submit-api (inputoutput/cardano-submit-api) yet

@uArtApe
Copy link

uArtApe commented Feb 3, 2022

Thanks for the reply. As soon as I managed to run it with docker I let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment