Skip to content

Billing and payment system for smart meter using the Ethereum Blockchain

License

Notifications You must be signed in to change notification settings

Felixel42/bachelor-thesis

 
 

Repository files navigation

Bachelor thesis

The objective of my thesis can be briefly described as: Design and implement a 2.0 version of Project Oaken's water-meter-acorn. Additional features are:

  • Authentication via the Ethereum Blockchain
  • Separate views for admin and customer
  • Hourly recording of smart meter readings and payment history

Goals

Cut out intermediaries involved in the billing and payment process of water suppliers. Utilizing the reliable, distributed and tamper-proof characteristics of Blockchain infrastructure to improve services around one of the most valuable resources. See also Project Oaken's Video

It was a great opportunity for me to gain experiences about Ethereum, Smart Contracts and the related technologies.

Table of contents

Architectural overview

Overview

Process view

BPMN

Directories

Dapp/
├── contracts/   (Smart contracts)
├── migrations   (truffle deployment)
├── public/      (html template)
    ├── img/     (images)
├── scss/        (scss source)
├── src/         (js|jsx source)
├── test/        (truffle tests)

Getting Started

The following instructions show how to run the Dapp (Decentralized Application) in combination with smart sontracts. The guide and resources to let the Raspberry Pi communicate with smart contracts can be found in this separate Readme.

Prerequisites

  • node >= 6.0.0
  • npm >= 5.0.0
  • truffle >= 4.0.0

Installing

npm install
// before calling npm start the first time
truffle compile

Running the smart contract tests

truffle develop
test

Deployment of smart contracts

Local test-blockchain (truffle)

truffle develop
migrate

Testnet (Kovan, Rinkeby, Ropsten)

Only the Authentication smart contract must be deployed upfront to a network of your choice. Example on Etherscan. The received contract address has to be changed in the LoginButtonAction from deployed to .at(yourAddressHere)

authentication.deployed().then(function(instance) {

Usage

truffle compile
npm start

Authentication

Log in the first time as admin (public address of user specified in the constructor of Authentication smart contract). See how it works: sequence_diagram authentication

Create new contract and user

contract_creation Must be a bug somewhere between web3, truffle-contract and MetaMask which effects the gasLimit computation for contract creation

User login

user_login

Request new invoice

invoice_creation

Pay Invoice

pay_invoice

Receive money

receive_payment

Contributing

If you have any additions or problems regarding this guide, just open an issue, create a pull request or send me a pm.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • CoreUI React for providing an awesome react based and free admin template
  • Adafruit with their beer keg-bot tutorial as perfect smart meter example
  • Truffle maintaining the in my opinion best IDE for smart contracts and provider for cool boxes
  • Redux-auth-wrapper as authentication component
  • The whole Ethereum ecosystem, keep up the good work!

Packages

No packages published

Languages

  • JavaScript 73.3%
  • CSS 19.7%
  • Python 4.9%
  • Solidity 1.6%
  • HTML 0.5%