Skip to content

This repository will contain code the Zk-Snark for on-chain credit checks

License

Notifications You must be signed in to change notification settings

xana-org/credit-checks

Repository files navigation

Confidential Credit Checks

This repository will contains code the Zk-Snark for on-chain credit checks and builds on the price range proof.

Price range proof

To determine the credit score of a consumer, a particular range zero-knowledge proof can be used to protect their acutal score. This is done with a verifying contract that doesn't include any actual credit scores.

Motivation

These applications can leverage the price range proof to verify that the price of an individual's credit score is between a certain range of values defined by min and max.

Proof definition

We will generate zk-SNARK proof to verify these constraints. The advantage with this approach is that the proof ensures privacy and the size of the proof is small as compared to some other zk proofs.

The private input in our case is the price of the asset. This price is ideally provided by some trusted sources. The min and max price will be the public inputs to the snark. The constraints are:

price > min price < max These constraints are enough to prove that the price of an asset is in the provided range.

Prover

The proof is generated by the prover after a trusted setup, so that fake proofs can't be generated. This proof can be used to verify arbitrary values of credit score, min, max.

Before generating the proof prover needs to generate the witness from the inputs. New witness and proof have to be generated each time for new input values.

Verifier

The verifier in our case will be a smart contract which is deployed on Ethereum. This verifier will only be generated once. This verifier can be used to verify any proof given the public inputs (min and max).

Code

To generate the proofs we use Zokrates DSL for specifying constraints.

def main(private field price, field min, field max) -> bool: assert(price>min) assert(price<max) return true

About

This repository will contain code the Zk-Snark for on-chain credit checks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published