Git Product home page Git Product logo

zk-timelock's Introduction

zk-timelock

This repo contains arithmetic circuits for verifiable time-lock encryption made using arkworks-rs toolkit. For more details on such an encryption scheme see drand/tlock (Go) and timoth-y/tlock-rs (Rust) repos.

Overview

The algorithm implemented here is the Boneh-Franklin's [1] identity-based encryption (IBE) (see Rust code here). The main challenge with translating this scheme into an arithmetic circuit comes from the heavy use of target group (pairing product) operations, specifically gt on fr multiplication.

All operations must be projected on top of the BLS12-381, as this is the only curve currently supported by the drand threshold network. This poses a problem as there is no commonly known pairing-friendly curve whose scalar field equals the base field of BLS12-381, which is needed for efficient KZG-based SNARKs.

There are multiple ways to tackle mentioned problems:

  1. Change projective curve (e.g. BLS12-377 [2] that can be embedded into BW6-761 [3])
    • trade-off: requires changes to the drand protocol.
  2. Simulate BLS12-381 using non-native arithmetic
    • trade-off: huge performance overhead.
  3. Find an application-specific curve that could embed BLS12-381 base field
    • trade-off: such curves would have low FFT space, but we can leverage Gemini [4] proving system to handle such brittle fields.
  4. Use Halo2 proving system that defers all the pairings to the very end (i.e. accumulators), this makes nonnative operations cheaper
    • trade-off: dev tools to construct a halo2 circuit are currently lacking.

For the sake of experiments, this repo provides circuits for the first three approaches. For the third approach, it also introduces YT6-776 - an application-specific curve that embeds BLS12-381's base field. See details about it here.

Circuits

  • Circuit<E: Pairing, P: Bls12Parameters>: a generic-curve circuit with native arithmetic only. Can be proved using the Groth16 system with BLS12-377/BW6-671 curve combination.
  • NonnativeCircuit<C: CurveGroup>: a circuit that simulates BLS12-381 base fields using non-native arithmetic. Can be proved by using the Groth16 system with any projective/pairing curves combination (also BLS12-377/BW6-671 here.
  • GeminiNativeCircuit: a modified native that (currently) comes without input variables (see this issue for details). Can be proved using the Gemini system with a BLS12-381/YT6-776 curve combination.

Benchmarks

The experimental results can be found on BENCHMARKS.md.

Usage

To perform benchmarks on your machine run cargo bench command.

For examples of each circuit usage see benches/ibe_benchmark.rs.

Acknowledgements

I greatly thank Weikeng Chen for sharing method of creating application-specific curves [5] and all the helpful discussions about it.

References

zk-timelock's People

Contributors

nulltea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

zk-timelock's Issues

error in running Benchmarks

hi, thanks for your great work, when running benchmarks, I encounter the following errors, could you help to take a look? thanks

(1) no "sync-algebra" branch, see the following error info
image

(2) for error (1), so I modify the reference branch to "master", however, meet new compile error,
image
image

my pc env is Mac os with M1 chip, thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.