/blockchain-project

Decentralized home battery management for Blockchain Project (Fall 2019) at the Howest

Primary LanguageJavaScriptMIT LicenseMIT

Decentralized home battery management

This project implements decentralized home battery management through the proposed standards ERC-1056 and ERC-780. Currently only identity creation and home battery production and commissioning are provided. The project consists of a server, which exposes a REST API for smart contract interaction, and a client which consumes said REST API. We implement the project in this manner to eliminate the need for Ethereum wallets or Ethereum-enabled browsers. However, do not confuse this for a centralized application: identities and home batteries are still connected to separate wallets, although these are funded by a central wallet whenever a transaction needs to take place.

Prerequisites

  • Node.js this project has been tested with version 12.x of Node.js

Setup

To set up the application, we need to set up both the server and the client.

Server

To set up the server, we first need to deploy the smart contracts via Truffle. Navigate to the /server directory from the root of this repository in a terminal of your choice and execute the following commands:

npm install
npx truffle develop

These commands open the Truffle console and fire up Ganache. To deploy the smart contracts from the Truffle console, execute:

truffle migrate

Keep Truffle open and in a new terminal window, start the REST API from the /server directory through the following command:

node index.js

The server will now be running at http://localhost:3000. Be sure to keep this terminal window open as well, or the server shuts down.

Client

After setting up the server, navigate to the /client directory from this repository’s root and execute the following commands to run the client:

npm install
npx webpack-dev-server

The Webpack bundle analyzer will show the size of the client-side web application in your browser and you will find its URI in the terminal output. Navigate to it in a web browser to interact with the application.