Skip to content
View Diffus's full-sized avatar
🎯
Focusing
🎯
Focusing
  • DIFFUSION S.A
  • FRANCE
  • 09:58 (UTC -12:00)
Block or Report

Block or report Diffus

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
Diffus/README.md

Architect a Blockchain Real Estate Marketplace

This project is intended to create a DApp that implements a decentralized housing product powered by Ethereum. The main idea is that the system makes it possible to mint tokens representing people's entitlement to the properties. Zk-SNARKs are used to prove that people own the property without revealing that information on the property. The verified token can then be listed on a blockchain marketplace (OpenSea) where it can bought by others.

Table of Contents

Some key data

In this section, some key data is provided:

Description of the Project

As has already been mentioned, this project develops a Dapp which implements a decentralized housing product based on Ethereum. Most notably, OpenSea, a decentralized marketplace, is used to sell crypto assets. Moreover, ZoKrates is used to implement zkSnarks on Ethereum. The work that has been done is best described by explaining its main steps:

  • The contract ERC721Mintable.sol has been filled out, and then test cases have been written and passed in the TestERC721Mintable.js file.
  • Zokrates has been implemented, producing a Verifier.sol contract. Then, test cases have been written and passed in the TestSquareVerifier.js file to ensure the Verifier.sol contract executes successfully.
  • The contract SolnSquareVerifier.sol has been filled out, and then test cases have been written and passed in the TestSolnSquareVerifier.js file. The main goal of this contract is to integrate ZK and ERC721.
  • Both Verifier.sol and SolnSquareVerifier.sol are deployed to Rinkeby.
  • Ten tokens are minted using MyEtherWallet.
  • The OpenSea marketplace is generated.
  • Five SolnSquareVerifier tokens are listed on the marketplace, and are then purchased by a different address from the one that owns them.
  • The documentation you are reading right now is completed.

Testing smart contract code coverage

In this section, the eleven tests covered are listed:

  • Contract TestERC721Mintable:
    • Match ERC721 specification:
      • Should return total supply.
      • Should get token balance.
      • Should return token URI.
      • Should transfer token from one owner to another.
    • Have ownership properties:
      • Should fail when minting when address is not contract owner.
      • Should return contract owner.
  • Contract TestSquareVerifier:
    • Test verification:
      • Test verification with correct proof.
      • Test verification with incorrect proof.
  • Contract TestSolnSquareVerifier:
    • Test SolnSquareVerifier:
      • Test if a new solution can be added for contract.
      • Test if an ERC721 token can be minted for contract.
      • Test if the same solution can be used twice.

Getting Started

The procedure to obtain functional a copy of the project on your local machine so that you can further develop and/or test it is explained in this section. It is assumed that you have already installed Truffle, Ganache CLI, and the Metamask extension in your browser. These are the steps to be followed:

  • Firstly, you have to download/clone the project files from this repository onto your local machine. Then, cd into the root folder where the project files are located.
  • Secondly, type npm install so that all required npm packages are installed.
  • Thirdly, run Ganache. This will start Ganache at http://127.0.0.1:8545/. This project has been developed assuming that block gas limit is set at 9999999, the number of accounts to generate at startup is 200, and the amount of ether to be assigned to each account is 50000. This can be accomplished by typing ganache-cli -l 9999999 -a 200 -e 50000. However, you might prefer to set some other values.
  • In the fourth place, to run the supporting unit tests on Ganache, you have to:
    • Open a new terminal shell window, cd to the same root folder of the project, from there to the eth-contracts folder, and then type truffle compile to compile the smart contracts. trufflecompile
    • Once the contracts have been successfully compiled, type truffle migrate --reset, to deploy them to Ganache. trufflemigrateganache
    • Now, you can run truffle test test/TestERC721Mintable.js, truffle test test/TestSquareVerifier.js, and then truffle test test/TestSolnSquareVerifier.js to run all tests. truffletests
  • In the fifth place, you have to set up a secret-parameters.js file at the eth-contracts folder of this project, where you are located just now. For convenience, one such file has been provided for you, so that you just have to fill out the data into the corresponding fields. This is a secret parameters file where you have to type two parameters for the application:
    • Firstly, your Metamask seed (mnemonic).
    • Secondly, your Infura PROJECT ID (infuraKey).
  • In the sixth place, both Verifier and SolnSquareVerifier contracts are deployed to the public test network Rinkeby. If you wanted to do that yourself, you should go back to the terminal shell window, and type the command truffle migrate --reset --network rinkeby. Nevertheless, this is not necessary to test the project. trufflemigraterinkeby After successful deployment of the SolnSquareVerifier contract on Rinkeby, as can be observed, the contract assigned contract address is 0x8e88accDD01cb9F3FA12f3e7e59ff40Abc84cB38. It can be accessed at Etherscan at https://rinkeby.etherscan.io/address/0x8e88accDD01cb9F3FA12f3e7e59ff40Abc84cB38. contractRinkeby
  • In the seventh place, a number of tokens are minted using the MyEtherWallet tool. To this end, the tool is provided with the corresponding contract address and ABI/JSON Interface. As already mentioned, the former is 0x8e88accDD01cb9F3FA12f3e7e59ff40Abc84cB38, and the latter can be obtained from the SolnSquareVerifier.json file at the /eth-contracts/build/contracts/ folder. The tokens are minted so that its owner is the 0x0B05E528B92c2C7A155fca34D376d8cA6D2ddc93 address. mew
  • In the eight place, the OpenSea marketplace is generated. OpenSea is provided with the contract address, and it automatically loads the data for the contract. The URL of the OpenSea Marketplace Storefront is https://rinkeby.opensea.io/assets/realestatemarketplace. Five tokens are listed. openseastorefront
  • In the ninth place, the owner of the five properties, 0x0B05E528B92c2C7A155fca34D376d8cA6D2ddc93, makes them available for sell. openseasell1 openseasell2 openseasell3 openseasell4
  • The URL of the five properties listed at the OpenSea storefront are:
  • In the tenth place, the five properties (tokens) are bought using a different address, 0x1F7552E7fB8264Ba85AC9127B81B65Eef70a6385. openseabuy1 openseabuy2 openseabuy3 openseabuy4
  • Finally, it can be seen that out of ten minted tokens, five belong to 0x0B05E528B92c2C7A155fca34D376d8cA6D2ddc93, and five to 0x1F7552E7fB8264Ba85AC9127B81B65Eef70a6385. etherscanfinal

Resources

Contributing

This repository contains all the work that makes up the project. Individuals and I myself are encouraged to further improve this project. As a result, I will be more than happy to consider any pull requests.

Popular repositories

  1. Diffus Diffus Public

    Config files for my GitHub profile.

    Solidity 1