Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Updated to latest Composer/Fabric
Browse files Browse the repository at this point in the history
  • Loading branch information
raheelzubairy committed Oct 16, 2017
1 parent 7508757 commit b6fb1e2
Show file tree
Hide file tree
Showing 26 changed files with 115 additions and 201 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ dist
go
lib
node_modules
angular-app
out
5 changes: 0 additions & 5 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ parserOptions:
sourceType:
- script
rules:
indent:
- error
- 4
linebreak-style:
- error
- unix
Expand All @@ -27,11 +24,9 @@ rules:
curly: error
eqeqeq: error
no-throw-literal: error
strict: error
no-var: error
dot-notation: error
no-tabs: error
no-trailing-spaces: error
no-use-before-define: error
no-useless-call: error
no-with: error
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ In this developer journey, we will create such a Blockchain application using Hy
# Architecture Flow

<p align="center">
<img width="650" height="200" src="arch.png">
<img width="650" height="200" src="images/arch.png">
</p>

1. The administrator interacts with Decentralized Energy UI comprising of Angular framework
Expand Down Expand Up @@ -97,7 +97,7 @@ Now, we are ready to deploy the BNA file to Hyperledger Fabric:

```
cd dist
composer network deploy -a decentralized-energy-network.bna -p hlfv1 -i PeerAdmin -s randomString
composer network deploy -a decentralized-energy-network.bna -p hlfv1 -i PeerAdmin -s randomString -A admin -S
```

You can verify that the network has been deployed by typing:
Expand All @@ -124,7 +124,7 @@ The application should now be running at:
`http://localhost:4200`

<div style='border: 2px solid #f00;'>
<img width="800" src="app_scrnshot.png">
<img width="800" src="images/app_scrnshot.png">
</div>
</br>

Expand Down Expand Up @@ -156,3 +156,9 @@ This application demonstrates a basic idea of a decentralized energy network usi
* Adding specific permissions and participant access
* Setting up real time transactions among participants
* Integrating with IoT to read from power meter and distribute energy


# Journey links

