/cardano-transaction-lib

A Purescript library for building smart contract transactions on Cardano

Primary LanguagePureScriptMIT LicenseMIT

cardano-transaction-lib

Moved to LovelaceAcademy/ctl-nix

Hercules-ci Cachix Cache

cardano-transaction-lib (CTL) is a Purescript library for building smart contract transactions on Cardano. It aims to port the functionality and interface of Plutus off-chain code to the browser environment.

Table of Contents

Roadmap

  • Stage 1 Build a simple transaction in the browser that works with at least one light wallet (Nami)
  • Stage 2 Once we can construct a simple user-to-user transaction, we will try to use the library to submit the tx with nami
  • Stage 3 Once we have a simple working transaction, we will seek to build a Plutus smart contract transaction with datum from scratch
  • Stage 4 Once we can construct Plutus smart contract transactions, we will seek to build a library/DSL/interface such that transactions can be built using constraints and lookups - as close as possible to a cut-and-paste solution from Plutus' Contract monad code in Haskell (but with no guarantee that code changes are not necessary)
    • Stage 4.1 Investigate supporting compatibility with the Vasil hardfork and improvements to our initial Contract API (In progress)
  • Stage 5 Once we have a basic Contract-style API, we will further refine its public interface, expand wallet support (see below), expose a test interface (see here), provide a more ergonomic JS/TS API, support stake validators, and support CIP workflows on the public testnet
  • Stage 6 Once CTL's Contract interface has been stabilized, we will add support for even more wallets and attempt to deprecate CTL's currently required Haskell server

Light wallet support

Support is planned for the following light wallets:

Due to recent ecosystem migration from legacy testnet to preprod and preview networks, some of the wallets stopped working. The progress of adapting them is tracked in this issue.

Documentation

Please explore our documentation to discover how to use CTL, how to set up its runtime, and how it compares to Plutus/PAB:

You can also access PureScript documentation for CTL and its dependencies for the most recent develop version, or generate it yourself.

Architecture

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
    • We may, however, support a BlockFrost backend as well in the future
  3. How do we query for datums (i.e. the datums themselves and not just their hashes)?
    • ogmios-datum-cache solves this problem
  4. How do we submit the transaction?
    • This is done via browser-based light wallet integration in the browser based on CIP-30
  5. 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 (e.g. CTL's DatumType and RedeemerType are type class with fundeps, as Purescript lacks any notion of type families/type-level functions)
  6. A lingering concern remains around storage solutions, if needed
    • This can be in memory, in various browser storage solutions, or a decentralized DB like Fluree

Additional resources/tools:

Available support channels info

You can find help, more information and ongoing discusion about the project here: