Skip to content

Instantly share code, notes, and snippets.

@ilyar
Last active February 21, 2023 09:27
Show Gist options
  • Save ilyar/09eda2bb01545296aa9e1351b8218086 to your computer and use it in GitHub Desktop.
Save ilyar/09eda2bb01545296aa9e1351b8218086 to your computer and use it in GitHub Desktop.
Use Daedalus socket for cardano-cli for Mainnet or Testnet the Cardano
#!/usr/bin/env bash
# Install cardano-cli or use docker https://gist.github.com/ilyar/bf4c2346be1a74c50e488181986808fb
#
# Linux https://hydra.iohk.io/job/Cardano/cardano-node/cardano-node-linux/latest-finished
# Win64 https://hydra.iohk.io/job/Cardano/cardano-node/cardano-node-win64/latest-finished
# Macos https://hydra.iohk.io/job/Cardano/cardano-node/cardano-node-macos/latest-finished
# Extcact only cardano-cli into /usr/local/bin/cardano-cli
# Check
cardano-cli --version
#########################################
# 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
# 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
# Check connect if yor run Daedalus for Mainnet
cardano-cli get-tip --mainnet
@hhqwerty
Copy link

cool! thank you and have a nice day!

@ssbright
Copy link

I am having an issue after the step where I use "cardano-cli get-tip" I get an error

error: Found argument 'get-tip' which wasn't expected, or isn't valid in this context

USAGE:
cardano-cli [FLAGS] [OPTIONS] [SUBCOMMAND]

For more information try --help

However, the previous step did indeed provide the path to node socket. What am I doing wrong. Any thoughts?

@ilyar
Copy link
Author

ilyar commented Feb 15, 2022

@ssbright

@local:~$ cardano-cli version
cardano-cli 1.28.0 - linux-x86_64 - ghc-8.10
git rev bf71fe31459905df8573e6d3f3cfe85af6ab1c99
@local:~$ cardano-cli get-tip --help
Usage: cardano-cli get-tip (--mainnet | --testnet-magic NATURAL) 

  Get the tip of your local node's blockchain

Available options:
  --mainnet                Use the mainnet magic id.
  --testnet-magic NATURAL  Specify a testnet magic id.
  -h,--help                Show this help text

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