doutv / poseidon-circuit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Poseidon Hash Circuit

Introduction

This library contains a halo2 circuit for the Poseidon hash algorithm. Please refer to the original paper for the definition of Poseidon hash.

The Poseidon circuit is based on a custom gate named MainGate with the following structure.

q_1([F;T]) q_5([F;T]) q_m (F) q_i(F) q_o(F) rc (F) state([A;T]) input (A) out (A)

Here T is the size of state, F means fixed column, A means adviced column.

Generic relation is defined as $$q_m\cdot s[0]\cdot s[1] + \sum_i q_1[i]\cdot s[i] + \sum_i q_5[i]*s^5[i] + rc + q_i\cdot input + q_o\cdot out=0$$

It is worth noting that MainGate was originally designed for the Sirius folding framework, thus some of the columns like $q_m$ are not needed for Poseidon hash and can always be set to be $0$.

Getting Started

This repository has integrated with the snarkify-sdk, facilitating effortless deployment to the Snarkify Cloud. With just a few clicks, you can have your prover service up and running, ready to handle proof requests.

👉 Follow our tutorial to deploy your Poseidon hash prover service on Snarkify Cloud.

Integrate with snarkify-sdk

For a complete example of snarkify-sdk integration with the Poseidon circuit, please reference to PR #5.

For more information about snarkify-sdk, please reference to the documentation.

Getting Involved

We'd love for you to be a part of our developer community! Whether you're looking to contribute code, provide feedback, or simply stay in the loop, our Telegram group is the place to be.

👉 Join our developer community

About

License:MIT License


Languages

Language:Rust 100.0%