Links

Setting up the environment

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.

Installing Haskell

The only Haskell tool you need for building Keelung programs is 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.

Installing Keelung compiler

You can choose to install the compiler either through Docker or download the binaries directly.

Docker

The easiest 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.

Native Binaries

We have native binaries built for these platforms on releases. You can download the binary of the compiler for your platform and put it in a directory listed in your PATH environment variable.

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
docker run -i btqag/keelungc --version

Start writing Keelung programs

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

Installing 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.
Copyright © 2023 BTQ