Search…
ZoKrates
⚠️This API and documentation is still under active development.

Overview

We have contemplated building ZoKrates as a static Rust library and linking it to our Golang binary. At this time, only some preliminary research has been done. Some high-level insights from that research are provided below.
The following approach is experimental and does not currently work. It is provided for reference for anyone who is interested in adding ZoKrates support to the API.

Linking a Static Rust Library with Golang Binary

This is an interesting article that describes how to approach building a static Rust library and link it to Golang binary.
The following Makefile was added to the ZoKrates repository on this fork:
1
.PHONY: build clean release static static-release
2
3
default: build
4
5
build:
6
ssh-add && RUST_BACKTRACE=1 rustup run nightly cargo -Z package-features build --features="libsnark"
7
8
clean:
9
rustup run nightly cargo clean
10
11
release:
12
ssh-add && RUST_BACKTRACE=1 rustup run nightly cargo -Z package-features build --release --features="libsnark"
13
14
static: clean build
15
rustc -g -O --crate-type staticlib target/debug/zokrates
16
17
static-release: clean release
18
rustc -g -O --crate-type staticlib target/release/zokrates
Copied!
The following target was added to our privacy service Makefile to setup the experiment:
1
zokrates:
2
@rm -rf .tmp/zokrates
3
@mkdir -p .tmp/
4
git clone --single-branch --branch makefile [email protected]:kthomas/zokrates.git .tmp/zokrates
5
@pushd .tmp/zokrates && make static && popd
6
@echo TODO... hoist built zokrates artifacts for linking...
Copied!
More effort is required to continue this effort. Get in touch if you're interested in contributing.
Last modified 9mo ago