Git Product home page Git Product logo

plutarch's Introduction

Plutarch

Hercules-ci Cachix Cache

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

Why Plutarch?

Plutarch written validators are often significantly more efficient than Plutus Tx written 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 Plutus Tx. 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:

Version CPU Memory Script Size
PlutusTx (current) 198,505,651 465,358 2013
Plutarch 51,475,605 99,992 489

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.

This package takes in a flag, development, that defaults to false. It's used to turn on "development mode". Following is a list of effects and their variations based on whether or not development mode is on.

On Off
Tracing functions from Plutarch.Trace log given message to the trace log. Tracing functions from Plutarch.Trace do not log. They merely return their argument.

You can turn on development mode by passing in the development flag in your cabal.project file:

package plutarch
  flags: +development

Benchmarks

See the plutarch-benchmark library for how to benchmark plutarch, and benchmarking your own scripts.

Usage

Read the Plutarch guide to get started!

Contributing

Contributions are more than welcome! Alongside the User guide above, you may also find the Developers' guide useful for understanding the codebase.

License

Copyright (c) 2021-2022 Ardana Labs
Copyright (c) 2021-2022 Cardax B.V.
Copyright (c) 2021-2022 Minswap Team
Copyright (c) 2021-2022 Liqwid Labs
Copyright (c) 2021-2022 Platonic.Systems
Copyright (c) 2021-2022 MLabs

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

plutarch's People

Contributors

totallynotchase avatar l-as avatar srid avatar t1lde avatar blamario avatar peter-mlabs avatar mangoiv avatar emiflake avatar geometer1729 avatar jhodgdev avatar darthpjb avatar sergesku avatar lemmon-714 avatar matthewcroughan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.