diff --git a/packages/composer-website/jekylldocs/business-network/bnd-create.md b/packages/composer-website/jekylldocs/business-network/bnd-create.md index 2413ac4ab7..c5d8b02be2 100644 --- a/packages/composer-website/jekylldocs/business-network/bnd-create.md +++ b/packages/composer-website/jekylldocs/business-network/bnd-create.md @@ -27,7 +27,7 @@ A description of the purpose of the business network using the Markdown mark-up ## Package.json A Business Network Definition has a name (limited to basic ASCII alphanumeric characters and `-`), a human-readable description and a version number. The version number for the network should take the form Major.Minor.Micro and -[Semantic Versioning](semver.org) principles should be used when incrementing the version number. +[Semantic Versioning](http://semver.org) principles should be used when incrementing the version number. The identifier of the network is formed from its name, the `-` character and its version number. A valid identifier is therefore `mybusinessnetwork-0.6.3`. diff --git a/packages/composer-website/jekylldocs/business-network/testing.md b/packages/composer-website/jekylldocs/business-network/testing.md index a36c14a94e..af9c863494 100644 --- a/packages/composer-website/jekylldocs/business-network/testing.md +++ b/packages/composer-website/jekylldocs/business-network/testing.md @@ -42,7 +42,7 @@ https://github.com/hyperledger/composer-sample-networks/blob/master/packages/bon ## References * [**Composer CLI commands**](../reference/commands.html) -* [**Mocha**](https://mochajs.orgl) +* [**Mocha**](https://mochajs.org) * [**Chai**](http://chaijs.com) * [**Sinon**](http://sinonjs.org) * [**Istambul**](https://istanbul.js.org) diff --git a/packages/composer-website/jekylldocs/installing/getting-started-cmd-line.md b/packages/composer-website/jekylldocs/installing/getting-started-cmd-line.md deleted file mode 100644 index c02fe16d6d..0000000000 --- a/packages/composer-website/jekylldocs/installing/getting-started-cmd-line.md +++ /dev/null @@ -1,233 +0,0 @@ ---- -layout: default -title: Getting Started with Hyperledger Composer -category: start -sidebar: sidebars/installing.md -excerpt: Getting Started with Hyperledger Composer ---- - -# Running a sample with the CLI - ---- - -Before you follow these instructions, make sure you've completed the -[Quickstart](../installing/quickstart.html)! After the end of the Quickstart there will be a local Hyperledger Fabric instance running and a deployed business network. - -This guide will explain more about the business network, and explain in more detail what is happening in the sample application. This is all done using a simple business network **Digital Property Network** - -## What is the Digital Property Network? - -This network will be expanded for other tutorials, but for this getting started we'll keep it simple. - -We going to model *Land Titles*, each of which has an owner, description, and a boolean saying if this property/land is up for sale. - -``` -asset LandTitle identified by titleId { - o String titleId - --> Person owner - o String information - o Boolean forSale optional -} -``` - -We'll also model the *Owner* as a Person (First,Last name). - -``` -participant Person identified by personId { - o String personId - o String firstName - o String lastName -} -``` - -We want to be able to mark one of the titles for sale so we'll create a *RegisterPropertyForSale* transaction that will update the for sale flag. - -``` -transaction RegisterPropertyForSale identified by transactionId{ - o String transactionId - --> Person seller - --> LandTitle title -} -``` - -The applications we're going to look at are going to store a number of (pretend) land titles, and mark them for sale. All this will be using the {{site.data.conrefs.composer_full}} backed by a real blockchain in the shape of a locally executing Hyperledger Fabric. - -## But what is an asset? -An asset is a term used to describe things of value both in the physical world and the equally real intangible world. These are stored in Asset Registries. Participants can act on these assets by submitting transactions. With the features of a blockchain provided by the Hyperledger Fabric, an application using {{site.data.conrefs.composer_full}} has a single source of truth for the state of these assets and their history. - -It's worth reading the [introduction](../introduction/introduction.html) page to get an idea of how everything fits together. The [Glossary](../reference/glossary.md) provides a detailed description of each term. - -## Updating the Business Network -All the resources and scripts you'll need are in a git repository that we'll clone, this will have the code for the applications along with the scripts to get the Hyperledger setup and ready to go. - -The first thing to do is to ensure that you have a suitable system ready for development. - -**Ensure that you have followed the steps in our [Quickstart](../installing/quickstart.md) before continuing!** - -Let's go ahead and make a change to start to show how easy it is to develop with {{site.data.conrefs.composer_full}}. - -### Clone the Repository and Install Dependencies -First clone the repository that contains the Business Network Definition (note this is not the same as the sample-applications repository). - -```bash -git clone https://github.com/hyperledger/composer-sample-networks.git -cd composer-sample-networks/packages/DigitalProperty-Network -npm install -``` - -### Update the Transaction Processor Function - -Open the file `lib/DigitalLandTitle.js` in a text editor and replace the contents with: - -```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; - - /* new line is here to update the information */ - propertyForSale.title.information = propertyForSale.title.information + ' Updated at: ' + new Date().toDateString(); - - return getAssetRegistry('net.biz.digitalPropertyNetwork.LandTitle').then(function(result) { - return result.update(propertyForSale.title); - } - ); -} -``` - -### Update the Business Network Definition -In a real-life scenario at this point you would edit `package.json` to increment the version number in the `DigitalProperty-Network` directory and publish this to npm. Please do not publish to the DigitalProperty-Network in npm. - -What we'll do therefore is adopt a different approach to create the Business Network Archive. From within the DigitalProperty-Network directory. - -```bash -composer archive create --sourceType dir --sourceName . -Creating Business Network Archive -Looking for package.json of Business Network Definition in /home/matthew/git17/DigitalProperty-Network - -Description:Digital Property Network -Name:digitalproperty-network -Identifier:digitalproperty-network-0.0.22 - -Written Business Network Definition Archive file to digitalproperty-network-0.0.22.bna -Command completed successfully. -``` - -We now have a new file that is the digital business network archive. - -### Update the deployed business network - -```bash -composer network update --archiveFile digitalproperty-network@0.0.22.bna --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d -Deploying business network from archive digitalproperty-network-0.0.22.bna -Business network definition: - Identifier: digitalproperty-network-0.0.22 - Description: Digital Property Network -Updating business network definition. This may take a few seconds... -Command completed successfully. -``` - -### Rerun the Test -If you go back to the getting started directory now - and list all the commands that available, you'll see one called `submitTransaction` - -```bash -npm run -Lifecycle scripts included in getting-started: - test - mocha --recursive && npm run bootstrapAssets && npm run listAssets && npm run submitTransaction - install - scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork - -available via `npm run-script`: - submitTransaction - node cli.js landregistry submit && node cli.js landregistry list - listAssets - node cli.js landregistry list - bootstrapAssets - node cli.js landregistry bootstrap - startHLF - scripts/start-hyperledger.sh - stopHLF - scripts/stop-hyperledger.sh - teardownHLF - scripts/teardown.sh - deployNetwork - composer archive create --sourceName digitalproperty-network --sourceType module --archiveFile digitalPropertyNetwork.bna && composer network deploy --archiveFile digitalPropertyNetwork.bna --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d && composer network list -n digitalproperty-network --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d - -``` - -If you issue this command, that will submit a transaction as before - but importantly this is the updated transaction function. You should now see: - -``` -npm run submitTransaction - -> getting-started@1.0.0 submitTransaction /home/matthew/github_lenny/sample-applications/packages/getting-started -> node cli.js landregistry submit && node cli.js landregistry list - -info: [Composer-GettingStarted] Hyperledger Composer: Getting Started appliation -info: [Composer-GettingStarted] LandRegistry: businessNetworkDefinition obtained digitalproperty-network@0.0.22 -info: [Composer-GettingStarted] updateForSale Getting assest from the registry. -info: [Composer-GettingStarted] updateForSale Submitting transaction -info: [Composer-GettingStarted] Transaction Submitted -undefined -info: [Composer-GettingStarted] Command completed successfully. -info: [Composer-GettingStarted] Hyperledger Composer: Getting Started appliation -info: [Composer-GettingStarted] LandRegistry: businessNetworkDefinition obtained digitalproperty-network@0.0.22 -info: [Composer-GettingStarted] listTitles Getting the asset registry -info: [Composer-GettingStarted] listTitles Getting all assest from the registry. -info: [Composer-GettingStarted] listTitles Current Land Titles -info: [Composer-GettingStarted] Titles listed -info: [Composer-GettingStarted] -┌──────────┬────────────────┬────────────┬─────────┬──────────────────────────────────────────────────────────┬─────────┐ -│ TitleID │ OwnerID │ First Name │ Surname │ Description │ ForSale │ -├──────────┼────────────────┼────────────┼─────────┼──────────────────────────────────────────────────────────┼─────────┤ -│ LID:1148 │ PID:1234567890 │ Fred │ Bloggs │ A nice house in the country Updated at: Thu, 02 Mar 2017 │ Yes │ -├──────────┼────────────────┼────────────┼─────────┼──────────────────────────────────────────────────────────┼─────────┤ -│ LID:6789 │ PID:1234567890 │ Fred │ Bloggs │ A small flat in the city │ No │ -└──────────┴────────────────┴────────────┴─────────┴──────────────────────────────────────────────────────────┴─────────┘ - -``` - -## Digging Deeper - -* `scripts/download-hyperledger.sh` This is a shell script that will download and tag the docker images for Hyperledger v0.6. It is important to note that this script will also delete the {{site.data.conrefs.composer_full}} Connection Profiles. This is important if you have connected to other Hyperledger Fabrics, or have changed the default ports that Hyperledger uses.`npm install` uses this script. - -* `scripts/start-hyperledger.sh` This is a shell script that starts the Hyperledger Fabric, this will also wait to make sure the Hyperledger Fabric has started. -`npm run startHLF` can also be used to call this script. -* `scripts/stop-hyperledger.sh` This is the opposite of the start script, and will stop the Hyperledger Fabric - but it critically does not delete or remove any state. Therefore it canbe restarted with the start script. `npm run stopHLF` can also be used to call this script. -* `scripts/teardown.sh` This will stop and remove all the docker images related to Hyperledger Fabric. This can be used to do an effective clean-up of the Hyperledger Fabric and the {{site.data.conrefs.composer_full}} Connection Profiles. - -**Composer CLI** - -* `composer archive create -m digitalproperty-network --archiveFile digitalPropertyNetwork.bna` -This command is used to create a Business Network Archive. `--archiveFile` is the name of the file. The `-m` is the npm module name of the business network to use. There is also a -d option to specify the directory the business network is in. Useful whilst developing the business network transactions functions. - -* `composer network deploy --archiveFile digitalPropertyNetwork.bna --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d` -This deploys the business network to the HyperLedger runtime; the archive is specified but also the Hyperledger Entrollment Id and Secret (the secret if not included in the command line will be prompted for) -* `composer network list -n digitalproperty-network --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d` -This lists the deployed business network details. `-n` is the name of the business network. With the same options for the Hyperledger Entrollment Id and Secret (the secret if not included in the command line will be prompted for) - -**Sample Applications** - -There are 3 sample JavaScript applications that use the {{site.data.conrefs.composer_full}} Client API to perform operations on the business network. These are applications that specific to the business network that has been defined in this Digital Property Network. - -* `node cli.js landregistry submit` This applications connects, and submits a transaction. -* `node cli.js landregistry list` This lists the contents of the asset registries that have been defined in the business network. -* `node cli.js landregistry bootstrap` This applications puts some pretend assets into the registries to work with. - -### Completed! -We have downloaded the Hyperledger Fabric Docker containers and started a locally running fabric. We have used the {{site.data.conrefs.composer_full}} Command line to deploy and update the DigitalProperty Network. We have used some JavaScript applications in node.js to list assets and submit transactions to work on those assets. A simple change and update has been made to one of the transaction functions. - -If you want to continue exploring, check out our other Getting Started guides: - -[Coding a Business Network Definition](../business-network/getting-started-coding-bnd.html) - -[Generating a REST API](../integrating/getting-started-rest-api.html) - -[Writing a Node.js App](../applications/getting-started-nodejs-app.html) diff --git a/packages/composer-website/jekylldocs/introduction/businessnetwork.md b/packages/composer-website/jekylldocs/introduction/businessnetwork.md deleted file mode 100644 index eb41ae65b2..0000000000 --- a/packages/composer-website/jekylldocs/introduction/businessnetwork.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -layout: default -title: Hyperledger Composer - Business Network -category: concepts -sidebar: sidebars/introduction.md -excerpt: Business Network ---- - -# An Example Business Network - ---- - -Imagine a property network, comprising participants who want to buy and sell property, estate agents (realtors) who provide matching services between buyers and sellers, conveyancers who exchange legal contracts related to the buying and selling of property, and government land registries who record the ongoing ownership of property. - -Here are the key elements of this property network. - -* Participants. Buyers, sellers, estate agents (realtors), conveyancers and the government land registry are the people and organizations who participate in this network. - -* Assets. Property is the asset that is exchanged and between buyers and sellers in the property network. Property is advertised by estate agents (realtors), exchanged by conveyancers, and recorded by land registries. Property has a fairly rich lifecycle, in that it can be created, exchanged, modified and destroyed. - -* Registries. Clearly the Land Registry record of properties is an obvious registry in this network, but there are others. The estate agent (realtor) has a set of properties for sale by registered sellers and interested buyers, and probably a separate record of the deals between buyers and sellers that are in-flight at a given moment in time. Conveyancers probably have a registry of properties in the process of being legally exchanged between buyers and sellers. Assets will be updated within these registries as they are exchanged between buyers and sellers. - -* Transactions. There are many transactions going on in this property network. Sellers sell property and buyers buy them. Conveyancers create and exchange legal contracts with other conveyancers on behalf of buyers and sellers and their respective property sales. The Land Registry records updates to property ownership, and estate agents (realtors) indicate that properties are for sale in a market and remove them from that market once they have been sold. - -{{site.data.conrefs.composer_full}} makes it easy to create these elements in a business network, and the applications which capture interactions between different participants. - -## Related Concepts - -[Business Network Definition](../introduction/businessnetworkdefinition.html) - -## Related Tasks - -[Deploying a business network](../business-network/deploybusinessnetwork.html) - -## Related Reference - -[Network deploy command](../reference/composer.network.deploy.md) diff --git a/packages/composer-website/jekylldocs/introduction/key-concepts.md b/packages/composer-website/jekylldocs/introduction/key-concepts.md index 74353e1f78..13fa335c3b 100644 --- a/packages/composer-website/jekylldocs/introduction/key-concepts.md +++ b/packages/composer-website/jekylldocs/introduction/key-concepts.md @@ -75,4 +75,4 @@ Business networks may contain a set of access control rules. Access control rule * To try {{site.data.conrefs.composer_full}} right away, see the [Online Playground](../installing/getting-started-with-playground.html) * For an architectural overview of a typical solution built with {{site.data.conrefs.composer_short}}, see [Typical Solution Architecture](./solution-architecture.html) -* To install the Development Tools, see [Getting setup with development tools](../installing/getting-started-cmd-line.html) +* To install the Development Tools, see [Getting setup with development tools](../installing/development-tools.html) diff --git a/packages/composer-website/jekylldocs/introduction/participantsandidentities.md b/packages/composer-website/jekylldocs/introduction/participantsandidentities.md deleted file mode 100644 index 8dc4f48423..0000000000 --- a/packages/composer-website/jekylldocs/introduction/participantsandidentities.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -layout: default -title: Hyperledger Composer - Participants and Identities -category: concepts -sidebar: sidebars/introduction.md -excerpt: Business Network ---- - -# Participants and Identities - ---- - -A `Participant` is an actor in a business network. A participant might be an -individual or an organization. A participant can create assets, and also exchange -assets with other participants. A participant works with assets by submitting transactions. - -A participant has a set of `Identity` documents that can be validated to prove the -identity of that participant. For example, an individual may have one or more of -the following identity documents that prove who they are: - -* Passport -* Driving license -* Fingerprints -* Retina scan -* SSL certificate - -In order for a new participant to join a business network, a new instance of that -participant must be created in the business network. An identity document must -then be `Issued` to that participant. The new participant can then use that identity -document to interact with the business network. - -Identity documents usually expire after a set period of time. Identity documents may -also be lost or stolen. If the identity document expires, or if it needs to be -replaced, then it must be `Revoked` so it can no longer be used to interact with -the business network. - -These actions are performed by an existing participant in the business network, -for example a regulatory body, or a participant in the same organization who has -been trusted to manage participants/identities in that organization. - -In {{site.data.conrefs.composer_full}}, the structure of a participant is modelled in a -model file. This structure may include various information about the participant, -for example the participants name, address, e-mail address, date of birth, etc. -New instances of that modelled participant can then be created and stored in a -participant registry. - -{{site.data.conrefs.composer_full}} uses Hyperledger Fabric enrollment certificates as -identity documents. APIs and command line applications are provided to issue and -revoke enrollment certificates to participants that are stored in a participant -registry. When transactions are submitted using those enrollment certificates, the -participant is identified and is made available for the transaction processor -function to use. - -## Related Concepts - -[Business Network](../introduction/businessnetwork.html) - -## Related Tasks - -[Create a Business Domain Model](../business-network/model-define.html) -[Add a Participant](../managing/participant-add.html) -[Issue an Identity to a Participant](../managing/identity-issue.html) -[Revoke an Identity from a Participant](../managing/identity-revoke.html) - -## Related Reference - -[Participant add command](../reference/composer.participant.add.html) -[Identity issue command](../reference/composer.identity.issue.html) -[Identity revoke command](../reference/composer.identity.revoke.html) diff --git a/packages/composer-website/jekylldocs/managing/participantsandidentities.md b/packages/composer-website/jekylldocs/managing/participantsandidentities.md index bfe4511f4b..3f1ab5af24 100644 --- a/packages/composer-website/jekylldocs/managing/participantsandidentities.md +++ b/packages/composer-website/jekylldocs/managing/participantsandidentities.md @@ -54,17 +54,17 @@ function to use. ## Related Concepts -[Business Network](../introduction/businessnetwork.html) +[Business Network](../business-network/business-network-index.html) ## Related Tasks -[Create a Business Domain Model](../business-network/model-define.html) -[Add a Participant](../managing/participant-add.html) -[Issue an Identity to a Participant](../managing/identity-issue.html) -[Revoke an Identity from a Participant](../managing/identity-revoke.html) +[Create a Business Network Definition](../business-network/bnd-create.html) +[Add a Participant](participant-add.html) +[Issue an Identity to a Participant](identity-issue.html) +[Revoke an Identity from a Participant](identity-revoke.html) ## Related Reference -[Participant add command](../reference/participant-add.html) -[Identity issue command](../reference/identity-issue.html) -[Identity revoke command](../reference/identity-revoke.html) +[Participant add command](../reference/composer.participant.add.html) +[Identity issue command](../reference/composer.identity.issue.html) +[Identity revoke command](../reference/composer.identity.revoke.html)