How to directly communicate with cardano-node through its socket?

I know of cardano-cli and I want to access some of its functionality (such as querying address balances, inspecting UTXOs etc.), but I don’t want to my program to call cardano-cli and parse its terminal output, instead I would rather interact with cardano-node directly, just as for example dbsync does.

Is there any description of the underlying protocol that describes how should I form and read the packets that go in / from the socket? What format is it using, is it all binary, or json?

2 Likes

You can use cardano-wallet to do some of those queries (inspecting balances for example), but you need cardano-db-sync and cardano-graphql to query UTxOs for example.

The diagram on this page (scroll down) shows how different components are interacting with each other:
https://docs.cardano.org/tools/comp-matrix

I do not know about any documentation about the protocol used to talk to the node directly through the socket, but that would be interesting.

1 Like

I know, I have experience with cardano-wallet, but I specifically don’t want to use that, in my use case the cardano-node could belong to semi-trusted intermediary that isn’t supposed to know any wallet secrets.

cardano-wallet requires wallet secrets to operate. I simply want to be able to query blockchain data or submit already signed transactions, just like cardano-cli can.

Try to look for Ogmios if you want to interact with the node, or blockfrost.io for an API variant may be.

blockfrost is useless for my case, I am trying to create a light wallet. blockfrost requires registration and is too centralized for this use case.

Looking at the Cardano documentation, I found: GitHub - input-output-hk/ouroboros-network: An implementation of the Ouroboros family of consensus algorithms, with its networking support

Do the PDFs there maybe help? They say that they also speak about the node-to-client protocol.

Please have a look at the added link to ogmios.

1 Like

yes that’s exactly what I was looking for