← Back to home

Noir-KZG

This work contains an implementation of the KZG commitment scheme for polynomials using the Noir language.

Screenshots

Noir-KZG screenshot 1
Noir-KZG screenshot 2
Noir-KZG screenshot 3

Problem Statement

This work contains an implementation of the KZG commitment scheme for polynomials using the Noir language. The KZG commitment scheme is described in detail inthis paper. The current implementation is simplified and not optimized for performance.

Solution

In the scenario provided, the project is built using the Noir programming language, which is focused on cryptographic computations. Here's a breakdown of how the project is pieced together based on the code snippet provided earlier:Technologies Used:Noir Language:Noir is a domain-specific language tailored for cryptographic computations. It provides a simplistic yet expressive syntax for defining and manipulating mathematical structures, making it suitable for implementing cryptographic schemes like the KZG commitment scheme.Project Structure:Main File (main.nr):This file hosts the implementation of the KZG commitment scheme.Implementation Details:Commitment Computation (commitfunction):Thecommitfunction takes a generatorgand a polynomialpas inputs and computes the polynomial commitmentcusing the formula described in the code comments.This function loops through the coefficients of the polynomialp, multiplying each coefficient by the respective power of the generatorg, and accumulates the results to computec.Evaluation Key Computation (evalfunction):Theevalfunction takes an evaluation keyeand a pointx, and computes the evaluationvof the keyeat the pointx.This function also loops through, but instead of working with the coefficients of a polynomial, it operates on the evaluation keye.Main Function (mainfunction):Themainfunction demonstrates the usage of thecommitandevalfunctions by calling them with specific inputs and verifying the correctness of the scheme using an assertion.Testing (test_mainfunction):A simple test function is provided to exemplify the usage of themainfunction with specific values.Noteworthy Hacks:The implementation appears to be straightforward without any particular hacky or unconventional techniques.However, this implementation is noted as being not optimized for performance, indicating there may be room for optimization or more efficient implementations.Benefits:This implementation provides a working example of the KZG commitment scheme in Noir, which could serve as a foundation for further development or optimization.The simplicity of the implementation makes it easy to understand and extend, which is beneficial for developers looking to explore cryptographic schemes using Noir.The project is a neat encapsulation of the KZG commitment scheme in Noir, demonstrating the ease with which cryptographic algorithms can be implemented using domain-specific languages.

Hackathon

ETHOnline 2023

2023

Contributors