Skip to content

Commit

Permalink
Merge pull request #22 from olisystems/publish-repo
Browse files Browse the repository at this point in the history
Publish repo
  • Loading branch information
m-yahya authored Sep 28, 2020
2 parents dde95c7 + 77d031a commit d01c9d5
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 370 deletions.
63 changes: 56 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,31 @@

[![Build Status](https://travis-ci.org/olisystems/alf-transparency.svg?branch=master)](https://travis-ci.org/olisystems/alf-transparency)

Implements Hashing-Dashboard on the basis of the ALF Flex Market with Vue.js and the Ethereum netwrok
Implements an hashing dashboard on the basis of the ALF Transparency with Merkletree.js, Vue.js and the Ethereum netwrok

## Table of Contents
[Demo](https://verify.flexibilitaetsmarkt.de/)

**Table of Contents**

<!-- MDTOC maxdepth:6 firsth1:0 numbering:1 flatten:0 bullets:0 updateOnSave:1 -->

1. [Table of Contents](#table-of-contents)
2. [Description](#description)
1. [Description](#description)
2. [API Documentation](#api-documentation)
3. [Overview of the Stack](#overview-of-the-stack)
4. [Getting Started](#getting-started)
&emsp;4.1. [Prerequisites](#prerequisites)
&emsp;4.2. [Installing](#installing)
5. [Built With](#built-with)
6. [Contributing](#contributing)

<!-- /MDTOC -->

## Description

The current project creates hashes of the given document using [web3 sha3](https://web3js.readthedocs.io/en/v1.2.7/web3-utils.html#sha3) function and stores them on [Volta](https://energyweb.atlassian.net/wiki/spaces/EWF/pages/702677023/Chain%3A+Volta+Test+Network) test network.
The current project creates hashes of the user offers using [Merkletree.js](https://github.com/miguelmota/merkletreejs#documentation) and stores them on [Volta](https://energyweb.atlassian.net/wiki/spaces/EWF/pages/702677023/Chain%3A+Volta+Test+Network) test network.

## API Documentation
Read the API documentation [here]('./../docs/API.md).

## Overview of the Stack

Expand All @@ -47,12 +53,55 @@ Please make sure you've already installed Truffle and enabled the MetaMask exten

Note: Please follow the [steps](https://energyweb.atlassian.net/wiki/spaces/EWF/pages/703201459/Volta+Connecting+to+Remote+RPC+and+Metamask) to connect Metamask with Volta.

### Installing
Follow the steps below to have development environment running:
1. Clone the repository:
```
$ git clone https://github.com/olisystems/alf-transparency.git
```

2. Change directory to `alf-transparency
` folder and install all requisite npm packages (as listed in `package.json`):
```
$ cd alf-transparency
$ npm install
```
3. Compile the smart contracts:
```
$ cd truffle
$ truffle compile
```
This will create the smart contract artifacts in folder `app\src\assets\js\contracts`.

4. Migrate smart contracts to `volta` chain:
```
$ npm run migrate
```

5. Test smart contracts:
```
$ npm run test
```

6. Compiles and hot-reloads for development, run the following command inside `app` directory:
```
$ cd app
$ npm run serve
```
Navigate to `localhost:8080` in your browser.

7. Compiles and minifies for production:
```
$ npm run build
```
## Built With

- [Ethereum](https://www.ethereum.org/) - Ethereum is a decentralized platform that runs smart contracts to make the web faster, safer, and more open.
- [Truffle Framework](http://truffleframework.com/) - Truffle is the most popular development framework for Ethereum with a mission to make your life a whole lot easier.
- [Vue.js](https://vuejs.org/) - The Progressive JavaScript Framework for building user interfaces.
- [Web3.js](https://web3js.readthedocs.io/en/v1.2.7/#web3-js-ethereum-javascript-api) - A collection of libraries which allow interacting with a local or remote ethereum node, using an HTTP or IPC connection.
- [MerkleTree.js](https://github.com/miguelmota/merkletreejs) - A JavaScript library to construct Merkle Tree and verify proofs.
- [Vue.js](https://vuejs.org/) - The Progressive JavaScript Framework for building user interfaces.
- [MongoDB](https://www.mongodb.com/) - A document-oriented database database that uses JSON-like documents with optional schemas.
- [Truffle Framework](http://truffleframework.com/) - Truffle is the most popular development framework for Ethereum with a mission to make your life a whole lot easier.

## Contributing

Expand Down
53 changes: 0 additions & 53 deletions backend/README.md

This file was deleted.

41 changes: 0 additions & 41 deletions docs/ALFTransparency.doc.md

This file was deleted.

67 changes: 67 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# ALF Transparency REST API
ALF Transparency REST API is designed to create offers, retrieve offer information and perform verification.

**Table of Contents**
<!-- MDTOC maxdepth:6 firsth1:0 numbering:1 flatten:0 bullets:0 updateOnSave:1 -->

1. [API Endpoints](#api-endpoints)
&emsp;1.1. [Create Offer](#create-offer)
&emsp;1.2. [Get Offer by Usrname and Date](#get-offer-by-usrname-and-date)
&emsp;1.3. [Send Root Hash](#send-root-hash)
&emsp;1.4. [Get Proof](#get-proof)

<!-- /MDTOC -->
## API Endpoints
The root path for the API is `https://verify.flexibilitaetsmarkt.de:3000/`.

### Create Offer
Create a new offer.
```
/api/offers/
```

- HTTP-Method: POST
- Connected function: `create()`
- Parameter: JSON-Object with following form:
```javascript
{
username: 'string',
date: 'string',
hash: 'string'
}
```
### Get Offer by Usrname and Date
Find an offer by a given username and date.
```
/api/offers/byUsernameDate
```

- HTTP-Methode: GET
- Connected function: `findByUsernameDate()`
- Parameter: Query with following form:
```
?username=<USERNAME>&date=<DATE>
```
### Send Root Hash
Create a Merkle tree for all offers of a given date and store the resulting root hash on the Volta Blockchain.
```
/api/offers/rootHashTrigger
```

- HTTP-Methode: GET
- Connected function: `storeRootHash()`
- Parameter: Query with following form:
```
?date=<DATE>
```
### Get Proof
Fetch a MerkleTree.js-Proof for an offer with a given username and date. The proof can be used to reconstruct/verify a root hash.
```
/api/offers/proof
```
- HTTP-Methode: GET
- Connected function: `getProof()`
- Parameter: Query with following form:
```
?username=<USERNAME>&date=<DATE>
```
29 changes: 0 additions & 29 deletions docs/Backend.md

This file was deleted.

Loading

0 comments on commit d01c9d5

Please sign in to comment.