The objective is to replace the physical warranty and have block chain based warranty using NFT which will ensure authenticity and security.
- Getting Started
- Problem Statement
- Solution
- Use Cases
- Tech Stack and Tools
- System Architecture
- Development
- Running the App
- Authors
FG4
βββ backend
β βββcontrollers
β βββmodels
β βββroutes
β βββsmart-contract
| | βββcontracts
| | βββpinata
β βββapp.js
βββ frontend
βββsrc
βββactions.js
βββcomponents
βββpages
βββindex.js
βββapp.js
In order to install this application, please follow the following steps carefully:
- Clone the project to your local system.
- Open the project directory in your IDE.
- Now in the terminal go to the
backend
folder. - Then
npm install
- This command will install all of the necessary node modules in your project folder. (Make sure you have a node installed in your system).
- Do the same in the frontend folder.
- Now in the terminal go to the backend folder type
nodemon start
then this will start the server. In the frontend console type,npm start
then this will start the frontend. - Now be on the
smart-contracts
folder on the terminal and thennpx hardhat compile
- Then run
npx hardhat run --network rinkeby scripts/deploy.js command
to get your smart contract address. - Create an
.env
file inside your backend folder to keep your API keys.
- Structure of .env file
SECRET_KEY
= 'Your wallet secret key'PINATA_API_KEY
= 'Your Pinata account API key'PINATA_API_SECRET
= 'Pinata secret key'MONGO
= 'Connection URL of Mongo'RINKEBY_API
= 'Alchemy Rinkeby network API url'PUBLIC_KEY
= 'Your wallet public address'CONTRACT_ADDRESS
= 'Smart Contract deployed address from point 9 of Installation Guide'
- You have successfully installed the project. πππ
As a part of this challenge, we were expected to build a blockchain-based eCommerce system (a web prototype) that will replace the physical warranty of the product with a digital version using Non-Fungible Tokens (NFTs) which will ensure the authenticity and security of the products.
We came up with the solution:
- There we will be two side interface in which user and seller both can login and signup with their details and then there metamask wallet will automatically connect with our site.
- The seller can list their products and buyer can buy the products.
- After placing order the order will be reflected in the order page and the nft token with product details will be created on market place.
- The json file will consist the data of the item and etherscan will have the transaction history of the product.
- The product also be listed in the metamask wallet of user.
-
Prove Authenticity
- When Customers buy any product then they will receive NFT that will store the data of the product and all details of the sender and its product like serial number and purchase history that helps to prove the authenticity of the product.
-
Secured Transactions
- For providing a secured environment we used the openzeppelin security library that helps.
- Pull Payment(avoid reentrancy attack)
- Reentrancy Guard
- Pausable
-
Decaying NFT
- The user will receive an NFT token in the form of a digital warranty card that will carry its warranty the period also and when the warranty gets over the NFT will automatically get removed.
-
Seamless GUI *The prototype itself shows the seamless experience for both customer and seller. The seller can list their products and sell without having previous knowledge of Blockchain or Web3. We have also introduced a loyalty program to engage and retain customers.
- React.js
- Node.js
- Express.js
- Solidity
- Web3.js
- Ethereum
- Hardhat
- Mongo dB
- Etherscan
- Material UI
- Alchemy
- OpenZepplin
- Remix
- OpenSea
- Pinata
- Metamask
The following section deals with the development process, walkthrough, and features of this project.
- The most important task at this point is to get a clear understanding of our future website purposes, and the main goals wish to get.
- A well-described and detailed plan based on this pre-development data protected us from spending extra resources on solving unexpected issues such as design changing or adding functionality that wasnβt, initially planned.
- Based on the information that was gathered together in the previous phase, a map is created for the project
- We first came up with the architecture of the backend i.e MVC architecture
- Now designing the database was the main step. We came up with the following tables
- User
- Product
- Cart
- Order
- We will discuss the fields of these tables later on
- Controllers contain the functions that will be called on requests. We have separated each file by its controller type i.e user-controller, product-controller, etc.
- Routes contain routes of different features. i.e user-routes, cart-routes, order-routes etc
- During the frontend design phase, our website took shape
- We came up with the design of the Flipkart website itself
- The whole website was divided into components and those components were further divided so that we can reuse them.
- Basic pages like homepage, and login page product page was created first.
- Then more complex functionality like cart, order, and seller pages were added later on.
-
The smart contract is the code that will be used to interact with the blockchain.
-
The smart contract is written in Solidity.
-
Pinata is used to store the metadata of the products and the json.
-
Contract will provide to mint Nft.
-
The Nft might be a decaying nft if there will be any warranty in the product.
-
Nft will have the serial number and other product details.
-
You can resale your product and the owner in the digital waranty card will also change.