The capstone will build upon the knowledge you have gained in the course in order to build a decentralized housing product.
The project is divided in two main parts: eth-contracts and zokrates. The js/solidity code is completely contained in eth-contracts.
Install node dependencies and compile contracts, from the project root run:
npm i && cd eth-contracts && truffle compile
Apart from the provided packages, I also added
truffle-assertions
: to add assertions interacting with solidity'srequire
dotenv
: to add the ability of using environment files
In order to run tests, we can use truffle
, from eth-contracts
:
truffle test
or one by one:
truffle test ./test/TestERC721Mintable.js
truffle test ./test/TestSquareVerifier.js
truffle test ./test/TestSolnSquareVerifier.js
To setup and run the example zokrates code, we need Docker. Then we run:
docker run -v zokrates:/home/zokrates/code -ti zokrates/zokrates /bin/bash
to access the container with the zokrates image. Depending on the version, you may need to verify where is zokrates with
which zokrates
then run
cd code/square
# Compile the example file
zokrates compile -i square.code
zokrates setup
# we can input infinite arguments, in our case we need two numbers.
zokrates compute-witness -a <a> <b>
zokrates generate-proof
zokrates export-verifier
and like that we will obtain all the files needed.
Since we are only testing, truffle-config.js
contains the configuration to deploy on INFURA.
To run the migration, having both keys
MNEMONIC=one two three
INFURA_KEY=<project_id>
in the environment file .env under project root:
cd eth-contracts
truffle migrate --network rinkeby
I saved the log under rinkeby-deployment.log, below are the addresses and ABIs.
-
CustomVerifier address on Rinkeby: 0x3A0382822c3663B232E1b8D8F71cB7C50B26ba16
-
SolnSquareVerifier address on Rinkeby: 0x3410AdbaDB55Da6C3a18ABb3FC3eAF4ef5531d5e
Contract ABI is under contract-abi.json in the project root.