An on-chain auction system with privacy by implementing zero-knowledge proofs. In this system, bidders and their bid prices will be hidden, ensuring that only the winning bidder and their bid amount will be revealed after the end of the valid bidding period.
- Install rust and circom2
- Clone or fork this template repository.
git clone https://github.com/Zauktion/zauktion-core
- Install packages
yarn
- Build: this compiles the circuits and exports artifacts. Then compiles the contracts and generate typescript clients.
yarn build
- Test contracts with Proofs
cd contracts/ yarn hardhat test test/Proof.test.ts
├── circuits
│ ├── zauktion.circom
│ ├── idcheck.circom
├── contracts
│ ├── IdcheckVerifier.sol
│ ├── ZauktionVerifier.sol
│ ├── Vault.sol
│ ├── PepeCoin.sol
│ ├── EventsFactory.sol
│ ├── Zauktion.sol
- To create an auction, call
createAuction()
inEventsFactory.sol
. This deploys a newZauktion.sol
contract, with each contract representing a new auction. - To set the parameters of the auction, call
setAuction()
inZauktion.sol
. These parameters include the bid due time, reveal due time, auction ID, auctionVerifier address, ID verifier address, and vault address.
- To participate in the auction, users can call the bid() function in Zauktion.sol. They must also submit proof information and earnest money to the contract. The contract will verify the proof and store the "y1" value, which will later be used to calculate the secret bid price. This process is inspired by RLN, which uses a polynomial to hide a secret and reveal it after a certain time.
Checks:
1. Check if the bid due time has passed.
2. Verify that the earnest money meets the entrance stake criteria.
3. Verify that the proof is valid. - After the bid due time, the user must submit another proof to reveal their secret bid price. The contract will verify the proof and use the "y2" value to calculate the secret bid price.
Checks:
1. If the due time has passed, reveal the time limit.
2. If the proof is valid - Once the reveal period has ended, we will determine the winner by calling
revealWinner()
inZauktion.sol
.
Checks:
1. If the time has passed reveal due time - Once we determine the winner, each bidder can reclaim their earnest money by calling
claimPrize()
.
Checks:
1. If the winner has been decided
2. If the user has submit the reveal proof
3. Whether the user has not claimed the prize yet
EventsFactory.sol: 0x77E4c192b6ab081584aBB7d71E795663587f7324
IdcheckVerifier.sol: 0x1F63A23BedC45EE169166Ff2fB3c484EF845D03e
PepeCoin.sol: 0x96332840c5Aa2F2F52C5ad60EeAaa9f72D795a0a
Vault.sol: 0x2Fa4e52a9D72f329958a555bc5edE5a360Df1c39
ZauktionVerifier.sol: 0xB6Ed48cf9f1EDf5298cd6FE5257c92B28bC22f57
Zauktion.sol: 0x6134fB1B9BDf76596F05851686F19c2c0A85CEe8