Skip to content
The Ergo Language for Smart Legal Contracts
Coq JavaScript OCaml Emacs Lisp Gherkin Java Other
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci build(fix) LICENSE check and opam switch Jun 21, 2019
.github docs(template): initiate pull request template Jun 21, 2019
.travis (fix) Update deploy scripts Mar 19, 2019
assets feat(assets): install ap logo - I620 Jun 19, 2019
backends feature(log) Experimental 'info' function + Revisions to lifting Jun 29, 2019
bin (fix) REPL can now import Jul 16, 2018
ergo.emacs fix(emacs) README Jul 9, 2019
ergo.vim feature(emacs) Move emacs mode to main repo Jul 9, 2019
examples test(inline) Better inlining/shadowing testing Jul 26, 2019
extraction feature(log) Experimental 'info' function + Revisions to lifting Jun 29, 2019
mechanization chore(version) Bump 0.9.4 Jul 26, 2019
packages Automatic version bump to 0.9.4 Jul 26, 2019
scripts test(license) now passes LICENSE check Jun 21, 2019
.gitignore (feature) Dependency analysis for modules and CTO files ; new ergodep… Aug 2, 2018
.npmignore Automate Release with Travis (#176) May 24, 2018
.travis.yml docs(README): point readme to charter - I620 Jul 9, 2019 docs(CONTRIBUTING): correct links - I620 Jun 19, 2019 (chore) Upgrade to Q*cert 1.3.0 + Various fixes Jun 21, 2019
HEADER chore(license) Clean up Jun 29, 2019
LICENSE Update LICENSE Jun 21, 2019
Makefile (fix) Bug in array operators ; Add containsAll & in Array Sep 15, 2018
Makefile.config Automate Release with Travis (#176) May 24, 2018
Makefile.coq_modules feature(log) Experimental 'info' function + Revisions to lifting Jun 29, 2019 Add link Jul 18, 2019
ergo.png (fix) Logo Jul 1, 2018
lerna.json Automatic version bump to 0.9.4 Jul 26, 2019
package-lock.json chore(lodash) upgrade dependencies Jul 26, 2019
package.json Automatic version bump to 0.9.4 Jul 26, 2019


Build Status CircleCI Coverage Status lerna npm version Netlify Status


This is the source code for the Ergo compiler. Ergo is the Accord Project language for Smart Legal Contracts.

The Ergo compiler is distributed as an npm package.

The Ergo compiler is written using the Coq proof assistant, with parsing and support code written in OCaml. It makes extensive use of the Q*cert compiler for code generation and type checking.

Both the Ergo language and its compiler are in early development phase. If you would like to build from source or to contribute, consult the DEVELOPERS file.

Try Ergo online

If you want to take a peek at Ergo without installing anything, check out the interactive REPL (read-eval-print-loop) for Ergo stand-alone, or the Accord Project Template Studio which illustrates Ergo in Accord Project templates.


The most recent Ergo documentation is in the Ergo Language Guide.


Install Ergo

The easiest way to install Ergo is as a Node.js package. Once you have Node.js installed on your machine, you can get the Ergo compiler and command-line using the Node.js package manager by typing the following in a terminal:

$ npm install -g @accordproject/ergo-cli

This will install the compiler itself (ergoc) and command-line tools (ergorun and ergotop) to create and invoke Ergo contracts. You can check that both have been installed and print the version number by typing the following in a terminal:

$ ergoc --version
$ ergorun --version

Then, to get command line help:

$ ergoc --help
$ ergorun --help

Compile a contract

To compile your first Ergo contract to JavaScript:

$ ergoc ./examples/volumediscount/model.cto ./examples/volumediscount/logic.ergo
15:17:08 - info: Logging initialized. 2018-05-24T19:17:08.024Z
Processing file: ./examples/volumediscount/logic.ergo -- compiled to: ./examples/volumediscount/logic.js

By default, Ergo compiles to JavaScript for execution. You can inspect the compiled JavaScript code in ./examples/volumediscount/logic.js

Invoke a contract

To compile and execute a contract by sending a request:

$ ergorun execute ./examples/volumediscount/model.cto ./examples/volumediscount/logic.ergo --contract ./examples/volumediscount/contract.json --request ./examples/volumediscount/request.json --state ./examples/volumediscount/state.json
06:40:01 - info:
  "response": {
    "discountRate": 2.8,
    "$class": "org.accordproject.volumediscount.VolumeDiscountResponse"
  "state": {
    "$class": "org.accordproject.cicero.contract.AccordContractState",
    "stateId": "1"
  "emit": []

To compile and invoke a specific contract clause:

$ ergorun invoke ./examples/volumediscount/model.cto ./examples/volumediscount/logic.ergo --clauseName volumediscount --contract ./examples/volumediscount/contract.json --params ./examples/volumediscount/params.json --state ./examples/volumediscount/state.json

To compile and obtain the initial state for the contract:

$ ergorun init ./examples/volumediscount/model.cto ./examples/volumediscount/logic.ergo --contract ./examples/volumediscount/contract.json
06:40:29 - info:

Accord Project Logo

Accord Project is an open source, non-profit, initiative working to transform contract management and contract automation by digitizing contracts. Accord Project operates under the umbrella of the Linux Foundation. The technical charter for the Accord Project can be found here.

Learn More About Accord Project




The Accord Project technology is being developed as open source. All the software packages are being actively maintained on GitHub and we encourage organizations and individuals to contribute requirements, documentation, issues, new templates, and code.

Find out what’s coming on our blog.

Join the Accord Project Technology Working Group Slack channel to get involved!

For code contributions, read our CONTRIBUTING guide and information for DEVELOPERS.


Accord Project source code files are made available under the Apache License, Version 2.0. Accord Project documentation files are made available under the Creative Commons Attribution 4.0 International License (CC-BY-4.0).

Copyright 2018-2019 Clause, Inc. All trademarks are the property of their respective owners. See LF Projects Trademark Policy.

You can’t perform that action at this time.