SPECKART - A Decentralized Ecommerce Blockchain platform
- Dennis Sam
- Mekha Krishnan M
: https://www.youtube.com/watch?v=HDqy9wLmFEU
The uses of Redis in an e-commerce application made us look more into the topic and we came up with an efficient solution to get the popular and recently searched items and the cart without even involving a call to the blockchain.
SpecKart is a decentralized blockchain e-commerce platform for buying and selling Spectacles. The sellers can sell and the buyers can buy the products directly without the intervention of another third party. The seller when adding the product to the platform will be putting 1% of the price of the product on a stake on the platform and similarly when the buyer orders the product he/she will also be putting the same amount of token along with the item price tokens on a stake on the platform. When the product receival is confirmed by the buyer without any dispute then the seller will be receiving his stake tokens and the product price. Similarly, the buyer will be receiving his/her stake from the platform. This mechanism avoids the seller/ buyer from doing malpractices since their amount is in stake in the platform. Now in the case of a dispute, while deploying the contract, a group of admins (say 3 in number) is assigned to manage this issue. Whenever a dispute happens, the issue is raised to them and they will be verifying the issue individually and will be voting for the dispute. If the seller wins, he/she will be receiving his tokens on the stake along with the product price, also, the product status will be sold on the platform, and the buyer will be losing his stake amount. This stake amount is distributed among the admins who have voted for the seller. Similarly, if the buyer wins, he/ she will receive the product price along with the tokens on stake and the seller will be losing the stake tokens. And here the seller's stake amount is distributed among the admins who have voted for the buyer. This incentive mechanism will make the admins do their work without any manipulation. There is a token market to sell and buy the SPEC token. We have added one chatroom for all the users (only sellers and buyers) to discuss the products and review the platform, and also another chatroom where admins are also included.
We built the smart contract for the DApp on Ethereum platform. SPEC token is an ERC20 token to buy/sell products in the SpecKart e-commerce platform. We have used Angular8 for the front-end, NodeJs for the back-end, MongoDB to save the image files, Socket.io for chatroom and RedisDB for multiple purposes like caching and sorting, pub/sub for a chatroom, redisearch for searching the details of the items, etc. ##Inspiration
The smart contract creation for this application was very challenging since it involved lots of payments and calculations and also we had a hard time making the smart contract to a deployable size. We were new to Redis and it was a challenge for us to learn it from the very scratch. We used Socket.io along with pub/sub for the first time. Also, we found the multiple chat room creation a bit difficult.
We are very proud of the work we have done for SpecKart by implementing various efficient and challenging tools and technologies like Socket.io, Redis and Blockchain.
Even though we faced a few challenges in the beginning while learning the new tools, we found them very useful and user friendly on the go. We used the interface for the first in the smart contract and how redis cache is actually fast and what and when it should be used. Like blockchain itself, Redis is also about where and how it is efficiently implemented.
Currently, we are assigning the set of admins who manages the disputes while deploying the contract itself. In future work, we can find a consensus algorithm for finding admins so that the chances of even the admins knowing among themselves will be less. And the whole platform becomes more efficient as the network grows. Hence makes it more scalable. In this work, SPEC token is a pegged coin (1 SPEC = 0.0005 ETH). For future works, we can make decisions on the value of the token, depending on the supply and demand in the platform which makes the users use the platform more. We can also improve the upgrade of the platform for not just spectacles but for all kinds of products.
- Go to home directory and run the command: : docker-compose up
- Go to 'spk-eth' directory and migrate the contract in the test network Ganache Test Network should be running The array of admins' addresses should be modified accordingly : cd spk-eth : truffle migrate --reset
- Go to 'spk-ui' directory and run the front-end of the application : cd spk-ui : npm install : ng serve
- Go to the url and run the application : http://localhost:4200