Coder Social home page Coder Social logo

1x-eng / decentralized_ecom Goto Github PK

View Code? Open in Web Editor NEW
133.0 6.0 43.0 718 KB

A decentralized e-commerce platform. Tech Stack: Ethereum (Solidity) on the backend, Web3 binding to ReactJS frontend

License: MIT License

JavaScript 84.72% HTML 4.06% CSS 1.13% Solidity 10.09%
blockchain blockchain-service ethereum-dapp ethereum-blockchain full-stack-blockchain full-stack-dapp full-stack-development full-stack-ethereum-react reactjs-web3 web3-solidity

decentralized_ecom's Introduction

Decentralized E-Commerce using ETHEReact!

alt text

Description

ETHEReact is a full-stack DApp, showcasing e-commerce capabilities without relying on any traditional database for the backend. Instead, it utilizes the Ethereum Virtual Machine (EVM) as its backbone. While not a product in itself, it serves as an idea for aspiring blockchain enthusiasts to explore the full potential of decentralized applications, from end to end.

  • This app utilizes Truffle-powered testrpc (also known as ganache) for local development.
  • Web3 serves as the bridge between Ethereum and ReactJS

Setup

  • Install the latest version of NodeJS
  • Install truffle globally using npm install -g truffle
  • Install Ethereum RPC globally using npm install -g ethereumjs-testrpc
  • Clone this Repo using git clone https://github.com/PruthviKumarBK/Decentralized_eCom.git
  • cd Decentralized_eCom
  • Below is the command sequence to be executed in the terminal or command prompt:
    cd backend
    testrpc -l 9000000000 -p 8484
    
    This will navigate to the 'backend' directory and instantiate a testrpc server with the specified gas limit and port. Make sure to leave the server running for Ethereum to be operational on your local development machine.
  • Change directory to 'backend' and compile the Solidity contracts, then migrate them to your Ethereum server. Depending on your setup, you might use Truffle commands like truffle compile and truffle migrate to achieve this."

    • truffle compile (On Windows 10, truffle.cmd compile)
    • truffle migrate (On Windows 10, truffle.cmd migrate)
    • truffle console (On Windows 10, truffle.cmd console)
      • In console, retrieve SHA256 addresses for Supplier.sol and Customer.sol contracts.
      • We can get that using Supplier.address
        • Copy this SHA256 string. We will need this later. [TAG - Supplier SHA256]
      • Get Customer contract address using Customer.address
        • Copy this SHA256, We will need this later. [TAG - Customer SHA256]
  • Now, let's get the front end functional.

  • Open the file named 'EthereumSetup.js' (Decentralized_eCom/frontend/src/EthereumSetup.js)

    • Copy SupplierAddress from [TAG - Supplier SHA256] step to line number 13. (let supplierAddress = '<YOUR SHA256 Address for Supplier Contract>')
    • Copy CustomerAddress from [TAG - Customer SHA256] step to line number 14. (`let customerAddress = '').
    • Save file EthereumSetup.js
  • Open a new terminal/cmd, navigate to the current working directory, and then change directory to 'frontend' using the command: cd frontend.

  • npm install

  • npm start

Welcome to decentralized e-commerce! While the UI may appear basic, it showcases the entire process: Supplier adding a product to the marketplace -> Customer making a purchase -> Supplier shipping the order -> Customer acknowledging delivery. And all of this happens on the blockchain! Exciting stuff!

LICENCE

MIT License

Copyright (c) 2018 Pruthvi Kumar

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

decentralized_ecom's People

Contributors

1x-eng avatar justinpinili avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar

decentralized_ecom's Issues

Problem with step 'Supplier.address'

In truffle console(development) after typing: Supplier.address the error is showing:

truffle(development)> Supplier.address
/home/oko/.nvm/versions/node/v11.4.0/lib/node_modules/truffle/build/cli.bundled.js:500795
throw new Error(error);
^

Error: Supplier has no network configuration for its current network id (1562525172380).

Any idea why?

Thanks

Some quick fixes

Compiling your contracts...
===========================
ParsedContract.sol:8:1: ParserError: Source file requires different compiler version (current compiler is 0.5.8+commit.23d335f2.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version pragma solidity ^0.4.17;
^----------------------^

change pragma solidity ^0.4.17; to version which you have.

**truffle migrate**
Warning: Both truffle-config.js and truffle.js were found. Using truffle-config.js.

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

Could not connect to your Ethereum client with the following parameters: - host > 127.0.0.1 - port > 7545 - network_id > 5777 Please check that your Ethereum client: - is running - is accepting RPC connections (i.e., "--rpc" option is used in geth) - is accessible over the network - is properly configured in your Truffle configuration file (truffle-config.js)
you need to delete one of them or copy module.export with network setting

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
frontend/package.json
  • react 18.1.0
  • react-bootstrap 2.3.1
  • react-dom 18.1.0
  • react-scripts 5.0.1
  • web3 1.7.3

  • Check this box to trigger a request for Renovate to run again on this repository

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.