A decentralised marketplace enabling customers purchase products directly from the shopkeeper. The data of seller and customer is kept private and no third party can have access to it. The traditional centralised marketplace sell their own products and allow authorized businesses or individuals to sell their good on their platform. The established platforms usually have a large stock of goods in the warehouses to quickly deliver an ordered product to the customer. The bad thing about this model is that not everyone benefits from it. The more power they have, the less power there is left to the ordinary customers! Also, there are some serious flaws in the centralized model, both for customers and retailers on the platforms:
This platform gives importance to small shopkeepers who are the real tax payers who are crushed the most when there is some mishap (Example-In COVID 19, all the shops were closed but online deliveries were allowed later). The customer can make the purchase from the shop who is offering the least price of the product. This way customers will get a variety of price options. Customers can rate seller on the basis of their past experiences. And these ratings will be public to everyone. The advantages of a decentralised marketplace includes-
How does it work? The customer's as well as the seller's data is encrypted and stored in swarm(which is a decentralised storage by ethereum). The id generated by swarm is uploaded to blockchain. All the product's images uploaded by the seller are also uploaded to swarm and hence reducing storage costs. The products listed by the sellers are not uploaded on blockchain because they don't contain any sensitive data. Apart from seller's ethereum address, no information about seller and customer is saved in database. When the customer wants to contact the seller, seller's number is retrieved from the blockchain in the background and neither the seller, nor the customer gets to know each other.
How to run? Step 1: Clone the repository and move inside the project directory. Make sure you have node and npm installed. Step 2: Also you should have a portis wallet and some matic eth to perform the transactions(You might need Metamask for importing wallet in portis using private keys). https://www.portis.io/ https://docs.matic.network/docs/develop/getting-started
Step 3: In the project directory, run:
sudo npm install It Installs all the dependencies. Step 4: Set your mysql password as 'password' or set your desired password in file named 'server.js' in line 12.
Follow this link to know how to set mySQL password- https://stackoverflow.com/questions/16556497/how-to-reset-or-change-the-mysql-root-password Step 5: In a new terminal, start MySQL server and paste the contents of the file 'query.sql'.
To start the mySQL server run- mysql -u root -p Step 6: Register on https://www.clicksend.com/ and get another API key. Put the username and key in line 228 and 229 respectively along with your RAPID API key in the file 'src/Customer/modal.js'. Step 7: In the project directory, start the server by:
node server.js Step 8: In the project directory, run:
sudo npm start Runs the app in the development mode. Open [http://localhost:3000] to view it in the browser.
The front end has been made using React.js. I used Remix to write the smart contract and then deployed it on Matic Network. I used Swarm as my decentralised storage.
The database I used is MySQL and I used Portis as my wallet. I also used Express.js for linking my backend with front-end.
This application values privacy of the customer as well as the seller.