Decentralized applications (DApps) are open-source applications without a centralized owner that controls the majority of its tokens. Bitcoin and Ethereum by themselves are examples of DApps, as well as the apps developed on 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 full test coverage.
The 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 remove them. The admin can also set a 'beneficiary' account, edit descriptions and prices in ETH currency.
Android app allows 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:
1. The user makes a purchase with their Android app.
2. The admin manages product supply from the admin panel.
3. Smart contracts (SC) are encoded for Ethereum’s runtime for smart contracts and backward to read the data out of transactions with the help of the application binary interface (ABI).
4. The Android app signs the transaction with the user’s private key in the Ethereum wallet. This is the piece of client-side software that allows you to prove that you have enough cryptocurrency to buy an item.
5. The transaction appears in the Ethereum blockchain.
6. The transaction gets confirmed by the network.
All functionality of the Smart contract was covered by Truffle tests to make sure that the Smart contract is secure.
The final product was based on the Smart contract that was deployed into the Ethereum blockchain, with the Web Admin Panel connected to the contract and placed at hosting. The Android app was distributed to the users. The client has received the following benefits:
- Simplification of multi-party purchasing and payment process;
- High-level security assurance;
- Enhanced verification process to reduce risks of fraud or theft.