Simplicity
Simplicity is a blockchain programming language designed as an alternative to Bitcoin script.
The language and implementation is still under development.
Contents
This project contains
- A Haskell implementation of Simplicity's language semantics, type inference engine, serialization functions, and some example Simplicity code.
- A Coq implementation of Simplicity's formal denotational and operational semantics.
Build
Building with Nix
Software artifacts can be built using Nix.
- To build the Haskell project, run
nix-build -A haskell
. - To use the Haskell project, try
nix-shell -p "(import ./default.nix {}).haskellPackages.ghcWithPackages (pkgs: [pkgs.Simplicity])"
. - To build the Coq project, run
nix-build -A coq
. - For a Simplicity-Haskell development environment, type
nix-shell --arg coq false
. - Typing
nix-shell
will provide a full C, Coq and Haskell development environment.
Building the C project manually
Install the GNU Compiler Collection and GNU Make.
Binary packages are available for Debian (apt install gcc make
) and other Linux distributions.
- Open a command line.
- Change directory to the
C
directory of this repository. - To run tests:
make check
- To install globally:
make install
- To install locally:
make install out=/path/to/dir
- To remove generated files:
make clean
Building the Coq project manually
Requires Coq 8.15.0, CompCert 3.11 and VST 2.11. Packages in the Coq ecosystem are managed by the opam package manager.
Installing Coq
- Install
opam
using your distribution's package manager. opam init
eval $(opam env)
opam pin -j$(nproc) add coq 8.15.0
Optional: Installing CoqIDE
CoqIDE is a user-friendly GUI for writing proofs in Coq.
opam install -j$(nproc) coqide
Installing CompCert
opam repo add coq-released https://coq.inria.fr/opam/released
opam install -j$(nproc) coq-compcert
Installing VST
We need a custom build and cannot use opam for this step.
wget -O - https://github.com/PrincetonUniversity/VST/archive/v2.11.tar.gz | tar -xvzf -
cd VST-2.11
make -j$(nproc) default_target sha
make install
install -d $(coqc -where)/user-contrib/sha
install -m 0644 -t $(coqc -where)/user-contrib/sha sha/*.v sha/*.vo
Building the Simplicity Coq library
- Change into the
Coq
directory of this repository coq_makefile -f _CoqProject -o CoqMakefile
make -f CoqMakefile -j$(nproc)
Optional: Installing the library
make -f CoqMakefile install
Building the Haskell project manually
Install the Glasgow Haskell Compiler and Cabal.
Binary packages are available for Debian (apt install ghc cabal-install
) and other Linux distributions.
- Open a command line.
- Change directory to the root directory of this repository.
cabal repl Simplicity
- Cabal will build the project and open a GHCi prompt.
Documentation
Detailed documentation can be found in the Simplicity-TR.tm
TeXmacs file.
A recent PDF version can be found in the pdf branch.
Further Resources
- Our paper that originally introduced Simplicity. Some of the finer details are out of date, but it is still a good introduction.
- BPASE 2018 presentation of the above paper (slides).
- Scale by the Bay 2018 presentation that illustrates formal verification of Simplicity in Agda (slides).
Contact
Interested parties are welcome to join the Simplicity mailing list. Issues and pull-requests can be made through GitHub's interface.