3

I am going through Cardano developer docs and the different APIs used to interact with the Cardano network. In the list is Cardano Serialization Lib which has the description,

This is a library for serialization & deserialization of data structures used in Cardano’s Haskell implementation of Shelley along with useful utility functions.

I am not sure I understand its intended use. Is it an API similar to Blockfrost, Dandelion or cardano-wallet-js? If it's different, what is the intended application?

1 Answer 1

6

Generally I think you can say the point of the serialization lib is to help you manage the off-chain aspects of preparing transactions before you submit them to the network.

It's a standalone library that does not interface with the blockchain, but it provides a lot of data structures and functions to make it easier to build and sign transactions, manage keys, generate and attach scripts and metadata etc..

In contrast, a service like Blockfrost (or Dandelion) directly interfaces with the blockchain and can, for example, take care of submitting the transactions you prepared with the serialization lib.

On the other side Blockfrost can also query on-chain data (eg. fetch a list of utxos belonging to an address) that you can then use to compose your transactions with the serialization lib.

So a typical scenario could be:

1. Blockfrost: Get current network parameters
2. Blockfrost: Get UTXOs by address
3. Serialization Lib: Create a transaction with these inputs and these outputs
4. Serialization Lib: Attach this script and some metadata
5. Serialization Lib: Sign the transaction with this key
6. Serialization Lib: Build the final transaction data structure
7. Blockfrost: Submit the transaction to the network
8. Blockfrost: Check the status / block confirmations etc.

I haven't used cardano-wallet-js, but its an SDK that internally makes use of the serialization lib package, and also connects to your own cardano wallet server (which interfaces with your node / the network) - so in a way you can probably call it a hybrid or a higher abstraction layer, that should simplify things even more, if you're running your own wallet server / node.

2
  • Thanks! This is most helpful. So I guess, ideally, I could call/use this library if I was creating a wallet and wanted to handle the transaction building part..
    – Skelli
    Apr 6, 2022 at 13:58
  • Serialization Lib is the Web3.js or Ethers of Cardano. :) Apr 19, 2022 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.