Collection/marketplace on OpenSea: https://testnets.opensea.io/collection/hcustomerc721token
SolnSquareVerifier
Contract:- Address:
0xb30721f2c6873aeec65e43259804ee1541a34f45
. - ABI is here
- It is verified and published on etherscan, after deployment. I.e: read and write can be done on etherscan directly.
- It is the contract linking
ERC721MintableComplete
withVerifier
contracts.
- Address:
- Verifier Contract, (the contract generated from ZoKrates):
- Address:
0xb4f536f2e6cb9388a456f98a16a18936731b48bb
. - ABI is here
- It is verified and published on etherscan, after deployment. I.e: read and write can be done on etherscan directly.
- Address:
https://testnets.opensea.io/assets/0xb30721f2c6873aeec65e43259804ee1541a34f45/1 https://testnets.opensea.io/assets/0xb30721f2c6873aeec65e43259804ee1541a34f45/2 https://testnets.opensea.io/assets/0xb30721f2c6873aeec65e43259804ee1541a34f45/3 https://testnets.opensea.io/assets/0xb30721f2c6873aeec65e43259804ee1541a34f45/5 https://testnets.opensea.io/assets/0xb30721f2c6873aeec65e43259804ee1541a34f45/7 https://testnets.opensea.io/assets/0xb30721f2c6873aeec65e43259804ee1541a34f45/9
These tokens were owned and marked for sale by 0x6c0ebe2a2cdbea429fd3719f56fb57d7719396f7
, then bought by 0xecc93d9486493ed1022298d1f43305ab85b1ea70
.
- Install
truffle
of the version mentioned below - Clone the repo
yarn install
truffle test
Truffle v5.4.25 (core: 5.4.25)
Solidity - 0.8.11 (solc-js)
Node v14.18.1
Web3.js v1.5.3
ZoKrates v0.7.10
Using ZoKrates:
shortcut cmd: yarn zokrates-all
cd zokrates/code
yarn zokrates compile -i ./square/square.zok
yarn zokrates setup
# generates witness with the args (fn inputs) 3 and 9 (3*3 == 9, so the inputs[1] should be 1)
yarn zokrates compute-witness -a 3 9 && cp witness ./generated/witness1
# generates `proof.json`
yarn zokrates generate-proof && cp proof.json ./generated/proof1.json
yarn zokrates export-verifier
yarn zokrates-cp && yarn format
For generating 10 proofs and witnesses (witness, contains the relealed info "square root"):
for i in {3..12}; do yarn zokrates compute-witness -a $(( i * 20 )) $(( i * i * 20 * 20 )) && cp witness ./generated/witness$(( i - 2 )) && yarn zokrates generate-proof && cp proof.json ./generated/proof$(( i - 2 )).json; done;
[OR] the detailed/manual version:
docker run -it -v ${PWD}/zokrates/code:/home/zokrates/code -w /home/zokrates/code zokrates/zokrates:0.7.10 /bin/bash
# ref: https://zokrates.github.io/gettingstarted.html
# compile - Generates: `out` binary
zokrates compile -i ./square/square.zok
# perform the setup phase - Generates: `proving.key` and `verification.key` (uses `out` binary)
zokrates setup
# execute the program - Generates: `witness` (uses `out` binary)
zokrates compute-witness -a 337 113569
# generate a proof of computation - Generates: `proof.json` (uses `proving.key` and `witness`)
zokrates generate-proof
# export a solidity verifier - Generates: `verifier.sol` (uses `verification.key`)
zokrates export-verifier
# or verify natively
zokrates verify
Useful resources for ZoKrates and zk-SNARKs
- https://www.youtube.com/watch?v=_ZvGZxhCFfE
- https://medium.com/extropy-io/zokrates-tutorial-with-truffle-41135a3fb754
- Fleek makes it easy to build websites and apps on the new open web: permissionless, trustless, censorship resistant, and free of centralized gatekeepers
- Kite: Code Faster. Stay in Flow. Kite adds AI powered code completions to your code editor, giving developers superpowers
- If you are interested in becoming an ethereum freelancer in blocklancer will interest you.
- The World’s First Real Estate NFT, one way to turn this Udacity project into a reality.
- This interesting article about a new dApp called Bloom
- Learn Ethereum is a book to go deeper in the technical topics and algorithms in Ethereum. This is an advanced technical book. In the book you will explore the blockchain-based decentralized platform and understand how Ethereum works with Dapps examples.
Expand/Collapse
Source: https://github.com/udacity/Blockchain-Capstone
The capstone will build upon the knowledge you have gained in the course in order to build a decentralized housing product.
- Clone the project repository
- Explore the code base.
- Fill out ERC721 Mintable Contract in ERC721Mintable.sol
- Write test cases TestERC721Mintable.js
- Compile and pass test cases in TestERC721Mintable.js
- Implement Zokrates
- Using Docker to install and instantiate a Zokrates zkSnarks development environment
- Completes the Zokrates proof in square.code by adding the variable names in square.code
- Compile program
- Trusted setup
- Compute witness
- Generate Proof
- Export Verifier.sol
- Note: This project uses solidity version 0.5.2 so you will be required to update the code in Verifier.sol accordingly based on the compiler errors you receive
- Write a test script to verify the solidity contract generated by Zokrates executed successfully - TestSquareVerifier.js
- Write test contract for ZK and ERC721 integration - SolnSquareVerifier.sol
- Compile and pass with TestSolnSquareVerifier.js
- Deploy latest contracts generated by Zokrates (a.k.a verifier.sol)
- Deploy SolnSquareVerifier contract to Rinkeby network
- Mint 10 tokens
- Generate OpenSea marketplace
- Test and Verify OpenSea with your SolnSquareVerifier tokens
- List 5 of your tokens on the marketplace
- Purchase those 5 tokens using a different address
- Complete required documentation and submit!