A self-contained step-by-step tutorial of Keelung

In this tutorial, we'll show you how to set up the environment and write programs in Keelung.

If you are having trouble when installing the following tools, please see Troubleshooting.


The only Haskell tool you need for Keelung is Stack, which will install and build the required GHC Haskell compiler for you when building Keelung programs.

Click here to learn how to install Stack.

It's also possible to install Stack using GHCup

For better development experience, it would be handy to have an Integrated Development Environment (IDE) or an editor with proper extensions installed.

Keelung Compiler

We provide 3 ways of installing the compiler

Build from source

Git clone or download the compiler's source code, enter the repository's directory and build the source.

git clone
cd keelung-compiler
stack install

It may take some time for the first time. After completed, the built binary keelungc should be available on your machine.

Native binaries (experimental)

If you are feeling adventurous, we also have native binaries built for major platforms available on the compiler's releases page. You can download the binary of the compiler for your platform and put it in a directory listed in your PATH environment variable.

Docker (highly experimental)

Another way to get the compiler is through Docker:

docker run -i btqag/keelungc

If you are experiencing a long Docker image startup time (5~10 seconds), you may want to consider downloading native prebuilt binaries instead.

Checking the installations

Run the commands below to see if you have stack and keelungc installed on your machine.

You should see version numbers displayed in the terminal or command prompt. If not, you may need to check your installation or add the executable to your system's PATH environment variable.

Haskell Stack

stack --version

Keelung compiler

keelungc --version

or if you're using the Docker image

docker run -i btqag/keelungc --version

Start writing Keelung programs

To start coding with Keelung, please continue with either one of the sections below:

pageStarting a Keelung project from scratch

Aurora prover/verifier (Advanced)

We've encountered some difficulties with the Docker images of the prover and verifier, a a new fixed version should be coming soon!

You don't have install the prover and the verifier now if you are just learning/trying out the Keelung language itself. You can still compile it into R1CS with the compiler above.

Aurora prover (btqag/aurora-prove):

docker run -i btqag/aurora-prove

Aurora verifier (btqag/aurora-verify):

docker run -i btqag/aurora-verify

Native Binaries

Currently only x86_64 Linux is supported, you can download it from the Keelung Release page.

See Building a zkSNARK Application with Keelung: Merkle tree membership for an example of their usage. If you don't have the binaries installed but have Docker, the Keelung library should automatically detect that and run the Docker images.

Last updated


Copyright © 2023 BTQ