DVILLA E-Commerce Project: A dApp that promotes healthy living
Chieloka Madubugwu

Chieloka Madubugwu @chielokacodes

About: Software Engineer with 4+ years of experience with proficiency in building web applications using Java Spring Boot, SQL Databases, Docker and frontend technologies like React js, Tailwind CSS etc

Joined:
Aug 4, 2024

DVILLA E-Commerce Project: A dApp that promotes healthy living

Publish Date: Aug 15 '24
74 51

This is a submission for the Build Better on Stellar: Smart Contract Challenge : Build a dApp

Table of Contents

What I Built

Dvilla Local Food Store project is a decentralised E-Commerce app where users can register an account and purchase organic foods and fruits, the app also rewards consistent users a little percentage to encourage people to stay on healthy foods and promote good living. The app leverages Stellar smart contracts to manage secure transactions, particularly in regions without credit card access, by placing assets in a vault during procurement and delivery. Payments are transferred only after safe delivery. Buyers are rest assured that payments are made or transferred to the local farms after their food items have been delivered safely to them. Its covers the Sustainability prompt and designed to fit into the category of a public goods application, where it incorporates features that contribute to real-world positive impacts. it promotes and sell products that are sustainably sourced from local farms.

Demo

The dApp is built on Next js for the frontend and Rust programming language for the backend and it incorporated the Stellar SDK for the Cli commands to interact with the blockchain and Soroban for the wallet

NOTE - To access the public url, make sure to install the Freighter wallet chrome extension. Currently, freighter wallet is unavailable for Android so download the Freighter chrome extension, create a wallet, and open the Public Url on Mac or Windows

Public Url: DVILLA E-commerce Project

Image description

My Code

The Github Repo: Github Repo

Video DEMO

smart_contract_explained

Contract on Stella Expert

Stellar Expert : Transactions done on the Contract address

The other function i implemented is the "place_order" is implemented to pay or place a cart order, it transfer the amount from the user to the contract address, then saves the order and creates a tracker that calculates the user rewards

Rust function implementation for the place_order function

Place_order_save_order

Place_order_reward tracker

Then on the frontend to sign and submit the transaction, we first need to build the transaction

Image description

Journey

For my project, I designed and implemented a smart contract on the Stellar network to facilitate seamless transactions for a local food store. The motivation behind this project was to create a decentralized application (dApp) that supports local businesses by enabling them to accept payments in XLM, thereby promoting financial inclusion and sustainability.

One of the functions which i implemented and which made me understand a lot about the concept of blockchain is the "transfer_xlm()" function. This function was used to transfer token with in place_order function and process_user_reward function

Transfer_xlm

Concepts Learned

  1. sourceAccount (--source): This is the admin that invokes the contract to do a transaction. The admin should be generated with its keyPair that is both public Key and Secret key. Its only with the secret key that a transaction is signed. Meaning the admin signs thats transaction.


  2. id or contract_id (--id): This is the address of a contract after it has been deployed. The contract_id holds all the functions of that contract. So in the case, you want to transfer a token from an address to another address. The transaction must happen on a contract having “transfer” as one of its functions. 



  3. Network (--network): This is the network on which the contracts were built or deployed on and where you will also be invoking the “transfer” transaction. This is either "testnet", "futurenet" or "mainnet".

  4. transfer_xlm: This is the name of the function in my localfoodstore contract id/address.



  5. From (--from): This is still the admin address or sourceAccount. For the transfer transaction, the admin must have a lot of XLM tokens to send to the address “to”. The address here must have been generated having its key pair (public key and secret key) and have been funded by the friendbot or another address.It’s worthy to note that if you dont have the secret key of the public address here, the transaction will fail. This can also be called Issuer address.

  6. To (--to): This holds the address to which the tokens are sent to. This address can be a contract id/address or a personal public address. This can also be called recipient address.

  7. Amount (--amount): this is the amount of tokens to be sent to the public or contract address. It can be the native XLM token or any non-native assest.

Image description

Here you can see the transfer of 1000XLM was successful to my contract address

Image description

Additional Prize Categories: Glorious Game and/or Super Sustainable

My Submission is largely under the Super Sustainable dApp category.

Next Steps

  • I hope to include feature to give the users the choice to donate their rewards to charity organisations
  • Also I will need to improve the UI

Reach me here for collaborations:
LinkedIn
Gmail
Whatsapp

