Interacting with cardano-node through Haskell

I’m writing a worker in Haskell that should interact with the cardano-node. I’m familiar with the cardano-cli now but I’m wondering if I can talk to the cardano-node directly through Haskell code instead of the cardano-cli. But I’m not sure where to start. Would I use the cardano-api?
To be more exact, I’m looking for the same actions that are available in the cli: build address, transaction, send transaction etc but through Haskell code directly. Is this possible?

It might be a complete miss on my side (not dev here), but this repo might help you in your project.

1 Like

Here is an example of custom Haskell code that creates transactions etc. and interacts with cardano-node via its socket:

It’s also possible to import Cardano.CLI directly into Haskell code to access the cardano-cli functionality.


Ahh of course did not realise this about the cli. Thank you for this project it includes exactly the kind of interaction I was looking for :pray:

The main hassle with the Cardano.CLI modules is that the commands there start with reading a file and end with writing one, so it isn’t easy to hold the data in memory (instead of in intermediate files) if one wants to chain operations like building a transaction, computing the fee, and then signing it. But Cardano.CLI has examples of how to implement the most common use cases in Haskell.