Decentralized applications (DApps) are the open-source applications without a centralized owner that controls the majority of its tokens. Bitcoin and Ethereum by themselves are the examples of DApps, as well as the apps developed on the top of them.
Elinext was challenged to create a decentralized e-commerce platform with the business logic built on the basis of the Ethereum smart contract.
The application is a retail store where the customers can purchase necessary items using an Android app with the ability to pay with ethers (ETH) and the admin can add products to the shop or remove them.
Our client experienced the problem of expensive and long payment processes. The payment process included some obstructive steps to settle a transaction and extra fees to pay for payment gateways.
To cut this long route short, Elinext has started the blockchain-based project that consisted of the following parts:
- Smart contract.
- Web Admin Panel.
- Android app for customers.
The main challenge for our developer was to implement data exchange between a smart contract and clients’ parts: Android app and web admin panel. Another challenge was to support purchases by ETH and custom tokens. On top of that, we needed to provide a full test coverage.
Smart contract entails all the products in store with descriptions and prices. The contract is deployed into the Ethereum blockchain and is used to streamline purchasing processes, remove duplicate processes and optimize data recording.
Web Admin Panel
Web Admin Panel allows the administrators to add new products to the contract or to remove them. The admin can also set a ‘beneficiary’ account, edit descriptions and prices in ETH currency.
Android app allows the users to purchase products from the contract with ETH.
The purchasing process is flexible, with many parts of it in a working state. You can buy a product with or without the admin, pay for that product with ETH, and accumulate the bonuses for your transactions which can be used for the new payments.
The whole blockchain works as follows:
- The user makes a purchase with their Android app.
- The admin manages product supply from the admin panel.
- Smart contracts (SC) are encoded for the Ethereum’s runtime for smart contracts and backward to read the data out of transactions with the help of application binary interface (ABI).
- The Android app signs the transaction with the user’s private key in the Ethereum wallet. This is the piece of client-side software which allows you to prove that you have enough cryptocurrency to buy an item.
- The transaction appears in the Ethereum blockchain.
- The transaction gets confirmed by the network.