8

Daedalus is a full node wallet application, but can I use the full node to query the ledger?

2 Answers 2

16

Daedalus runs its own instance of cardano-node under the hood, so by installing and using cardano-cli, one can connect to this node and interact with the blockchain directly.

  1. Start Daedalus, and wait until it reaches the wallet home screen; the cardano-node.socket file is only made available after the cardano-node has started fully.
  2. Use cardano-cli: [Documentation]

Ubuntu Example (Bash)

export CARDANO_NODE_SOCKET_PATH=/home/$USER/.local/share/Daedalus/mainnet/cardano-node.socket
cardano-cli query tip --mainnet

MacOS Example

export CARDANO_NODE_SOCKET_PATH=~/Library/Application\ Support/Daedalus\ Mainnet/cardano-node.socket
cardano-cli query tip --mainnet

Windows Example (PowerShell)

On Windows, a socket file isn't used, instead we specify the pipe used, which has a different name every time Daedalus runs.

cd "C:\Program Files\Daedalus Mainnet"
$ENV:CARDANO_NODE_SOCKET_PATH = (Get-ChildItem \\.\pipe\ | Where-Object {$_.name -like "cardano-node*"}).FullName
.\cardano-cli.exe query tip --mainnet
7
  • 2
    Would be nice to have Windows and MacOS examples too, at least the default socket paths
    – Ben NOBLE
    Commented May 4, 2021 at 2:20
  • Ah I forgot how awkward it was to get the Windows named pipe :D Commented May 4, 2021 at 10:02
  • 1
    @soccer193 Trying it via PowerShell doesn't appear to work. Deadalus is running, node fully sync'd. "Shelley command failed: query tip Error: Error while looking up environment variable: CARDANO_NODE_SOCKET_PATH Error: "CARDANO_NODE_SOCKET_PATH"" If I run: Get-ChildItem \\.\pipe\ | Where-Object {$_.name -like "cardano-node-mainnet*"} It returns nothing. Currently using PowerShell 7.1.3 Commented May 5, 2021 at 2:28
  • Hey @ChadCarter, left you a response in the 'Cardano' chat room on the right of this page.
    – soccer193
    Commented May 5, 2021 at 2:54
  • @soccer193 I posted a response in the chat the other day. If you have any ideas on where the socket path should be in Windows, I'd love to know. Commented May 6, 2021 at 12:14
0

If you really have to use standard Windows CMD (instead of PowerShell) we first need to get the PID of the right "Daedalus Mainnet" process (there are multiple) eg 12345, then set CARDANO_NODE_SOCKET_PATH eg:

cd "C:\Program Files\Daedalus Mainnet"
set CARDANO_NODE_SOCKET_PATH=\\.\pipe\cardano-node-mainnet.12345.0

(Swap the 12345 with your PID value, see below. You might need to change the .0 too)

Then run your cardano-cli commands eg

cardano-cli query tip --mainnet

This should then work until you restart Daedalus.

Note: make sure Daedalus is fully synced before running cardano-cli

To get the PID manually via Task manager:

I see 4 processes named "Daedalus Mainnet" under the Processes tab in Windows11. Select the one with extra details after the name eg "(4.8.0#23001)" and right-click "Go To Details", note the PID eg 12345.

To get the PID via PowerShell, run:

(Get-ChildItem \\.\pipe\ | Where-Object {$_.name -like "cardano-node*"}).FullName

(Thanks to soccer193 and Tend for this PS snippet)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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