diff --git a/.gitignore b/.gitignore index d43cae59..66bd17ba 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,7 @@ jspm_packages .node_repl_history # Getting started archive - created as part of thenpm install -packages/**/digitalPropertyNetwork.bna \ No newline at end of file +packages/**/digitalPropertyNetwork.bna + +# Fabric start tools if they are downloaded into the usual directory +fabric-tools/** \ No newline at end of file diff --git a/packages/getting-started/Dockerfile b/packages/getting-started/Dockerfile deleted file mode 100644 index bf86e5db..00000000 --- a/packages/getting-started/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM node:argon - diff --git a/packages/getting-started/LICENSE b/packages/getting-started/LICENSE deleted file mode 100644 index 8f71f43f..00000000 --- a/packages/getting-started/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/packages/getting-started/README.md b/packages/getting-started/README.md deleted file mode 100644 index a80a0d53..00000000 --- a/packages/getting-started/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Hyperledger Composer - -This is a simple commandline-centric application to get started with the Hyperledger Composer framework quickly and easily. -Starting from nothing to an application running against and actual Hyperledger Fabric. diff --git a/packages/getting-started/cli.js b/packages/getting-started/cli.js deleted file mode 100755 index ee1ebf57..00000000 --- a/packages/getting-started/cli.js +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env node -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const winston = require('winston'); - -process.on('uncaughtException', function (err) { - console.log( 'Uncaught Exception: ' + err.stack); -}); - -winston.loggers.add('application', { - console: { - level: 'silly', - colorize: true, - label: 'Composer-GettingStarted' - } -}); - -const LOG = winston.loggers.get('application'); - -LOG.info('Hyperledger Composer: Getting Started application'); - -require('yargs') - .usage ('node cli.js ') - .commandDir('lib/cmds') - .demand(1,'Please specify a partipant, for example: node cli.js landregistry ') - .help() - .strict() - .recommendCommands() - .epilogue('For more information visit us at https://hyperledger.github.io/composer/') - .argv; diff --git a/packages/getting-started/config/default.json b/packages/getting-started/config/default.json deleted file mode 100644 index c0ea8054..00000000 --- a/packages/getting-started/config/default.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "gettingstarted": { - "participantId" : "WebAppAdmin", - "participantPwd" :"DJY27pEnl16d", - "businessNetworkIdentifier" : "digitalproperty-network", - "connectionProfile" :"defaultProfile" - } -} diff --git a/packages/getting-started/lib/cmds/landregistry.js b/packages/getting-started/lib/cmds/landregistry.js deleted file mode 100644 index 2d104249..00000000 --- a/packages/getting-started/lib/cmds/landregistry.js +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env node -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -exports.command = 'landregistry '; -exports.desc = 'Manage set of tracked repos'; -exports.builder = function (yargs) { - return yargs.commandDir('landregistry_cmds'); -}; -exports.handler = function (argv) {}; diff --git a/packages/getting-started/lib/cmds/landregistry_cmds/addDefaultTitles.js b/packages/getting-started/lib/cmds/landregistry_cmds/addDefaultTitles.js deleted file mode 100644 index 00c13116..00000000 --- a/packages/getting-started/lib/cmds/landregistry_cmds/addDefaultTitles.js +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env node -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; -const LandRegistry = require('./../../landRegistry.js'); -const winston = require('winston'); -const LOG = winston.loggers.get('application'); - -exports.command = 'bootstrap'; -exports.desc = 'Add a set of default land titiles'; -exports.builder = {}; - -exports.handler = function (argv) { - LOG.info('Adding default land titles to the asset registry'); - return LandRegistry.addDefaultCmd(argv) -.then(() => { - LOG.info ('Command completed successfully.'); - process.exit(0); -}) -.catch((error) => { - LOG.error(error+ '\nCommand failed.'); - process.exit(1); -}); -}; diff --git a/packages/getting-started/lib/cmds/landregistry_cmds/listTitles.js b/packages/getting-started/lib/cmds/landregistry_cmds/listTitles.js deleted file mode 100644 index 6866900f..00000000 --- a/packages/getting-started/lib/cmds/landregistry_cmds/listTitles.js +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env node -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const LandRegistry = require('./../../landRegistry.js'); -const winston = require('winston'); -const LOG = winston.loggers.get('application'); - -exports.command = 'list'; -exports.desc = 'Lists all the land titles held in the Land Regsitry'; -exports.builder = {}; -exports.handler = function (argv) { - - - return LandRegistry.listCmd(argv) - .then(() => { - LOG.info('Command completed successfully.'); - process.exit(0); - }) - .catch((error) => { - LOG.error(error+ '\nCommand failed.'); - process.exit(1); - }); - - - - -}; diff --git a/packages/getting-started/lib/cmds/landregistry_cmds/submit.js b/packages/getting-started/lib/cmds/landregistry_cmds/submit.js deleted file mode 100644 index e1890894..00000000 --- a/packages/getting-started/lib/cmds/landregistry_cmds/submit.js +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env node -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const LandRegistry = require('./../../landRegistry.js'); -const winston = require('winston'); -const LOG = winston.loggers.get('application'); - -exports.command = 'submit'; -exports.desc = 'Updates a fixed title in the regsitry'; -exports.builder = {}; -exports.handler = function (argv) { - - - return LandRegistry.submitCmd(argv) - .then(() => { - LOG.info('Command completed successfully.'); - process.exit(0); - }) - .catch((error) => { - LOG.error(error+ '\nCommand failed.'); - process.exit(1); - }); - - - - -}; diff --git a/packages/getting-started/lib/landRegistry.js b/packages/getting-started/lib/landRegistry.js deleted file mode 100644 index 45943867..00000000 --- a/packages/getting-started/lib/landRegistry.js +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// This is a simple sample that will demonstrate how to use the -// API connecting to a HyperLedger Blockchain Fabric -// -// The scenario here is using a simple model of a participant of 'Student' -// and a 'Test' and 'Result' assets. - -'use strict'; - - -const BusinessNetworkConnection = require('composer-client').BusinessNetworkConnection; -const Table = require('cli-table'); -const winston = require('winston'); -let config = require('config').get('gettingstarted'); - -// these are the credentials to use to connect to the Hyperledger Fabric -let participantId = config.get('participantId'); -let participantPwd = config.get('participantPwd'); -const LOG = winston.loggers.get('application'); - - -/** Class for the land registry*/ -class LandRegistry { - - /** - * Need to have the mapping from bizNetwork name to the URLs to connect to. - * bizNetwork nawme will be able to be used by Composer to get the suitable model files. - * - */ - constructor() { - - this.bizNetworkConnection = new BusinessNetworkConnection(); - this.CONNECTION_PROFILE_NAME = config.get('connectionProfile'); - this.businessNetworkIdentifier = config.get('businessNetworkIdentifier'); - } - - /** @description Initalizes the LandRegsitry by making a connection to the Composer runtime - * @return {Promise} A promise whose fullfillment means the initialization has completed - */ - init() { - return this.bizNetworkConnection.connect(this.CONNECTION_PROFILE_NAME, this.businessNetworkIdentifier, participantId, participantPwd) - .then((result) => { - this.businessNetworkDefinition = result; - LOG.info('LandRegistry:', 'businessNetworkDefinition obtained', this.businessNetworkDefinition.getIdentifier()); - }) - // and catch any exceptions that are triggered - .catch(function (error) { - throw error; - }); - - } - - /** Updates a fixes asset for selling.. - @return {Promise} resolved when this update has compelted - */ - updateForSale() { - const METHOD = 'updateForSale'; - - return this.bizNetworkConnection.getAssetRegistry('net.biz.digitalPropertyNetwork.LandTitle') - .then((registry) => { - - LOG.info(METHOD, 'Getting assest from the registry.'); - return registry.get('LID:1148'); - - }).then((result) => { - - let factory = this.businessNetworkDefinition.getFactory(); - let transaction = factory.newTransaction('net.biz.digitalPropertyNetwork','RegisterPropertyForSale'); - transaction.title = factory.newRelationship('net.biz.digitalPropertyNetwork', 'LandTitle', 'LID:1148'); - transaction.seller = factory.newRelationship('net.biz.digitalPropertyNetwork', 'Person', 'PID:1234567890'); - - LOG.info(METHOD, 'Submitting transaction'); - - return this.bizNetworkConnection.submitTransaction(transaction); - }) // and catch any exceptions that are triggered - .catch(function (error) { - LOG.error('LandRegsitry:updateForSale', error); - throw error; - }); - } - - /** bootstrap into the resgitry a few example land titles - * @return {Promise} resolved when the assests have been created - - */ - _bootstrapTitles() { - LOG.info('LandRegistry:_bootstrapTitles', 'getting asset registry for "net.biz.digitalPropertyNetwork.LandTitle"'); - let owner; - LOG.info('about to get asset registry'); - return this.bizNetworkConnection.getAssetRegistry('net.biz.digitalPropertyNetwork.LandTitle') // how do I know what this name is? - - .then((result) => { - // got the assest registry for land titles - LOG.info('LandRegistry:_bootstrapTitles', 'got asset registry'); - this.titlesRegistry = result; - }).then(() => { - LOG.info('LandRegistry:_bootstrapTitles', 'getting factory and adding assets'); - let factory = this.businessNetworkDefinition.getFactory(); - - LOG.info('LandRegistry:_bootstrapTitles', 'Creating a person'); - owner = factory.newInstance('net.biz.digitalPropertyNetwork', 'Person', 'PID:1234567890'); - owner.firstName = 'Fred'; - owner.lastName = 'Bloggs'; - - /** Create a new relationship for the owner */ - let ownerRelation = factory.newRelationship('net.biz.digitalPropertyNetwork', 'Person', 'PID:1234567890'); - - LOG.info('LandRegistry:_bootstrapTitles', 'Creating a land title#1'); - let landTitle1 = factory.newInstance('net.biz.digitalPropertyNetwork', 'LandTitle', 'LID:1148'); - landTitle1.owner = ownerRelation; - landTitle1.information = 'A nice house in the country'; - - LOG.info('LandRegistry:_bootstrapTitles', 'Creating a land title#2'); - let landTitle2 = factory.newInstance('net.biz.digitalPropertyNetwork', 'LandTitle', 'LID:6789'); - landTitle2.owner = ownerRelation; - landTitle2.information = 'A small flat in the city'; - - LOG.info('LandRegistry:_bootstrapTitles', 'Adding these to the registry'); - return this.titlesRegistry.addAll([landTitle1, landTitle2]); - - }).then(() => { - return this.bizNetworkConnection.getParticipantRegistry('net.biz.digitalPropertyNetwork.Person'); - }) - .then((personRegistry) => { - return personRegistry.add(owner); - }) // and catch any exceptions that are triggered - .catch(function (error) { - console.log(error); - LOG.error('LandRegsitry:_bootstrapTitles', error); - throw error; - }); - - } - - /** - * List the land titles that are stored in the Land Title Resgitry - * @return {Promise} resolved when fullfiled will have listed out the titles to stdout - */ - listTitles() { - const METHOD = 'listTitles'; - - let landTitleRegistry; - let personRegistry; - - LOG.info(METHOD, 'Getting the asset registry'); - // get the land title registry and then get all the files. - return this.bizNetworkConnection.getAssetRegistry('net.biz.digitalPropertyNetwork.LandTitle') - .then((registry) => { - landTitleRegistry = registry; - - return this.bizNetworkConnection.getParticipantRegistry('net.biz.digitalPropertyNetwork.Person'); - }).then((registry) => { - personRegistry = registry; - - LOG.info(METHOD, 'Getting all assest from the registry.'); - return landTitleRegistry.resolveAll(); - - }) - - .then((aResources) => { - - LOG.info(METHOD, 'Current Land Titles'); - // instantiate - let table = new Table({ - head: ['TitleID', 'OwnerID', 'First Name', 'Surname', 'Description', 'ForSale'] - }); - let arrayLength = aResources.length; - for(let i = 0; i < arrayLength; i++) { - - let tableLine = []; - - - - tableLine.push(aResources[i].titleId); - tableLine.push(aResources[i].owner.personId); - tableLine.push(aResources[i].owner.firstName); - tableLine.push(aResources[i].owner.lastName); - tableLine.push(aResources[i].information); - tableLine.push(aResources[i].forSale ? 'Yes' : 'No'); - table.push(tableLine); - } - - // Put to stdout - as this is really a command line app - return(table); - }) - - - // and catch any exceptions that are triggered - .catch(function (error) { - console.log(error); - /* potentially some code for generating an error specific message here */ - this.log.error(METHOD, 'uh-oh', error); - }); - - } - - /** - * @description - run the listtiles command - * @param {Object} args passed from the command line - * @return {Promise} resolved when the action is complete - */ - static listCmd(args) { - - let lr = new LandRegistry('landRegsitryUK'); - - - return lr.init() - .then(() => { - return lr.listTitles(); - }) - - .then((results) => { - LOG.info('Titles listed'); - LOG.info('\n'+results.toString()); - }) - .catch(function (error) { - /* potentially some code for generating an error specific message here */ - throw error; - }); - } - - /** - * @description - run the add default assets command - * @param {Object} args passed from the command line - * @return {Promise} resolved when complete - */ - static addDefaultCmd(args) { - - let lr = new LandRegistry('landRegsitryUK'); - - - return lr.init() - - .then(() => { - return lr._bootstrapTitles(); - }) - - .then((results) => { - LOG.info('Default titles added'); - }) - .catch(function (error) { - /* potentially some code for generating an error specific message here */ - throw error; - }); - } - - /** - * @description - run the listtiles command - * @param {Object} args passed from the command line - * @return {Promise} resolved when the action is complete - */ - static submitCmd(args) { - - let lr = new LandRegistry('landRegsitryUK'); - - - return lr.init() - - .then(() => { - return lr.updateForSale(); - }) - - .then((results) => { - LOG.info('Transaction Submitted'); - }) - .catch(function (error) { - /* potentially some code for generating an error specific message here */ - throw error; - }); - } -} -module.exports = LandRegistry; diff --git a/packages/getting-started/package.json b/packages/getting-started/package.json deleted file mode 100644 index 9443af85..00000000 --- a/packages/getting-started/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "getting-started", - "version": "0.0.1", - "description": "The repository for the Hyperledger Composer Getting Started application - DEPRECATED", - "main": "index.js", - "scripts": { - "preinstall": "composer --version || { echo 'Please first run npm install -g composer-cli' ; exit 1;} ", - "test": "mocha --recursive && npm run bootstrapAssets && npm run listAssets && npm run submitTransaction", - "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", - "install": "scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork" - }, - "repository": { - "type": "git", - "url": "https://github.com/hyperledger/composer-sample-applications.git" - }, - "keywords": [ - "Blockchain", - "Solutions", - "Framework", - "getting-started", - "Hyperledger Composer" - ], - "author": "Hyperledger Composer", - "license": "Apache-2.0", - "dependencies": { - "cli-table": "^0.3.1", - "composer-admin": "^0.7.0", - "composer-client": "^0.7.0", - "config": "^1.24.0", - "digitalproperty-network": "latest", - "jsonfile": "^2.4.0", - "lodash": "^4.17.4", - "sprintf-js": "^1.0.3", - "winston": "^2.3.0", - "yargs": "^6.5.0" - }, - "devDependencies": { - "chai": "^3.5.0", - "chai-as-promised": "^6.0.0", - "chai-things": "^0.2.0", - "composer-connector-embedded": "^0.7.0", - "mocha": "^3.2.0", - "sinon": "^1.17.6", - "sinon-as-promised": "^4.0.2" - } -} diff --git a/packages/getting-started/scripts/docker-compose.yml b/packages/getting-started/scripts/docker-compose.yml deleted file mode 100644 index 5c46c680..00000000 --- a/packages/getting-started/scripts/docker-compose.yml +++ /dev/null @@ -1,28 +0,0 @@ -membersrvc: - image: hyperledger/fabric-membersrvc - ports: - - '7054:7054' - command: membersrvc -vp0: - image: hyperledger/fabric-peer - ports: - - '7050:7050' - - '7051:7051' - - '7052:7052' - - '7053:7053' - environment: - - CORE_PEER_ADDRESSAUTODETECT=true - - CORE_VM_ENDPOINT=unix:///var/run/docker.sock - - CORE_LOGGING_LEVEL=DEBUG - - CORE_PEER_ID=vp0 - - CORE_PEER_PKI_ECA_PADDR=membersrvc:7054 - - CORE_PEER_PKI_TCA_PADDR=membersrvc:7054 - - CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054 - - CORE_SECURITY_ENABLED=true - - CORE_SECURITY_ENROLLID=test_vp0 - - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT - links: - - membersrvc - command: sh -c 'sleep 5; peer node start' - volumes: - - /var/run/docker.sock:/var/run/docker.sock \ No newline at end of file diff --git a/packages/getting-started/scripts/download-hyperledger.sh b/packages/getting-started/scripts/download-hyperledger.sh deleted file mode 100755 index 933c489c..00000000 --- a/packages/getting-started/scripts/download-hyperledger.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# Exit on first error, print all commands. -set -ev - -# Grab the current directory. -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" - -# Shut down the Docker containers that might be currently running. -cd "${DIR}"/scripts -docker-compose kill && docker-compose down - -# TODO change this to alter the default profile which is, by convention, a local running hyperledger fabric -rm -rf ~/.composer-connection-profiles/defaultProfile/* -rm -rf ~/.composer-credentials/* - - -# delete all existing containers and images -# This is not used in general usage but this might -#read -p "Press y to delete all docker containers images" -n 1 -r -#echo # (optional) move to a new line -#if [[ $REPLY =~ ^[Yy]$ ]] -#then -# docker rm $(docker ps -a -q) -f -# docker rmi $(docker images -q) -f -#fi - -# Pull and tag the latest Hyperledger Fabric base image. -docker pull hyperledger/fabric-baseimage:x86_64-0.1.0 -docker tag hyperledger/fabric-baseimage:x86_64-0.1.0 hyperledger/fabric-baseimage:latest diff --git a/packages/getting-started/scripts/prereqs-dev.sh b/packages/getting-started/scripts/prereqs-dev.sh deleted file mode 100755 index 6fda0be8..00000000 --- a/packages/getting-started/scripts/prereqs-dev.sh +++ /dev/null @@ -1,30 +0,0 @@ -# Install useful development prereqs - -set -e - -# Install Atom -sudo add-apt-repository ppa:webupd8team/atom - -sudo apt update; sudo apt install atom - -# install xclip -sudo apt-get install xclip - -# Get the MICRO editor and unzip and create a link to it -if [ ! -f /opt/micro-1.1.4/micro ]; then - sudo curl -sL https://github.com/zyedidia/micro/releases/download/v1.1.4/micro-1.1.4-linux64.tar.gz | tar xz --directory /opt - sudo ln -s /opt/micro-1.1.4/micro /usr/local/bin/micro -fi - -# Install the tree file utility -sudo apt install tree - -# NPM utility to pretty the output of JSON files -npm install -g prettyjson - - -# Install Chrome -wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - -sudo sh -c 'echo "deb https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' -sudo apt-get update -sudo apt-get install google-chrome-stable diff --git a/packages/getting-started/scripts/prereqs-ubuntu.sh b/packages/getting-started/scripts/prereqs-ubuntu.sh deleted file mode 100755 index 6e599672..00000000 --- a/packages/getting-started/scripts/prereqs-ubuntu.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash - -# Usage: -# -# ./prereqs-ubuntu.sh -# -# User must then logout and login upon completion of script -# - -# Exit on any failure -set -e - -# Array of supported versions -declare -a versions=('trusty' 'xenial' 'yakkety'); - -# check the version and extract codename of ubuntu if release codename not provided by user -if [ -z "$1" ]; then - source /etc/lsb-release || \ - (echo "Error: Release information not found, run script passing Ubuntu version codename as a parameter"; exit 1) - CODENAME=${DISTRIB_CODENAME} -else - CODENAME=${1} -fi - -# check version is supported -if echo ${versions[@]} | grep -q -w ${CODENAME}; then - echo "Installing Hyperledger Composer prereqs for Ubuntu ${CODENAME}" -else - echo "Error: Ubuntu ${CODENAME} is not supported" - exit 1 -fi - -# Update package lists -echo "# Updating package lists" -sudo apt-get update - -# Install Git -echo "# Installing GitHub" -sudo apt-get -y install git - -# Install nvm dependencies -echo "# Installing nvm dependencies" -sudo apt-get -y install build-essential libssl-dev - -# Execute nvm installation script -echo "# Executing nvm installation script" -curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash - -# Set up nvm environment without restarting the shell -export NVM_DIR="${HOME}/.nvm" -[ -s "${NVM_DIR}/nvm.sh" ] && . "${NVM_DIR}/nvm.sh" -[ -s "${NVM_DIR}/bash_completion" ] && . "${NVM_DIR}/bash_completion" - -# Install node -echo "# Installing nodeJS" -nvm install --lts - -# Configure nvm to use version 6.9.5 -nvm use --lts -nvm alias default 'lts/*' - -# Install the latest version of npm -echo "# Installing npm" -npm install npm@latest -g - -# Ensure that CA certificates are installed -sudo apt-get -y install apt-transport-https ca-certificates - -# Add Docker repository key to APT keychain -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - -# Update where APT will search for Docker Packages -echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu ${CODENAME} stable" | \ - sudo tee /etc/apt/sources.list.d/docker.list - -# Update package lists -sudo apt-get update - -# Verifies APT is pulling from the correct Repository -sudo apt-cache policy docker-ce - -# Install kernel packages which allows us to use aufs storage driver if V14 (trusty/utopic) -if [ "${CODENAME}" == "trusty" ]; then - echo "# Installing required kernel packages" - sudo apt-get -y install linux-image-extra-$(uname -r) linux-image-extra-virtual -fi - -# Install Docker -echo "# Installing Docker" -sudo apt-get -y install docker-ce - -# Add user account to the docker group -sudo usermod -aG docker $(whoami) - -# Install docker compose -echo "# Installing Docker-Compose" -sudo curl -L "https://github.com/docker/compose/releases/download/1.13.0/docker-compose-$(uname -s)-$(uname -m)" \ - -o /usr/local/bin/docker-compose -sudo chmod +x /usr/local/bin/docker-compose - -# Print installation details for user -echo '' -echo 'Installation completed, versions installed are:' -echo '' -echo -n 'Node: ' -node --version -echo -n 'npm: ' -npm --version -echo -n 'Docker: ' -docker --version -echo -n 'Docker Compose: ' -docker-compose --version - -# Print reminder of need to logout in order for these changes to take effect! -echo '' -echo "Please logout then login before continuing." diff --git a/packages/getting-started/scripts/setup.sh b/packages/getting-started/scripts/setup.sh deleted file mode 100755 index a7f58726..00000000 --- a/packages/getting-started/scripts/setup.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# Exit on first error, print all commands. -set -ev - -# Grab the current directory. -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" - -# remove existing profiles and credentials -rm -rf ~/.composer-connection-profiles/* -rm -rf ~/.composer-credentials/* - -# Shut down the Docker containers that might be currently running. -cd "${DIR}"/scripts -docker-compose kill && docker-compose down - - -# Pull and tag the latest Hyperledger Fabric base image. -docker pull hyperledger/fabric-baseimage:x86_64-0.1.0 -docker tag hyperledger/fabric-baseimage:x86_64-0.1.0 hyperledger/fabric-baseimage:latest - -# Start up the Docker containers -docker-compose build - -# Start up the Hyperledger Fabric -docker-compose up -d - -# -cd "${DIR}" - -# Wait for the Hyperledger Fabric to start.# -while ! nc localhost 7051 { - - describe('#sample test', () => { - it('should pass', () => { - true.should.not.be.null; - }); - }); -}); - -/*eslint-enable no-unused-vars*/