Skip to content

Latest commit

 

History

History
84 lines (58 loc) · 5.13 KB

comparisons.md

File metadata and controls

84 lines (58 loc) · 5.13 KB

CTL vs. other offchain solutions

This document highlights key differences between CTL and other Cardano offchain frameworks.

Plutus Application Backend

CTL is directly inspired by the Plutus Application Backend (PAB). Unlike PAB, however, CTL is a library and not a standalone process. Over the course of CTL's development, several questions have been raised as to how best create PAB-as-a-library:

  1. How do we get the transaction in the right format?
    • This is handled by cardano-serialization-lib, a Rust library available as WASM
  2. How do we query the chain?
    • This has been solved using Ogmios & Kupo
    • Thanks to Catalyst, we now support an alternative BlockFrost backend as well (docs)
  3. How do we get wallet data?
  4. How closely should we follow Plutus' Contract API?
    • CTL's Contract model is significantly less restrictive than Plutus' and allows for arbitrary effects within the Contract monad
    • Certain features cannot be directly translated into Purescript from Haskell due to differences between the two languages
    • Some of the Plutus conventions do not make sense for us, due to differences between on-chain and off-chain
    • Our API scope is a lot more extensive, as we provide support for wallet interactions, staking operations, and more support for balancer tweaking.

For a more in-depth explanation of the differences between PAB and CTL (with code examples), refer to plutus-comparison.md.

Lucid

Wallet support

  • Both CTL and Lucid support using seed phrases and private keys.
  • Lucid allows to use any address without a private key for querying - CTL does not allow that, but it's still possible to build transactions for other wallets to sign via other means.

Query layer differences

Lucid uses a Provider class that defines all available queries. CTL query methods are defined in QueryHandle.

CTL supports the following queries that Lucid does not:

  • getScriptByHash
  • getTxMetadata
  • getChainTip
  • getCurrentEpoch
  • evaluateTx (not needed for Lucid)
  • getEraSummaries
  • getPoolIds

Lucid, on the other hand, provides a way to get a UTxO that contains a specified NFT (getUtxoByUnit).

Supported backends

  • Both CTL and Lucid support Blockfrost and Kupo+Ogmios
  • Lucid also supports Maestro
  • Both CTL and Lucid allow for custom backends - Lucid via Provider interface implementation, and CTL via a custom QueryHandle.

Staking support

Both CTL and Lucid support all operations with ADA delegations.

Testing

CTL uses Cardano Testnet, while Lucid uses an emulator.

Additionally, CTL supports testing with real wallets via headless browsers and provides an assertion library.

API design

Lucid aims for simplicity, while CTL allows more fine-grained control over transaction building process without losing the benefits of declarativeness.