From 648caee703212aaab270b5f4c014cbe37c061853 Mon Sep 17 00:00:00 2001 From: Tobias Hunter Date: Thu, 13 Jul 2017 16:07:21 +0100 Subject: [PATCH 1/3] all readme's complete overhaul --- packages/animaltracking-network/README.md | 64 ++++++++--- packages/basic-sample-network/README.md | 8 +- packages/bond-network/README.md | 70 +++++++++++- packages/carauction-network/README.md | 8 +- packages/digitalproperty-network/README.md | 109 +++++++++---------- packages/marbles-network/README.md | 65 ++++++++++- packages/perishable-network/README.md | 61 +++++++---- packages/pii-network/README.md | 60 +++++++++- packages/trade-network/README.md | 73 +++++++++++-- packages/vehicle-lifecycle-network/README.md | 67 +++++++++++- 10 files changed, 464 insertions(+), 121 deletions(-) diff --git a/packages/animaltracking-network/README.md b/packages/animaltracking-network/README.md index 999f103..2bca198 100644 --- a/packages/animaltracking-network/README.md +++ b/packages/animaltracking-network/README.md @@ -1,22 +1,58 @@ # Animal Tracking Network -Defines an Animal Movement business network based on UK DEFRA government regulations https://www.gov.uk/animal-movement-england. -Farmers can move animals between farms/fields and the UK government farming regulator has -visibility into the locations of all animals and all animal movements between farms. +> This is an Animal Tracking Business Network based on UK DEFRA government regulations (https://www.gov.uk/animal-movement-england). Farmers can move animals between farms/fields and the UK government farming regulator has visibility into the locations of all animals and all animal movements between farms. -- Each Farmer owns a Business that is identified by a Single Business Identifier (SBI) -- Each Farmer owns a set of Animals -- Each Business owns a set of Fields -- Each Field contains a set of Animals owned by the Farmer -- Animals can be transfered between Farmers or between Fields +In the **Define** tab this in Business Network defines: -## Demo inside Hyperledger Composer -Import the sample into Hyperledger Composer using the `Import/Replace` button. +**Participants** +`Farmer` `Regulator` -Submit a `SetupDemo` transaction to bootstrap a scenario to get you started. +**Assets** +`Animal` `Business` `Field` -You will see the 2 `Farmer` participants have been created, `FARMER_1` and `FARMER_2` as well as 2 `Field`'s, 2 `Business`'s and 8 `Animal`'s. +**Transactions** +`AnimalMovementDeparture` `AnimalMovementArrival` `SetupDemo` -Submit a `AnimalMovementDeparture` when you wish to sent an `Animal` to another `Farmer`, then, as the `Animal`'s new owner, submit an `AnimalMovementArrival` transaction to confirm revceipt. +Each Farmer owns a Business that is identified by a Single Business Identifier (SBI). Each Farmer owns a set of Animals. Each Business owns a set of Fields. Each Field contains a set of Animals owned by the Farmer. Animals can be transfered between Farmers or between Fields -![Definiton Diagram](./network.png) +To test this Business Network Definition in the **Test** tab: + +Submit a `SetupDemo` transaction: + +``` +{ + "$class": "com.biz.SetupDemo" +} +``` + +This transaction populates the Participant Registries with two `Farmer` participants and a `Regulator` participant. The Asset Registries will have eight `Animal` assets, two `Business` assets and four `Field` assets. + +Submit a `AnimalMovementDeparture` transaction: + +``` +{ + "$class": "com.biz.AnimalMovementDeparture", + "fromField": "resource:com.biz.Field#FIELD_1", + "animal": "resource:com.biz.Animal#ANIMAL_1", + "from": "resource:com.biz.Business#BUSINESS_1", + "to": "resource:com.biz.Business#BUSINESS_2" +} +``` + +This transaction moves `ANIMAL_1` from `FIELD_1` at `BUSINESS_1` to `BUSINESS_2`. + +Submit a `AnimalMovementArrival` transaction: + +``` +{ + "$class": "com.biz.AnimalMovementArrival", + "arrivalField": "resource:com.biz.Field#FIELD_2", + "animal": "resource:com.biz.Animal#ANIMAL_1", + "from": "resource:com.biz.Business#BUSINESS_1", + "to": "resource:com.biz.Business#BUSINESS_2" +} +``` + +This transaction confirms the receipt of `ANIMAL_1` from `BUSINESS_1` to `FIELD_2` at `BUSINESS_2`. + +Congratulations! diff --git a/packages/basic-sample-network/README.md b/packages/basic-sample-network/README.md index 05f4376..123205e 100644 --- a/packages/basic-sample-network/README.md +++ b/packages/basic-sample-network/README.md @@ -2,14 +2,14 @@ > This is the "Hello World" of Hyperledger Composer samples, which demonstrates the core functionality of Hyperledger Composer by changing the value of an asset. -In the **Define** tab this in Basic Sample Business Network defines: - -**Asset** -`SampleAsset` +In the **Define** tab this in Business Network defines: **Participant** `SampleParticipant` +**Asset** +`SampleAsset` + **Transaction** `SampleTransaction` diff --git a/packages/bond-network/README.md b/packages/bond-network/README.md index d3852a9..f21e8ee 100644 --- a/packages/bond-network/README.md +++ b/packages/bond-network/README.md @@ -1,8 +1,66 @@ -# Hyperledger Composer Bond Reference Data Demo +# Bond Network -Example business network that stores information about financial bonds on the blockchain. It allows -the issuer of a bond to update the bond information whilst other members of the business network can -only read the bond data. +> The Bond Network allows the issuer of a bond to update the bond information whilst other members of the business network can only read the bond data. -The data model for a bond is based on the FpML schema: -http://www.fpml.org/spec/fpml-5-3-2-wd-2/html/reporting/schemaDocumentation/schemas/fpml-asset-5-3_xsd/elements/bond.html +In the **Define** tab this in Business Network defines: + +**Participants** +`Issuer` `Member` + +**Assets** +`BondAsset` + +**Transactions** +`PublishBond` + +The `PublishBond` transaction submitted by an `Issuer` participant will create a new `BondAsset`. + +To test this Business Network Definition in the **Test** tab: + +Create a `Issuer` participant: + +``` +{ + "$class": "org.acme.bond.Issuer", + "memberId": "memberId:1", + "name": "Tobias Hunter" +} +``` + +Create a `Member` participant: + +``` +{ + "$class": "org.acme.bond.Member", + "memberId": "memberId:1", + "name": "Jenny Jones" +} +``` + +Submit a `PublishBond` transaction: + +``` +{ + "$class": "org.acme.bond.PublishBond", + "ISINCode": "ISINCode:1234", + "bond": { + "$class": "org.acme.bond.Bond", + "instrumentId": [], + "exchangeId": [], + "maturity": "2017-07-13T09:39:05.369Z", + "parValue": 1000, + "faceAmount": 1000, + "paymentFrequency": { + "$class": "org.acme.bond.PaymentFrequency", + "periodMultiplier": 0, + "period": "DAY" + }, + "dayCountFraction": "", + "issuer": "resource:org.acme.bond.Issuer#memberId:1" + } +} +``` + +The `PublishBond` transaction will create a new `BondAsset` in the Asset Registry. + +Congratulations! diff --git a/packages/carauction-network/README.md b/packages/carauction-network/README.md index 44615cd..288cd57 100755 --- a/packages/carauction-network/README.md +++ b/packages/carauction-network/README.md @@ -1,15 +1,15 @@ -# Car Auction Business Network +# Car Auction Network > This is an interactive, distributed, car auction demo. List assets for sale (setting a reserve price), and watch as assets that have met their reserve price are automatically transferred to the highest bidder at the end of the auction. In the **Define** tab for this network there is defined: -**Assets:** -`Vehicle` `VehicleListing` - **Participants:** `Member` `Auctioneer` +**Assets:** +`Vehicle` `VehicleListing` + **Transactions:** `Offer` `CloseBidding` diff --git a/packages/digitalproperty-network/README.md b/packages/digitalproperty-network/README.md index 5d98780..022bdcd 100644 --- a/packages/digitalproperty-network/README.md +++ b/packages/digitalproperty-network/README.md @@ -1,84 +1,73 @@ # Digital Property Network -Defines a business network where house sellers can list their properties for sale. +> This Defines a business network where house sellers can list their properties for sale. -Note that this network **references** the digital property model, via an npm dependency declared in package.json: +In the **Define** tab this in Business Network defines: -``` -"dependencies": { - "digitalproperty-model": "latest" - } -``` +**Participant** +`Person` + +**Assets** +`LandTitle` `SalesAgreement` -This allows the model to be shared across different types of business networks, and allows the model to have a lifecycle that is independent of the business network. +**Transaction** +`RegisterPropertyForSale` -## What should I do with this npm module? -It is expected that this npm module would be associated with a CI pipeline and tracked as source code in something like GitHub Enterpise. The CI pipeline this would be able to run functional validation on the whole definition, and also be able to published the module to an NPM repository. This allows sharing of the module etc. +A `Person` is responsible for a `LandTitle`. By creating a `SalesAgreement` between two `Person` participants you are then able to submit a `RegisterPropertyForSale` transaction. -For a production or QA runtime there are administrative steps (deploy, update, remove etc.) that are performed using this Business Network Definition on a running Hyperledger Fabric. The lifecycle at it's simplest is *deploy a network definition*, *update a network definition* and (potentially) *remove the network definition*. These actions are performed using the Business Network Archive - which is a single file that encapsulates all aspects of the Business Network Definition. It is the 'deployable unit'. +To test this Business Network Definition in the **Test** tab: -## Creating the BusinessNetwork. -*Step1:* Create a npm module +Create two `Person` participants: ``` -npm init +{ + "$class": "net.biz.digitalPropertyNetwork.Person", + "personId": "personId:Billy", + "firstName": "Billy", + "lastName": "Thompson" +} ``` -The important aspects of this are the name, version and description. The only dependancy that will be required is the NPM module that contains the model - see step 2. - -*Step2:* Create the transaction functions - -We need to create a standard JavaScript file to contain the transaction functions -```bash -\git\DigitialProperty-Model > touch lib/DigitalLandTitle.js ``` - -In this example the following is the implementation of the `registeryPropertyForSale` transaction - -```javascript -'use strict'; - -/** - * Process a property that is held for sale - * @param {net.biz.digitalPropertyNetwork.RegisterPropertyForSale} propertyForSale the property to be sold - * @transaction - */ -function onRegisterPropertyForSale(propertyForSale) { - console.log('### onRegisterPropertyForSale ' + propertyForSale.toString()); - propertyForSale.title.forSale = true; - - return getAssetRegistry('net.biz.digitalPropertyNetwork.LandTitle').then(function(result) { - return result.update(propertyForSale.title); - } - ); +{ + "$class": "net.biz.digitalPropertyNetwork.Person", + "personId": "personId:Jenny", + "firstName": "Jenny", + "lastName": "Jones" } ``` -_FUTURE_ -Create a file to hold the permissions access control inforation - create a `permissions.acl` file - - +Create a `LandTitle` asset: -## Work with the network -Once we have the network complete we can create a business network definition archive. This is the unit that will actually be deloyable to the HyperLedger Fabric. - -There is a `composer archive` command that can be used to create and inspect these archives. The `composer network` command is then used to administer the business network archive on the Hyperledger Fabric. - -### Creating an archive - -The `composer archive create` command is used to create the archive. The `--archiveFile` option is used to specify the name of the archive file to create. If this is not specified then a default name will be used that is based on the identifier of the business network (sanitized to be suitable as a filename). For example `@example_digitalPropertyNetwork-0.1.2.bna`. - -Please refer to the docs for `composer archive create` for more options. +``` +{ + "$class": "net.biz.digitalPropertyNetwork.LandTitle", + "titleId": "titleId:ABCD", + "owner": "resource:net.biz.digitalPropertyNetwork.Person#personId:Billy", + "information": "Detached House" +} +``` +Create a `SalesAgreement` asset: -```bash -composer archive create --archiveFile digitialLandTitle.bna --inputDir . --sourceType dir --sourceName DigitalLandTitle +``` +{ + "$class": "net.biz.digitalPropertyNetwork.SalesAgreement", + "salesId": "salesId:1234", + "buyer": "resource:net.biz.digitalPropertyNetwork.Person#personId:Jenny", + "seller": "resource:net.biz.digitalPropertyNetwork.Person#personId:Billy", + "title": "resource:net.biz.digitalPropertyNetwork.LandTitle#titleId:ABCD" +} ``` -Once you have this archive it can then be deployed to the HLF (which will assuming is all running for the moment) +Submit a `RegisterPropertyForSale` transaction: -```bash -composer network deploy --archiveFile DigitalLandTitle.zip --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d +``` +{ + "$class": "net.biz.digitalPropertyNetwork.RegisterPropertyForSale", + "seller": "resource:net.biz.digitalPropertyNetwork.Person#personId:Billy", + "title": "resource:net.biz.digitalPropertyNetwork.LandTitle#titleId:ABCD" +} ``` - +Congratulations! diff --git a/packages/marbles-network/README.md b/packages/marbles-network/README.md index 981d383..c89c1c2 100644 --- a/packages/marbles-network/README.md +++ b/packages/marbles-network/README.md @@ -1,3 +1,64 @@ -# Hyperledger Composer Marbles Demo +# Marbles Network -The Hyperledger Composer team has built an interactive, distributed, marble trading demo, backed by Hyperledger Fabric. Invite participants to join your distributed marble exchange, list marbles for sale and exchange marbles between participants. +> This is an interactive and distributed, marble trading demo. List marbles for sale and exchange marbles between participants. + +In the **Define** tab this in Business Network defines: + +**Participant** +`Player` + +**Asset** +`Marble` + +**Transaction** +`TradeMarble` + +`Player` participants are able to have `Marble` assets and trade these with `TradeMarble` transaction. + +To test this Business Network Definition in the **Test** tab: + +Create two `Player` participant: + +``` +{ + "$class": "org.hyperledger_composer.marbles.Player", + "email": "memberA@acme.org", + "firstName": "Jenny", + "lastName": "Jones" +} +``` + +``` +{ + "$class": "org.hyperledger_composer.marbles.Player", + "email": "memberB@acme.org", + "firstName": "Billy", + "lastName": "Thompson" +} +``` + +Create a `Marble` asset: + +``` +{ + "$class": "org.hyperledger_composer.marbles.Marble", + "marbleId": "marbleId:1234", + "size": "SMALL", + "color": "BLUE", + "owner": "resource:org.hyperledger_composer.marbles.Player#email:memberA@acme.org" +} +``` + +Submit a `Transaction` transaction: + +``` +{ + "$class": "org.hyperledger_composer.marbles.TradeMarble", + "marble": "resource:org.hyperledger_composer.marbles.Marble#marbleId:1234", + "newOwner": "resource:org.hyperledger_composer.marbles.Player#email:memberB@acme.org" +} +``` + +This transaction traded `marbleId:1234` from `memberA@acme.org` to `memberB@acme.org`. + +Congratulations! diff --git a/packages/perishable-network/README.md b/packages/perishable-network/README.md index 6bc7638..a485591 100644 --- a/packages/perishable-network/README.md +++ b/packages/perishable-network/README.md @@ -1,34 +1,57 @@ -# Hyperledger Composer Perishable Goods Demo +# Perishable Goods Network -Example business network that shows growers, shippers and importers defining contracts for the price -of perishable goods, based on temperature readings received for shipping containers. +> Example business network that shows growers, shippers and importers defining contracts for the price of perishable goods, based on temperature readings received for shipping containers. -The business network defines a parameterizable contract between growers and importers. The contract stipulates -that: +_The business network defines a parameterizable contract between growers and importers. The contract stipulates that: On receipts of the shipment the importer pays the grower the unit price x the number of units in the shipment. Shipments that arrive late are free. Shipments that have breached the low temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factory. Shipments that have breached the high temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factory._ -1. On receipts of the shipment the importer pays the grower the unit price x the number of units in the shipment -2. Shipments that arrive late are free -3. Shipments that have breached the low temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factory -4. Shipments that have breached the high temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factory +In the **Define** tab this in Business Network defines: -### Running Locally (Unit Test) +**Participants** +`Grower` `Importer` `Shipper` -`git clone` the repository for the sample, `cd` into its directory and then run `npm install` followed by `npm test`. The unit test will run and should pass. +**Assets** +`Contract` `Shipment` -### Demo inside Hyperledger Composer +**Transactions** +`TemperatureReading` `ShipmentReceived` `SetupDemo` -Import the sample into Hyperledger Composer using the `Import/Replace` button. +Summarise how the elements of the Business Network interact! -Submit a `SetupDemo` transaction - -You will see the 3 participants have been created (a grower, an importer and a shipper) along with 2 assets (a shipment `SHIP_001` and a contract `CON_001`). +To test this Business Network Definition in the **Test** tab: -Inspect the details of `SHIP_001` and `CON_001`. +Submit a `SetupDemo` transaction: -Submit a `TemperatureReading` for the shipment `SHIP_001`. If the temperature reading falls outside the min/max range of the contract then the price received by the grower will be reduced. You may submit several readings if you wish. Each reading will be aggregated within `SHIP_001`. +``` +{ + "$class": "org.acme.shipping.perishable.SetupDemo" +} +``` -Submit a `ShipmentReceived` transaction for the shipment `SHIP_001` to trigger the payout to the grower, based on the parameters of the `CON_001` contract. If the date-time of the `ShipmentReceived` transaction is after the `arrivalDateTime` on `CON_001` then the grower will no receive any payment for the shipment. +This transaction populates the Participant Registries with a `Grower`, an `Importer` and a `Shipper`. The Asset Registries will have a `Contract` asset and a `Shipment` asset. +Submit a `TemperatureReading` transaction: +``` +{ + "$class": "org.acme.shipping.perishable.TemperatureReading", + "centigrade": 18, + "shipment": "resource:org.acme.shipping.perishable.Shipment#SHIP_001" +} +``` +If the temperature reading falls outside the min/max range of the contract, the price received by the grower will be reduced. You may submit several readings if you wish. Each reading will be aggregated within `SHIP_001` Shipment Asset Registry. +Submit a `ShipmentReceived` transaction for `SHIP_001` to trigger the payout to the grower, based on the parameters of the `CON_001` contract: + +``` +{ + "$class": "org.acme.shipping.perishable.ShipmentReceived", + "shipment": "resource:org.acme.shipping.perishable.Shipment#SHIP_001" +} +``` + +If the date-time of the `ShipmentReceived` transaction is after the `arrivalDateTime` on `CON_001` then the grower will no receive any payment for the shipment. + +Summarise the the result of the test tab! + +Congratulations! diff --git a/packages/pii-network/README.md b/packages/pii-network/README.md index d15fb57..62ec73e 100644 --- a/packages/pii-network/README.md +++ b/packages/pii-network/README.md @@ -1,3 +1,59 @@ -# Hyperledger Composer Access Control Demo +# Personally Identifiable Information Network -A business network where members can grant/revoke access to their personal information to other members. +> A business network where members can grant/revoke access to their personal information to other members. + +In the **Define** tab this in Business Network defines: + +**Participant** +`Member` + +**Transaction** +`AuthorizeAccess` `RevokeAccess` + +Summarise how the elements of the Business Network interact! + +To test this Business Network Definition in the **Test** tab: + +Create two `Member` participants: + +``` +{ + "$class": "org.acme.pii.Member", + "email": "memberA@acme.org", + "firstName": "Billy", + "lastName": "Thompson" +} +``` + +``` +{ + "$class": "org.acme.pii.Member", + "email": "memberB@acme.org", + "firstName": "Jenny", + "lastName": "Jones" +} +``` + +Submit a `AuthorizeAccess` transaction: + +``` +{ + "$class": "org.acme.pii.AuthorizeAccess", + "memberId": "" +} +``` + +This `AuthorizeAccess` allowed `memberA@acme.org` permission to view personal information of other members. + +Submit a `RevokeAccess` transaction: + +``` +{ + "$class": "org.acme.pii.RevokeAccess", + "memberId": "" +} +``` + +This `RevokeAccess` revoked `memberB@acme.org` permission to view personal information of other members. + +Congratulations! diff --git a/packages/trade-network/README.md b/packages/trade-network/README.md index 43d8742..75f3d41 100644 --- a/packages/trade-network/README.md +++ b/packages/trade-network/README.md @@ -1,11 +1,68 @@ -# Hyperledger Composer Commodities Trading Demo +# Trade Network -Example business network that illustrates commodity trading. +> This Business Network illustrates commodity trading. -This business network shows the main features of the Hyperleger Composer programming model: +In the **Define** tab this in Business Network defines: -- Transaction processor functions (chaincode) written in JavaScript -- Emitting events from TP functions -- Composer Query Language (CQL) named queries - - Called from TP functions - - Called from JS client API \ No newline at end of file +**Participant** +`Trader` + +**Asset** +`Commodity` + +**Transaction(s)** +`Transaction` + +**Event** +`TradeNotification ` + +Summarise how the elements of the Business Network interact! + +To test this Business Network Definition in the **Test** tab: + +Create two `Trader` participants: + +``` +{ + "$class": "org.acme.mynetwork.Trader", + "tradeId": "TRADER1", + "firstName": "Jenny", + "lastName": "Jones" +} +``` + +``` +{ + "$class": "org.acme.mynetwork.Trader", + "tradeId": "TRADER2", + "firstName": "Amy", + "lastName": "Williams" +} +``` + +Create a `Commodity` asset: + +``` +{ + "$class": "org.acme.mynetwork.Commodity", + "tradingSymbol": "ABC", + "description": "Test commodity", + "mainExchange": "Euronext", + "quantity": 72.297, + "owner": "resource:org.acme.mynetwork.Trader#TRADER1" +} +``` + +Submit a `Trade` transaction: + +``` +{ + "$class": "org.acme.mynetwork.Trade", + "commodity": "resource:org.acme.mynetwork.Commodity#ABC", + "newOwner": "resource:org.acme.mynetwork.Trader#TRADER2" +} +``` + +After submitting this transaction, you should now see the transaction in the transaction registry. As a result, the owner of the commodity `ABC` should now be owned `TRADER2` in the Asset Registry. + +Congratulations! diff --git a/packages/vehicle-lifecycle-network/README.md b/packages/vehicle-lifecycle-network/README.md index 1919139..c22620d 100644 --- a/packages/vehicle-lifecycle-network/README.md +++ b/packages/vehicle-lifecycle-network/README.md @@ -1,3 +1,66 @@ -# Hyperledger Composer Vehicle Lifecycle Demo +# Vehicle Lifecycle Network -Vehicle Lifecycle demo. +> This network tracks the Lifecycle of Vehicles from manufacture to being scrapped involving private owners, manufacturers and scrap merchants. A regulator is able to provide oversight throughout this whole process. + +In the **Define** tab this in Business Network defines: + +**Participants** +`AuctionHouse` `Company` `Manufacturer` `PrivateOwner` `Regulator` `ScrapMerchant` + +**Assets** +`Order` `Vehicle` + +**Transactions** +`PlaceOrder` `UpdateOrderStatus` `ApplicationForVehicleRegistrationCertificate` `PrivateVehicleTransfer` `ScrapVehicle` `UpdateSuspicious` `ScrapAllVehiclesByColour` `SetupDemo` + +**Events** +`PlaceOrderEvent` `UpdateOrderStatusEvent` `ScrapVehicleEvent` + +A `PriavteOwner` participant would submit a `PlaceOrder` transaction, through a Manufacturer's application. A `Manufacturer` would submit an `UpdateOrderStatus` transaction which would be the Vehicle being manufactured. They would apply for a registration certificate by submitting an `ApplicationForVehicleRegistrationCertificate` transaction. After the vehicle has been manufactured they would submit a `PrivateVehicleTransfer` transaction. A `Regulator` would be able perform oversight over this whole process and submit an `UpdateSuspicious` transaction to view any suspicious vehicles that may be out of compliance with regulations. A `ScrapMerchant` would be able to submit a `ScrapVehicle` or a `ScrapAllVehiclesByColour` transaction to complete the lifecycle of a vehicle. + +To test this Business Network Definition in the **Test** tab: + +Submit a `SetupDemo` transaction: + +``` +{ + "$class": "org.acme.vehicle.lifecycle.SetupDemo" +} +``` + +This transaction populates the Participant Registries with three `Manufacturer` participants, twenty-three `PrivateOwner` participants and a `Regulator` participant. The `Vehicle` Asset Registry will have thirteen `Vehicle` assets. + +Submit a `PlaceOrder` transaction: + +``` +{ + "$class": "org.acme.vehicle.lifecycle.manufacturer.PlaceOrder", + "orderId": "1234", + "vehicleDetails": { + "$class": "org.vda.VehicleDetails", + "make": "Arium", + "modelType": "Gamora", + "colour": "Sunburst Orange" + }, + "manufacturer": "resource:org.acme.vehicle.lifecycle.manufacturer.Manufacturer#Arium", + "orderer": "resource:org.acme.vehicle.lifecycle.PrivateOwner#toby" +} +``` + +This `PlaceOrder` transaction creates a new order in the `Order` Asset Registry. It also emits a `PlaceOrderEvent` events. + +Submit a `UpdateOrderStatus` transaction: + +``` +{ + "$class": "org.acme.vehicle.lifecycle.manufacturer.UpdateOrderStatus", + "orderStatus": "SCHEDULED_FOR_MANUFACTURE", + "order": "resource:org.acme.vehicle.lifecycle.manufacturer.Order#1234" +} +``` + +This `UpdateOrderStatus` transaction updates the order status of `orderId:1234` in the `Order` Asset Registry. It also emits a `UpdateOrderStatusEvent` event. + +Congratulations! + +This Business Network definition had been used to create demo applications for the `PrivateOwner`, `Manufacturer` and `Regulator`. Find more information here: https://github.com/hyperledger/composer-sample-applications/tree/master/packages/vehicle-lifecycle From 89e6cc61ee19e99da03d6f1901d26e620f586fe4 Mon Sep 17 00:00:00 2001 From: Tobias Hunter Date: Fri, 14 Jul 2017 11:34:28 +0100 Subject: [PATCH 2/3] all readmes --- packages/animaltracking-network/README.md | 2 +- packages/bond-network/README.md | 2 +- packages/carauction-network/README.md | 23 +++------------------- packages/digitalproperty-network/README.md | 2 ++ packages/marbles-network/README.md | 2 +- packages/perishable-network/README.md | 6 ++---- packages/pii-network/README.md | 4 ++-- packages/trade-network/README.md | 14 ++++++------- 8 files changed, 19 insertions(+), 36 deletions(-) diff --git a/packages/animaltracking-network/README.md b/packages/animaltracking-network/README.md index 2bca198..7e58bf6 100644 --- a/packages/animaltracking-network/README.md +++ b/packages/animaltracking-network/README.md @@ -13,7 +13,7 @@ In the **Define** tab this in Business Network defines: **Transactions** `AnimalMovementDeparture` `AnimalMovementArrival` `SetupDemo` -Each Farmer owns a Business that is identified by a Single Business Identifier (SBI). Each Farmer owns a set of Animals. Each Business owns a set of Fields. Each Field contains a set of Animals owned by the Farmer. Animals can be transfered between Farmers or between Fields +Each Farmer owns a Business that is identified by a Single Business Identifier (SBI). A Farmer owns a set of Animals. A Business owns a set of Fields. A Field contains a set of Animals owned by the Farmer. Animals can be transferred between Farmers or between Fields. To test this Business Network Definition in the **Test** tab: diff --git a/packages/bond-network/README.md b/packages/bond-network/README.md index f21e8ee..4eba4af 100644 --- a/packages/bond-network/README.md +++ b/packages/bond-network/README.md @@ -23,7 +23,7 @@ Create a `Issuer` participant: { "$class": "org.acme.bond.Issuer", "memberId": "memberId:1", - "name": "Tobias Hunter" + "name": "Billy Thompson" } ``` diff --git a/packages/carauction-network/README.md b/packages/carauction-network/README.md index 288cd57..af74e3b 100755 --- a/packages/carauction-network/README.md +++ b/packages/carauction-network/README.md @@ -2,7 +2,7 @@ > This is an interactive, distributed, car auction demo. List assets for sale (setting a reserve price), and watch as assets that have met their reserve price are automatically transferred to the highest bidder at the end of the auction. -In the **Define** tab for this network there is defined: +In the **Define** tab this in Business Network defines: **Participants:** `Member` `Auctioneer` @@ -13,14 +13,12 @@ In the **Define** tab for this network there is defined: **Transactions:** `Offer` `CloseBidding` -The `makeOffer` function is called when an `Offer` transaction is submitted. The logic simply checks that the listing for the offer is still for sale, and then adds the offer to the listing, and then updates the offer in the `VehicleListing` asset registry. +The `makeOffer` function is called when an `Offer` transaction is submitted. The logic simply checks that the listing for the offer is still for sale, and then adds the offer to the listing, and then updates the offers in the `VehicleListing` asset registry. The `closeBidding` function is called when a `CloseBidding` transaction is submitted for processing. The logic checks that the listing is still for sale, sorts the offers by bid price, and then if the reserve has been met, transfers the ownership of the vehicle associated with the listing to the highest bidder. Money is transferred from the buyer's account to the seller's account, and then all the modified assets are updated in their respective registries. To test this Business Network Definition in the **Test** tab: -## Create an Auctioneer - In the `Auctioneer` participant registry, create a new participant. ``` @@ -32,8 +30,6 @@ In the `Auctioneer` participant registry, create a new participant. } ``` -## Create two Members - In the `Member` participant registry, create two participants. ``` @@ -56,8 +52,6 @@ In the `Member` participant registry, create two participants. } ``` -## Create a Vehicle - In the `Vehicle` asset registry, create a new asset of a vehicle owned by `memberA@acme.org`. ``` @@ -68,8 +62,6 @@ In the `Vehicle` asset registry, create a new asset of a vehicle owned by `membe } ``` -## Create a Vehicle Listing - In the `VehicleListing` asset registry, create a vehicle listing for car `vin:1234`. ``` @@ -85,12 +77,8 @@ In the `VehicleListing` asset registry, create a vehicle listing for car `vin:12 You've just listed an Arium Nova for auction, with a reserve price of 3500! -## Bidding on a VehicleListing - As soon as a `VehicleListing` has been created (and is in the `FOR_SALE` state) participants can submit `Offer` transactions to bid on a vehicle listing. -## Submit two Offer Transactions - Submit an `Offer` transaction, by submitting a transaction and selecting `Offer` from the dropdown. ``` @@ -111,9 +99,7 @@ Submit an `Offer` transaction, by submitting a transaction and selecting `Offer` } ``` -## End the Auction - -To end the auction submit a `CloseBidding` transaction for the listing, by selecting `CloseBidding` from the dropdown. +To end the auction submit a `CloseBidding` transaction for the listing. ``` { @@ -124,9 +110,6 @@ To end the auction submit a `CloseBidding` transaction for the listing, by selec This simply indicates that the auction for `listingId:ABCD` is now closed, triggering the `closeBidding` function that was described above. - -## Check the Results of the Auction - To see the Vehicle was sold you need to click on the `Vehicle` asset registry to check the owner of the car. The reserve price was met by owner `memberB@acme.org` so you should see the owner of the vehicle is now `memberB@acme.org`. If you check the state of the VehicleListing with `listingId:ABCD` is should be `SOLD`. diff --git a/packages/digitalproperty-network/README.md b/packages/digitalproperty-network/README.md index 022bdcd..e9a165c 100644 --- a/packages/digitalproperty-network/README.md +++ b/packages/digitalproperty-network/README.md @@ -70,4 +70,6 @@ Submit a `RegisterPropertyForSale` transaction: } ``` +This `RegisterPropertyForSale` transaction will update `titleId:ABCD` `LandTitle` asset to `forSale`. + Congratulations! diff --git a/packages/marbles-network/README.md b/packages/marbles-network/README.md index c89c1c2..9258c38 100644 --- a/packages/marbles-network/README.md +++ b/packages/marbles-network/README.md @@ -59,6 +59,6 @@ Submit a `Transaction` transaction: } ``` -This transaction traded `marbleId:1234` from `memberA@acme.org` to `memberB@acme.org`. +This transaction has transferred `marbleId:1234` from `memberA@acme.org` to `memberB@acme.org`. Congratulations! diff --git a/packages/perishable-network/README.md b/packages/perishable-network/README.md index a485591..96a4270 100644 --- a/packages/perishable-network/README.md +++ b/packages/perishable-network/README.md @@ -2,7 +2,7 @@ > Example business network that shows growers, shippers and importers defining contracts for the price of perishable goods, based on temperature readings received for shipping containers. -_The business network defines a parameterizable contract between growers and importers. The contract stipulates that: On receipts of the shipment the importer pays the grower the unit price x the number of units in the shipment. Shipments that arrive late are free. Shipments that have breached the low temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factory. Shipments that have breached the high temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factory._ +The business network defines a contract between growers and importers. The contract stipulates that: On receipts of the shipment the importer pays the grower the unit price x the number of units in the shipment. Shipments that arrive late are free. Shipments that have breached the low temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factory. Shipments that have breached the high temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factory. In the **Define** tab this in Business Network defines: @@ -34,7 +34,7 @@ Submit a `TemperatureReading` transaction: ``` { "$class": "org.acme.shipping.perishable.TemperatureReading", - "centigrade": 18, + "centigrade": 8, "shipment": "resource:org.acme.shipping.perishable.Shipment#SHIP_001" } ``` @@ -52,6 +52,4 @@ Submit a `ShipmentReceived` transaction for `SHIP_001` to trigger the payout to If the date-time of the `ShipmentReceived` transaction is after the `arrivalDateTime` on `CON_001` then the grower will no receive any payment for the shipment. -Summarise the the result of the test tab! - Congratulations! diff --git a/packages/pii-network/README.md b/packages/pii-network/README.md index 62ec73e..65f6b58 100644 --- a/packages/pii-network/README.md +++ b/packages/pii-network/README.md @@ -39,7 +39,7 @@ Submit a `AuthorizeAccess` transaction: ``` { "$class": "org.acme.pii.AuthorizeAccess", - "memberId": "" + "memberId": "org.acme.pii.Member#memberA@acme.org" } ``` @@ -50,7 +50,7 @@ Submit a `RevokeAccess` transaction: ``` { "$class": "org.acme.pii.RevokeAccess", - "memberId": "" + "memberId": "org.acme.pii.Member#memberB@acme.org" } ``` diff --git a/packages/trade-network/README.md b/packages/trade-network/README.md index 75f3d41..bef95b8 100644 --- a/packages/trade-network/README.md +++ b/packages/trade-network/README.md @@ -24,7 +24,7 @@ Create two `Trader` participants: ``` { - "$class": "org.acme.mynetwork.Trader", + "$class": "org.acme.trading.Trader", "tradeId": "TRADER1", "firstName": "Jenny", "lastName": "Jones" @@ -33,7 +33,7 @@ Create two `Trader` participants: ``` { - "$class": "org.acme.mynetwork.Trader", + "$class": "org.acme.trading.Trader", "tradeId": "TRADER2", "firstName": "Amy", "lastName": "Williams" @@ -44,12 +44,12 @@ Create a `Commodity` asset: ``` { - "$class": "org.acme.mynetwork.Commodity", + "$class": "org.acme.trading.Commodity", "tradingSymbol": "ABC", "description": "Test commodity", "mainExchange": "Euronext", "quantity": 72.297, - "owner": "resource:org.acme.mynetwork.Trader#TRADER1" + "owner": "resource:org.acme.trading.Trader#TRADER1" } ``` @@ -57,9 +57,9 @@ Submit a `Trade` transaction: ``` { - "$class": "org.acme.mynetwork.Trade", - "commodity": "resource:org.acme.mynetwork.Commodity#ABC", - "newOwner": "resource:org.acme.mynetwork.Trader#TRADER2" + "$class": "org.acme.trading.Trade", + "commodity": "resource:org.acme.trading.Commodity#ABC", + "newOwner": "resource:org.acme.trading.Trader#TRADER2" } ``` From 7aba1c53e32f89d3ca2afb31f7fb2b2f6e1a1b69 Mon Sep 17 00:00:00 2001 From: Tobias Hunter Date: Fri, 14 Jul 2017 13:31:37 +0100 Subject: [PATCH 3/3] fixes --- packages/animaltracking-network/README.md | 2 +- packages/basic-sample-network/README.md | 2 +- packages/bond-network/README.md | 2 +- packages/carauction-network/README.md | 2 +- packages/digitalproperty-network/README.md | 2 +- packages/marbles-network/README.md | 2 +- packages/perishable-network/README.md | 6 ++---- packages/pii-network/README.md | 4 +--- packages/trade-network/README.md | 4 +--- packages/vehicle-lifecycle-network/README.md | 2 +- 10 files changed, 11 insertions(+), 17 deletions(-) diff --git a/packages/animaltracking-network/README.md b/packages/animaltracking-network/README.md index 7e58bf6..66a1356 100644 --- a/packages/animaltracking-network/README.md +++ b/packages/animaltracking-network/README.md @@ -2,7 +2,7 @@ > This is an Animal Tracking Business Network based on UK DEFRA government regulations (https://www.gov.uk/animal-movement-england). Farmers can move animals between farms/fields and the UK government farming regulator has visibility into the locations of all animals and all animal movements between farms. -In the **Define** tab this in Business Network defines: +This business network defines: **Participants** `Farmer` `Regulator` diff --git a/packages/basic-sample-network/README.md b/packages/basic-sample-network/README.md index 123205e..5345c22 100644 --- a/packages/basic-sample-network/README.md +++ b/packages/basic-sample-network/README.md @@ -2,7 +2,7 @@ > This is the "Hello World" of Hyperledger Composer samples, which demonstrates the core functionality of Hyperledger Composer by changing the value of an asset. -In the **Define** tab this in Business Network defines: +This business network defines: **Participant** `SampleParticipant` diff --git a/packages/bond-network/README.md b/packages/bond-network/README.md index 4eba4af..409c802 100644 --- a/packages/bond-network/README.md +++ b/packages/bond-network/README.md @@ -2,7 +2,7 @@ > The Bond Network allows the issuer of a bond to update the bond information whilst other members of the business network can only read the bond data. -In the **Define** tab this in Business Network defines: +This business network defines: **Participants** `Issuer` `Member` diff --git a/packages/carauction-network/README.md b/packages/carauction-network/README.md index af74e3b..27f019b 100755 --- a/packages/carauction-network/README.md +++ b/packages/carauction-network/README.md @@ -2,7 +2,7 @@ > This is an interactive, distributed, car auction demo. List assets for sale (setting a reserve price), and watch as assets that have met their reserve price are automatically transferred to the highest bidder at the end of the auction. -In the **Define** tab this in Business Network defines: +This business network defines: **Participants:** `Member` `Auctioneer` diff --git a/packages/digitalproperty-network/README.md b/packages/digitalproperty-network/README.md index e9a165c..540b05a 100644 --- a/packages/digitalproperty-network/README.md +++ b/packages/digitalproperty-network/README.md @@ -2,7 +2,7 @@ > This Defines a business network where house sellers can list their properties for sale. -In the **Define** tab this in Business Network defines: +This business network defines: **Participant** `Person` diff --git a/packages/marbles-network/README.md b/packages/marbles-network/README.md index 9258c38..bfa5d77 100644 --- a/packages/marbles-network/README.md +++ b/packages/marbles-network/README.md @@ -2,7 +2,7 @@ > This is an interactive and distributed, marble trading demo. List marbles for sale and exchange marbles between participants. -In the **Define** tab this in Business Network defines: +This business network defines: **Participant** `Player` diff --git a/packages/perishable-network/README.md b/packages/perishable-network/README.md index 96a4270..e1ea10c 100644 --- a/packages/perishable-network/README.md +++ b/packages/perishable-network/README.md @@ -2,9 +2,9 @@ > Example business network that shows growers, shippers and importers defining contracts for the price of perishable goods, based on temperature readings received for shipping containers. -The business network defines a contract between growers and importers. The contract stipulates that: On receipts of the shipment the importer pays the grower the unit price x the number of units in the shipment. Shipments that arrive late are free. Shipments that have breached the low temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factory. Shipments that have breached the high temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factory. +The business network defines a contract between growers and importers. The contract stipulates that: On receipt of the shipment the importer pays the grower the unit price x the number of units in the shipment. Shipments that arrive late are free. Shipments that have breached the low temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factor. Shipments that have breached the high temperate threshold have a penalty applied proportional to the magnitude of the breach x a penalty factor. -In the **Define** tab this in Business Network defines: +This business network defines: **Participants** `Grower` `Importer` `Shipper` @@ -15,8 +15,6 @@ In the **Define** tab this in Business Network defines: **Transactions** `TemperatureReading` `ShipmentReceived` `SetupDemo` -Summarise how the elements of the Business Network interact! - To test this Business Network Definition in the **Test** tab: Submit a `SetupDemo` transaction: diff --git a/packages/pii-network/README.md b/packages/pii-network/README.md index 65f6b58..a8afce5 100644 --- a/packages/pii-network/README.md +++ b/packages/pii-network/README.md @@ -2,7 +2,7 @@ > A business network where members can grant/revoke access to their personal information to other members. -In the **Define** tab this in Business Network defines: +This business network defines: **Participant** `Member` @@ -10,8 +10,6 @@ In the **Define** tab this in Business Network defines: **Transaction** `AuthorizeAccess` `RevokeAccess` -Summarise how the elements of the Business Network interact! - To test this Business Network Definition in the **Test** tab: Create two `Member` participants: diff --git a/packages/trade-network/README.md b/packages/trade-network/README.md index bef95b8..5b3405e 100644 --- a/packages/trade-network/README.md +++ b/packages/trade-network/README.md @@ -2,7 +2,7 @@ > This Business Network illustrates commodity trading. -In the **Define** tab this in Business Network defines: +This business network defines: **Participant** `Trader` @@ -16,8 +16,6 @@ In the **Define** tab this in Business Network defines: **Event** `TradeNotification ` -Summarise how the elements of the Business Network interact! - To test this Business Network Definition in the **Test** tab: Create two `Trader` participants: diff --git a/packages/vehicle-lifecycle-network/README.md b/packages/vehicle-lifecycle-network/README.md index c22620d..24594c4 100644 --- a/packages/vehicle-lifecycle-network/README.md +++ b/packages/vehicle-lifecycle-network/README.md @@ -2,7 +2,7 @@ > This network tracks the Lifecycle of Vehicles from manufacture to being scrapped involving private owners, manufacturers and scrap merchants. A regulator is able to provide oversight throughout this whole process. -In the **Define** tab this in Business Network defines: +This business network defines: **Participants** `AuctionHouse` `Company` `Manufacturer` `PrivateOwner` `Regulator` `ScrapMerchant`