* Export type alias for bulletproof backend fields Also, keep bulletproof stuff namespaced to a `bulletproofs` module. * Change sudoku to use pub over const * Docs updates * Rename / clean up sudoku * Export `Proof` type Basically required for being able to deserialize a proof * Add zkp/serde workspace example * Drive by cleaning * Exports necessary for gadget impls * Rename compute_inputs to compute_hidden_inputs * Add prove/verify builders * Export the builder types This isnt strictly necessary but it would be weird for these to not show up in the cargo docs * Clippy fix * Add helper .compile() & .runtime() methods to fhe prog fns I do wonder if these should be defined in a separate trait, just so that they don't live next to the more internal functions in documentation. * Use new swag to simplify the front-facing api docs example * Add some whitespace * Switch to an extension trait * Add an extension to ZkpProgramFn * Take an owned ZkpBackend, rather than reference Its typical to have the caller handle cloning, rather than taking a reference, requiring Clone impl, and forcing clone. Plus, as of now the only backend is a zero size null struct, so nothing to be gained by using a reference. It also just looks weird to always pass `&BulletproofsBackend::new()` * Update sudoku to use new swag * Target second attribute in multi attribute error * Enforce ordering zkp inputs: constants,public,private Honestly this feels a little unnatural to me. Might want to reverse: private, public, constant and then change all the prove/verify methods to that ordering * Build whitelist example in CI * Reorder constant->public->private to private->public->constant * Fix trailing ws * Fix example * Make .runtime() more consistent with .compile() * Get rid of some boilerplate impls * Add custom zkp type example * Move example run checks into example tests Should speed up CI a bit * Change whitelist -> allowlist
Intro
Sunscreen is an ecosystem for building privacy-preserving applications using fully homomorphic encryption (and later on zero-knowledge proofs as well). Fully homomorphic encryption (FHE) is a special kind of encryption scheme that allows anyone to perform computations directly on encrypted data. Since it's quite hard to write FHE programs, we've created a "compiler" to make this process easier for developers.
If you'd like to try out our FHE compiler before downloading it, we offer a playground.
Extensive documentation can be found here.
WARNING! This library is meant for experiments only. It has not been externally audited and is not intended for use in production.
Set up
These directions cover the requirements for developing the sunscreen platform itself, which may be more than needed to merely consume it as a dependency. If you wish to develop an application using Sunscreen, see the installation.
Install Rust
Install Rustup and follow the directions for your OS. We recommend stable Rust 1.58 or later.
MacOS
brew install cmake git
Linux
Install prereqs
Using yum:
sudo yum install gcc gcc-c++ cmake3 openssl-devel clang git
Using apt:
sudo apt install build-essential clang cmake3 libssl-dev git
After installing prereqs, make a link to cmake3 named cmake
sudo ln /usr/bin/cmake3 <somwhere/under/$PATH/>cmake
Windows
We recommend developing sunscreen on macOS or Linux, as Windows is really slow.
Cmake
Install cmake 3.
Clang
Install llvm+clang. In the installer, select the option to add LLVM to your %PATH%. If you forget to do check this option, add C:\Program Files\LLVM\bin to your %PATH%.
MSVC C++
Install the MSVC C++ toolchain
When prompted for what to install, ensure you additionally check the Windows 10 SDK. You'll need to rerun the tool and modify your installation if you forget to do this.
Enable long file paths
Some of our compilation tests produce really long file paths. These tests will fail unless you enable long file paths. TL;DR; run regedit.exe, set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem to 1 and reboot.
git
Install git. Defaults are fine.
Initialize submodules
git submodule update --init --recursive
Dev workflows
Working with Sunscreen is as you'd expect with any other Rust repository:
Build
cargo build
Test
cargo test --release
Docs
cargo doc --open
Format
cargo fmt
Debug
We have a launch.json checked in that defines a bunch of debug configurations. In VSCode, you should see a bunch of dropdowns in the debug menu to debug the tests and examples.
License
This project is licensed under the terms of the GNU AGPLv3 license. If you require a different license for your application, please reach out to us.
Contribute
Feel free to open up issues!
If you'd like to submit a pull request, you'll need to agree to a Contributor License Agreement. For more info, contact us at hello@sunscreen.tech.