examples for using the cardano-api library
Building, balancing and submitting transactions to the cardano blockchain is usually done with a high level of abstraction, using the plutus contract monad or the CTL (cardano transaction library) contract monad.
Another tool to build and submit transactions is the cardano-cli
. the cardano-cli comes with the cardano-node and uses the cardano-api library unter the hood. the following examples, taken from the third iteration of the plutus pioneer program, try to show how the cardano-cli
makes use of the cardano-api
to build, balance, sign and transmit transactions.
Sometimes it may also be necessary to use the cardano-api directly. One example for this is the mlabs hydra-demo. The interface to speak to a hydra node is a websocket and so tools like the contract monad and the PAB (plutus application backend) are not (yet) available (see details here). hydra-demo shows how the cardano-api can be used to build, balance and sign transactions (which then are serialised to CBOR
and transmitted through websocket to a hydra node).