Skip to content

MeerKatDev/BlockchainND-RealEstateMarket

Repository files navigation

Udacity Blockchain Capstone

The capstone will build upon the knowledge you have gained in the course in order to build a decentralized housing product.

Description

The project is divided in two main parts: eth-contracts and zokrates. The js/solidity code is completely contained in eth-contracts.

Initialization

Install node dependencies and compile contracts, from the project root run:

npm i && cd eth-contracts && truffle compile

Additional packages used

Apart from the provided packages, I also added

  • truffle-assertions: to add assertions interacting with solidity's require
  • dotenv: to add the ability of using environment files

Testing

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

ZoKrates

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.

Deployment

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.

Contract ABI is under contract-abi.json in the project root.

Project Resources

About

Capstone project for the Udacity Nanodegree

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •