The capstone will build upon the knowledge you have gained in the course in order to build a decentralized housing product, named Puy du Sapt, for real estate properties in Auvergne France.
Truffle v5.4.24 (core: 5.4.24)
Solidity v0.5.16 (solc-js)
Node v12.0.0
Web3.js v1.5.3
- cd into project repro & install modules
npm install
- Compile Contracts
cd eth-contracts
truffle compile
- Start ganache (CLI or GUI)
ganache-cli -l 8000000 -p 8545 -m "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat"
- Migrate locally
truffle migrate --network development --reset
Testing ERC721
File: TestERC721Mintable.js
Test minting functionality of tokens and transfer of tokens.
truffle test ./test/TestERC721Mintable.js
Test zkSnarks
File: TestSquareVerifier.js
Verifies zkSnarks is successfully implemented.
truffle test ./test/TestSquareVerifier.js
Testing ERC721 token with zkSnarks
File: TestSolnSquareVerifier.js
Test minting with zkSnarks.
truffle test ./test/TestSolnSquareVerifier.js
- OpenSea PDS market place item 1
- OpenSea PDS market place item 2
- OpenSea PDS market place item 3
- OpenSea PDS market place item 4
- OpenSea PDS market place item 5
- OpenSea PDS market place item 6
- OpenSea PDS market place item 7
- OpenSea PDS market place item 8
- OpenSea PDS market place item 9
- OpenSea PDS market place item 10
- OpenSea PDS market place item 5
- OpenSea PDS market place item 6
- OpenSea PDS market place item 7
- OpenSea PDS market place item 8
- OpenSea PDS market place item 9
- OpenSea PDS market place item 10
Purchase account: 0x183C7cE2bad24ED4a266E01eC343B15c215EF11F
- OpenSea PDS market place item 5
- OpenSea PDS market place item 6
- OpenSea PDS market place item 7
- OpenSea PDS market place item 8
- OpenSea PDS market place item 9
- OpenSea PDS market place item 10
Compiling your contracts...
===========================
> Compiling .\contracts\ERC721Mintable.sol
> Compiling .\contracts\Migrations.sol
> Compiling .\contracts\Oraclize.sol
> Compiling .\contracts\SolnSquareVerifier.sol
> Compiling .\contracts\verifier.sol
> Compiling openzeppelin-solidity\contracts\drafts\Counters.sol
> Compiling openzeppelin-solidity\contracts\math\SafeMath.sol
> Compiling openzeppelin-solidity\contracts\token\ERC721\IERC721Receiver.sol
> Compiling openzeppelin-solidity\contracts\utils\Address.sol
> Compilation warnings encountered:
project:/contracts/verifier.sol:8:1: Warning: Experimental features are turned on. Do not use experimental features on live deployments.
pragma experimental ABIEncoderV2;
^-------------------------------^
,project:/contracts/SolnSquareVerifier.sol:2:1: Warning: Experimental features are turned on. Do not use experimental features on live deployments.
pragma experimental ABIEncoderV2;
^-------------------------------^
,project:/contracts/Oraclize.sol:320:7: Warning: Unreachable code.
_networkID; // silence the warning and remain backwards compatible
^--------^
,project:/contracts/Oraclize.sol:373:7: Warning: Unreachable code.
_myid; _result; _proof; // Silence compiler warnings
^--------------------^
,project:/contracts/SolnSquareVerifier.sol:41:38: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
function addSolution(address to, uint256 tokenId, uint[2] memory a, uint[2][2] memory b, uint[2] memory c, uint[2] memory inputs) public {
^-------------^
,project:/contracts/SolnSquareVerifier.sol:57:153: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
... [2] memory inputs) public returns (bool result) {
^---------^
,project:/contracts/Oraclize.sol:371:5: Warning: Function state mutability can be restricted to pure
function __callback(bytes32 _myid, string memory _result, bytes memory _proof) public {
^ (Relevant source part starts here and spans across multiple lines).
> Artifacts written to C:\Users\Baptiste\Documents\udacity\blockchain_project_5\Blockchain-Capstone\eth-contracts\build\contracts
> Compiled successfully using:
- solc: 0.5.5+commit.47a71e8f.Emscripten.clang
Migrations dry-run (simulation)
===============================
> Network name: 'rinkeby-fork'
> Network id: 4
> Block gas limit: 30000000 (0x1c9c380)
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
> block number: 9830505
> block timestamp: 1639752279
> account: 0x18BD4E3354e0D99D06ffDeD10793eEc71dEbC9E3
> balance: 14.541197118482228581
> gas used: 208305 (0x32db1)
> gas price: 10 gwei
> value sent: 0 ETH
> total cost: 0.00208305 ETH
-------------------------------------
> Total cost: 0.00208305 ETH
2_deploy_contracts.js
=====================
Deploying 'Verifier'
--------------------
> block number: 9830507
> block timestamp: 1639752286
> account: 0x18BD4E3354e0D99D06ffDeD10793eEc71dEbC9E3
> balance: 14.529639948482228581
> gas used: 1128354 (0x1137a2)
> gas price: 10 gwei
> value sent: 0 ETH
> total cost: 0.01128354 ETH
Deploying 'SolnSquareVerifier'
------------------------------
> block number: 9830508
> block timestamp: 1639752315
> account: 0x18BD4E3354e0D99D06ffDeD10793eEc71dEbC9E3
> balance: 14.496375088482228581
> gas used: 3326486 (0x32c216)
> gas price: 10 gwei
> value sent: 0 ETH
> total cost: 0.03326486 ETH
Deploying 'Verifier'
--------------------
> block number: 9830509
> block timestamp: 1639752331
> account: 0x18BD4E3354e0D99D06ffDeD10793eEc71dEbC9E3
> balance: 14.485091548482228581
> gas used: 1128354 (0x1137a2)
> gas price: 10 gwei
> value sent: 0 ETH
> total cost: 0.01128354 ETH
-------------------------------------
> Total cost: 0.05583194 ETH
Summary
=======
> Total deployments: 4
> Final cost: 0.05791499 ETH
> Duplicate contract names found for Verifier.
> This can cause errors and unknown behavior. Please rename one of your contracts.
Starting migrations...
======================
> Network name: 'rinkeby'
> Network id: 4
> Block gas limit: 30000000 (0x1c9c380)
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
> transaction hash: 0x224e27814db6fdc7fa70326a2bcce9842117f0c560a45010bcaf6989002dcd64
> Blocks: 1 Seconds: 8
> contract address: 0x7f8366579538aE8e2892cB7965c3eb9F5662c47b
> block number: 9830509
> block timestamp: 1639752349
> account: 0x18BD4E3354e0D99D06ffDeD10793eEc71dEbC9E3
> balance: 14.541034118482228581
> gas used: 224605 (0x36d5d)
> gas price: 10 gwei
> value sent: 0 ETH
> total cost: 0.00224605 ETH
> Saving migration to chain.
> Saving artifacts
-------------------------------------
> Total cost: 0.00224605 ETH
2_deploy_contracts.js
=====================
Deploying 'Verifier'
--------------------
> transaction hash: 0x844e93712a69a183753af464a107e370e8e22ca28956e1d915ce033a7a9f7c4a
> Blocks: 0 Seconds: 8
> contract address: 0x250855a8fBd1bfECA3e865736819e4fB61835DBf
> block number: 9830511
> block timestamp: 1639752379
> account: 0x18BD4E3354e0D99D06ffDeD10793eEc71dEbC9E3
> balance: 14.529292948482228581
> gas used: 1128354 (0x1137a2)
> gas price: 10 gwei
> value sent: 0 ETH
> total cost: 0.01128354 ETH
Deploying 'SolnSquareVerifier'
------------------------------
> transaction hash: 0x91b897b86826fca2197ae3165228c50249fe728d055315e903844cd1d134e14e
> Blocks: 0 Seconds: 8
> contract address: 0x6cc2E1fD602080E148B355fDBdCe68B35D78eAA8
> block number: 9830512
> block timestamp: 1639752394
> account: 0x18BD4E3354e0D99D06ffDeD10793eEc71dEbC9E3
> balance: 14.494240088482228581
> gas used: 3505286 (0x357c86)
> gas price: 10 gwei
> value sent: 0 ETH
> total cost: 0.03505286 ETH
Deploying 'Verifier'
--------------------
> transaction hash: 0x0f36b6ee7363594786121e51b11550dfe6f36d76e9016c87b4f5a363f2b84076
> Blocks: 0 Seconds: 8
> contract address: 0x9487687488C390269Edc9679054c47B81504EC6D
> block number: 9830513
> block timestamp: 1639752409
> account: 0x18BD4E3354e0D99D06ffDeD10793eEc71dEbC9E3
> balance: 14.482956548482228581
> gas used: 1128354 (0x1137a2)
> gas price: 10 gwei
> value sent: 0 ETH
> total cost: 0.01128354 ETH
> Saving migration to chain.
> Saving artifacts
-------------------------------------
> Total cost: 0.05761994 ETH
Summary
=======
> Total deployments: 4
> Final cost: 0.05986599 ETH
> Duplicate contract names found for Verifier.
> This can cause errors and unknown behavior. Please rename one of your contracts.
"abi": [
{
"constant": false,
"inputs": [
{
"name": "status",
"type": "bool"
}
],
"name": "setter",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "getApproved",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "approve",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "from",
"type": "address"
},
{
"name": "to",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_myid",
"type": "bytes32"
},
{
"name": "_result",
"type": "string"
}
],
"name": "__callback",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "owner",
"type": "address"
},
{
"name": "index",
"type": "uint256"
}
],
"name": "tokenOfOwnerByIndex",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_myid",
"type": "bytes32"
},
{
"name": "_result",
"type": "string"
},
{
"name": "_proof",
"type": "bytes"
}
],
"name": "__callback",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "mint",
"outputs": [
{
"name": "result",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "from",
"type": "address"
},
{
"name": "to",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "safeTransferFrom",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "index",
"type": "uint256"
}
],
"name": "tokenByIndex",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "ownerOf",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "approved",
"type": "bool"
}
],
"name": "setApprovalForAll",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "_owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "from",
"type": "address"
},
{
"name": "to",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
},
{
"name": "_data",
"type": "bytes"
}
],
"name": "safeTransferFrom",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "tokenId",
"type": "uint256"
}
],
"name": "tokenURI",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "baseTokenURI",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "owner",
"type": "address"
},
{
"name": "operator",
"type": "address"
}
],
"name": "isApprovedForAll",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"name": "verifierAddress",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "index",
"type": "uint256"
},
{
"indexed": false,
"name": "holder",
"type": "address"
}
],
"name": "SolutionE",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": true,
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "approved",
"type": "address"
},
{
"indexed": true,
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "operator",
"type": "address"
},
{
"indexed": false,
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "_owner",
"type": "address"
}
],
"name": "Paused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "_owner",
"type": "address"
}
],
"name": "Unpaused",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "newOwner",
"type": "address"
}
],
"name": "Ownership",
"type": "event"
},
{
"constant": true,
"inputs": [],
"name": "getSolutionLength",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
},
{
"name": "a",
"type": "uint256[2]"
},
{
"name": "b",
"type": "uint256[2][2]"
},
{
"name": "c",
"type": "uint256[2]"
},
{
"name": "inputs",
"type": "uint256[2]"
}
],
"name": "addSolution",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "to",
"type": "address"
},
{
"name": "tokenId",
"type": "uint256"
},
{
"name": "a",
"type": "uint256[2]"
},
{
"name": "b",
"type": "uint256[2][2]"
},
{
"name": "c",
"type": "uint256[2]"
},
{
"name": "inputs",
"type": "uint256[2]"
}
],
"name": "VerifyAndMint",
"outputs": [
{
"name": "result",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
]