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:
This implementation was done as part of master thesis for the Master's degree in Software Engineering.
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
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:
Firebase
: Firebase Authentication, Firebase Realtime DatabaseAWS
: Amplify, Route 53Infura
: Infura Ethereum API
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.
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
.
Setting up and running the application :
- Install truffle:
npm install truffle -g
- Install npm moduls:
npm install
in the root directory (for truffle and unit tests)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
.