This repository contains our collection of the libraries for developing and auditing Plutus contracts. These libraries are a research prototype under active development, they comes as is with no guarantees whatosever. Check the license for details.
The rendered Haddock for the current main
branch can be found at https://tweag.github.io/plutus-libs/
- Used for writing the first layer of off-chain code: generating and submitting transactions.
- Enables property-based testing of Plutus contracts with no code duplication.
- Interacts seamlessly with Plutus
Contract
monad. - Supports loading arbitrary UPLC contracts from bytestrings for testing.
- Example contracts and their test suites written using
cooked-validators
- Experimental instantiation of pirouette for PlutusIR.
A Nix shell development environment is provided.
See nix-shell
docs.
All of the project dependencies, except for Plutus, are handled by nix. Plutus is handled by cabal.
This results in a simpler nix setup that is easy to extend with different tools one might need.
Plutus uses a custom GHC version. To avoid having to build this GHC, make sure you set up the IOHK binary nix cache as instructed here.
We recommend using direnv
to automatically bring in the nix dependencies
when entering the project directory. Just run direnv allow
at the root of the repo.
To cache the nix environment and make direnv load instantaneously, you can
and use nix-direnv.
Several editors have support for direnv
. If you use emacs, we recomend using envrc-mode
.
In order to improve reproducibility, nixpkgs and haskell.nix
are pinned.
See "FAQ/Pinning Nixpkgs" wiki
Pinning is done using niv
. Updating them is simple:
nix-shell -p niv --run "niv update nixpkgs"
nix-shell -p niv --run "niv update haskellNix"
Check out the nix/sources.json
file, you might need to switch the branch.
Are you a contributor and would you like to bump the Plutus version we are depending upon? Because we are not pinning plutus with nix, updating it's a little more manual but it's straightforward.
Our cabal.project
file is a copy of the homonym file from
plutus-apps,
with the addition of plutus-apps
themselves in there and a different list
of packages to build.
In order to bump plutus, you must:
- Select the tag you want to update to from
plutus-apps
. - Copy the
cabal.project
from there - Modify the
packages:
section to build our packages:packages: cooked-validators examples
- Add the relevant setting for linking with libsodium:
package cardano-crypto-praos flags: -external-libsodium-vrf
- Add the
plutus-apps
dependency in there:In this case, we're running withsource-repository-package type: git location: https://github.com/input-output-hk/plutus-apps.git tag: v2021-11-05 -- change the tag to whatever tag you need. subdir: freer-extras playground-common plutus-chain-index plutus-chain-index-core plutus-contract plutus-pab plutus-ledger plutus-use-cases quickcheck-dynamic
plutus-apps
at tagv2021-11-05
. - Run
cabal build all
and grab a coffee, this will take a while.
Our ci runs ormolu
and cabal test
for each of our subprojects.
In order to help avoid CI failures due to formatting problems, we recommend
that you install the pre-commit hook for running ormolu.
To do so, simply copy (or link) the script into .git/hooks/pre-commit
.