Final Project for the Consensys 2018 Developer course by Marcellus Spears. This project allows a user to prove he/she is the unique author/creator of a digital image.
- User uploads unique image to the dApp.
- User registers image on blockchain with email and unique MetaMask account.
- User creates a unique SHA256 Hash of the users image.
- User confirms the transactions details and pulls up MetaMask modal.
- User submits the transaction and successfully registers the asset on the blockchain.
- Truffle
- Ganache
- MetaMask
- React
- Redux
- React-Router
- Material-UI
- Zeppelin
-
Clone the project
$ git clone https://github.com/plaidpizazz/poe-image-dapp.git
-
Change to Project Directory
$ cd poe-image-dapp
-
Install truffle and an ethereum client. For local development, try EthereumJS TestRPC.
$ npm install -g truffle // Version 3.0.5+ required. $ npm install -g ethereumjs-testrpc
-
Install your Ethereum client
$ npm install -g ganache-cli
-
Change to Project Directory
$ cd poe-image-dapp
-
Start your Ethereum client
$ ganache-cli
-
Compile and migrate the contracts.
$ truffle compile $ truffle migrate
-
Run the webpack server for front-end hot reloading.
$ npm run start
- Open localhost in web browser, 'http://localhost:3000'. You should see the following homepage.
-
Follow on-screen prompts to upload an image. Click Upload Photo
-
Select an image from your computer. Click Open
-
Register the image on blockchain. Click Register Photo on Blockchain.
-
Enter your email and MetaMask account. This will check if image has already been registered.
-
A unique SHA-256 Hash is created of your photo. Click Next.
-
Confim the transaction details. Click Register.
-
Submit transaction on MetaMask.
-
Jest is included for testing React components and Truffle's own suite is incldued for smart contracts. Be sure you've compile your contracts before running jest, or you'll receive some file not found errors.
-
Change to Project Directory
$ cd poe-image-dapp
-
Run Desired Test
// Runs Jest for React component tests. $ npm run test // Runs Truffle's test suite for smart contract tests. $ truffle test
- [Design Patter Decisions]
- [Avoiding Common Attacks]
-
Why is there both a truffle.js file and a truffle-config.js file?
Truffle requires the truffle.js file be named truffle-config on Windows machines. Feel free to delete the file that doesn't correspond to your platform.