Comments 51 total

  • Vivian Ilechukwu
    Vivian IlechukwuAug 15, 2024

    Well done, Chieloka!

  • kemsguy7
    kemsguy7Aug 15, 2024

    Wonderful project, this is really encourage people to get more healthy foods

    • Chieloka Madubugwu
      Chieloka MadubugwuAug 15, 2024

      Thank you, we are planning to add more features to get users coming back

  • Valentine Onyekachi
    Valentine OnyekachiAug 15, 2024

    Nice work Chieloka, this is great

  • Chidubem Madubugwu
    Chidubem MadubugwuAug 15, 2024

    Nice one, I really like this👍🏽

  • Chibuikem Nwosu
    Chibuikem NwosuAug 16, 2024

    Nice project
    I really love the concept and analysis behind the project

  • Stella Chika
    Stella ChikaAug 16, 2024

    Great job! You shall surely go places!!

  • Rosemary Chidera Madubugwu
    Rosemary Chidera MadubugwuAug 16, 2024

    This is really commendable. This app helps promote Sustainable Development Goals (SDGs) number 3 concerned with good health and well-being of individuals.

  • Princewill Ibekaku
    Princewill IbekakuAug 16, 2024

    This is so smart.

  • Jude Madubugwu
    Jude MadubugwuAug 16, 2024

    Good job!!! Well-done

    The dApp for a seamless operation of a local food store is awesome.

    Keep it up

  • Onuigbo Onyinyechi
    Onuigbo OnyinyechiAug 16, 2024

    What a wonderful project you've got here Chieloka.
    Not only is this a brilliant blend of technology and sustainability, it also helps in promoting healthy living while supporting local farms. The rewards system is also a great idea since this will encourage consistent healthy choices. It's exciting to see how this can create real-world positive impacts.
    Great job Chieloka .

    • Chieloka Madubugwu
      Chieloka MadubugwuAug 16, 2024

      Thank you very much Onyinyechi. This is a great summary of the project, I hope to add more features to make users keep coming back, features like user can choose to donate their rewards to charity organisations

  • wisdom Umenta
    wisdom UmentaAug 16, 2024

    Great concept. This has so much knowledge.
    You've started so well and you will definitely do great.

  • Isaiah Onyekachi
    Isaiah OnyekachiAug 16, 2024

    Reconciling technology and healthy living screams sustainability. This project is an outstanding one I must confess. I look forward to the unveiling of its potentials.

    Great job, man!

  • Chidumebi Ifemena
    Chidumebi IfemenaAug 16, 2024

    Nice insight... Hope this will be implemented soon

  • Adedini James
    Adedini JamesAug 16, 2024

    It is a nice project, Well-done. More power to your elbow

  • Ugwu Emmanuel
    Ugwu EmmanuelAug 16, 2024

    Your idea is excellent. You did marvelous by incorporating a "reward for consistent users to promote good health" This shows the uniqueness of what you have created. It doesn't just make it easy for customers to order food and fruits; it also encourages them to stay healthy. Furthermore, your future plan to add a section where customers may decide to donate their rewards to charity is indeed another innovative approach to make it easy for the needy to get their own food. However, I can say you holistically considered both the customers and the less privileged.

    You deserve an accolade for this bro! Keep it up.

  • Nnenna Okoye
    Nnenna OkoyeAug 16, 2024

    Nice project. Well done, Chieloka.

  • Chidera
    Chidera Aug 16, 2024

    Weldone!

  • Lucy Obeta
    Lucy ObetaAug 16, 2024

    This is wonderful. You did a great work with this one

  • Oloye Tobe
    Oloye TobeAug 16, 2024

    Keep up the good work

  • Kene Basil
    Kene BasilAug 16, 2024

    Nice chieloka

  • Anyaegbu Eucharia
    Anyaegbu EuchariaAug 16, 2024

    Good job

  • Amaka Nwosu
    Amaka NwosuAug 16, 2024

    A wonderful project 👍👍

  • Oloye Tobe
    Oloye TobeAug 16, 2024

    Beautiful

  • chisom nwafor
    chisom nwaforAug 16, 2024

    Well-done, very impressive work.

  • jennifer udeze
    jennifer udezeAug 16, 2024

    Nice one

  • Perry Jasper
    Perry JasperAug 16, 2024

    Nice 👍 job....you did very well ❤️‍🩹 my dear!

  • Chibuikem Nwosu
    Chibuikem NwosuAug 16, 2024

    Amazing 👏

  • Kelvin Smith
    Kelvin SmithAug 16, 2024

    wow nice one

  • Kpoped Queen
    Kpoped QueenAug 16, 2024

    You did great
    Keep it up 👍✊

  • Ayogu Oluchi
    Ayogu OluchiAug 16, 2024

    The reward system is intriguing and the whole idea is wonderful as it helps to narrow down the search for good food..

  • Rodrick
    Rodrick Aug 16, 2024

    Nice work chieloka

  • Ifeakor Chinonso Valerian
    Ifeakor Chinonso ValerianAug 16, 2024

    Nice project

  • Nedosa Ab
    Nedosa AbAug 17, 2024

    This is clean and solves an important real life problem. You’ve done a wonderful job

  • Ohaegbu Ben
    Ohaegbu BenAug 19, 2024

    Great work!keep it up!!

  • Rodrick Joshua
    Rodrick JoshuaAug 20, 2024

    Wow, this is captivating.
    Thanks for this amazing piece.

  • Lief Storer
    Lief StorerAug 22, 2024

    This is a great dApp demo!

    Where I could see this being really interesting is applying it to last-mile food delivery where users could place an order (similar to instacart) where your credit card is pre-authorized for the cart amount, but the transaction doesn't process till the food delivery is confirmed. In regions that don't have credit cards, using a smart contract to place assets in a vault while the order is being procured would be an awesome way to enable a whole economy of local buyers.

    • Chieloka Madubugwu
      Chieloka MadubugwuAug 23, 2024

      Wow! Great idea.. I would really like upgrading the dApp with this. It provides security and trust that the food items will really get delivered safely before payments are transferred to the food store or local farm

    • Chieloka Madubugwu
      Chieloka MadubugwuAug 27, 2024

      Thanks for the Idea, i have implemented the feature. I would love to get your feedback on it. The link is same as above. Now the buyers are rest assured that payment is made only when their food items have been delivered to them

Add comment