Skip to content

ASHISHKUMAR2411/Blockchain-based-eCommerce-Warranty-system-fg4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Blockchain-based eCommerce warranty system using NFTs

The objective is to replace the physical warranty and have block chain based warranty using NFT which will ensure authenticity and security.

Table of Contents 😍😍

Getting Started πŸ“¦πŸ“¦

  FG4
  β”œβ”€β”€ backend
  β”‚   β”œβ”€β”€controllers
  β”‚   β”œβ”€β”€models
  β”‚   β”œβ”€β”€routes
  β”‚   β”œβ”€β”€smart-contract
  |   |		      β”œβ”€β”€contracts
  |   |		      └──pinata
  β”‚   └──app.js
  └── frontend
      └──src
      	 β”œβ”€β”€actions.js
         β”œβ”€β”€components
	 β”œβ”€β”€pages
	 β”œβ”€β”€index.js
	 └──app.js

Installation Guide πŸ’«πŸ’«

In order to install this application, please follow the following steps carefully:

  1. Clone the project to your local system.
  2. Open the project directory in your IDE.
  3. Now in the terminal go to the backend folder.
  4. Then npm install
  5. This command will install all of the necessary node modules in your project folder. (Make sure you have a node installed in your system).
  6. Do the same in the frontend folder.
  7. 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.
  8. Now be on the smart-contracts folder on the terminal and then npx hardhat compile
  9. Then run npx hardhat run --network rinkeby scripts/deploy.js command to get your smart contract address.
  10. Create an .env file inside your backend folder to keep your API keys.
  1. You have successfully installed the project. πŸŽ‰πŸŽ‰πŸŽ‰

Problem Statement 🀞🀞

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.

Solution πŸ’₯πŸ’₯

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.

Use Cases πŸ’žπŸ’ž

  • 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.

Tech Stack and Tools πŸ’«πŸ’«

  • React.js
  • Node.js
  • Express.js
  • Solidity
  • Web3.js
  • Ethereum
  • Hardhat
  • Mongo dB
  • Etherscan
  • Material UI
  • Alchemy
  • OpenZepplin
  • Remix
  • OpenSea
  • Pinata
  • Metamask

System Architecture πŸ“¦πŸ“¦

image image image

Development πŸ’«πŸ’«

The following section deals with the development process, walkthrough, and features of this project.

Part 1: Gathering Information

  • 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.

Part 2: Planning

  • Based on the information that was gathered together in the previous phase, a map is created for the project

Step 1: Backend

  • 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

Step 2: Frontend

  • 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.

Step 3: Smart-contract

  • 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.

Running the App 🧠🧠

Before MetaMask Installation 😎😎

image

User ✨✨

image image image image image

Seller ✨✨

image image

NFT Generated ✨✨

image instance6

Product created in MetaMask Wallet πŸŽ‰πŸŽ‰πŸŽ‰

Authors 😎😎

Anurag Sharma

Ashish Kumar

Dev Agrawal

About

Focused

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •