Giter Club home page Giter Club logo

decentralized-ecommerce's Introduction

Decentralize: Ecommerce Store

Overview: This is a simple ecommerce DApp store where everyone can sell/buy products. Truffle framework is being used to build the entire app end-to-end.

By utilizing IPFS to host the site(image files first, site fully with other assests would be shift to IPFS later in the future) to make it truly decentralized.

  • The contract will also feature an escrow system, which involves a 3-person approval to release funds. This means that instead of the buyer sending money to the sender directly, a third person holds the funds until the others have agreed funds should be released (or refunded). To be added

User Stories

The following user stories must be completed:

  • Users can see products for sale, and buy them through a web interface.
  • Users can add products for sale using a web interface.
  • Product images are being hosted on IPFS.
  • The WebUI is updated as the user makes transactions, by listening to Solidity Events.
  • Frontend/site assets are being hosted on IPFS.
  • A functioning escrow system:
    • Instead of transferring money directly to the buyer, money is sent to an "escrow" holder.
    • This person will release funds or refund funds based on consensus from 2 out of the 3 parties.
    • The escrow contract will deduct a 1% fee for these services.
  • User is able to filter products based on category and sold/unsold status. To do this, an off-blockchain store would be implemented so as to aid the search of listed product but actual transactions won't be done on the off-blockchain store, just the items list would be there.

Tips

  • Define a struct for Product information.ProductStatus to represent whether it's available, buying, or sold may be enum.
struct Product {
  string name;
  string category;
  string imageLink;
  string descLink;
  uint price;
  ProductStatus status;
}
  • Updating the page in real time as different transactions occur will use Events in Solidity. Solidity Events.

Advanced

The following advanced user stories are optional, and more knowledge are gain from doing them:

  • Writing unit tests for the contract functionality. Examples are verifying that money is debited correctly, product availability is updated correctly, products are added correctly.
  • Allow quantity for products in the store.
  • Whatever else that could be think of!

Development

Prerequisites

Building and Deploying the contract

$ truffle compile
$ truffle migrate

Start IPFS deamon

$ ipfs daemon

If you have problem with CORS access, run below command and restart your deamon:

ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]'

Start the Web App

$ npm install
$ npm run dev

Live deploy link of MVP

Decentralize Ecommerce

decentralized-ecommerce's People

Contributors

goldenglorys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.