Skip to content

zkpnftdrop/project

Repository files navigation

ZKP-enabled fair NFT minting

Development

Install rapidsnark:

sudo apt-get install build-essential libgmp-dev libsodium-dev nasm
git clone https://github.com/iden3/rapidsnark.git && \
cd rapidsnark && \
npm install && \
git submodule init && \
git submodule update && \
npx task createFieldSources && \
npx task buildProver

Rapidsnark is now in build/prover.

Install circom-helper dependencies:

sudo apt-get install libgmp-dev nlohmann-json3-dev nasm g++

Install circom v2:

https://docs.circom.io/

Once you have compiled the circom binary, note down where it is located.

Clone the project and install dependencies:

git clone git@github.com:zkpnftdrop/project.git && \
cd project && \
npm i && \
npx lerna bootstrap && \
npx lerna run build

Update ./circuits/circomHelperConfig.json:

{
    "circom": "<PATH TO CIRCOM BINARY>",
    "snarkjs": "./node_modules/snarkjs/build/cli.cjs",
    "circuitDirs": [
        "./circom/test"
    ]
}

During development, you can make Typescript recompile code automatically whenever you save a file in ts/. In each module:

npm run watch

Circuit development

Make sure nothing else is running on port 9001.

In circuits/:

npm run circom-helper

Build circuits for the demo

For the demo, we are using a tree depth of 3 (TBD). This can be configured in circuits/zkeys.config.yml.

In circuits/:

npm run zkey-manager-compile
npm run zkey-manager-downloadPtau
npm run zkey-manager-genZkeys

Export the verifier contract:

npm run export-verifier-sol

Contract development

To compile contracts, navigate to ./contracts and run:

npx hardhat compile

To test contracts, run:

npx hardhat test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published