Skip to content

essential-contributions/essential-integration

Repository files navigation

essential-integration

Crates.io Documentation license Build Status

Integration of the Pint constraint language and the Essential protocol.

Goals

The goal for this repo is to demonstrate (and test) the process of creating end-to-end Essential applications via the command line.

The developer experience can be broken into the following stages:

  1. build: Write and compile the contract with Pint.
  2. run sever: Start an essential-rest-server instance running or use https://server.essential.builders.
  3. sign and deploy: Sign and deploy the contract to using essential-deploy-contract.
  4. solve: Create a solution and submit it to the essential-rest-server, updating the state as a result.

Language Agnostic Counter App Example

Users should not require any knowledge beyond basic command line tooling to get started with Pint and Essential.

In turn, we avoid letting Rust (or any other language besides Pint) leak into the repository in order to emulate the experience of writing apps purely using CLi tools.

The included Rust essential-cli crate contains a few small commands that should be extracted from this repo into a more general-use essential tooling suite.

Example Applications

Both these example applications use Rust as their front end. They are much more in depth then the counter app example. This should give a good idea of how to build a more complex application using the Essential protocol.

Abi Gen

When you first clone this repo or change the contracts the abi gen will not have the file it needs to run so rust will not compile the app. To fix this run the following command in the root of the repo.

nix run .#compile-all-contracts

Or if you are not using nix you can go to the directory of each contract and run the following command.

pint build

Using Nix

A Nix flake is included providing the essential-all package, providing pint, pintc, pintfmt, essential-rest-server and more. There is also the essential-minimal package which contains just the bare minimal requirements to build an application.

  1. Install Nix, easiest with the Determinate Systems installer.

  2. Use Nix to enter a shell with the all Essential tools:

    nix shell git+ssh://git@github.com/essential-contributions/essential-integration

    To include these along with the jq and xxd tools required to run included test scripts, use:

    nix develop github:essential-contributions/essential-integration

    or if you have the repo cloned locally, simply cd in and use:

    nix develop