Giter Club home page Giter Club logo

circuits's Introduction

Dark Forest ZK Circuits

Development Guide

Folder setup

Each of the primary Dark Forest circuits is stored in its own subdirectory:

  • /circuits/init: Proof for initializing a player into the universe
  • /circuits/move: Proof for initiating a move between two planets
  • /circuits/reveal: Proof for broadcasting/revealing the coordinates of a planet. Note that nothing in the broadcast action needs to happen in "zero-knowledge"; we just found it easier to implement verification of MiMC hash preimage via a ZK verifier than via a Solidity verifier.
  • /circuits/biomebase: Proof that a planet has a given biomebase, which in combination with the planet's spacetype will specify the planet's biome.

There are two additional subdirectories for auxiliary utility circuits:

  • /circuits/perlin: Perlin Noise ZK Circuit.
  • /circuits/range_proof: Proof that an input, or list of inputs, has an absolute value that is at most a user-provided upper bound.

Installing Core Dependencies

  • Node (v14.x OR v16.x)
  • Yarn (Javascript Package Manager)

Installing The Correct Node Version Using NVM

Dark Forest is built and tested using Node.js v14/v16 and might not run properly on other Node.js versions. We recommend using NVM to switch between multiple Node.js version on your machine.

Refer to nvm's official documentation for the installation guide.

After the installation is finished, you can run node --version to verify that you are running v14 or v16

Installing Yarn & Other Dev Dependencies

Refer to Yarn's official documentation for the installation guide.

After you have Yarn installed, run yarn to install dependencies.

Local Usage

This set of circuits is meant to be used in conjunction with the public smart contract subdirectory eth and Project Sophon's hardhat-circom plugin. If these two directories are unified as sibling directories under a common root, you can run yarn circom:dev in eth to compile and run the circuits on provided input files.

For your convenience, a sample input.json and public.json pair is included for sanity test checks. input.json is a sample input, public.json is public parameters. yarn dev or yarn prod will create witness.json and verification_key.json, and print to the console verifying that the proof is generated and verifies properly.

circuits's People

Contributors

actions-user avatar cha0sg0d avatar gubsheep avatar

Forkers

stx69

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.