This project aims to create an NFT Marketplace with focus on best practices and scalability.
The problem of counterfeit jewelry is a significant issue in the market, which leads to buyers being scammed into purchasing products that are not authentic. In this projet, I propose a solution to this problem through the use of non-fungible tokens (NFTs) in a jewelry marketplace. My approach involves creating a platform that connects jewelry manufacturers, owners, and buyers through the use of NFTs, which would ensure the authenticity of the jewelry and create a more secure marketplace for buyers.
This solution consists of three main sections:
- A manufacturer section for minting NFTs
- An owner section for selling authentic jewelry with accompanying NFTs
- A marketplace for buyers to purchase authentic jewelry.
The manufacturer section will use a signature-based validation process to ensure that only authentic jewelry manufacturers are able to mint NFTs on our platform. Owners will then be able to sell their authentic jewelry with accompanying NFTs in the owner section, and buyers can purchase authentic jewelry with confidence on the marketplace.
The repository is a monorepo, which means that it contains multiple projects. Currently contains 3 projects:
- The blockchain project, that uses Hardhat as a development environment, testing framework and deployment tool for Ethereum smart contracts. It has 3 smart contracts:
- The ChainGems contract, which is a ERC1155 contract, that is used to mint the NFTs and the native token.
- The ChainGemsExchange contract, which is a decentralized exchange that is used to exchange the native token for a stablecoin.
- The USDToken contract, which is a ERC20 contract, that is used as a stablecoin.
- The frontend project, which is a React application that interacts with smart contracts and is based on the Model View Presenter architecture and Atomic Design methodology.
- The backend project, which is a NodeJS that upload files to IPFS.
The project is based on the following principles:
- SOLID
- Separation of Concerns (SOC)
- Don't Repeat Yourself (DRY)
- You Aren't Gonna Need It (YAGNI)
- Keep It Simple, Silly (KISS)
-
Model View Presenter (on the Front)
The items in this section are not strictly related to methodologies, but are concepts that I applied to the project and helped me to maintain an organized, structured and testable code.
-
GitFlow
-
Monorepo
-
Continous Integration
-
Conventionnal Commits
-
Semantic Versioning
-
Linting and Formatting
-
Unit Testing
The most relevant technologies used in this project are:
Back | Front | General |
---|---|---|
|
|
|
To run the project, you need to have Yarn installed, Node and Metamask .
-
Clone the repository
-
Install dependencies
yarn install
- Run the blockchain project
Inside the Blockchain
folder, run:
yarn hardhat node
- Run the frontend project
Inside the Frontend
folder, run:
yarn dev
- If you want to use Metamask, remember to connect to the local network
Because of the monorepo structure, some tools need to be run from the root of the project and others in their own packages(Backend/Frontend).
The context for executing each each tool is clarified in parentheses.
-
Slither (Blockchain)
For running these tools, I use a docker image, you can run this command to get the image:docker pull trailofbits/eth-security-toolbox
Then you need to run the following command:yarn toolbox
And inside the container, you can run slither as follows:\slither /src/Blockchain/contracts/ --solc-remaps '@openzeppelin=/src/node_modules/@openzeppelin @chainlink=/src/node_modules/@chainlink' --exclude naming-convention,external-function,low-level-calls
-
Mythril (Blockchain)
To run mythril, you can do it with docker. First, you need to get the image:docker pull mythril/myth
Then you can run it (one contract at a time) as follows:docker run -v ${PWD%/*}:/src mythril/myth analyze --solc-json /src/Blockchain/mythril-config.json /src/Blockchain/contracts/{contract_name}.sol
-
Storybook (Frontend)
To run storybook, you need to run the following command:yarn storybook