This repository contains code for SHMART Marketplace using Ethereum blockchain.
How to run this project
- Open the root directory of this project in terminal. In our case, the root directory is
Shmart. We have tested this code on Windows. - Type
npm run devornode server.jsin terminal.
Directory structure
-
Ethereumdirectory contains Ethereum related code. TheEthereumdirectory contains two directoriesbuild,contractsand files. We provide the details as follows:Contractdirectory contain contract files. It contains.solfiles.Builddirectory contains compiled contracts.- Files
compile.jsfile compiles the smart contracts. The compiled contracts are generated intoBuilddirectory. We compile each contract separately. Therefore, the file name convention iscompile-<contract-name>.jsfile responsible to compile<contract-name>contract.deploy.jsfile deploys smart contracts on Rinkby Test Blockchain network.web.jsfile configure web3 with a metamask provider.factory.jstells the web3 that a deployed copy of the contract exists.
-
testdirectory contains files to test the compiled contracts. The file name convention is<contract-name>.test.js. The contracts are tested on local network -- Ganache. -
.nextdirectory is automatically created by the project. -
pagesdirectory contains react components that get turned into a webpages. E.g.,localhost:3000/<react-page-name.js>,localhost:3000/<folder-name>/<react-page-name.js>- If the file name is
index.js, the react will assume it for the landing page of the project. new.jshandles user registeration.
- If the file name is
-
componentsdirectory contains the code files for common UI components, such as Layout, Header and so on. -
routes.jsfile defines the routes of our application. -
server.jsfile boot up the application and tells the application to use routes.js -
package.jsonlists the dependencies required for this project