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
@ilyar
Copy link
Author

ilyar commented Aug 11, 2021

@hoanghnbk and debug:

ps ax | grep -v grep | grep cardano-wallet
out?
ps ax | grep -v grep | grep cardano-wallet | grep mainnet
out?

@hhqwerty
Copy link

hi @ilyar it is the output for ps ax | grep -v grep | grep cardano-wallet | grep mainnet :
cardano-wallet serve --shutdown-handler --port 49581 --database /Users/hoanghoang/Library/Application Support/Daedalus Mainnet/wallets --tls-ca-cert /Users/hoanghoang/Library/Application Support/Daedalus Mainnet/tls/server/ca.crt --tls-sv-cert /Users/hoanghoang/Library/Application Support/Daedalus Mainnet/tls/server/server.crt --tls-sv-key /Users/hoanghoang/Library/Application Support/Daedalus Mainnet/tls/server/server.key --token-metadata-server https://tokens.cardano.org --sync-tolerance 300s --mainnet --node-socket /Users/hoanghoang/Library/Application Support/Daedalus Mainnet/cardano-node.socket

@hhqwerty
Copy link

and out put of sed --help is :
sed --help sed: illegal option -- - usage: sed script [-Ealn] [-i extension] [file ...] sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

@hhqwerty
Copy link

oh, I know what happened, on my macOS (Catalina 10.15.7) (I don't know if another version faces the same issue ), you change sed -r to sed -E. but thank you for your help

@ilyar
Copy link
Author

ilyar commented Aug 13, 2021

@hoanghnbk thank you
I checked for me (Linux) works both variants and updated script

@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