Splitting cardano-api in two: cardano-node-client and cardano-tx-api #4687
koslambrou
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context
The proposal is part of the general goal of creating an awesome Haskell API for working with a local (or remote) running node.
For writing DApps in Haskell, especially Plutus applications, more and more developers are using the cardano-api Haskell package, as it is the supported entry point to interact with the Cardano blockchain.
There are several issues with
cardano-api
that should be eventually addressed. In this proposal, we want to partially address the dependency footprint issue. Compiling cardano-api with its dependencies (especially cardano-ledger and ouroboros-network packages) has a very long compilation time (especially if not using Nix). For simple use cases, like only needing the ability to use types and serialization with cardano-api, a user would need to depend on the whole Cardano ecosystem. CHaP (Cardano Haskell Packages) greatly helps in reducing the dependency size listed in a downstream project’s cabal.project, but it doesn’t actually reduce compilation time as there is no cache set up. That is, unless Nix is used and a cache is set up by the user, but that is a significant amount of work.Solution
We propose to split the current cardano-api Haskell package into two packages: cardano-tx-api and cardano-node-client (or cardano-node-api).
cardano-tx-api
This Haskell package is a subset of the current
cardano-api
which is responsible for creating and balancing transactions, calculating fees and min UTXO value, etc.Any functionality that aims to communicate with a local (or remote) node on the consensus layer (e.g. the functions in
Cardano.Api.IPC
andCardano.Api.Query
) should not be in this package.This package would depend on
cardano-ledger
Haskell packages, but not onouroboros-network
packages.Cardano-node-client (or cardano-node-api)
This Haskell package will contain functions to communicate with a local (or remote) running node through the IPC interface. The functions in the modules
Cardano.Api.IPC
andCardano.Api.Query
should be of this package. Anything else related to the block listening, transaction submission, state query and tx monitoring should be part of this package.This package would depend on the
ouroboros-consensus
andcardano-ledger
Haskell packages, as well ascardano-tx-api
.Argument
This simple restructuring change will greatly reduce the dependency footprint for end-users who wish to create and serialize transactions in Haskell, but submitting them with a different tool (like a wallet). In this scenario, you don’t need the
ouroboros-network
dependency, and you would only depend oncardano-ledger
packages.Co-authored-by: @abailly-iohk @ch1bo
Beta Was this translation helpful? Give feedback.
All reactions