[Decentralized energy with Hyperledger Composer journey](https://developer.ibm.com/code/journey/decentralized-energy-hyperledger-composer/)<br />
[Blockchain journeys](https://developer.ibm.com/code/journey/category/blockchain/)
26 changes: 13 additions & 13 deletions angular-app/src/app/AllTransactions/AllTransactions.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ <h4>Performed Transactions</h4>
</th>
<th>
Transaction ID
</th>
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let transaction of performedTransactions">
<tr *ngFor="let transaction of performedTransactions">
<td>
{{transaction.$class}}
{{transaction.transactionType}}
</td>
<td>
{{transaction.transactionId}}
</td>


</tr>
</tbody>
</table>

</div>

<div class="row">
Expand All @@ -63,30 +63,30 @@ <h4>System Transactions</h4>
</th>
<th>
Transaction ID
</th>
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let transaction of systemTransactions">
<tr *ngFor="let transaction of systemTransactions">
<td>
{{transaction.$class}}
{{transaction.transactionType}}
</td>
<td>
{{transaction.transactionId}}
</td>


</tr>
</tbody>
</table>
<!-- p *ngFor="let transaction of allTransactions">{{transaction.transactionId}}</p-->

<!-- p *ngFor="let transaction of allTransactions">{{transaction.transactionId}}</p-->
</div>

<div class="row">
<br>
<br>
</div>


</div>
</div>
28 changes: 12 additions & 16 deletions angular-app/src/app/AllTransactions/AllTransactions.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ export class AllTransactionsComponent {
private performedTransactions = [];

constructor(private serviceTransaction:AllTransactionsService, fb: FormBuilder) {

};


ngOnInit(): void {

this.loadAllTransactions();

}

//sort the objects on key
sortByKey(array, key): Object[] {
return array.sort(function(a, b) {
Expand All @@ -40,35 +40,31 @@ export class AllTransactionsComponent {

//get all Residents
loadAllTransactions(): Promise<any> {

let tempList = [];
let systemList = [];
let performedList = [];
let performedList = [];

return this.serviceTransaction.getTransactions()
.toPromise()
.then((result) => {
result = this.sortByKey(result, 'timestamp');
result = this.sortByKey(result, 'transactionTimestamp');
this.errorMessage = null;
result.forEach(transaction => {
tempList.push(transaction);

var importClass = transaction["$class"];
var importClassArray = importClass.split(".");
var importClassArray = importClass.split(".");

if(importClassArray[1] == 'hyperledger'){
//transaction["$class"] = importClassArray[importClassArray.length-1];
systemList.push(transaction);
systemList.push(transaction);
}
else {
//transaction["$class"] = importClassArray[importClassArray.length-1];
performedList.push(transaction);
performedList.push(transaction);
}



});

this.systemTransactions = systemList;
this.performedTransactions = performedList;
this.allTransactions = tempList;
Expand All @@ -89,5 +85,5 @@ export class AllTransactionsComponent {
});
}


}
3 changes: 2 additions & 1 deletion angular-app/src/app/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export class DataService<Type> {
public transactions(): Observable<Type[]> {
console.log('Get transactions ');

return this.http.get(this.actionUrl + 'system/transactions')
//return this.http.get(this.actionUrl + 'system/transactions')
return this.http.get(this.actionUrl + 'system/historian')
.map(this.extractData)
.catch(this.handleError);
}
Expand Down
Binary file modified fabric-tools/fabric-dev-servers.zip
Binary file not shown.
1 change: 0 additions & 1 deletion fabric-tools/fabric-scripts/hlfv0.6/README.md

This file was deleted.

22 changes: 0 additions & 22 deletions fabric-tools/fabric-scripts/hlfv0.6/createComposerProfile.sh

This file was deleted.

30 changes: 0 additions & 30 deletions fabric-tools/fabric-scripts/hlfv0.6/docker-compose.yml

This file was deleted.

14 changes: 0 additions & 14 deletions fabric-tools/fabric-scripts/hlfv0.6/downloadFabric.sh

This file was deleted.

19 changes: 0 additions & 19 deletions fabric-tools/fabric-scripts/hlfv0.6/startFabric.sh

This file was deleted.

9 changes: 0 additions & 9 deletions fabric-tools/fabric-scripts/hlfv0.6/stopFabric.sh

This file was deleted.

15 changes: 0 additions & 15 deletions fabric-tools/fabric-scripts/hlfv0.6/teardownFabric.sh

This file was deleted.

Binary file modified fabric-tools/fabric-scripts/hlfv1/composer/composer-channel.tx
Binary file not shown.
Binary file not shown.
8 changes: 4 additions & 4 deletions fabric-tools/fabric-scripts/hlfv1/composer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2'

services:
ca.org1.example.com:
image: hyperledger/fabric-ca:x86_64-1.0.0
image: hyperledger/fabric-ca:$ARCH-1.0.1
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com
Expand All @@ -18,7 +18,7 @@ services:

orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer:x86_64-1.0.0
image: hyperledger/fabric-orderer:$ARCH-1.0.1
environment:
- ORDERER_GENERAL_LOGLEVEL=debug
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
Expand All @@ -36,7 +36,7 @@ services:

peer0.org1.example.com:
container_name: peer0.org1.example.com
image: hyperledger/fabric-peer:x86_64-1.0.0
image: hyperledger/fabric-peer:$ARCH-1.0.1
environment:
- CORE_LOGGING_PEER=debug
- CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
Expand Down Expand Up @@ -64,7 +64,7 @@ services:

couchdb:
container_name: couchdb
image: hyperledger/fabric-couchdb:x86_64-1.0.0
image: hyperledger/fabric-couchdb:$ARCH-1.0.1
ports:
- 5984:5984
environment:
Expand Down
13 changes: 8 additions & 5 deletions fabric-tools/fabric-scripts/hlfv1/downloadFabric.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
# Exit on first error, print all commands.
set -ev

# Set ARCH
ARCH=`uname -m`

# Grab the current directory.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Pull and tag the latest Hyperledger Fabric base image.
docker pull hyperledger/fabric-peer:x86_64-1.0.0
docker pull hyperledger/fabric-ca:x86_64-1.0.0
docker pull hyperledger/fabric-ccenv:x86_64-1.0.0
docker pull hyperledger/fabric-orderer:x86_64-1.0.0
docker pull hyperledger/fabric-couchdb:x86_64-1.0.0
docker pull hyperledger/fabric-peer:$ARCH-1.0.1
docker pull hyperledger/fabric-ca:$ARCH-1.0.1
docker pull hyperledger/fabric-ccenv:$ARCH-1.0.1
docker pull hyperledger/fabric-orderer:$ARCH-1.0.1
docker pull hyperledger/fabric-couchdb:$ARCH-1.0.1
Loading

0 comments on commit b6fb1e2

Please sign in to comment.