/pricify

Ethereum DApp for storing prices of consumer goods on the blockchain to fix the problem of fake and intransparent sales and prices.

Primary LanguageJavaScriptMIT LicenseMIT

Pricify - System for storing prices of consumer goods on the blockchain

Introduction

This repository contains a system for storing prices of consumer goods and services 📈. Price history is stored on a Ethereum blockchain. The Pricify system provides a solution to a problem of fake sales and prices that consumers are facing while making purchasing decisions.

This system aims to fix the problem of intransparent sales and prices, bring the transparency, and help the consumers make better economic decisions while shopping 🛍️🛒.

Price history of items/services is stored and recorded on Ethereum blockchain via smart contracts (more about smart contracts). By storing the price updates and changes on a public blockchain, anyone can verify the validity of the current discount for the item/service. That will disenable the merchants from manipulating the prices.

More info:

Screenshot 2022-05-07 at 14 01 28

This implementation was done as part of master thesis for the Master's degree in Software Engineering.

Demo

Consumers have a possibility to determine the real price of the item and to verify the validity of the advertised sales:

  • In physical stores - by scanning the QR code on the item, which will redirect them to the web page for sales validation and price history
  • In online stores - by clicking the link for validating the price of the item; redirects to the same web page for sales validation and price history
Pricify.-.Demo.mp4

Architecture and technologies

Technologies

For the MVP of this system Ethereum blockchain was used. Smart contracts were implemented in Solidity. Other tools that are used for implementation and testing of smart contracts are Ganache, Truffle, MetaMask wallet.

Frontend web app that interacts with smart contracts is implemented in ReactJS using Material UI component library.

Backend is serverless, utilizing services from:

Sustem architecture overview

image

Smart Contracts

Smart contracts are in the /contracts dir. They are implemented in Solidity. Some of the smart contracts are used from OpenZeppelin:

In the /test dir there are tests for the smart contracts. After testing locally, contracts are deployed to the Ropsten testnet.

image

How to run?

Configuration

Config:

  • In the truffle-config.js you may see and change the Ethereum networks.
  • In the root dir rename the .env.template to .env and add your mnemonic.
  • In the /client dir rename the .env.template to .env and set Firebase credentials and config.

Requirements:

  • NodeJS version: v10.15.0.
  • Solidity compiler version: v0.6.6.
  • Truffle: v5.1.40.

Rinning

Setting up and running the application :

  • Install truffle: npm install truffle -g
  • Install npm moduls:
    1. npm install in the root directory (for truffle and unit tests)
    2. cd client & npm install (for ReactJS app)
  • Start Ganache and update truffle-config file if necessary with the network parameters.
  • Compile and migrate smart contracts to the local blockchain (from truffle console): truffle migrate --network "development/ganache-local" --reset.
  • Start react app: cd client & npm start.

To test the smart contracts:

  • In the root directory: truffle test.