How bloxbean/cardano-client-lib works
This project is a full‐featured Java client library for interacting with the Cardano blockchain. It is highly modular, composed of many modules (each with its own subpackage and even its own build file) that span a wide range of concerns—from low‐level crypto and address management through transaction specification, metadata, and even support for multiple blockchain “backend” providers (e.g. Blockfrost, Koios, Ogmios/Kupo) as well as advanced modules such as CIP implementations and QuickTx. In other words, the library uses a layered, “plug‐in” style architecture, where each module is independent but interdependent through imported common utilities and defined APIs.
Main Components
• Core Library and Utilities: Represent modules such as “common”, “common-spec”, “crypto”, and “address”. These modules provide basic building blocks such as CBOR serialization, cryptography (Bip32, Bip39, CIP1852), and address derivation.
• Transaction and Metadata Modules: Include “transaction-spec”, “metadata” and “core/core-api” modules that help build, serialize, and sign blockchain transactions.
• Plutus and CIP Modules: Illustrate the “plutus” module to support smart contract serialization and on-chain script interactions. Also, include the umbrella “cip” module and its sub-modules (cip8, cip20, cip25, cip27, cip30, cip67, cip68) that add support for Cardano Improvement Proposals.
• Advanced Transaction Builders: Represent the “quicktx”, “function”, “coinselection” and other supportive modules that provide high-level, composable functions as well as customized coin selection and transaction assembly strategies.
• Supporting/Ancillary Modules: Identify other modules such as “annotation-processor”, “hd-wallet”, “governance”, “supplier” (which bring in external interactions or domain-specific functionality like wallet management or governance).
Specify Relationships and Dependencies
• Directional links from higher-level modules (like “core” and “core-api”) to lower-level ones (such as “common”, “crypto”, “common-spec”, “address”, “metadata”). Indicate that “transaction-spec” and “plutus” depend on these foundational modules.
Architectural Patterns and Design Principles
• Modularity and Separation of Concerns: Show each module as a clearly labeled block that does one thing (e.g., “plutus” handles smart contract logic, “coinselection” handles UTXO algorithm choices).
Relevant Technologies and Libraries
• That the project uses Gradle for builds (and even has Jenkins and GitHub Actions for CI/CD).
• That the library is built for Java 11.
– Clearly labeled components (e.g., “Cardano Client Core”, “Crypto & Address Utils”, “Transaction Spec”, “Metadata”, “Plutus Module”).
Overall
– Begin by sketching the broad layers: Bottom (Utilities and Fundamental Libraries), Middle (Core Domain Logic for transactions, metadata, addresses, cryptography), Upper (Specialized Modules supporting smart contracts and CIP standards), and External Integration (Backend providers connecting to the Cardano network).