Skip to main content

Plutarch (Haskell)

Plutarch is a typed eDSL in Haskell for writing efficient Plutus Core validators.

Why Plutarch?

Plutarch written validators are often significantly more efficient validators. With Plutarch, you have much more fine gained control of the Plutus Core you generate, without giving up any type information.

To put things into perspective, one validator script from a large production contract was rewritten in Plutarch, changed from Plinth. Here's the comparison between the Plutarch script's execution cost compared to the Plutus Tx script's execution cost. These numbers were gathered by simulating the whole contract flow on a testnet:

VersionCPUMemoryScript Size
PlutusTx (current)198,505,651465,3582013
Plutarch51,475,60599,992489

More benchmarks, with reproducible code, soon to follow.

Installation

  • Add this repo as a source repository package to your cabal.project.
  • Add the plutarch package as a dependency to your cabal file.

Benchmarks

See the plutarch-test for testing and golden files containing benchmarks and UPLCs.

Usage

Alongside the User guide above, you may also find the Developers' guide useful for understanding the codebase.

Community