Repository navigation
HaskLedger v1.0.0 is the first public release of HaskLedger: a Haskell eDSL for writing Cardano smart contracts.
You write validators in plain Haskell, with operators such as .==, .&& and txValidRange `after` deadline. HaskLedger compiles them through MLabs' Covenant intermediate representation and the c2uplc code generator into Plutus V3 scripts that cardano-cli deploys directly.
Haskell eDSL -> Covenant IR -> c2uplc -> UPLC -> .plutus
What you get
- The library: script context and every
TxInfofield, signatures, time ranges, values and minting, payout and double-satisfaction guards, list folds, lazy branching, hashing and BLS12-381 builtins. One import:import HaskLedger. - Thirteen example contracts, from a one-line smoke test to vesting, escrow, token gate, multisig, treasury, oracle and a one-shot NFT. Each is tested off-chain and has been run on the Cardano Preview testnet with both accepted and refused transactions.
- Security guards built in for datum hijack, token-name smuggling, double satisfaction and dust payouts, with attack tests for each.
- Seven test suites covering the library and every example contract.
- A reproducible benchmark against the same contracts written in idiomatic PlutusTx.
Performance
On the five contracts compared, on identical inputs, with the chain's cost model:
| HaskLedger vs PlutusTx | |
|---|---|
| Script size | 8 to 16 times smaller |
| CPU steps | 2.6 to 26 times fewer |
| Memory | 3.7 to 16 times less |
This is execution budget per validation, not a claim about network throughput. Method and commands to reproduce: Performance.
Get started
git clone https://github.com/KonmaORG/HaskLedger.git
cd HaskLedger
git checkout v1.0.0
nix develop
cabal build all
cabal test all
cabal run haskledger-examplesThen follow Getting started, or browse the documentation: user guide, API reference, compilation, security, testing and deployment.
Known limits
Datums are read by field index rather than typed records, .&& and .|| evaluate both sides, payout guards count lovelace only, test helpers are not yet part of the library, and there is no CIP-57 blueprint output. See current limits and how HaskLedger compares with Aiken, Plutarch and PlutusTx.
HaskLedger started with a Project Catalyst Fund 11 grant.