diff --git a/.gitignore b/.gitignore index 4b705ae4..91fd87a1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,7 @@ /config .DS_Store .project +# omit Go vendor directories +vendor/ +.vscode +.gradle diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 00000000..d2863b64 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 + +# Fabric Samples Maintaners +* @christo4ferris @denyeart @harrisob @jyellick @lehors @mastersingh24 @mbwhite @sstone1 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..59c64a95 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,157 @@ +#!groovy +// Copyright IBM Corp All Rights Reserved +// +// SPDX-License-Identifier: Apache-2.0 +// + +// Jenkinfile will get triggered on verify and merge jobs and run byfn, eyfn and fabcar +// tests. + +// global shared library from ci-management repository +// https://github.com/hyperledger/ci-management/tree/master/vars (Global Shared scripts) +@Library("fabric-ci-lib") _ + pipeline { + agent { + // Execute tests on x86_64 build nodes + // Set this value from Jenkins Job Configuration + label env.NODE_ARCH + } + options { + // Using the Timestamper plugin we can add timestamps to the console log + timestamps() + // Set build timeout for 60 mins + timeout(time: 60, unit: 'MINUTES') + } + environment { + ROOTDIR = pwd() + // Applicable only on x86_64 nodes + // LF team has to install the newer version in Jenkins global config + // Send an email to helpdesk@hyperledger.org to add newer version + nodeHome = tool 'nodejs-8.11.3' + MARCH = sh(returnStdout: true, script: "uname -m | sed 's/x86_64/amd64/g'").trim() + OS_NAME = sh(returnStdout: true, script: "uname -s|tr '[:upper:]' '[:lower:]'").trim() + props = "null" + } + stages { + stage('Clean Environment') { + steps { + script { + // delete working directory + deleteDir() + // Clean build env before start the build + fabBuildLibrary.cleanupEnv() + // Display jenkins environment details + fabBuildLibrary.envOutput() + } + } + } + stage('Checkout SCM') { + steps { + script { + // Get changes from gerrit + fabBuildLibrary.cloneRefSpec('fabric-samples') + // Load properties from ci.properties file + props = fabBuildLibrary.loadProperties() + } + } + } + // Pull build artifacts + stage('Pull Build Artifacts') { + steps { + script { + if(props["IMAGE_SOURCE"] == "build") { + println "BUILD ARTIFACTS" + // Set PATH + env.GOPATH = "$WORKSPACE/gopath" + env.GOROOT = "/opt/go/go" + props["GO_VER"] + ".linux." + "$MARCH" + env.PATH = "$GOPATH/bin:$GOROOT/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:${nodeHome}/bin:$PATH" + // Clone fabric repo + fabBuildLibrary.cloneScm('fabric', '$GERRIT_BRANCH') + // Build fabric docker images and binaries + fabBuildLibrary.fabBuildImages('fabric', 'docker dist') + // Clone fabric-ca repo + fabBuildLibrary.cloneScm('fabric-ca', '$GERRIT_BRANCH') + // Build fabric docker images and binaries + fabBuildLibrary.fabBuildImages('fabric-ca', 'docker dist') + // Copy binaries to fabric-samples dir + sh 'cp -r $ROOTDIR/gopath/src/github.com/hyperledger/fabric/release/$OS_NAME-$MARCH/bin $ROOTDIR/$BASE_DIR/' + // Pull Thirdparty Docker Images from hyperledger DockerHub + fabBuildLibrary.pullThirdPartyImages(props["FAB_BASEIMAGE_VERSION"], props["FAB_THIRDPARTY_IMAGES_LIST"]) + } else { + dir("$ROOTDIR/$BASE_DIR") { + // Set PATH + env.GOPATH = "$WORKSPACE/gopath" + env.GOROOT = "/opt/go/go" + props["GO_VER"] + ".linux." + "$MARCH" + env.PATH = "$GOPATH/bin:$GOROOT/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:${nodeHome}/bin:$PATH" + // Pull Binaries with latest version from nexus2 + fabBuildLibrary.pullBinaries(props["FAB_BINARY_VER"], props["FAB_BINARY_REPO"]) + // Pull Docker Images from nexus3 + fabBuildLibrary.pullDockerImages(props["FAB_BASE_VERSION"], props["FAB_IMAGES_LIST"]) + // Pull Thirdparty Docker Images from hyperledger DockerHub + fabBuildLibrary.pullThirdPartyImages(props["FAB_BASEIMAGE_VERSION"], props["FAB_THIRDPARTY_IMAGES_LIST"]) + } + } + } + } + } + // Run byfn, eyfn tests (default, custom channel, couchdb, nodejs, java chaincode) + stage('Run byfn_eyfn Tests') { + steps { + script { + // making the output color coded + // wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) { + try { + dir("$ROOTDIR/$BASE_DIR/scripts/ci_scripts") { + // Run BYFN, EYFN tests + sh './ciScript.sh --byfn_eyfn_Tests' + } + } + catch (err) { + failure_stage = "byfn_eyfn_Tests" + currentBuild.result = 'FAILURE' + throw err + } + // } + } + } + } + // Run fabcar tests + stage('Run Fab Car Tests') { + steps { + script { + // making the output color coded + // wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) { + try { + dir("$ROOTDIR/$BASE_DIR/scripts/ci_scripts") { + // Run fabcar tests + sh './ciScript.sh --fabcar_Tests' + } + } + catch (err) { + failure_stage = "fabcar_Tests" + currentBuild.result = 'FAILURE' + throw err + } + // } + } + } + } + } // stages + post { + always { + // Archiving the .log files and ignore if empty + archiveArtifacts artifacts: '**/*.log', allowEmptyArchive: true + } + failure { + script { + if (env.JOB_TYPE == 'merge') { + // Send rocketChat notification to channel + // Send merge build failure email notifications to the submitter + sendNotifications(currentBuild.result, props["CHANNEL_NAME"]) + // Delete workspace when build is done + cleanWs notFailBuild: true + } + } + } + } // post + } // pipeline diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 7c669dbb..cda38dc9 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -1,5 +1,19 @@ -## Hyperledger Fabric Maintainers +Maintainers +=========== -[MAINTAINERS](http://hyperledger-fabric.readthedocs.io/en/latest/MAINTAINERS.html) +fabric-samples uses a non-author code review policy, requiring a single +2 from a non-author maintainer. -Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License +| Name | GitHub | Chat | email | +|---------------------------|------------------|----------------|-------------------------------------| +| Arnaud Le Hors | lehors | lehors | lehors@us.ibm.com | +| Bret Harrison | harrisob | bretharrison | harrisob@us.ibm.com | +| Chris Ferris | christo4ferris | cbf | chris.ferris@gmail.com | +| Dave Enyeart | denyeart | dave.enyeart | enyeart@us.ibm.com | +| Gari Singh | mastersingh24 | mastersingh24 | gari.r.singh@gmail.com | +| Jason Yellick | jyellick | jyellick | jyellick@us.ibm.com | +| Matthew B White | mbwhite | mbwhite | whitemat@uk.ibm.com | +| Simon Stone | sstone1 | sstone1 | sstone1@uk.ibm.com | + +Also: Please see the [Release Manager section](https://github.com/hyperledger/fabric/blob/master/MAINTAINERS.md) + +Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/balance-transfer/.gitignore b/balance-transfer/.gitignore deleted file mode 100644 index 5ab9c94c..00000000 --- a/balance-transfer/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/node_modules/* -/package-lock.json -/fabric-client-kv-org* diff --git a/balance-transfer/README.md b/balance-transfer/README.md deleted file mode 100644 index 0b31ec74..00000000 --- a/balance-transfer/README.md +++ /dev/null @@ -1,332 +0,0 @@ -## Balance transfer - -A sample Node.js app to demonstrate **__fabric-client__** & **__fabric-ca-client__** Node.js SDK APIs - -### Prerequisites and setup: - -* [Docker](https://www.docker.com/products/overview) - v1.12 or higher -* [Docker Compose](https://docs.docker.com/compose/overview/) - v1.8 or higher -* [Git client](https://git-scm.com/downloads) - needed for clone commands -* **Node.js** v8.4.0 or higher -* [Download Docker images](http://hyperledger-fabric.readthedocs.io/en/latest/samples.html#binaries) - -``` -cd fabric-samples/balance-transfer/ -``` - -Once you have completed the above setup, you will have provisioned a local network with the following docker container configuration: - -* 2 CAs -* A SOLO orderer -* 4 peers (2 peers per Org) - -#### Artifacts -* Crypto material has been generated using the **cryptogen** tool from Hyperledger Fabric and mounted to all peers, the orderering node and CA containers. More details regarding the cryptogen tool are available [here](http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#crypto-generator). -* An Orderer genesis block (genesis.block) and channel configuration transaction (mychannel.tx) has been pre generated using the **configtxgen** tool from Hyperledger Fabric and placed within the artifacts folder. More details regarding the configtxgen tool are available [here](http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#configuration-transaction-generator). - -## Running the sample program - -There are two options available for running the balance-transfer sample -For each of these options, you may choose to run with chaincode written in golang or in node.js. - -### Option 1: - -##### Terminal Window 1 - -* Launch the network using docker-compose - -``` -docker-compose -f artifacts/docker-compose.yaml up -``` -##### Terminal Window 2 - -* Install the fabric-client and fabric-ca-client node modules - -``` -npm install -``` - -* Start the node app on PORT 4000 - -``` -PORT=4000 node app -``` - -##### Terminal Window 3 - -* Execute the REST APIs from the section [Sample REST APIs Requests](https://github.com/hyperledger/fabric-samples/tree/master/balance-transfer#sample-rest-apis-requests) - - -### Option 2: - -##### Terminal Window 1 - -``` -cd fabric-samples/balance-transfer - -./runApp.sh - -``` - -* This launches the required network on your local machine -* Installs the fabric-client and fabric-ca-client node modules -* And, starts the node app on PORT 4000 - -##### Terminal Window 2 - - -In order for the following shell script to properly parse the JSON, you must install ``jq``: - -instructions [https://stedolan.github.io/jq/](https://stedolan.github.io/jq/) - -With the application started in terminal 1, next, test the APIs by executing the script - **testAPIs.sh**: -``` -cd fabric-samples/balance-transfer - -## To use golang chaincode execute the following command - -./testAPIs.sh -l golang - -## OR use node.js chaincode - -./testAPIs.sh -l node -``` - - -## Sample REST APIs Requests - -### Login Request - -* Register and enroll new users in Organization - **Org1**: - -`curl -s -X POST http://localhost:4000/users -H "content-type: application/x-www-form-urlencoded" -d 'username=Jim&orgName=Org1'` - -**OUTPUT:** - -``` -{ - "success": true, - "secret": "RaxhMgevgJcm", - "message": "Jim enrolled Successfully", - "token": "" -} -``` - -The response contains the success/failure status, an **enrollment Secret** and a **JSON Web Token (JWT)** that is a required string in the Request Headers for subsequent requests. - -### Create Channel request - -``` -curl -s -X POST \ - http://localhost:4000/channels \ - -H "authorization: Bearer " \ - -H "content-type: application/json" \ - -d '{ - "channelName":"mychannel", - "channelConfigPath":"../artifacts/channel/mychannel.tx" -}' -``` - -Please note that the Header **authorization** must contain the JWT returned from the `POST /users` call - -### Join Channel request - -``` -curl -s -X POST \ - http://localhost:4000/channels/mychannel/peers \ - -H "authorization: Bearer " \ - -H "content-type: application/json" \ - -d '{ - "peers": ["peer0.org1.example.com","peer1.org1.example.com"] -}' -``` -### Install chaincode - -``` -curl -s -X POST \ - http://localhost:4000/chaincodes \ - -H "authorization: Bearer " \ - -H "content-type: application/json" \ - -d '{ - "peers": ["peer0.org1.example.com","peer1.org1.example.com"], - "chaincodeName":"mycc", - "chaincodePath":"github.com/example_cc/go", - "chaincodeType": "golang", - "chaincodeVersion":"v0" -}' -``` -**NOTE:** *chaincodeType* must be set to **node** when node.js chaincode is used and *chaincodePath* must be set to the location of the node.js chaincode. Also put in the $PWD -``` -ex: -curl -s -X POST \ - http://localhost:4000/chaincodes \ - -H "authorization: Bearer " \ - -H "content-type: application/json" \ - -d '{ - "peers": ["peer0.org1.example.com","peer1.org1.example.com"], - "chaincodeName":"mycc", - "chaincodePath":"$PWD/artifacts/src/github.com/example_cc/node", - "chaincodeType": "node", - "chaincodeVersion":"v0" -}' -``` - -### Instantiate chaincode - -This is the endorsement policy defined during instantiation. -This policy can be fulfilled when members from both orgs sign the transaction proposal. - -``` -{ - identities: [{ - role: { - name: 'member', - mspId: 'Org1MSP' - } - }, - { - role: { - name: 'member', - mspId: 'Org2MSP' - } - } - ], - policy: { - '2-of': [{ - 'signed-by': 0 - }, { - 'signed-by': 1 - }] - } -} -``` - -``` -curl -s -X POST \ - http://localhost:4000/channels/mychannel/chaincodes \ - -H "authorization: Bearer " \ - -H "content-type: application/json" \ - -d '{ - "chaincodeName":"mycc", - "chaincodeVersion":"v0", - "chaincodeType": "golang", - "args":["a","100","b","200"] -}' -``` -**NOTE:** *chaincodeType* must be set to **node** when node.js chaincode is used - -### Invoke request - -This invoke request is signed by peers from both orgs, *org1* & *org2*. -``` -curl -s -X POST \ - http://localhost:4000/channels/mychannel/chaincodes/mycc \ - -H "authorization: Bearer " \ - -H "content-type: application/json" \ - -d '{ - "peers": ["peer0.org1.example.com","peer0.org2.example.com"], - "fcn":"move", - "args":["a","b","10"] -}' -``` -**NOTE:** Ensure that you save the Transaction ID from the response in order to pass this string in the subsequent query transactions. - -### Chaincode Query - -``` -curl -s -X GET \ - "http://localhost:4000/channels/mychannel/chaincodes/mycc?peer=peer0.org1.example.com&fcn=query&args=%5B%22a%22%5D" \ - -H "authorization: Bearer " \ - -H "content-type: application/json" -``` - -### Query Block by BlockNumber - -``` -curl -s -X GET \ - "http://localhost:4000/channels/mychannel/blocks/1?peer=peer0.org1.example.com" \ - -H "authorization: Bearer " \ - -H "content-type: application/json" -``` - -### Query Transaction by TransactionID - -``` -curl -s -X GET http://localhost:4000/channels/mychannel/transactions/?peer=peer0.org1.example.com \ - -H "authorization: Bearer " \ - -H "content-type: application/json" -``` -**NOTE**: The transaction id can be from any previous invoke transaction, see results of the invoke request, will look something like `8a95b1794cb17e7772164c3f1292f8410fcfdc1943955a35c9764a21fcd1d1b3`. - - -### Query ChainInfo - -``` -curl -s -X GET \ - "http://localhost:4000/channels/mychannel?peer=peer0.org1.example.com" \ - -H "authorization: Bearer " \ - -H "content-type: application/json" -``` - -### Query Installed chaincodes - -``` -curl -s -X GET \ - "http://localhost:4000/chaincodes?peer=peer0.org1.example.com&type=installed" \ - -H "authorization: Bearer " \ - -H "content-type: application/json" -``` - -### Query Instantiated chaincodes - -``` -curl -s -X GET \ - "http://localhost:4000/chaincodes?peer=peer0.org1.example.com&type=instantiated" \ - -H "authorization: Bearer " \ - -H "content-type: application/json" -``` - -### Query Channels - -``` -curl -s -X GET \ - "http://localhost:4000/channels?peer=peer0.org1.example.com" \ - -H "authorization: Bearer " \ - -H "content-type: application/json" -``` - -### Clean the network - -The network will still be running at this point. Before starting the network manually again, here are the commands which cleans the containers and artifacts. - -``` -docker rm -f $(docker ps -aq) -docker rmi -f $(docker images | grep dev | awk '{print $3}') -rm -rf fabric-client-kv-org[1-2] -``` - -### Network configuration considerations - -You have the ability to change configuration parameters by either directly editing the network-config.yaml file or provide an additional file for an alternative target network. The app uses an optional environment variable "TARGET_NETWORK" to control the configuration files to use. For example, if you deployed the target network on Amazon Web Services EC2, you can add a file "network-config-aws.yaml", and set the "TARGET_NETWORK" environment to 'aws'. The app will pick up the settings inside the "network-config-aws.yaml" file. - -#### IP Address** and PORT information - -If you choose to customize your docker-compose yaml file by hardcoding IP Addresses and PORT information for your peers and orderer, then you MUST also add the identical values into the network-config.yaml file. The url and eventUrl settings will need to be adjusted to match your docker-compose yaml file. - -``` -peer1.org1.example.com: - url: grpcs://x.x.x.x:7056 - eventUrl: grpcs://x.x.x.x:7058 - -``` - -#### Discover IP Address - -To retrieve the IP Address for one of your network entities, issue the following command: - -``` -# this will return the IP Address for peer0 -docker inspect peer0 | grep IPAddress -``` - -Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/balance-transfer/app.js b/balance-transfer/app.js deleted file mode 100644 index 83b1226a..00000000 --- a/balance-transfer/app.js +++ /dev/null @@ -1,430 +0,0 @@ -/** - * Copyright 2017 IBM All Rights Reserved. - * - * 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'; -var log4js = require('log4js'); -var logger = log4js.getLogger('SampleWebApp'); -var express = require('express'); -var session = require('express-session'); -var cookieParser = require('cookie-parser'); -var bodyParser = require('body-parser'); -var http = require('http'); -var util = require('util'); -var app = express(); -var expressJWT = require('express-jwt'); -var jwt = require('jsonwebtoken'); -var bearerToken = require('express-bearer-token'); -var cors = require('cors'); - -require('./config.js'); -var hfc = require('fabric-client'); - -var helper = require('./app/helper.js'); -var createChannel = require('./app/create-channel.js'); -var join = require('./app/join-channel.js'); -var updateAnchorPeers = require('./app/update-anchor-peers.js'); -var install = require('./app/install-chaincode.js'); -var instantiate = require('./app/instantiate-chaincode.js'); -var invoke = require('./app/invoke-transaction.js'); -var query = require('./app/query.js'); -var host = process.env.HOST || hfc.getConfigSetting('host'); -var port = process.env.PORT || hfc.getConfigSetting('port'); -/////////////////////////////////////////////////////////////////////////////// -//////////////////////////////// SET CONFIGURATONS //////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -app.options('*', cors()); -app.use(cors()); -//support parsing of application/json type post data -app.use(bodyParser.json()); -//support parsing of application/x-www-form-urlencoded post data -app.use(bodyParser.urlencoded({ - extended: false -})); -// set secret variable -app.set('secret', 'thisismysecret'); -app.use(expressJWT({ - secret: 'thisismysecret' -}).unless({ - path: ['/users'] -})); -app.use(bearerToken()); -app.use(function(req, res, next) { - logger.debug(' ------>>>>>> new request for %s',req.originalUrl); - if (req.originalUrl.indexOf('/users') >= 0) { - return next(); - } - - var token = req.token; - jwt.verify(token, app.get('secret'), function(err, decoded) { - if (err) { - res.send({ - success: false, - message: 'Failed to authenticate token. Make sure to include the ' + - 'token returned from /users call in the authorization header ' + - ' as a Bearer token' - }); - return; - } else { - // add the decoded user name and org name to the request object - // for the downstream code to use - req.username = decoded.username; - req.orgname = decoded.orgName; - logger.debug(util.format('Decoded from JWT token: username - %s, orgname - %s', decoded.username, decoded.orgName)); - return next(); - } - }); -}); - -/////////////////////////////////////////////////////////////////////////////// -//////////////////////////////// START SERVER ///////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -var server = http.createServer(app).listen(port, function() {}); -logger.info('****************** SERVER STARTED ************************'); -logger.info('*************** http://%s:%s ******************',host,port); -server.timeout = 240000; - -function getErrorMessage(field) { - var response = { - success: false, - message: field + ' field is missing or Invalid in the request' - }; - return response; -} - -/////////////////////////////////////////////////////////////////////////////// -///////////////////////// REST ENDPOINTS START HERE /////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Register and enroll user -app.post('/users', async function(req, res) { - var username = req.body.username; - var orgName = req.body.orgName; - logger.debug('End point : /users'); - logger.debug('User name : ' + username); - logger.debug('Org name : ' + orgName); - if (!username) { - res.json(getErrorMessage('\'username\'')); - return; - } - if (!orgName) { - res.json(getErrorMessage('\'orgName\'')); - return; - } - var token = jwt.sign({ - exp: Math.floor(Date.now() / 1000) + parseInt(hfc.getConfigSetting('jwt_expiretime')), - username: username, - orgName: orgName - }, app.get('secret')); - let response = await helper.getRegisteredUser(username, orgName, true); - logger.debug('-- returned from registering the username %s for organization %s',username,orgName); - if (response && typeof response !== 'string') { - logger.debug('Successfully registered the username %s for organization %s',username,orgName); - response.token = token; - res.json(response); - } else { - logger.debug('Failed to register the username %s for organization %s with::%s',username,orgName,response); - res.json({success: false, message: response}); - } - -}); -// Create Channel -app.post('/channels', async function(req, res) { - logger.info('<<<<<<<<<<<<<<<<< C R E A T E C H A N N E L >>>>>>>>>>>>>>>>>'); - logger.debug('End point : /channels'); - var channelName = req.body.channelName; - var channelConfigPath = req.body.channelConfigPath; - logger.debug('Channel name : ' + channelName); - logger.debug('channelConfigPath : ' + channelConfigPath); //../artifacts/channel/mychannel.tx - if (!channelName) { - res.json(getErrorMessage('\'channelName\'')); - return; - } - if (!channelConfigPath) { - res.json(getErrorMessage('\'channelConfigPath\'')); - return; - } - - let message = await createChannel.createChannel(channelName, channelConfigPath, req.username, req.orgname); - res.send(message); -}); -// Join Channel -app.post('/channels/:channelName/peers', async function(req, res) { - logger.info('<<<<<<<<<<<<<<<<< J O I N C H A N N E L >>>>>>>>>>>>>>>>>'); - var channelName = req.params.channelName; - var peers = req.body.peers; - logger.debug('channelName : ' + channelName); - logger.debug('peers : ' + peers); - logger.debug('username :' + req.username); - logger.debug('orgname:' + req.orgname); - - if (!channelName) { - res.json(getErrorMessage('\'channelName\'')); - return; - } - if (!peers || peers.length == 0) { - res.json(getErrorMessage('\'peers\'')); - return; - } - - let message = await join.joinChannel(channelName, peers, req.username, req.orgname); - res.send(message); -}); -// Update anchor peers -app.post('/channels/:channelName/anchorpeers', async function(req, res) { - logger.debug('==================== UPDATE ANCHOR PEERS =================='); - var channelName = req.params.channelName; - var configUpdatePath = req.body.configUpdatePath; - logger.debug('Channel name : ' + channelName); - logger.debug('configUpdatePath : ' + configUpdatePath); - if (!channelName) { - res.json(getErrorMessage('\'channelName\'')); - return; - } - if (!configUpdatePath) { - res.json(getErrorMessage('\'configUpdatePath\'')); - return; - } - - let message = await updateAnchorPeers.updateAnchorPeers(channelName, configUpdatePath, req.username, req.orgname); - res.send(message); -}); -// Install chaincode on target peers -app.post('/chaincodes', async function(req, res) { - logger.debug('==================== INSTALL CHAINCODE =================='); - var peers = req.body.peers; - var chaincodeName = req.body.chaincodeName; - var chaincodePath = req.body.chaincodePath; - var chaincodeVersion = req.body.chaincodeVersion; - var chaincodeType = req.body.chaincodeType; - logger.debug('peers : ' + peers); // target peers list - logger.debug('chaincodeName : ' + chaincodeName); - logger.debug('chaincodePath : ' + chaincodePath); - logger.debug('chaincodeVersion : ' + chaincodeVersion); - logger.debug('chaincodeType : ' + chaincodeType); - if (!peers || peers.length == 0) { - res.json(getErrorMessage('\'peers\'')); - return; - } - if (!chaincodeName) { - res.json(getErrorMessage('\'chaincodeName\'')); - return; - } - if (!chaincodePath) { - res.json(getErrorMessage('\'chaincodePath\'')); - return; - } - if (!chaincodeVersion) { - res.json(getErrorMessage('\'chaincodeVersion\'')); - return; - } - if (!chaincodeType) { - res.json(getErrorMessage('\'chaincodeType\'')); - return; - } - let message = await install.installChaincode(peers, chaincodeName, chaincodePath, chaincodeVersion, chaincodeType, req.username, req.orgname) - res.send(message);}); -// Instantiate chaincode on target peers -app.post('/channels/:channelName/chaincodes', async function(req, res) { - logger.debug('==================== INSTANTIATE CHAINCODE =================='); - var peers = req.body.peers; - var chaincodeName = req.body.chaincodeName; - var chaincodeVersion = req.body.chaincodeVersion; - var channelName = req.params.channelName; - var chaincodeType = req.body.chaincodeType; - var fcn = req.body.fcn; - var args = req.body.args; - logger.debug('peers : ' + peers); - logger.debug('channelName : ' + channelName); - logger.debug('chaincodeName : ' + chaincodeName); - logger.debug('chaincodeVersion : ' + chaincodeVersion); - logger.debug('chaincodeType : ' + chaincodeType); - logger.debug('fcn : ' + fcn); - logger.debug('args : ' + args); - if (!chaincodeName) { - res.json(getErrorMessage('\'chaincodeName\'')); - return; - } - if (!chaincodeVersion) { - res.json(getErrorMessage('\'chaincodeVersion\'')); - return; - } - if (!channelName) { - res.json(getErrorMessage('\'channelName\'')); - return; - } - if (!chaincodeType) { - res.json(getErrorMessage('\'chaincodeType\'')); - return; - } - if (!args) { - res.json(getErrorMessage('\'args\'')); - return; - } - - let message = await instantiate.instantiateChaincode(peers, channelName, chaincodeName, chaincodeVersion, chaincodeType, fcn, args, req.username, req.orgname); - res.send(message); -}); -// Invoke transaction on chaincode on target peers -app.post('/channels/:channelName/chaincodes/:chaincodeName', async function(req, res) { - logger.debug('==================== INVOKE ON CHAINCODE =================='); - var peers = req.body.peers; - var chaincodeName = req.params.chaincodeName; - var channelName = req.params.channelName; - var fcn = req.body.fcn; - var args = req.body.args; - logger.debug('channelName : ' + channelName); - logger.debug('chaincodeName : ' + chaincodeName); - logger.debug('fcn : ' + fcn); - logger.debug('args : ' + args); - if (!chaincodeName) { - res.json(getErrorMessage('\'chaincodeName\'')); - return; - } - if (!channelName) { - res.json(getErrorMessage('\'channelName\'')); - return; - } - if (!fcn) { - res.json(getErrorMessage('\'fcn\'')); - return; - } - if (!args) { - res.json(getErrorMessage('\'args\'')); - return; - } - - let message = await invoke.invokeChaincode(peers, channelName, chaincodeName, fcn, args, req.username, req.orgname); - res.send(message); -}); -// Query on chaincode on target peers -app.get('/channels/:channelName/chaincodes/:chaincodeName', async function(req, res) { - logger.debug('==================== QUERY BY CHAINCODE =================='); - var channelName = req.params.channelName; - var chaincodeName = req.params.chaincodeName; - let args = req.query.args; - let fcn = req.query.fcn; - let peer = req.query.peer; - - logger.debug('channelName : ' + channelName); - logger.debug('chaincodeName : ' + chaincodeName); - logger.debug('fcn : ' + fcn); - logger.debug('args : ' + args); - - if (!chaincodeName) { - res.json(getErrorMessage('\'chaincodeName\'')); - return; - } - if (!channelName) { - res.json(getErrorMessage('\'channelName\'')); - return; - } - if (!fcn) { - res.json(getErrorMessage('\'fcn\'')); - return; - } - if (!args) { - res.json(getErrorMessage('\'args\'')); - return; - } - args = args.replace(/'/g, '"'); - args = JSON.parse(args); - logger.debug(args); - - let message = await query.queryChaincode(peer, channelName, chaincodeName, args, fcn, req.username, req.orgname); - res.send(message); -}); -// Query Get Block by BlockNumber -app.get('/channels/:channelName/blocks/:blockId', async function(req, res) { - logger.debug('==================== GET BLOCK BY NUMBER =================='); - let blockId = req.params.blockId; - let peer = req.query.peer; - logger.debug('channelName : ' + req.params.channelName); - logger.debug('BlockID : ' + blockId); - logger.debug('Peer : ' + peer); - if (!blockId) { - res.json(getErrorMessage('\'blockId\'')); - return; - } - - let message = await query.getBlockByNumber(peer, req.params.channelName, blockId, req.username, req.orgname); - res.send(message); -}); -// Query Get Transaction by Transaction ID -app.get('/channels/:channelName/transactions/:trxnId', async function(req, res) { - logger.debug('================ GET TRANSACTION BY TRANSACTION_ID ======================'); - logger.debug('channelName : ' + req.params.channelName); - let trxnId = req.params.trxnId; - let peer = req.query.peer; - if (!trxnId) { - res.json(getErrorMessage('\'trxnId\'')); - return; - } - - let message = await query.getTransactionByID(peer, req.params.channelName, trxnId, req.username, req.orgname); - res.send(message); -}); -// Query Get Block by Hash -app.get('/channels/:channelName/blocks', async function(req, res) { - logger.debug('================ GET BLOCK BY HASH ======================'); - logger.debug('channelName : ' + req.params.channelName); - let hash = req.query.hash; - let peer = req.query.peer; - if (!hash) { - res.json(getErrorMessage('\'hash\'')); - return; - } - - let message = await query.getBlockByHash(peer, req.params.channelName, hash, req.username, req.orgname); - res.send(message); -}); -//Query for Channel Information -app.get('/channels/:channelName', async function(req, res) { - logger.debug('================ GET CHANNEL INFORMATION ======================'); - logger.debug('channelName : ' + req.params.channelName); - let peer = req.query.peer; - - let message = await query.getChainInfo(peer, req.params.channelName, req.username, req.orgname); - res.send(message); -}); -//Query for Channel instantiated chaincodes -app.get('/channels/:channelName/chaincodes', async function(req, res) { - logger.debug('================ GET INSTANTIATED CHAINCODES ======================'); - logger.debug('channelName : ' + req.params.channelName); - let peer = req.query.peer; - - let message = await query.getInstalledChaincodes(peer, req.params.channelName, 'instantiated', req.username, req.orgname); - res.send(message); -}); -// Query to fetch all Installed/instantiated chaincodes -app.get('/chaincodes', async function(req, res) { - var peer = req.query.peer; - var installType = req.query.type; - logger.debug('================ GET INSTALLED CHAINCODES ======================'); - - let message = await query.getInstalledChaincodes(peer, null, 'installed', req.username, req.orgname) - res.send(message); -}); -// Query to fetch channels -app.get('/channels', async function(req, res) { - logger.debug('================ GET CHANNELS ======================'); - logger.debug('peer: ' + req.query.peer); - var peer = req.query.peer; - if (!peer) { - res.json(getErrorMessage('\'peer\'')); - return; - } - - let message = await query.getChannels(peer, req.username, req.orgname); - res.send(message); -}); diff --git a/balance-transfer/app/create-channel.js b/balance-transfer/app/create-channel.js deleted file mode 100644 index 97494402..00000000 --- a/balance-transfer/app/create-channel.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright 2017 IBM All Rights Reserved. - * - * 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. - */ -var fs = require('fs'); -var path = require('path'); - -var helper = require('./helper.js'); -var logger = helper.getLogger('Create-Channel'); -//Attempt to send a request to the orderer with the sendTransaction method -var createChannel = async function(channelName, channelConfigPath, username, orgName) { - logger.debug('\n====== Creating Channel \'' + channelName + '\' ======\n'); - try { - // first setup the client for this org - var client = await helper.getClientForOrg(orgName); - logger.debug('Successfully got the fabric client for the organization "%s"', orgName); - - // read in the envelope for the channel config raw bytes - var envelope = fs.readFileSync(path.join(__dirname, channelConfigPath)); - // extract the channel config bytes from the envelope to be signed - var channelConfig = client.extractChannelConfig(envelope); - - //Acting as a client in the given organization provided with "orgName" param - // sign the channel config bytes as "endorsement", this is required by - // the orderer's channel creation policy - // this will use the admin identity assigned to the client when the connection profile was loaded - let signature = client.signChannelConfig(channelConfig); - - let request = { - config: channelConfig, - signatures: [signature], - name: channelName, - txId: client.newTransactionID(true) // get an admin based transactionID - }; - - // send to orderer - const result = await client.createChannel(request) - logger.debug(' result ::%j', result); - if (result) { - if (result.status === 'SUCCESS') { - logger.debug('Successfully created the channel.'); - const response = { - success: true, - message: 'Channel \'' + channelName + '\' created Successfully' - }; - return response; - } else { - logger.error('Failed to create the channel. status:' + result.status + ' reason:' + result.info); - const response = { - success: false, - message: 'Channel \'' + channelName + '\' failed to create status:' + result.status + ' reason:' + result.info - }; - return response; - } - } else { - logger.error('\n!!!!!!!!! Failed to create the channel \'' + channelName + - '\' !!!!!!!!!\n\n'); - const response = { - success: false, - message: 'Failed to create the channel \'' + channelName + '\'', - }; - return response; - } - } catch (err) { - logger.error('Failed to initialize the channel: ' + err.stack ? err.stack : err); - throw new Error('Failed to initialize the channel: ' + err.toString()); - } -}; - -exports.createChannel = createChannel; diff --git a/balance-transfer/app/helper.js b/balance-transfer/app/helper.js deleted file mode 100644 index 64896191..00000000 --- a/balance-transfer/app/helper.js +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Copyright 2017 IBM All Rights Reserved. - * - * 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'; -var log4js = require('log4js'); -var logger = log4js.getLogger('Helper'); -logger.setLevel('DEBUG'); - -var path = require('path'); -var util = require('util'); - -var hfc = require('fabric-client'); -hfc.setLogger(logger); - -async function getClientForOrg (userorg, username) { - logger.debug('getClientForOrg - ****** START %s %s', userorg, username) - // get a fabric client loaded with a connection profile for this org - let config = '-connection-profile-path'; - - // build a client context and load it with a connection profile - // lets only load the network settings and save the client for later - let client = hfc.loadFromConfig(hfc.getConfigSetting('network'+config)); - - // This will load a connection profile over the top of the current one one - // since the first one did not have a client section and the following one does - // nothing will actually be replaced. - // This will also set an admin identity because the organization defined in the - // client section has one defined - client.loadFromConfig(hfc.getConfigSetting(userorg+config)); - - // this will create both the state store and the crypto store based - // on the settings in the client section of the connection profile - await client.initCredentialStores(); - - // The getUserContext call tries to get the user from persistence. - // If the user has been saved to persistence then that means the user has - // been registered and enrolled. If the user is found in persistence - // the call will then assign the user to the client object. - if(username) { - let user = await client.getUserContext(username, true); - if(!user) { - throw new Error(util.format('User was not found :', username)); - } else { - logger.debug('User %s was found to be registered and enrolled', username); - } - } - logger.debug('getClientForOrg - ****** END %s %s \n\n', userorg, username) - - return client; -} - -var getRegisteredUser = async function(username, userOrg, isJson) { - try { - var client = await getClientForOrg(userOrg); - logger.debug('Successfully initialized the credential stores'); - // client can now act as an agent for organization Org1 - // first check to see if the user is already enrolled - var user = await client.getUserContext(username, true); - if (user && user.isEnrolled()) { - logger.info('Successfully loaded member from persistence'); - } else { - // user was not enrolled, so we will need an admin user object to register - logger.info('User %s was not enrolled, so we will need an admin user object to register',username); - var admins = hfc.getConfigSetting('admins'); - let adminUserObj = await client.setUserContext({username: admins[0].username, password: admins[0].secret}); - let caClient = client.getCertificateAuthority(); - let secret = await caClient.register({ - enrollmentID: username, - affiliation: userOrg.toLowerCase() + '.department1' - }, adminUserObj); - logger.debug('Successfully got the secret for user %s',username); - user = await client.setUserContext({username:username, password:secret}); - logger.debug('Successfully enrolled username %s and setUserContext on the client object', username); - } - if(user && user.isEnrolled) { - if (isJson && isJson === true) { - var response = { - success: true, - secret: user._enrollmentSecret, - message: username + ' enrolled Successfully', - }; - return response; - } - } else { - throw new Error('User was not enrolled '); - } - } catch(error) { - logger.error('Failed to get registered user: %s with error: %s', username, error.toString()); - return 'failed '+error.toString(); - } - -}; - - -var setupChaincodeDeploy = function() { - process.env.GOPATH = path.join(__dirname, hfc.getConfigSetting('CC_SRC_PATH')); -}; - -var getLogger = function(moduleName) { - var logger = log4js.getLogger(moduleName); - logger.setLevel('DEBUG'); - return logger; -}; - -exports.getClientForOrg = getClientForOrg; -exports.getLogger = getLogger; -exports.setupChaincodeDeploy = setupChaincodeDeploy; -exports.getRegisteredUser = getRegisteredUser; diff --git a/balance-transfer/app/install-chaincode.js b/balance-transfer/app/install-chaincode.js deleted file mode 100644 index ea6c4124..00000000 --- a/balance-transfer/app/install-chaincode.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright 2017 IBM All Rights Reserved. - * - * 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'; -var util = require('util'); -var helper = require('./helper.js'); -var logger = helper.getLogger('install-chaincode'); - -var installChaincode = async function(peers, chaincodeName, chaincodePath, - chaincodeVersion, chaincodeType, username, org_name) { - logger.debug('\n\n============ Install chaincode on organizations ============\n'); - helper.setupChaincodeDeploy(); - let error_message = null; - try { - logger.info('Calling peers in organization "%s" to join the channel', org_name); - - // first setup the client for this org - var client = await helper.getClientForOrg(org_name, username); - logger.debug('Successfully got the fabric client for the organization "%s"', org_name); - - var request = { - targets: peers, - chaincodePath: chaincodePath, - chaincodeId: chaincodeName, - chaincodeVersion: chaincodeVersion, - chaincodeType: chaincodeType - }; - let results = await client.installChaincode(request); - // the returned object has both the endorsement results - // and the actual proposal, the proposal will be needed - // later when we send a transaction to the orederer - var proposalResponses = results[0]; - var proposal = results[1]; - - // lets have a look at the responses to see if they are - // all good, if good they will also include signatures - // required to be committed - for (const i in proposalResponses) { - if (proposalResponses[i] instanceof Error) { - error_message = util.format('install proposal resulted in an error :: %s', proposalResponses[i].toString()); - logger.error(error_message); - } else if (proposalResponses[i].response && proposalResponses[i].response.status === 200) { - logger.info('install proposal was good'); - } else { - all_good = false; - error_message = util.format('install proposal was bad for an unknown reason %j', proposalResponses[i]); - logger.error(error_message); - } - } - } catch(error) { - logger.error('Failed to install due to error: ' + error.stack ? error.stack : error); - error_message = error.toString(); - } - - if (!error_message) { - let message = util.format('Successfully installed chaincode'); - logger.info(message); - // build a response to send back to the REST caller - const response = { - success: true, - message: message - }; - return response; - } else { - let message = util.format('Failed to install due to:%s',error_message); - logger.error(message); - const response = { - success: false, - message: message - }; - return response; - } -}; -exports.installChaincode = installChaincode; diff --git a/balance-transfer/app/instantiate-chaincode.js b/balance-transfer/app/instantiate-chaincode.js deleted file mode 100644 index 022043d7..00000000 --- a/balance-transfer/app/instantiate-chaincode.js +++ /dev/null @@ -1,205 +0,0 @@ -/** - * Copyright 2017 IBM All Rights Reserved. - * - * 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 util = require('util'); -const helper = require('./helper.js'); -const logger = helper.getLogger('instantiate-chaincode'); - -const instantiateChaincode = async function(peers, channelName, chaincodeName, chaincodeVersion, functionName, chaincodeType, args, username, org_name) { - logger.debug('\n\n============ Instantiate chaincode on channel ' + channelName + - ' ============\n'); - let error_message = null; - let client = null; - let channel = null; - try { - // first setup the client for this org - client = await helper.getClientForOrg(org_name, username); - logger.debug('Successfully got the fabric client for the organization "%s"', org_name); - channel = client.getChannel(channelName); - if(!channel) { - let message = util.format('Channel %s was not defined in the connection profile', channelName); - logger.error(message); - throw new Error(message); - } - const tx_id = client.newTransactionID(true); // Get an admin based transactionID - // An admin based transactionID will - // indicate that admin identity should - // be used to sign the proposal request. - // will need the transaction ID string for the event registration later - const deployId = tx_id.getTransactionID(); - - // send proposal to endorser - const request = { - targets : peers, - chaincodeId: chaincodeName, - chaincodeType: chaincodeType, - chaincodeVersion: chaincodeVersion, - args: args, - txId: tx_id, - - // Use this to demonstrate the following policy: - // The policy can be fulfilled when members from both orgs signed. - 'endorsement-policy': { - identities: [ - { role: { name: 'member', mspId: 'Org1MSP' }}, - { role: { name: 'member', mspId: 'Org2MSP' }} - ], - policy: { - '2-of':[{ 'signed-by': 0 }, { 'signed-by': 1 }] - } - } - }; - - if (functionName) - request.fcn = functionName; - - let results = await channel.sendInstantiateProposal(request, 60000); //instantiate takes much longer - - // the returned object has both the endorsement results - // and the actual proposal, the proposal will be needed - // later when we send a transaction to the orderer - const proposalResponses = results[0]; - const proposal = results[1]; - - // look at the responses to see if they are all are good - // response will also include signatures required to be committed - let all_good = true; - for (const i in proposalResponses) { - if (proposalResponses[i] instanceof Error) { - all_good = false; - error_message = util.format('instantiate proposal resulted in an error :: %s', proposalResponses[i].toString()); - logger.error(error_message); - } else if (proposalResponses[i].response && proposalResponses[i].response.status === 200) { - logger.info('instantiate proposal was good'); - } else { - all_good = false; - error_message = util.format('instantiate proposal was bad for an unknown reason %j', proposalResponses[i]); - logger.error(error_message); - } - } - - if (all_good) { - logger.info(util.format( - 'Successfully sent Proposal and received ProposalResponse: Status - %s, message - "%s", metadata - "%s", endorsement signature: %s', - proposalResponses[0].response.status, proposalResponses[0].response.message, - proposalResponses[0].response.payload, proposalResponses[0].endorsement.signature)); - - // wait for the channel-based event hub to tell us that the - // instantiate transaction was committed on the peer - const promises = []; - const event_hubs = channel.getChannelEventHubsForOrg(); - logger.debug('found %s eventhubs for this organization %s',event_hubs.length, org_name); - event_hubs.forEach((eh) => { - let instantiateEventPromise = new Promise((resolve, reject) => { - logger.debug('instantiateEventPromise - setting up event'); - let event_timeout = setTimeout(() => { - let message = 'REQUEST_TIMEOUT:' + eh.getPeerAddr(); - logger.error(message); - eh.disconnect(); - }, 60000); - eh.registerTxEvent(deployId, (tx, code, block_num) => { - logger.info('The chaincode instantiate transaction has been committed on peer %s',eh.getPeerAddr()); - logger.info('Transaction %s has status of %s in blocl %s', tx, code, block_num); - clearTimeout(event_timeout); - - if (code !== 'VALID') { - let message = util.format('The chaincode instantiate transaction was invalid, code:%s',code); - logger.error(message); - reject(new Error(message)); - } else { - let message = 'The chaincode instantiate transaction was valid.'; - logger.info(message); - resolve(message); - } - }, (err) => { - clearTimeout(event_timeout); - logger.error(err); - reject(err); - }, - // the default for 'unregister' is true for transaction listeners - // so no real need to set here, however for 'disconnect' - // the default is false as most event hubs are long running - // in this use case we are using it only once - {unregister: true, disconnect: true} - ); - eh.connect(); - }); - promises.push(instantiateEventPromise); - }); - - const orderer_request = { - txId: tx_id, // must include the transaction id so that the outbound - // transaction to the orderer will be signed by the admin id - // the same as the proposal above, notice that transactionID - // generated above was based on the admin id not the current - // user assigned to the 'client' instance. - proposalResponses: proposalResponses, - proposal: proposal - }; - const sendPromise = channel.sendTransaction(orderer_request); - // put the send to the orderer last so that the events get registered and - // are ready for the orderering and committing - promises.push(sendPromise); - const results = await Promise.all(promises); - logger.debug(util.format('------->>> R E S P O N S E : %j', results)); - const response = results.pop(); // orderer results are last in the results - if (response.status === 'SUCCESS') { - logger.info('Successfully sent transaction to the orderer.'); - } else { - error_message = util.format('Failed to order the transaction. Error code: %s',response.status); - logger.debug(error_message); - } - - // now see what each of the event hubs reported - for(const i in results) { - const event_hub_result = results[i]; - const event_hub = event_hubs[i]; - logger.debug('Event results for event hub :%s',event_hub.getPeerAddr()); - if(typeof event_hub_result === 'string') { - logger.debug(event_hub_result); - } else { - if(!error_message) error_message = event_hub_result.toString(); - logger.debug(event_hub_result.toString()); - } - } - } - } catch (error) { - logger.error('Failed to send instantiate due to error: ' + error.stack ? error.stack : error); - error_message = error.toString(); - } finally { - if (channel) { - channel.close(); - } - } - - let success = true; - let message = util.format('Successfully instantiate chaincode in organization %s to the channel \'%s\'', org_name, channelName); - if (error_message) { - message = util.format('Failed to instantiate the chaincode. cause:%s',error_message); - success = false; - logger.error(message); - } else { - logger.info(message); - } - - // build a response to send back to the REST caller - const response = { - success: success, - message: message - }; - return response; -}; -exports.instantiateChaincode = instantiateChaincode; diff --git a/balance-transfer/app/invoke-transaction.js b/balance-transfer/app/invoke-transaction.js deleted file mode 100644 index 5cb26480..00000000 --- a/balance-transfer/app/invoke-transaction.js +++ /dev/null @@ -1,185 +0,0 @@ -/** - * Copyright 2017 IBM All Rights Reserved. - * - * 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 util = require('util'); -const helper = require('./helper.js'); -const logger = helper.getLogger('invoke-chaincode'); - -const invokeChaincode = async function(peerNames, channelName, chaincodeName, fcn, args, username, org_name) { - logger.debug(util.format('\n============ invoke transaction on channel %s ============\n', channelName)); - let error_message = null; - let tx_id_string = null; - let client = null; - let channel = null; - try { - // first setup the client for this org - client = await helper.getClientForOrg(org_name, username); - logger.debug('Successfully got the fabric client for the organization "%s"', org_name); - channel = client.getChannel(channelName); - if(!channel) { - let message = util.format('Channel %s was not defined in the connection profile', channelName); - logger.error(message); - throw new Error(message); - } - const tx_id = client.newTransactionID(); - // will need the transaction ID string for the event registration later - tx_id_string = tx_id.getTransactionID(); - - // send proposal to endorser - const request = { - targets: peerNames, - chaincodeId: chaincodeName, - fcn: fcn, - args: args, - chainId: channelName, - txId: tx_id - }; - - let results = await channel.sendTransactionProposal(request); - - // the returned object has both the endorsement results - // and the actual proposal, the proposal will be needed - // later when we send a transaction to the orderer - const proposalResponses = results[0]; - const proposal = results[1]; - - // look at the responses to see if they are all are good - // response will also include signatures required to be committed - let all_good = true; - for (const i in proposalResponses) { - if (proposalResponses[i] instanceof Error) { - all_good = false; - error_message = util.format('invoke chaincode proposal resulted in an error :: %s', proposalResponses[i].toString()); - logger.error(error_message); - } else if (proposalResponses[i].response && proposalResponses[i].response.status === 200) { - logger.info('invoke chaincode proposal was good'); - } else { - all_good = false; - error_message = util.format('invoke chaincode proposal failed for an unknown reason %j', proposalResponses[i]); - logger.error(error_message); - } - } - - if (all_good) { - logger.info(util.format( - 'Successfully sent Proposal and received ProposalResponse: Status - %s, message - "%s", metadata - "%s", endorsement signature: %s', - proposalResponses[0].response.status, proposalResponses[0].response.message, - proposalResponses[0].response.payload, proposalResponses[0].endorsement.signature)); - - // wait for the channel-based event hub to tell us - // that the commit was good or bad on each peer in our organization - const promises = []; - let event_hubs = channel.getChannelEventHubsForOrg(); - event_hubs.forEach((eh) => { - logger.debug('invokeEventPromise - setting up event'); - let invokeEventPromise = new Promise((resolve, reject) => { - let event_timeout = setTimeout(() => { - let message = 'REQUEST_TIMEOUT:' + eh.getPeerAddr(); - logger.error(message); - eh.disconnect(); - }, 3000); - eh.registerTxEvent(tx_id_string, (tx, code, block_num) => { - logger.info('The chaincode invoke chaincode transaction has been committed on peer %s',eh.getPeerAddr()); - logger.info('Transaction %s has status of %s in blocl %s', tx, code, block_num); - clearTimeout(event_timeout); - - if (code !== 'VALID') { - let message = util.format('The invoke chaincode transaction was invalid, code:%s',code); - logger.error(message); - reject(new Error(message)); - } else { - let message = 'The invoke chaincode transaction was valid.'; - logger.info(message); - resolve(message); - } - }, (err) => { - clearTimeout(event_timeout); - logger.error(err); - reject(err); - }, - // the default for 'unregister' is true for transaction listeners - // so no real need to set here, however for 'disconnect' - // the default is false as most event hubs are long running - // in this use case we are using it only once - {unregister: true, disconnect: true} - ); - eh.connect(); - }); - promises.push(invokeEventPromise); - }); - - const orderer_request = { - txId: tx_id, - proposalResponses: proposalResponses, - proposal: proposal - }; - const sendPromise = channel.sendTransaction(orderer_request); - // put the send to the orderer last so that the events get registered and - // are ready for the orderering and committing - promises.push(sendPromise); - let results = await Promise.all(promises); - logger.debug(util.format('------->>> R E S P O N S E : %j', results)); - let response = results.pop(); // orderer results are last in the results - if (response.status === 'SUCCESS') { - logger.info('Successfully sent transaction to the orderer.'); - } else { - error_message = util.format('Failed to order the transaction. Error code: %s',response.status); - logger.debug(error_message); - } - - // now see what each of the event hubs reported - for(let i in results) { - let event_hub_result = results[i]; - let event_hub = event_hubs[i]; - logger.debug('Event results for event hub :%s',event_hub.getPeerAddr()); - if(typeof event_hub_result === 'string') { - logger.debug(event_hub_result); - } else { - if(!error_message) error_message = event_hub_result.toString(); - logger.debug(event_hub_result.toString()); - } - } - } - } catch (error) { - logger.error('Failed to invoke due to error: ' + error.stack ? error.stack : error); - error_message = error.toString(); - } finally { - if (channel) { - channel.close(); - } - } - - let success = true; - let message = util.format( - 'Successfully invoked the chaincode %s to the channel \'%s\' for transaction ID: %s', - org_name, channelName, tx_id_string); - if (error_message) { - message = util.format('Failed to invoke chaincode. cause:%s',error_message); - success = false; - logger.error(message); - } else { - logger.info(message); - } - - // build a response to send back to the REST caller - const response = { - success: success, - message: message - }; - return response; -}; - -exports.invokeChaincode = invokeChaincode; diff --git a/balance-transfer/app/join-channel.js b/balance-transfer/app/join-channel.js deleted file mode 100644 index c050f748..00000000 --- a/balance-transfer/app/join-channel.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright 2017 IBM All Rights Reserved. - * - * 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. - */ -var util = require('util'); - -var helper = require('./helper.js'); -var logger = helper.getLogger('Join-Channel'); - -/* - * Have an organization join a channel - */ -var joinChannel = async function(channel_name, peers, username, org_name) { - logger.debug('\n\n============ Join Channel start ============\n') - var error_message = null; - var all_eventhubs = []; - try { - logger.info('Calling peers in organization "%s" to join the channel', org_name); - - // first setup the client for this org - var client = await helper.getClientForOrg(org_name, username); - logger.debug('Successfully got the fabric client for the organization "%s"', org_name); - var channel = client.getChannel(channel_name); - if(!channel) { - let message = util.format('Channel %s was not defined in the connection profile', channel_name); - logger.error(message); - throw new Error(message); - } - - // next step is to get the genesis_block from the orderer, - // the starting point for the channel that we want to join - let request = { - txId : client.newTransactionID(true) //get an admin based transactionID - }; - let genesis_block = await channel.getGenesisBlock(request); - - // tell each peer to join and wait 10 seconds - // for the channel to be created on each peer - var promises = []; - promises.push(new Promise(resolve => setTimeout(resolve, 10000))); - - let join_request = { - targets: peers, //using the peer names which only is allowed when a connection profile is loaded - txId: client.newTransactionID(true), //get an admin based transactionID - block: genesis_block - }; - let join_promise = channel.joinChannel(join_request); - promises.push(join_promise); - let results = await Promise.all(promises); - logger.debug(util.format('Join Channel R E S P O N S E : %j', results)); - - // lets check the results of sending to the peers which is - // last in the results array - let peers_results = results.pop(); - // then each peer results - for(let i in peers_results) { - let peer_result = peers_results[i]; - if (peer_result instanceof Error) { - error_message = util.format('Failed to join peer to the channel with error :: %s', peer_result.toString()); - logger.error(error_message); - } else if(peer_result.response && peer_result.response.status == 200) { - logger.info('Successfully joined peer to the channel %s',channel_name); - } else { - error_message = util.format('Failed to join peer to the channel %s',channel_name); - logger.error(error_message); - } - } - } catch(error) { - logger.error('Failed to join channel due to error: ' + error.stack ? error.stack : error); - error_message = error.toString(); - } - - // need to shutdown open event streams - all_eventhubs.forEach((eh) => { - eh.disconnect(); - }); - - if (!error_message) { - let message = util.format( - 'Successfully joined peers in organization %s to the channel:%s', - org_name, channel_name); - logger.info(message); - // build a response to send back to the REST caller - const response = { - success: true, - message: message - }; - return response; - } else { - let message = util.format('Failed to join all peers to channel. cause:%s',error_message); - logger.error(message); - // build a response to send back to the REST caller - const response = { - success: false, - message: message - }; - return response; - } -}; -exports.joinChannel = joinChannel; diff --git a/balance-transfer/app/query.js b/balance-transfer/app/query.js deleted file mode 100644 index a0d3b055..00000000 --- a/balance-transfer/app/query.js +++ /dev/null @@ -1,237 +0,0 @@ -/** - * Copyright 2017 IBM All Rights Reserved. - * - * 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. - */ -var util = require('util'); -var helper = require('./helper.js'); -var logger = helper.getLogger('Query'); - -var queryChaincode = async function(peer, channelName, chaincodeName, args, fcn, username, org_name) { - let client = null; - let channel = null; - try { - // first setup the client for this org - client = await helper.getClientForOrg(org_name, username); - logger.debug('Successfully got the fabric client for the organization "%s"', org_name); - channel = client.getChannel(channelName); - if(!channel) { - let message = util.format('Channel %s was not defined in the connection profile', channelName); - logger.error(message); - throw new Error(message); - } - - // send query - var request = { - targets : [peer], //queryByChaincode allows for multiple targets - chaincodeId: chaincodeName, - fcn: fcn, - args: args - }; - let response_payloads = await channel.queryByChaincode(request); - if (response_payloads) { - for (let i = 0; i < response_payloads.length; i++) { - logger.info(args[0]+' now has ' + response_payloads[i].toString('utf8') + - ' after the move'); - } - return args[0]+' now has ' + response_payloads[0].toString('utf8') + - ' after the move'; - } else { - logger.error('response_payloads is null'); - return 'response_payloads is null'; - } - } catch(error) { - logger.error('Failed to query due to error: ' + error.stack ? error.stack : error); - return error.toString(); - } finally { - if (channel) { - channel.close(); - } - } -}; -var getBlockByNumber = async function(peer, channelName, blockNumber, username, org_name) { - try { - // first setup the client for this org - var client = await helper.getClientForOrg(org_name, username); - logger.debug('Successfully got the fabric client for the organization "%s"', org_name); - var channel = client.getChannel(channelName); - if(!channel) { - let message = util.format('Channel %s was not defined in the connection profile', channelName); - logger.error(message); - throw new Error(message); - } - - let response_payload = await channel.queryBlock(parseInt(blockNumber, peer)); - if (response_payload) { - logger.debug(response_payload); - return response_payload; - } else { - logger.error('response_payload is null'); - return 'response_payload is null'; - } - } catch(error) { - logger.error('Failed to query due to error: ' + error.stack ? error.stack : error); - return error.toString(); - } -}; -var getTransactionByID = async function(peer, channelName, trxnID, username, org_name) { - try { - // first setup the client for this org - var client = await helper.getClientForOrg(org_name, username); - logger.debug('Successfully got the fabric client for the organization "%s"', org_name); - var channel = client.getChannel(channelName); - if(!channel) { - let message = util.format('Channel %s was not defined in the connection profile', channelName); - logger.error(message); - throw new Error(message); - } - - let response_payload = await channel.queryTransaction(trxnID, peer); - if (response_payload) { - logger.debug(response_payload); - return response_payload; - } else { - logger.error('response_payload is null'); - return 'response_payload is null'; - } - } catch(error) { - logger.error('Failed to query due to error: ' + error.stack ? error.stack : error); - return error.toString(); - } -}; -var getBlockByHash = async function(peer, channelName, hash, username, org_name) { - try { - // first setup the client for this org - var client = await helper.getClientForOrg(org_name, username); - logger.debug('Successfully got the fabric client for the organization "%s"', org_name); - var channel = client.getChannel(channelName); - if(!channel) { - let message = util.format('Channel %s was not defined in the connection profile', channelName); - logger.error(message); - throw new Error(message); - } - - let response_payload = await channel.queryBlockByHash(Buffer.from(hash,'hex'), peer); - if (response_payload) { - logger.debug(response_payload); - return response_payload; - } else { - logger.error('response_payload is null'); - return 'response_payload is null'; - } - } catch(error) { - logger.error('Failed to query due to error: ' + error.stack ? error.stack : error); - return error.toString(); - } -}; -var getChainInfo = async function(peer, channelName, username, org_name) { - try { - // first setup the client for this org - var client = await helper.getClientForOrg(org_name, username); - logger.debug('Successfully got the fabric client for the organization "%s"', org_name); - var channel = client.getChannel(channelName); - if(!channel) { - let message = util.format('Channel %s was not defined in the connection profile', channelName); - logger.error(message); - throw new Error(message); - } - - let response_payload = await channel.queryInfo(peer); - if (response_payload) { - logger.debug(response_payload); - return response_payload; - } else { - logger.error('response_payload is null'); - return 'response_payload is null'; - } - } catch(error) { - logger.error('Failed to query due to error: ' + error.stack ? error.stack : error); - return error.toString(); - } -}; -//getInstalledChaincodes -var getInstalledChaincodes = async function(peer, channelName, type, username, org_name) { - try { - // first setup the client for this org - var client = await helper.getClientForOrg(org_name, username); - logger.debug('Successfully got the fabric client for the organization "%s"', org_name); - - let response = null - if (type === 'installed') { - response = await client.queryInstalledChaincodes(peer, true); //use the admin identity - } else { - var channel = client.getChannel(channelName); - if(!channel) { - let message = util.format('Channel %s was not defined in the connection profile', channelName); - logger.error(message); - throw new Error(message); - } - response = await channel.queryInstantiatedChaincodes(peer, true); //use the admin identity - } - if (response) { - if (type === 'installed') { - logger.debug('<<< Installed Chaincodes >>>'); - } else { - logger.debug('<<< Instantiated Chaincodes >>>'); - } - var details = []; - for (let i = 0; i < response.chaincodes.length; i++) { - logger.debug('name: ' + response.chaincodes[i].name + ', version: ' + - response.chaincodes[i].version + ', path: ' + response.chaincodes[i].path - ); - details.push('name: ' + response.chaincodes[i].name + ', version: ' + - response.chaincodes[i].version + ', path: ' + response.chaincodes[i].path - ); - } - return details; - } else { - logger.error('response is null'); - return 'response is null'; - } - } catch(error) { - logger.error('Failed to query due to error: ' + error.stack ? error.stack : error); - return error.toString(); - } -}; -var getChannels = async function(peer, username, org_name) { - try { - // first setup the client for this org - var client = await helper.getClientForOrg(org_name, username); - logger.debug('Successfully got the fabric client for the organization "%s"', org_name); - - let response = await client.queryChannels(peer); - if (response) { - logger.debug('<<< channels >>>'); - var channelNames = []; - for (let i = 0; i < response.channels.length; i++) { - channelNames.push('channel id: ' + response.channels[i].channel_id); - } - logger.debug(channelNames); - return response; - } else { - logger.error('response_payloads is null'); - return 'response_payloads is null'; - } - } catch(error) { - logger.error('Failed to query due to error: ' + error.stack ? error.stack : error); - return error.toString(); - } -}; - -exports.queryChaincode = queryChaincode; -exports.getBlockByNumber = getBlockByNumber; -exports.getTransactionByID = getTransactionByID; -exports.getBlockByHash = getBlockByHash; -exports.getChainInfo = getChainInfo; -exports.getInstalledChaincodes = getInstalledChaincodes; -exports.getChannels = getChannels; diff --git a/balance-transfer/app/update-anchor-peers.js b/balance-transfer/app/update-anchor-peers.js deleted file mode 100644 index da59ece9..00000000 --- a/balance-transfer/app/update-anchor-peers.js +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright Hitachi America, Ltd. All Rights Reserved. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -'use strict'; -var util = require('util'); -var fs = require('fs'); -var path = require('path'); - -var helper = require('./helper.js'); -var logger = helper.getLogger('update-anchor-peers'); - -var updateAnchorPeers = async function(channelName, configUpdatePath, username, org_name) { - logger.debug('\n====== Updating Anchor Peers on \'' + channelName + '\' ======\n'); - var error_message = null; - try { - // first setup the client for this org - var client = await helper.getClientForOrg(org_name, username); - logger.debug('Successfully got the fabric client for the organization "%s"', org_name); - var channel = client.getChannel(channelName); - if(!channel) { - let message = util.format('Channel %s was not defined in the connection profile', channelName); - logger.error(message); - throw new Error(message); - } - - // read in the envelope for the channel config raw bytes - var envelope = fs.readFileSync(path.join(__dirname, configUpdatePath)); - // extract the channel config bytes from the envelope to be signed - var channelConfig = client.extractChannelConfig(envelope); - - //Acting as a client in the given organization provided with "orgName" param - // sign the channel config bytes as "endorsement", this is required by - // the orderer's channel creation policy - // this will use the admin identity assigned to the client when the connection profile was loaded - let signature = client.signChannelConfig(channelConfig); - - let request = { - config: channelConfig, - signatures: [signature], - name: channelName, - txId: client.newTransactionID(true) // get an admin based transactionID - }; - - var promises = []; - let event_hubs = channel.getChannelEventHubsForOrg(); - logger.debug('found %s eventhubs for this organization %s',event_hubs.length, org_name); - event_hubs.forEach((eh) => { - let anchorUpdateEventPromise = new Promise((resolve, reject) => { - logger.debug('anchorUpdateEventPromise - setting up event'); - const event_timeout = setTimeout(() => { - let message = 'REQUEST_TIMEOUT:' + eh.getPeerAddr(); - logger.error(message); - eh.disconnect(); - }, 60000); - eh.registerBlockEvent((block) => { - logger.info('The config update has been committed on peer %s',eh.getPeerAddr()); - clearTimeout(event_timeout); - resolve(); - }, (err) => { - clearTimeout(event_timeout); - logger.error(err); - reject(err); - }, - // the default for 'unregister' is true for block listeners - // so no real need to set here, however for 'disconnect' - // the default is false as most event hubs are long running - // in this use case we are using it only once - {unregister: true, disconnect: true} - ); - eh.connect(); - }); - promises.push(anchorUpdateEventPromise); - }); - - var sendPromise = client.updateChannel(request); - // put the send to the orderer last so that the events get registered and - // are ready for the orderering and committing - promises.push(sendPromise); - let results = await Promise.all(promises); - logger.debug(util.format('------->>> R E S P O N S E : %j', results)); - let response = results.pop(); // orderer results are last in the results - - if (response) { - if (response.status === 'SUCCESS') { - logger.info('Successfully update anchor peers to the channel %s', channelName); - } else { - error_message = util.format('Failed to update anchor peers to the channel %s with status: %s reason: %s', channelName, response.status, response.info); - logger.error(error_message); - } - } else { - error_message = util.format('Failed to update anchor peers to the channel %s', channelName); - logger.error(error_message); - } - } catch (error) { - logger.error('Failed to update anchor peers due to error: ' + error.stack ? error.stack : error); - error_message = error.toString(); - } - - if (!error_message) { - let message = util.format( - 'Successfully update anchor peers in organization %s to the channel \'%s\'', - org_name, channelName); - logger.info(message); - const response = { - success: true, - message: message - }; - return response; - } else { - let message = util.format('Failed to update anchor peers. cause:%s',error_message); - logger.error(message); - const response = { - success: false, - message: message - }; - return response; - } -}; - -exports.updateAnchorPeers = updateAnchorPeers; diff --git a/balance-transfer/artifacts/base.yaml b/balance-transfer/artifacts/base.yaml deleted file mode 100644 index 35027d7f..00000000 --- a/balance-transfer/artifacts/base.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -version: '2' -services: - peer-base: - image: hyperledger/fabric-peer - environment: - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - # the following setting starts chaincode containers on the same - # bridge network as the peers - # https://docs.docker.com/compose/networking/ - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=artifacts_default - - FABRIC_LOGGING_SPEC=DEBUG - - CORE_PEER_GOSSIP_USELEADERELECTION=true - - CORE_PEER_GOSSIP_ORGLEADER=false - # The following setting skips the gossip handshake since we are - # are not doing mutual TLS - - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/crypto/peer/msp - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/crypto/peer/tls/server.key - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/crypto/peer/tls/server.crt - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/crypto/peer/tls/ca.crt - working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer - command: peer node start - volumes: - - /var/run/:/host/var/run/ diff --git a/balance-transfer/artifacts/channel/Org1MSPanchors.tx b/balance-transfer/artifacts/channel/Org1MSPanchors.tx deleted file mode 100644 index 104ee50e..00000000 Binary files a/balance-transfer/artifacts/channel/Org1MSPanchors.tx and /dev/null differ diff --git a/balance-transfer/artifacts/channel/Org2MSPanchors.tx b/balance-transfer/artifacts/channel/Org2MSPanchors.tx deleted file mode 100644 index eaaf1d7f..00000000 Binary files a/balance-transfer/artifacts/channel/Org2MSPanchors.tx and /dev/null differ diff --git a/balance-transfer/artifacts/channel/configtx.yaml b/balance-transfer/artifacts/channel/configtx.yaml deleted file mode 100644 index 98f5cb72..00000000 --- a/balance-transfer/artifacts/channel/configtx.yaml +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - ---- -################################################################################ -# -# Section: Organizations -# -# - This section defines the different organizational identities which will -# be referenced later in the configuration. -# -################################################################################ -Organizations: - - # SampleOrg defines an MSP using the sampleconfig. It should never be used - # in production but may be used as a template for other definitions - - &OrdererOrg - # DefaultOrg defines the organization which is used in the sampleconfig - # of the fabric.git development environment - Name: OrdererMSP - - # ID to load the MSP definition as - ID: OrdererMSP - - # MSPDir is the filesystem path which contains the MSP configuration - MSPDir: crypto-config/ordererOrganizations/example.com/msp - - - &Org1 - # DefaultOrg defines the organization which is used in the sampleconfig - # of the fabric.git development environment - Name: Org1MSP - - # ID to load the MSP definition as - ID: Org1MSP - - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - - AnchorPeers: - # AnchorPeers defines the location of peers which can be used - # for cross org gossip communication. Note, this value is only - # encoded in the genesis block in the Application section context - - Host: peer0.org1.example.com - Port: 7051 - - - &Org2 - # DefaultOrg defines the organization which is used in the sampleconfig - # of the fabric.git development environment - Name: Org2MSP - - # ID to load the MSP definition as - ID: Org2MSP - - MSPDir: crypto-config/peerOrganizations/org2.example.com/msp - - AnchorPeers: - # AnchorPeers defines the location of peers which can be used - # for cross org gossip communication. Note, this value is only - # encoded in the genesis block in the Application section context - - Host: peer0.org2.example.com - Port: 7051 - -################################################################################ -# -# SECTION: Application -# -# - This section defines the values to encode into a config transaction or -# genesis block for application related parameters -# -################################################################################ -Application: &ApplicationDefaults - - # Organizations is the list of orgs which are defined as participants on - # the application side of the network - Organizations: - -################################################################################ -# -# SECTION: Orderer -# -# - This section defines the values to encode into a config transaction or -# genesis block for orderer related parameters -# -################################################################################ -Orderer: &OrdererDefaults - - # Orderer Type: The orderer implementation to start - # Available types are "solo" and "kafka" - OrdererType: solo - - Addresses: - - orderer.example.com:7050 - - # Batch Timeout: The amount of time to wait before creating a batch - BatchTimeout: 2s - - # Batch Size: Controls the number of messages batched into a block - BatchSize: - - # Max Message Count: The maximum number of messages to permit in a batch - MaxMessageCount: 10 - - # Absolute Max Bytes: The absolute maximum number of bytes allowed for - # the serialized messages in a batch. - AbsoluteMaxBytes: 98 MB - - # Preferred Max Bytes: The preferred maximum number of bytes allowed for - # the serialized messages in a batch. A message larger than the preferred - # max bytes will result in a batch larger than preferred max bytes. - PreferredMaxBytes: 512 KB - - Kafka: - # Brokers: A list of Kafka brokers to which the orderer connects - # NOTE: Use IP:port notation - Brokers: - - 127.0.0.1:9092 - - # Organizations is the list of orgs which are defined as participants on - # the orderer side of the network - Organizations: - -################################################################################ -# -# Profile -# -# - Different configuration profiles may be encoded here to be specified -# as parameters to the configtxgen tool -# -################################################################################ -Profiles: - - TwoOrgsOrdererGenesis: - Orderer: - <<: *OrdererDefaults - Organizations: - - *OrdererOrg - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - - *Org2 - TwoOrgsChannel: - Consortium: SampleConsortium - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 - - *Org2 diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/ca/0d46ccf0e9436c1bc3b6e2bf80cdb202c4943604f95c72ee0ff839d3ec300719_sk b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/ca/0d46ccf0e9436c1bc3b6e2bf80cdb202c4943604f95c72ee0ff839d3ec300719_sk deleted file mode 100755 index 6e2c4c3d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/ca/0d46ccf0e9436c1bc3b6e2bf80cdb202c4943604f95c72ee0ff839d3ec300719_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg9pRJ4Y87tn+vE1fU -uAGVg5OOGwHYlqBuvAOvy0Z+mEChRANCAAQyw4A26b4ouKj0TxbF3mM4I51vDLZ2 -clA+fdrYJwZcI9F/lLmpu+oEd/XXdQn/ELzEsgeCi9xdThVYmeXJ/53K ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/ca/ca.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/ca/ca.example.com-cert.pem deleted file mode 100644 index e83e629e..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/ca/ca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICLjCCAdWgAwIBAgIQCeSxIA/5bBc/893OreC2kzAKBggqhkjOPQQDAjBpMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w -bGUuY29tMB4XDTE3MDYyMzEyMzMxOVoXDTI3MDYyMTEyMzMxOVowaTELMAkGA1UE -BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz -Y28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABDLDgDbpvii4qPRPFsXeYzgjnW8M -tnZyUD592tgnBlwj0X+Uuam76gR39dd1Cf8QvMSyB4KL3F1OFViZ5cn/ncqjXzBd -MA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMB -Af8wKQYDVR0OBCIEIA1GzPDpQ2wbw7biv4DNsgLElDYE+Vxy7g/4OdPsMAcZMAoG -CCqGSM49BAMCA0cAMEQCICXp7cNAHK6RQOFxE8Gpqy1B/FuLbmtYNqqBo5e1Pgly -AiAWH23pmnXngcjLHg3nGwa3oUlCyPD64ilFoCMdN9TRVg== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/msp/admincerts/Admin@example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/msp/admincerts/Admin@example.com-cert.pem deleted file mode 100644 index 4a1dbfa9..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/msp/admincerts/Admin@example.com-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICCjCCAbGgAwIBAgIRANPhTyHWZkTenKfX4eBv0ZUwCgYIKoZIzj0EAwIwaTEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFt -cGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMFYxCzAJBgNV -BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp -c2NvMRowGAYDVQQDDBFBZG1pbkBleGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqG -SM49AwEHA0IABKAyu7N4S2ZPQSzsAVF/mwwCewuu++MtfcMmUdeoIPFRBj1JMCnf -f88M0wj13gQSJQ6GfnUrT76G/L5fGxCUifWjTTBLMA4GA1UdDwEB/wQEAwIHgDAM -BgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIA1GzPDpQ2wbw7biv4DNsgLElDYE+Vxy -7g/4OdPsMAcZMAoGCCqGSM49BAMCA0cAMEQCIEdiGFLzeGMvVNubuZ3iuvRp/Pp6 -im3FmABwIbnMarabAiBIHWzz8Yxh9K5ZNkVNZX3fLZ4LlzsKBinbWH9J2wblDg== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/msp/cacerts/ca.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/msp/cacerts/ca.example.com-cert.pem deleted file mode 100644 index e83e629e..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/msp/cacerts/ca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICLjCCAdWgAwIBAgIQCeSxIA/5bBc/893OreC2kzAKBggqhkjOPQQDAjBpMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w -bGUuY29tMB4XDTE3MDYyMzEyMzMxOVoXDTI3MDYyMTEyMzMxOVowaTELMAkGA1UE -BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz -Y28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABDLDgDbpvii4qPRPFsXeYzgjnW8M -tnZyUD592tgnBlwj0X+Uuam76gR39dd1Cf8QvMSyB4KL3F1OFViZ5cn/ncqjXzBd -MA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMB -Af8wKQYDVR0OBCIEIA1GzPDpQ2wbw7biv4DNsgLElDYE+Vxy7g/4OdPsMAcZMAoG -CCqGSM49BAMCA0cAMEQCICXp7cNAHK6RQOFxE8Gpqy1B/FuLbmtYNqqBo5e1Pgly -AiAWH23pmnXngcjLHg3nGwa3oUlCyPD64ilFoCMdN9TRVg== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem deleted file mode 100644 index 88a1e69d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNTCCAdygAwIBAgIRAN1F77OjzDmyWCzGuLyXHI8wCgYIKoZIzj0EAwIwbDEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5l -eGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMGwxCzAJ -BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJh -bmNpc2NvMRQwEgYDVQQKEwtleGFtcGxlLmNvbTEaMBgGA1UEAxMRdGxzY2EuZXhh -bXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQkmbjr/9EK0m/4CpR6 -DiM+Eyke3vxPX+IhL+utTRt/qYz2q0UT9wem0xgRVqyWp4vN35ur7aSI+dALKBFT -RWPwo18wXTAOBgNVHQ8BAf8EBAMCAaYwDwYDVR0lBAgwBgYEVR0lADAPBgNVHRMB -Af8EBTADAQH/MCkGA1UdDgQiBCBqIR7RiIC02zhngxyXeAmQJxO44yGlq1XswQTa -/C7sSTAKBggqhkjOPQQDAgNHADBEAiBSxokO+9hHG+FpYikoNpcma4AK6N1KI2B6 -WqI5xNyF4gIgIQx8Q6p6ynDfUGDJ43uTHPzwlt+o8gQ3A5w07L70ml0= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/admincerts/Admin@example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/admincerts/Admin@example.com-cert.pem deleted file mode 100644 index 4a1dbfa9..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/admincerts/Admin@example.com-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICCjCCAbGgAwIBAgIRANPhTyHWZkTenKfX4eBv0ZUwCgYIKoZIzj0EAwIwaTEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFt -cGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMFYxCzAJBgNV -BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp -c2NvMRowGAYDVQQDDBFBZG1pbkBleGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqG -SM49AwEHA0IABKAyu7N4S2ZPQSzsAVF/mwwCewuu++MtfcMmUdeoIPFRBj1JMCnf -f88M0wj13gQSJQ6GfnUrT76G/L5fGxCUifWjTTBLMA4GA1UdDwEB/wQEAwIHgDAM -BgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIA1GzPDpQ2wbw7biv4DNsgLElDYE+Vxy -7g/4OdPsMAcZMAoGCCqGSM49BAMCA0cAMEQCIEdiGFLzeGMvVNubuZ3iuvRp/Pp6 -im3FmABwIbnMarabAiBIHWzz8Yxh9K5ZNkVNZX3fLZ4LlzsKBinbWH9J2wblDg== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/cacerts/ca.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/cacerts/ca.example.com-cert.pem deleted file mode 100644 index e83e629e..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/cacerts/ca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICLjCCAdWgAwIBAgIQCeSxIA/5bBc/893OreC2kzAKBggqhkjOPQQDAjBpMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w -bGUuY29tMB4XDTE3MDYyMzEyMzMxOVoXDTI3MDYyMTEyMzMxOVowaTELMAkGA1UE -BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz -Y28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABDLDgDbpvii4qPRPFsXeYzgjnW8M -tnZyUD592tgnBlwj0X+Uuam76gR39dd1Cf8QvMSyB4KL3F1OFViZ5cn/ncqjXzBd -MA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMB -Af8wKQYDVR0OBCIEIA1GzPDpQ2wbw7biv4DNsgLElDYE+Vxy7g/4OdPsMAcZMAoG -CCqGSM49BAMCA0cAMEQCICXp7cNAHK6RQOFxE8Gpqy1B/FuLbmtYNqqBo5e1Pgly -AiAWH23pmnXngcjLHg3nGwa3oUlCyPD64ilFoCMdN9TRVg== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/keystore/2fb065725bf1b7e2811c0e8ca8d37f5a951fc4cd1162a47aad8accf9ddd10291_sk b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/keystore/2fb065725bf1b7e2811c0e8ca8d37f5a951fc4cd1162a47aad8accf9ddd10291_sk deleted file mode 100755 index 403d8e5e..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/keystore/2fb065725bf1b7e2811c0e8ca8d37f5a951fc4cd1162a47aad8accf9ddd10291_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgc4TjL7yNIkRpowuC -Y0uEEkzJraTtTM380wlyrRoVs96hRANCAARi2C4soUEstzRVLDI8ccc17vocfvWg -5crrC6fxj/m+0xrA9n9ZOb+8FVRZ182XNz14DbxpfHrMEAHyJGbXoR5T ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/signcerts/orderer.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/signcerts/orderer.example.com-cert.pem deleted file mode 100644 index 0fb71451..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/signcerts/orderer.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICDTCCAbOgAwIBAgIRALFafJiTFN/47AvAGfvj1ZEwCgYIKoZIzj0EAwIwaTEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFt -cGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMFgxCzAJBgNV -BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp -c2NvMRwwGgYDVQQDExNvcmRlcmVyLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYI -KoZIzj0DAQcDQgAEYtguLKFBLLc0VSwyPHHHNe76HH71oOXK6wun8Y/5vtMawPZ/ -WTm/vBVUWdfNlzc9eA28aXx6zBAB8iRm16EeU6NNMEswDgYDVR0PAQH/BAQDAgeA -MAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDUbM8OlDbBvDtuK/gM2yAsSUNgT5 -XHLuD/g50+wwBxkwCgYIKoZIzj0EAwIDSAAwRQIhANJuEGHBftrtlWgie9zgc60J -/XVytPN/D0rPlkMV17n7AiBBbStggGBfFYcQ2LhDhcKut8nScJ2OFrt+dJSdJbod -7A== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem deleted file mode 100644 index 88a1e69d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNTCCAdygAwIBAgIRAN1F77OjzDmyWCzGuLyXHI8wCgYIKoZIzj0EAwIwbDEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5l -eGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMGwxCzAJ -BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJh -bmNpc2NvMRQwEgYDVQQKEwtleGFtcGxlLmNvbTEaMBgGA1UEAxMRdGxzY2EuZXhh -bXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQkmbjr/9EK0m/4CpR6 -DiM+Eyke3vxPX+IhL+utTRt/qYz2q0UT9wem0xgRVqyWp4vN35ur7aSI+dALKBFT -RWPwo18wXTAOBgNVHQ8BAf8EBAMCAaYwDwYDVR0lBAgwBgYEVR0lADAPBgNVHRMB -Af8EBTADAQH/MCkGA1UdDgQiBCBqIR7RiIC02zhngxyXeAmQJxO44yGlq1XswQTa -/C7sSTAKBggqhkjOPQQDAgNHADBEAiBSxokO+9hHG+FpYikoNpcma4AK6N1KI2B6 -WqI5xNyF4gIgIQx8Q6p6ynDfUGDJ43uTHPzwlt+o8gQ3A5w07L70ml0= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt deleted file mode 100644 index 88a1e69d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNTCCAdygAwIBAgIRAN1F77OjzDmyWCzGuLyXHI8wCgYIKoZIzj0EAwIwbDEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5l -eGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMGwxCzAJ -BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJh -bmNpc2NvMRQwEgYDVQQKEwtleGFtcGxlLmNvbTEaMBgGA1UEAxMRdGxzY2EuZXhh -bXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQkmbjr/9EK0m/4CpR6 -DiM+Eyke3vxPX+IhL+utTRt/qYz2q0UT9wem0xgRVqyWp4vN35ur7aSI+dALKBFT -RWPwo18wXTAOBgNVHQ8BAf8EBAMCAaYwDwYDVR0lBAgwBgYEVR0lADAPBgNVHRMB -Af8EBTADAQH/MCkGA1UdDgQiBCBqIR7RiIC02zhngxyXeAmQJxO44yGlq1XswQTa -/C7sSTAKBggqhkjOPQQDAgNHADBEAiBSxokO+9hHG+FpYikoNpcma4AK6N1KI2B6 -WqI5xNyF4gIgIQx8Q6p6ynDfUGDJ43uTHPzwlt+o8gQ3A5w07L70ml0= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt deleted file mode 100644 index 5f61f509..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICWjCCAgCgAwIBAgIRAKk85zOKA4NKFQe/AmGxK7EwCgYIKoZIzj0EAwIwbDEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5l -eGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMFgxCzAJ -BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJh -bmNpc2NvMRwwGgYDVQQDExNvcmRlcmVyLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0C -AQYIKoZIzj0DAQcDQgAE3Nve7G2pybxbA+S3bvKlP8BAR4kJG96Yd2k9UFc7+Mmd -XM5/7TeVCbaidnYpODYr2pNlzo8HijwoyvYxnN7U3aOBljCBkzAOBgNVHQ8BAf8E -BAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMAwGA1UdEwEB/wQC -MAAwKwYDVR0jBCQwIoAgaiEe0YiAtNs4Z4Mcl3gJkCcTuOMhpatV7MEE2vwu7Ekw -JwYDVR0RBCAwHoITb3JkZXJlci5leGFtcGxlLmNvbYIHb3JkZXJlcjAKBggqhkjO -PQQDAgNIADBFAiEAtW6SunJ0GXR2gZY2yOg4CAOLPqb3YB07/9byOSFYZygCIA77 -iitG1Mkvlc7fyNFcgYKDUpbXQBS5iTmAuo/cISDx ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key deleted file mode 100755 index 9096afb0..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgUsf4CUpdmdIaax7T -qjCJaQLCsSU1/xaoETdgCCZ8fDihRANCAATc297sbanJvFsD5Ldu8qU/wEBHiQkb -3ph3aT1QVzv4yZ1czn/tN5UJtqJ2dik4Nivak2XOjweKPCjK9jGc3tTd ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/tlsca/6a211ed18880b4db3867831c977809902713b8e321a5ab55ecc104dafc2eec49_sk b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/tlsca/6a211ed18880b4db3867831c977809902713b8e321a5ab55ecc104dafc2eec49_sk deleted file mode 100755 index 0fc62a25..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/tlsca/6a211ed18880b4db3867831c977809902713b8e321a5ab55ecc104dafc2eec49_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQghjZ40AvUeupMV603 -i9pA9S8uNLz5i6TePeBgJZhrY/ihRANCAAQkmbjr/9EK0m/4CpR6DiM+Eyke3vxP -X+IhL+utTRt/qYz2q0UT9wem0xgRVqyWp4vN35ur7aSI+dALKBFTRWPw ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem deleted file mode 100644 index 88a1e69d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNTCCAdygAwIBAgIRAN1F77OjzDmyWCzGuLyXHI8wCgYIKoZIzj0EAwIwbDEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5l -eGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMGwxCzAJ -BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJh -bmNpc2NvMRQwEgYDVQQKEwtleGFtcGxlLmNvbTEaMBgGA1UEAxMRdGxzY2EuZXhh -bXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQkmbjr/9EK0m/4CpR6 -DiM+Eyke3vxPX+IhL+utTRt/qYz2q0UT9wem0xgRVqyWp4vN35ur7aSI+dALKBFT -RWPwo18wXTAOBgNVHQ8BAf8EBAMCAaYwDwYDVR0lBAgwBgYEVR0lADAPBgNVHRMB -Af8EBTADAQH/MCkGA1UdDgQiBCBqIR7RiIC02zhngxyXeAmQJxO44yGlq1XswQTa -/C7sSTAKBggqhkjOPQQDAgNHADBEAiBSxokO+9hHG+FpYikoNpcma4AK6N1KI2B6 -WqI5xNyF4gIgIQx8Q6p6ynDfUGDJ43uTHPzwlt+o8gQ3A5w07L70ml0= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/admincerts/Admin@example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/admincerts/Admin@example.com-cert.pem deleted file mode 100644 index 4a1dbfa9..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/admincerts/Admin@example.com-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICCjCCAbGgAwIBAgIRANPhTyHWZkTenKfX4eBv0ZUwCgYIKoZIzj0EAwIwaTEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFt -cGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMFYxCzAJBgNV -BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp -c2NvMRowGAYDVQQDDBFBZG1pbkBleGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqG -SM49AwEHA0IABKAyu7N4S2ZPQSzsAVF/mwwCewuu++MtfcMmUdeoIPFRBj1JMCnf -f88M0wj13gQSJQ6GfnUrT76G/L5fGxCUifWjTTBLMA4GA1UdDwEB/wQEAwIHgDAM -BgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIA1GzPDpQ2wbw7biv4DNsgLElDYE+Vxy -7g/4OdPsMAcZMAoGCCqGSM49BAMCA0cAMEQCIEdiGFLzeGMvVNubuZ3iuvRp/Pp6 -im3FmABwIbnMarabAiBIHWzz8Yxh9K5ZNkVNZX3fLZ4LlzsKBinbWH9J2wblDg== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/cacerts/ca.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/cacerts/ca.example.com-cert.pem deleted file mode 100644 index e83e629e..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/cacerts/ca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICLjCCAdWgAwIBAgIQCeSxIA/5bBc/893OreC2kzAKBggqhkjOPQQDAjBpMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w -bGUuY29tMB4XDTE3MDYyMzEyMzMxOVoXDTI3MDYyMTEyMzMxOVowaTELMAkGA1UE -BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz -Y28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABDLDgDbpvii4qPRPFsXeYzgjnW8M -tnZyUD592tgnBlwj0X+Uuam76gR39dd1Cf8QvMSyB4KL3F1OFViZ5cn/ncqjXzBd -MA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMB -Af8wKQYDVR0OBCIEIA1GzPDpQ2wbw7biv4DNsgLElDYE+Vxy7g/4OdPsMAcZMAoG -CCqGSM49BAMCA0cAMEQCICXp7cNAHK6RQOFxE8Gpqy1B/FuLbmtYNqqBo5e1Pgly -AiAWH23pmnXngcjLHg3nGwa3oUlCyPD64ilFoCMdN9TRVg== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore/db670eed8487a93c35ae448b9f84c2f241a7a8c87df0544fc1dc08baf7832aa0_sk b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore/db670eed8487a93c35ae448b9f84c2f241a7a8c87df0544fc1dc08baf7832aa0_sk deleted file mode 100755 index 06fdf974..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore/db670eed8487a93c35ae448b9f84c2f241a7a8c87df0544fc1dc08baf7832aa0_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg33NMbWc5E80ueSIA -iWqRlyC2M+1ce4shkkP/CVKOp4uhRANCAASgMruzeEtmT0Es7AFRf5sMAnsLrvvj -LX3DJlHXqCDxUQY9STAp33/PDNMI9d4EEiUOhn51K0++hvy+XxsQlIn1 ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/signcerts/Admin@example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/signcerts/Admin@example.com-cert.pem deleted file mode 100644 index 4a1dbfa9..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/signcerts/Admin@example.com-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICCjCCAbGgAwIBAgIRANPhTyHWZkTenKfX4eBv0ZUwCgYIKoZIzj0EAwIwaTEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFt -cGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMFYxCzAJBgNV -BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp -c2NvMRowGAYDVQQDDBFBZG1pbkBleGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqG -SM49AwEHA0IABKAyu7N4S2ZPQSzsAVF/mwwCewuu++MtfcMmUdeoIPFRBj1JMCnf -f88M0wj13gQSJQ6GfnUrT76G/L5fGxCUifWjTTBLMA4GA1UdDwEB/wQEAwIHgDAM -BgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIA1GzPDpQ2wbw7biv4DNsgLElDYE+Vxy -7g/4OdPsMAcZMAoGCCqGSM49BAMCA0cAMEQCIEdiGFLzeGMvVNubuZ3iuvRp/Pp6 -im3FmABwIbnMarabAiBIHWzz8Yxh9K5ZNkVNZX3fLZ4LlzsKBinbWH9J2wblDg== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/tlscacerts/tlsca.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/tlscacerts/tlsca.example.com-cert.pem deleted file mode 100644 index 88a1e69d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/tlscacerts/tlsca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNTCCAdygAwIBAgIRAN1F77OjzDmyWCzGuLyXHI8wCgYIKoZIzj0EAwIwbDEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5l -eGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMGwxCzAJ -BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJh -bmNpc2NvMRQwEgYDVQQKEwtleGFtcGxlLmNvbTEaMBgGA1UEAxMRdGxzY2EuZXhh -bXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQkmbjr/9EK0m/4CpR6 -DiM+Eyke3vxPX+IhL+utTRt/qYz2q0UT9wem0xgRVqyWp4vN35ur7aSI+dALKBFT -RWPwo18wXTAOBgNVHQ8BAf8EBAMCAaYwDwYDVR0lBAgwBgYEVR0lADAPBgNVHRMB -Af8EBTADAQH/MCkGA1UdDgQiBCBqIR7RiIC02zhngxyXeAmQJxO44yGlq1XswQTa -/C7sSTAKBggqhkjOPQQDAgNHADBEAiBSxokO+9hHG+FpYikoNpcma4AK6N1KI2B6 -WqI5xNyF4gIgIQx8Q6p6ynDfUGDJ43uTHPzwlt+o8gQ3A5w07L70ml0= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/ca.crt b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/ca.crt deleted file mode 100644 index 88a1e69d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/ca.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNTCCAdygAwIBAgIRAN1F77OjzDmyWCzGuLyXHI8wCgYIKoZIzj0EAwIwbDEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5l -eGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTlaMGwxCzAJ -BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJh -bmNpc2NvMRQwEgYDVQQKEwtleGFtcGxlLmNvbTEaMBgGA1UEAxMRdGxzY2EuZXhh -bXBsZS5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQkmbjr/9EK0m/4CpR6 -DiM+Eyke3vxPX+IhL+utTRt/qYz2q0UT9wem0xgRVqyWp4vN35ur7aSI+dALKBFT -RWPwo18wXTAOBgNVHQ8BAf8EBAMCAaYwDwYDVR0lBAgwBgYEVR0lADAPBgNVHRMB -Af8EBTADAQH/MCkGA1UdDgQiBCBqIR7RiIC02zhngxyXeAmQJxO44yGlq1XswQTa -/C7sSTAKBggqhkjOPQQDAgNHADBEAiBSxokO+9hHG+FpYikoNpcma4AK6N1KI2B6 -WqI5xNyF4gIgIQx8Q6p6ynDfUGDJ43uTHPzwlt+o8gQ3A5w07L70ml0= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/server.crt b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/server.crt deleted file mode 100644 index e920e6e2..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/server.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICKzCCAdKgAwIBAgIQF7ZJRSdZJSb9HEWyJaxQuDAKBggqhkjOPQQDAjBsMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xGjAYBgNVBAMTEXRsc2NhLmV4 -YW1wbGUuY29tMB4XDTE3MDYyMzEyMzMxOVoXDTI3MDYyMTEyMzMxOVowVjELMAkG -A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFu -Y2lzY28xGjAYBgNVBAMMEUFkbWluQGV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYI -KoZIzj0DAQcDQgAE+9xJbd39hXJw8Y49mtzzO1P/KaLjzkEAQGG7cnujbytJHRLL -+kHW2E02+ob8hAucwsjR/Sxg0J2yufaDxKWtSqNsMGowDgYDVR0PAQH/BAQDAgWg -MB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNVHRMBAf8EAjAAMCsG -A1UdIwQkMCKAIGohHtGIgLTbOGeDHJd4CZAnE7jjIaWrVezBBNr8LuxJMAoGCCqG -SM49BAMCA0cAMEQCIA5f8O7WfymKaLrJ71f77GGb/6z72Jh7g5svHDZBgKkBAiAg -fkCIypxeGnU1Vbo3vYauhqU6lQYO6VcVBhk3182wyQ== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/server.key b/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/server.key deleted file mode 100755 index e8e021d0..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgixJReeen2sIgyqT6 -F0z2Y9iYIu++FVOGg7ha4FR6G2WhRANCAAT73Elt3f2FcnDxjj2a3PM7U/8pouPO -QQBAYbtye6NvK0kdEsv6QdbYTTb6hvyEC5zCyNH9LGDQnbK59oPEpa1K ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/ca/0e729224e8b3f31784c8a93c5b8ef6f4c1c91d9e6e577c45c33163609fe40011_sk b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/ca/0e729224e8b3f31784c8a93c5b8ef6f4c1c91d9e6e577c45c33163609fe40011_sk deleted file mode 100755 index 3c356ecb..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/ca/0e729224e8b3f31784c8a93c5b8ef6f4c1c91d9e6e577c45c33163609fe40011_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgp4Y9v/Cx/ee3K2mP -N62ttbG2y1NkppMN6MlycYpqtT2hRANCAAQohXCFPMmsvPN+QiP874DXwHXyTZxI -oRZ1Jt9ZkikUlJv3LDxCgSxu2TjCP0kkP/A5JrV4MP+lCit6MKbbkKYF ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem deleted file mode 100644 index 01ce790d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQjCCAemgAwIBAgIQIR2LR9fa8xs5unnJJ9PFSzAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MHMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMRwwGgYDVQQD -ExNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE -KIVwhTzJrLzzfkIj/O+A18B18k2cSKEWdSbfWZIpFJSb9yw8QoEsbtk4wj9JJD/w -OSa1eDD/pQorejCm25CmBaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1UdJQQIMAYG -BFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQgDnKSJOiz8xeEyKk8W472 -9MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDRwAwRAIgMIO+yK3Fbwv1EXMc -tQam42i6ROxSanaAHrbY2oVC1fICICsMpdSS2kbdntUDayi09v4/WRtC59ExCrHl -rg/GXwkv ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem deleted file mode 100644 index e716793f..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGTCCAb+gAwIBAgIQKKKdQSzsDoUYn/LPAuRWGTAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECmbzUDozIrLKjp3OAzItSG7m7Flw76rT -8VO8E6otlCwxKtBRkPpZL7norC3NsjyE339J5O4pXCqhIApQyRRsRqNNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDnKSJOiz8xeE -yKk8W4729MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDSAAwRQIhALT02pc/ -yfE/4wUJfUBQ32GifUEh8JktAXzL/73S0rjYAiACNSp6zAQBX9SBxTOGMk4cGGAy -CKqf8052NVUs2CvPzA== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem deleted file mode 100644 index 01ce790d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQjCCAemgAwIBAgIQIR2LR9fa8xs5unnJJ9PFSzAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MHMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMRwwGgYDVQQD -ExNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE -KIVwhTzJrLzzfkIj/O+A18B18k2cSKEWdSbfWZIpFJSb9yw8QoEsbtk4wj9JJD/w -OSa1eDD/pQorejCm25CmBaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1UdJQQIMAYG -BFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQgDnKSJOiz8xeEyKk8W472 -9MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDRwAwRAIgMIO+yK3Fbwv1EXMc -tQam42i6ROxSanaAHrbY2oVC1fICICsMpdSS2kbdntUDayi09v4/WRtC59ExCrHl -rg/GXwkv ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem deleted file mode 100644 index d4e63536..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAe+gAwIBAgIQZrCrf6SF3Z/w7z3PwCNaaTAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMz -MTlaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD -VQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D -AQcDQgAEq4HHYbyF3O3iX+bt7tATNgdrWW6GYXWfKKJjsriBMhtYr5y/sTjvg64s -Z517Nx/QNj26yKLdZ9vSBUGhAUfedaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1Ud -JQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQglFCS2Tb1g4xa -b2SE25dNhXkzcGc30A0Ev2X3Tjl2+fgwCgYIKoZIzj0EAwIDSAAwRQIhANDFPsDw -14ftcZgQtMQ0yuMg8cCHj246rhsrnjwar7aAAiBwLG+4sKnTOOa+ceK6p+PpKu6F -qwkrkz69kT1ZsL7SXw== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem deleted file mode 100644 index e716793f..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGTCCAb+gAwIBAgIQKKKdQSzsDoUYn/LPAuRWGTAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECmbzUDozIrLKjp3OAzItSG7m7Flw76rT -8VO8E6otlCwxKtBRkPpZL7norC3NsjyE339J5O4pXCqhIApQyRRsRqNNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDnKSJOiz8xeE -yKk8W4729MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDSAAwRQIhALT02pc/ -yfE/4wUJfUBQ32GifUEh8JktAXzL/73S0rjYAiACNSp6zAQBX9SBxTOGMk4cGGAy -CKqf8052NVUs2CvPzA== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem deleted file mode 100644 index 01ce790d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQjCCAemgAwIBAgIQIR2LR9fa8xs5unnJJ9PFSzAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MHMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMRwwGgYDVQQD -ExNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE -KIVwhTzJrLzzfkIj/O+A18B18k2cSKEWdSbfWZIpFJSb9yw8QoEsbtk4wj9JJD/w -OSa1eDD/pQorejCm25CmBaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1UdJQQIMAYG -BFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQgDnKSJOiz8xeEyKk8W472 -9MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDRwAwRAIgMIO+yK3Fbwv1EXMc -tQam42i6ROxSanaAHrbY2oVC1fICICsMpdSS2kbdntUDayi09v4/WRtC59ExCrHl -rg/GXwkv ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/keystore/27db82c96b1482480baa1c75f80e5cce249beaab27b70c741bb0e2554355957e_sk b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/keystore/27db82c96b1482480baa1c75f80e5cce249beaab27b70c741bb0e2554355957e_sk deleted file mode 100755 index 04b22a2d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/keystore/27db82c96b1482480baa1c75f80e5cce249beaab27b70c741bb0e2554355957e_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgTEPwtCyJ1jFk2qQs -oFgHzMo3/MEXG1XJHiTgoRYvnPahRANCAATNL2TaAIodxq3xaPhPacHW7ILxHbOD -e6bF1MvueaAVanS7IIJtBDEP9VL7xH/cM28QWS/OFyNz01T+dGoyKuku ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/signcerts/peer0.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/signcerts/peer0.org1.example.com-cert.pem deleted file mode 100644 index 53158d45..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/signcerts/peer0.org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGDCCAb+gAwIBAgIQPcMFFEB/vq6mEL6vXV7aUTAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcxLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEzS9k2gCKHcat8Wj4T2nB1uyC8R2zg3um -xdTL7nmgFWp0uyCCbQQxD/VS+8R/3DNvEFkvzhcjc9NU/nRqMirpLqNNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDnKSJOiz8xeE -yKk8W4729MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDRwAwRAIgHBdxbHUG -rFUzKPX9UmmN3SwigWcRUREUy/GTb3hDIAsCIEF1BxTqv8ilQYE8ql0wJL4mTber -HE6DFYvvBCUnicUh ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem deleted file mode 100644 index d4e63536..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAe+gAwIBAgIQZrCrf6SF3Z/w7z3PwCNaaTAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMz -MTlaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD -VQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D -AQcDQgAEq4HHYbyF3O3iX+bt7tATNgdrWW6GYXWfKKJjsriBMhtYr5y/sTjvg64s -Z517Nx/QNj26yKLdZ9vSBUGhAUfedaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1Ud -JQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQglFCS2Tb1g4xa -b2SE25dNhXkzcGc30A0Ev2X3Tjl2+fgwCgYIKoZIzj0EAwIDSAAwRQIhANDFPsDw -14ftcZgQtMQ0yuMg8cCHj246rhsrnjwar7aAAiBwLG+4sKnTOOa+ceK6p+PpKu6F -qwkrkz69kT1ZsL7SXw== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt deleted file mode 100644 index d4e63536..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAe+gAwIBAgIQZrCrf6SF3Z/w7z3PwCNaaTAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMz -MTlaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD -VQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D -AQcDQgAEq4HHYbyF3O3iX+bt7tATNgdrWW6GYXWfKKJjsriBMhtYr5y/sTjvg64s -Z517Nx/QNj26yKLdZ9vSBUGhAUfedaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1Ud -JQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQglFCS2Tb1g4xa -b2SE25dNhXkzcGc30A0Ev2X3Tjl2+fgwCgYIKoZIzj0EAwIDSAAwRQIhANDFPsDw -14ftcZgQtMQ0yuMg8cCHj246rhsrnjwar7aAAiBwLG+4sKnTOOa+ceK6p+PpKu6F -qwkrkz69kT1ZsL7SXw== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt deleted file mode 100644 index f34c5be8..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICczCCAhmgAwIBAgIRAIKTnLyvyRImVvGtyrD0wH4wCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEAxMWcGVlcjAub3JnMS5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCZF1/1UYwnRJk2d+3zB0cW9oi8H -h7g6CaBw6aEI1WwgtKZ+/s28oQVUYBVJsdT3RAGgRRRt12QrqO/xa7/i1UejgaIw -gZ8wDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcD -AjAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIJRQktk29YOMWm9khNuXTYV5M3Bn -N9ANBL9l9045dvn4MDMGA1UdEQQsMCqCFnBlZXIwLm9yZzEuZXhhbXBsZS5jb22C -BXBlZXIwgglsb2NhbGhvc3QwCgYIKoZIzj0EAwIDSAAwRQIhAPs/YOkkkh2835Vb -pXtUuQNCi/PlhPhTiFlEdeE56vmmAiBadeHDYBIHkEA10wzr33wS1FpELg18eC5N -5gtmHzQUBA== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key deleted file mode 100755 index d4a96e2d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgCRU1ZAMLxDAlcr5d -D6ZSprL4Lf0+TkWwN6rCFVWmjDuhRANCAAQmRdf9VGMJ0SZNnft8wdHFvaIvB4e4 -OgmgcOmhCNVsILSmfv7NvKEFVGAVSbHU90QBoEUUbddkK6jv8Wu/4tVH ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem deleted file mode 100644 index e716793f..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGTCCAb+gAwIBAgIQKKKdQSzsDoUYn/LPAuRWGTAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECmbzUDozIrLKjp3OAzItSG7m7Flw76rT -8VO8E6otlCwxKtBRkPpZL7norC3NsjyE339J5O4pXCqhIApQyRRsRqNNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDnKSJOiz8xeE -yKk8W4729MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDSAAwRQIhALT02pc/ -yfE/4wUJfUBQ32GifUEh8JktAXzL/73S0rjYAiACNSp6zAQBX9SBxTOGMk4cGGAy -CKqf8052NVUs2CvPzA== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem deleted file mode 100644 index 01ce790d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQjCCAemgAwIBAgIQIR2LR9fa8xs5unnJJ9PFSzAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MHMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMRwwGgYDVQQD -ExNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE -KIVwhTzJrLzzfkIj/O+A18B18k2cSKEWdSbfWZIpFJSb9yw8QoEsbtk4wj9JJD/w -OSa1eDD/pQorejCm25CmBaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1UdJQQIMAYG -BFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQgDnKSJOiz8xeEyKk8W472 -9MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDRwAwRAIgMIO+yK3Fbwv1EXMc -tQam42i6ROxSanaAHrbY2oVC1fICICsMpdSS2kbdntUDayi09v4/WRtC59ExCrHl -rg/GXwkv ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/keystore/fdee12a3510fde3155c37128cfec26090ae249bfbca28f884e60c21338493edd_sk b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/keystore/fdee12a3510fde3155c37128cfec26090ae249bfbca28f884e60c21338493edd_sk deleted file mode 100755 index ae23cef0..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/keystore/fdee12a3510fde3155c37128cfec26090ae249bfbca28f884e60c21338493edd_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgtzNlo4v/qB1j5dJ6 -CRLQb9UAfUMMevXdnbuXUux2K2GhRANCAAQp09OJbb47IImVbghi7EWMxIgkyWZW -cIdx0/9u9wdzZFgO8K5ciuxXwGpyMnsbkdVCPZuPmCjahRunIGJ3/DLH ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/signcerts/peer1.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/signcerts/peer1.org1.example.com-cert.pem deleted file mode 100644 index 35a225be..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/signcerts/peer1.org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGjCCAcCgAwIBAgIRAI+BBtEBvpOqhfRZZH7eV/YwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEfMB0GA1UEAxMWcGVlcjEub3JnMS5leGFtcGxlLmNvbTBZ -MBMGByqGSM49AgEGCCqGSM49AwEHA0IABCnT04ltvjsgiZVuCGLsRYzEiCTJZlZw -h3HT/273B3NkWA7wrlyK7FfAanIyexuR1UI9m4+YKNqFG6cgYnf8MsejTTBLMA4G -A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIA5ykiTos/MX -hMipPFuO9vTByR2ebld8RcMxY2Cf5AARMAoGCCqGSM49BAMCA0gAMEUCIQCSRdWm -i4IgVUajvzWVxyE/wi7n617pVqS4+nJ7gbTRjQIgefzBwS+bkNhPc3/rktySFLRC -WMnq87KyqMLc6iRaJx0= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem deleted file mode 100644 index d4e63536..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAe+gAwIBAgIQZrCrf6SF3Z/w7z3PwCNaaTAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMz -MTlaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD -VQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D -AQcDQgAEq4HHYbyF3O3iX+bt7tATNgdrWW6GYXWfKKJjsriBMhtYr5y/sTjvg64s -Z517Nx/QNj26yKLdZ9vSBUGhAUfedaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1Ud -JQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQglFCS2Tb1g4xa -b2SE25dNhXkzcGc30A0Ev2X3Tjl2+fgwCgYIKoZIzj0EAwIDSAAwRQIhANDFPsDw -14ftcZgQtMQ0yuMg8cCHj246rhsrnjwar7aAAiBwLG+4sKnTOOa+ceK6p+PpKu6F -qwkrkz69kT1ZsL7SXw== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt deleted file mode 100644 index d4e63536..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAe+gAwIBAgIQZrCrf6SF3Z/w7z3PwCNaaTAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMz -MTlaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD -VQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D -AQcDQgAEq4HHYbyF3O3iX+bt7tATNgdrWW6GYXWfKKJjsriBMhtYr5y/sTjvg64s -Z517Nx/QNj26yKLdZ9vSBUGhAUfedaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1Ud -JQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQglFCS2Tb1g4xa -b2SE25dNhXkzcGc30A0Ev2X3Tjl2+fgwCgYIKoZIzj0EAwIDSAAwRQIhANDFPsDw -14ftcZgQtMQ0yuMg8cCHj246rhsrnjwar7aAAiBwLG+4sKnTOOa+ceK6p+PpKu6F -qwkrkz69kT1ZsL7SXw== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/server.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/server.crt deleted file mode 100644 index 15158a45..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/server.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICczCCAhmgAwIBAgIRALZ2km4W6KjPQb9rM12Ewb4wCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEAxMWcGVlcjEub3JnMS5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABKpNWa4jf/Rk5bpSZqFYteLESkd7 -KbrSOoiqLJmYSvM+KjDRPt+/pjLBNKM60tvknTUslU6Jne/7CVx1FpiHjRGjgaIw -gZ8wDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcD -AjAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIJRQktk29YOMWm9khNuXTYV5M3Bn -N9ANBL9l9045dvn4MDMGA1UdEQQsMCqCFnBlZXIxLm9yZzEuZXhhbXBsZS5jb22C -BXBlZXIxgglsb2NhbGhvc3QwCgYIKoZIzj0EAwIDSAAwRQIhAKjhWT8ZdaYR2Hvx -hPUl3t6gDJmkVuhy2Mxin04XxrUUAiBmBN83NmGoluPHQnvtGQ1BQP/JpY+UCkMR -O0xeuEChjA== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/server.key b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/server.key deleted file mode 100755 index 5fa4ace4..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgi4EN3aLIYYJMpLwD -r3yCKO+EBzcCcTA5QbNZ1SvDFa+hRANCAASqTVmuI3/0ZOW6UmahWLXixEpHeym6 -0jqIqiyZmErzPiow0T7fv6YywTSjOtLb5J01LJVOiZ3v+wlcdRaYh40R ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/tlsca/945092d936f5838c5a6f6484db974d857933706737d00d04bf65f74e3976f9f8_sk b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/tlsca/945092d936f5838c5a6f6484db974d857933706737d00d04bf65f74e3976f9f8_sk deleted file mode 100755 index 9d302e4d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/tlsca/945092d936f5838c5a6f6484db974d857933706737d00d04bf65f74e3976f9f8_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg/I1tIO3Xr1ZlsJUm -FDoUo/CNIJXLPlpUxtB7/LjcNzahRANCAASrgcdhvIXc7eJf5u3u0BM2B2tZboZh -dZ8oomOyuIEyG1ivnL+xOO+DrixnnXs3H9A2PbrIot1n29IFQaEBR951 ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem deleted file mode 100644 index d4e63536..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAe+gAwIBAgIQZrCrf6SF3Z/w7z3PwCNaaTAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMz -MTlaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD -VQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D -AQcDQgAEq4HHYbyF3O3iX+bt7tATNgdrWW6GYXWfKKJjsriBMhtYr5y/sTjvg64s -Z517Nx/QNj26yKLdZ9vSBUGhAUfedaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1Ud -JQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQglFCS2Tb1g4xa -b2SE25dNhXkzcGc30A0Ev2X3Tjl2+fgwCgYIKoZIzj0EAwIDSAAwRQIhANDFPsDw -14ftcZgQtMQ0yuMg8cCHj246rhsrnjwar7aAAiBwLG+4sKnTOOa+ceK6p+PpKu6F -qwkrkz69kT1ZsL7SXw== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem deleted file mode 100644 index e716793f..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGTCCAb+gAwIBAgIQKKKdQSzsDoUYn/LPAuRWGTAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECmbzUDozIrLKjp3OAzItSG7m7Flw76rT -8VO8E6otlCwxKtBRkPpZL7norC3NsjyE339J5O4pXCqhIApQyRRsRqNNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDnKSJOiz8xeE -yKk8W4729MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDSAAwRQIhALT02pc/ -yfE/4wUJfUBQ32GifUEh8JktAXzL/73S0rjYAiACNSp6zAQBX9SBxTOGMk4cGGAy -CKqf8052NVUs2CvPzA== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem deleted file mode 100644 index 01ce790d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQjCCAemgAwIBAgIQIR2LR9fa8xs5unnJJ9PFSzAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MHMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMRwwGgYDVQQD -ExNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE -KIVwhTzJrLzzfkIj/O+A18B18k2cSKEWdSbfWZIpFJSb9yw8QoEsbtk4wj9JJD/w -OSa1eDD/pQorejCm25CmBaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1UdJQQIMAYG -BFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQgDnKSJOiz8xeEyKk8W472 -9MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDRwAwRAIgMIO+yK3Fbwv1EXMc -tQam42i6ROxSanaAHrbY2oVC1fICICsMpdSS2kbdntUDayi09v4/WRtC59ExCrHl -rg/GXwkv ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/5890f0061619c06fb29dea8cb304edecc020fe63f41a6db109f1e227cc1cb2a8_sk b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/5890f0061619c06fb29dea8cb304edecc020fe63f41a6db109f1e227cc1cb2a8_sk deleted file mode 100755 index 09b7d469..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/5890f0061619c06fb29dea8cb304edecc020fe63f41a6db109f1e227cc1cb2a8_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgNmsvQQm4nwrxOKFX -UNfLPgjNm+FtYu3vb6OZ9q/5GbChRANCAAQKZvNQOjMissqOnc4DMi1IbubsWXDv -qtPxU7wTqi2ULDEq0FGQ+lkvueisLc2yPITff0nk7ilcKqEgClDJFGxG ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem deleted file mode 100644 index e716793f..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGTCCAb+gAwIBAgIQKKKdQSzsDoUYn/LPAuRWGTAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECmbzUDozIrLKjp3OAzItSG7m7Flw76rT -8VO8E6otlCwxKtBRkPpZL7norC3NsjyE339J5O4pXCqhIApQyRRsRqNNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgDnKSJOiz8xeE -yKk8W4729MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDSAAwRQIhALT02pc/ -yfE/4wUJfUBQ32GifUEh8JktAXzL/73S0rjYAiACNSp6zAQBX9SBxTOGMk4cGGAy -CKqf8052NVUs2CvPzA== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem deleted file mode 100644 index d4e63536..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAe+gAwIBAgIQZrCrf6SF3Z/w7z3PwCNaaTAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMz -MTlaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD -VQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D -AQcDQgAEq4HHYbyF3O3iX+bt7tATNgdrWW6GYXWfKKJjsriBMhtYr5y/sTjvg64s -Z517Nx/QNj26yKLdZ9vSBUGhAUfedaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1Ud -JQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQglFCS2Tb1g4xa -b2SE25dNhXkzcGc30A0Ev2X3Tjl2+fgwCgYIKoZIzj0EAwIDSAAwRQIhANDFPsDw -14ftcZgQtMQ0yuMg8cCHj246rhsrnjwar7aAAiBwLG+4sKnTOOa+ceK6p+PpKu6F -qwkrkz69kT1ZsL7SXw== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/ca.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/ca.crt deleted file mode 100644 index d4e63536..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/ca.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAe+gAwIBAgIQZrCrf6SF3Z/w7z3PwCNaaTAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMz -MTlaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD -VQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D -AQcDQgAEq4HHYbyF3O3iX+bt7tATNgdrWW6GYXWfKKJjsriBMhtYr5y/sTjvg64s -Z517Nx/QNj26yKLdZ9vSBUGhAUfedaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1Ud -JQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQglFCS2Tb1g4xa -b2SE25dNhXkzcGc30A0Ev2X3Tjl2+fgwCgYIKoZIzj0EAwIDSAAwRQIhANDFPsDw -14ftcZgQtMQ0yuMg8cCHj246rhsrnjwar7aAAiBwLG+4sKnTOOa+ceK6p+PpKu6F -qwkrkz69kT1ZsL7SXw== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/server.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/server.crt deleted file mode 100644 index 54c13d41..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/server.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICOzCCAeKgAwIBAgIRALvUEE81tMguFRFvx00HyREwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWQWRtaW5Ab3JnMS5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCk0mXNbPIzN+YOJvx/0XnOVdb6G -RxNetOOuuWq+QBWLJhdlRKrhtI+NTiHKjq7UMmBNdIfBPC1YXHIGdeD2u+CjbDBq -MA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIw -DAYDVR0TAQH/BAIwADArBgNVHSMEJDAigCCUUJLZNvWDjFpvZITbl02FeTNwZzfQ -DQS/ZfdOOXb5+DAKBggqhkjOPQQDAgNHADBEAiAp9+XFJ2igUvUlvkFVLeH7sWHf -+Q4m47hVT/81vedY1gIgTSz5CufvmWnI5AgwCuw4D0w0eDPFAc1HkO1rlVo5icY= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/server.key b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/server.key deleted file mode 100755 index 2cfab9b4..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgfVrs13ZtxgKp8l5T -WAq2IXqgd+zF1V6sTh7rbQ104rShRANCAAQpNJlzWzyMzfmDib8f9F5zlXW+hkcT -XrTjrrlqvkAViyYXZUSq4bSPjU4hyo6u1DJgTXSHwTwtWFxyBnXg9rvg ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/admincerts/User1@org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/admincerts/User1@org1.example.com-cert.pem deleted file mode 100644 index 37762582..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/admincerts/User1@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGjCCAcCgAwIBAgIRANfNECvok9C6hT58XJZ/lJAwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWVXNlcjFAb3JnMS5leGFtcGxlLmNvbTBZ -MBMGByqGSM49AgEGCCqGSM49AwEHA0IABHV6X/kWuQK6xhXe9OenQZKDI7/zax7Y -jYlRvUlHgCoqKIy8fFAat3glGbVX1oo2oZ7cMJVlFnbuiPdrg4vkyjejTTBLMA4G -A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIA5ykiTos/MX -hMipPFuO9vTByR2ebld8RcMxY2Cf5AARMAoGCCqGSM49BAMCA0gAMEUCIQDbCDrW -eqZ4yw7vcEhnNExiRZTv0xcVbRF8JgGozLz6qwIgZoXcqxvkJaBdZpwzg4f0RvVQ -QrjJMURXXchQ1Mnd5+o= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem deleted file mode 100644 index 01ce790d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQjCCAemgAwIBAgIQIR2LR9fa8xs5unnJJ9PFSzAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MHMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMRwwGgYDVQQD -ExNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE -KIVwhTzJrLzzfkIj/O+A18B18k2cSKEWdSbfWZIpFJSb9yw8QoEsbtk4wj9JJD/w -OSa1eDD/pQorejCm25CmBaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1UdJQQIMAYG -BFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQgDnKSJOiz8xeEyKk8W472 -9MHJHZ5uV3xFwzFjYJ/kABEwCgYIKoZIzj0EAwIDRwAwRAIgMIO+yK3Fbwv1EXMc -tQam42i6ROxSanaAHrbY2oVC1fICICsMpdSS2kbdntUDayi09v4/WRtC59ExCrHl -rg/GXwkv ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/73cdc0072c7203f1ec512232c780fc84acc9752ef30ebc16be1f4666c02b614b_sk b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/73cdc0072c7203f1ec512232c780fc84acc9752ef30ebc16be1f4666c02b614b_sk deleted file mode 100755 index 37d8e8df..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/73cdc0072c7203f1ec512232c780fc84acc9752ef30ebc16be1f4666c02b614b_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgaYlbFIz6yVz0SYqh -nrhdTCb797PBwSwtCw9HtOkbqQGhRANCAAR1el/5FrkCusYV3vTnp0GSgyO/82se -2I2JUb1JR4AqKiiMvHxQGrd4JRm1V9aKNqGe3DCVZRZ27oj3a4OL5Mo3 ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem deleted file mode 100644 index 37762582..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGjCCAcCgAwIBAgIRANfNECvok9C6hT58XJZ/lJAwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWVXNlcjFAb3JnMS5leGFtcGxlLmNvbTBZ -MBMGByqGSM49AgEGCCqGSM49AwEHA0IABHV6X/kWuQK6xhXe9OenQZKDI7/zax7Y -jYlRvUlHgCoqKIy8fFAat3glGbVX1oo2oZ7cMJVlFnbuiPdrg4vkyjejTTBLMA4G -A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIA5ykiTos/MX -hMipPFuO9vTByR2ebld8RcMxY2Cf5AARMAoGCCqGSM49BAMCA0gAMEUCIQDbCDrW -eqZ4yw7vcEhnNExiRZTv0xcVbRF8JgGozLz6qwIgZoXcqxvkJaBdZpwzg4f0RvVQ -QrjJMURXXchQ1Mnd5+o= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem deleted file mode 100644 index d4e63536..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAe+gAwIBAgIQZrCrf6SF3Z/w7z3PwCNaaTAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMz -MTlaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD -VQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D -AQcDQgAEq4HHYbyF3O3iX+bt7tATNgdrWW6GYXWfKKJjsriBMhtYr5y/sTjvg64s -Z517Nx/QNj26yKLdZ9vSBUGhAUfedaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1Ud -JQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQglFCS2Tb1g4xa -b2SE25dNhXkzcGc30A0Ev2X3Tjl2+fgwCgYIKoZIzj0EAwIDSAAwRQIhANDFPsDw -14ftcZgQtMQ0yuMg8cCHj246rhsrnjwar7aAAiBwLG+4sKnTOOa+ceK6p+PpKu6F -qwkrkz69kT1ZsL7SXw== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/ca.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/ca.crt deleted file mode 100644 index d4e63536..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/ca.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAe+gAwIBAgIQZrCrf6SF3Z/w7z3PwCNaaTAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMz -MTlaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD -VQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D -AQcDQgAEq4HHYbyF3O3iX+bt7tATNgdrWW6GYXWfKKJjsriBMhtYr5y/sTjvg64s -Z517Nx/QNj26yKLdZ9vSBUGhAUfedaNfMF0wDgYDVR0PAQH/BAQDAgGmMA8GA1Ud -JQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQglFCS2Tb1g4xa -b2SE25dNhXkzcGc30A0Ev2X3Tjl2+fgwCgYIKoZIzj0EAwIDSAAwRQIhANDFPsDw -14ftcZgQtMQ0yuMg8cCHj246rhsrnjwar7aAAiBwLG+4sKnTOOa+ceK6p+PpKu6F -qwkrkz69kT1ZsL7SXw== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/server.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/server.crt deleted file mode 100644 index 20a11827..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/server.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICOjCCAeGgAwIBAgIQSEKNVPcBOB7Kgrrzf05rJjAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMz -MTlaMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZVc2VyMUBvcmcxLmV4YW1wbGUuY29t -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEyHrGhNgy26huH3hNap1UMtQRBVIx -xTX0NqIbUMKcBSw9DRF0ndZHd5KQUVrj5t2/QY+YSpqK6ufDk68fWSAZ7KNsMGow -DgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAM -BgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIJRQktk29YOMWm9khNuXTYV5M3BnN9AN -BL9l9045dvn4MAoGCCqGSM49BAMCA0cAMEQCIE6HCTr9in2CqF6S+m/aGCVQrZwK -/o3oyXdcymDc/PbDAiAHIRDkIw1mU31KNhvPd6f8c/sReVDr3PQLydWh/HJpTQ== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/server.key b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/server.key deleted file mode 100755 index f23e877e..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgOXZUBNCAmIwJR3bt -GfoOwtmo3QunwcBnBBUPjot4frihRANCAATIesaE2DLbqG4feE1qnVQy1BEFUjHF -NfQ2ohtQwpwFLD0NEXSd1kd3kpBRWuPm3b9Bj5hKmorq58OTrx9ZIBns ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/ca/a7d47efa46a6ba07730c850fed2c1375df27360d7227f48cdc2f80e505678005_sk b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/ca/a7d47efa46a6ba07730c850fed2c1375df27360d7227f48cdc2f80e505678005_sk deleted file mode 100755 index 3f732ae4..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/ca/a7d47efa46a6ba07730c850fed2c1375df27360d7227f48cdc2f80e505678005_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgUgMy/PQKxjfxITFM -mVPTu4ZwQlhYIh1vJkn3dkjqDBShRANCAARVtStps/F2HsCLFIdah6iJhTW6Vvro -DQ/HOkGAfPZjzjB4cYpfaRNX19I/9fPnuLqIWxSjj/FEwdeXNX/5hUhH ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem deleted file mode 100644 index a26e1ec2..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQzCCAeqgAwIBAgIRAJEAD5YytxsnFjw+liBjOQkwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UE -AxMTY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA -BFW1K2mz8XYewIsUh1qHqImFNbpW+ugND8c6QYB89mPOMHhxil9pE1fX0j/18+e4 -uohbFKOP8UTB15c1f/mFSEejXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAG -BgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIKfUfvpGproHcwyFD+0s -E3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0cAMEQCIGrkModOvz6mcUDA -Zql4YPXU/3ZUbMLw8VuSNHh47lg7AiAPLSKy/v8y8mhebGRCNTYwdkidQCQFrh+2 -BIirBFsT0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/msp/admincerts/Admin@org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/msp/admincerts/Admin@org2.example.com-cert.pem deleted file mode 100644 index 93086ac9..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/msp/admincerts/Admin@org2.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGjCCAcCgAwIBAgIRAIUbkOONvaq2DLJr9qZbDKwwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWQWRtaW5Ab3JnMi5leGFtcGxlLmNvbTBZ -MBMGByqGSM49AgEGCCqGSM49AwEHA0IABMLKHXm1xN7Tk4YzaWg4GYhLoyNjrjs5 -302o37m12U8LorR7IL5fdFgYILeL4XUPjC/QG4E2o6hPl3uZPUVErbajTTBLMA4G -A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIKfUfvpGproH -cwyFD+0sE3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0gAMEUCIQDa1k6R -+luypvng6JMSKIyibptkwICToEAZlDqLeD+k1gIgGFXm1+p1QqxViOa+c1dUvjl0 -m1UCqGDwNTHDm5mO+es= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem deleted file mode 100644 index a26e1ec2..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQzCCAeqgAwIBAgIRAJEAD5YytxsnFjw+liBjOQkwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UE -AxMTY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA -BFW1K2mz8XYewIsUh1qHqImFNbpW+ugND8c6QYB89mPOMHhxil9pE1fX0j/18+e4 -uohbFKOP8UTB15c1f/mFSEejXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAG -BgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIKfUfvpGproHcwyFD+0s -E3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0cAMEQCIGrkModOvz6mcUDA -Zql4YPXU/3ZUbMLw8VuSNHh47lg7AiAPLSKy/v8y8mhebGRCNTYwdkidQCQFrh+2 -BIirBFsT0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem deleted file mode 100644 index 6d01d67c..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRANX86HJQn/543CANoioLOegwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABBp+58H8VypXHB9Hf/1ExZTmNdcBlTUgAmHH5sb9DizHXwljo6zdyXfZ -cLvTCpoLybJ/rnp4PKJ7NKUDmrQymLWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIHu4uj/xHTyM -9ZK9QyYGLnfQasSWPHt65FkoTfvT61qsMAoGCCqGSM49BAMCA0cAMEQCIBJ9N4PD -mB+2gAPeDWYteAZ5Q2KR/E0zMQ13pDSunHNcAiBwWRzwscXxCPOJp1sjBMVp5Z1a -nfIdbwvBbsl1XV/j0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/admincerts/Admin@org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/admincerts/Admin@org2.example.com-cert.pem deleted file mode 100644 index 93086ac9..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/admincerts/Admin@org2.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGjCCAcCgAwIBAgIRAIUbkOONvaq2DLJr9qZbDKwwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWQWRtaW5Ab3JnMi5leGFtcGxlLmNvbTBZ -MBMGByqGSM49AgEGCCqGSM49AwEHA0IABMLKHXm1xN7Tk4YzaWg4GYhLoyNjrjs5 -302o37m12U8LorR7IL5fdFgYILeL4XUPjC/QG4E2o6hPl3uZPUVErbajTTBLMA4G -A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIKfUfvpGproH -cwyFD+0sE3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0gAMEUCIQDa1k6R -+luypvng6JMSKIyibptkwICToEAZlDqLeD+k1gIgGFXm1+p1QqxViOa+c1dUvjl0 -m1UCqGDwNTHDm5mO+es= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem deleted file mode 100644 index a26e1ec2..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQzCCAeqgAwIBAgIRAJEAD5YytxsnFjw+liBjOQkwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UE -AxMTY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA -BFW1K2mz8XYewIsUh1qHqImFNbpW+ugND8c6QYB89mPOMHhxil9pE1fX0j/18+e4 -uohbFKOP8UTB15c1f/mFSEejXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAG -BgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIKfUfvpGproHcwyFD+0s -E3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0cAMEQCIGrkModOvz6mcUDA -Zql4YPXU/3ZUbMLw8VuSNHh47lg7AiAPLSKy/v8y8mhebGRCNTYwdkidQCQFrh+2 -BIirBFsT0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/keystore/0d9f72608133ee627b570b6af6877666bc8f365746f9329d6dd8a5f54e53e2ab_sk b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/keystore/0d9f72608133ee627b570b6af6877666bc8f365746f9329d6dd8a5f54e53e2ab_sk deleted file mode 100755 index d9e2dfdf..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/keystore/0d9f72608133ee627b570b6af6877666bc8f365746f9329d6dd8a5f54e53e2ab_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgNYZ86CFF4Iz0K+sE -HMg3lSS+mo5lRIFFLUOGrfseqhOhRANCAAT/Dd/SwXAdKicm97/WPViD32Bzn1j5 -2k/FslsxorK2Lx1Rfhi3wyxa40LNLjfED7E7KmJZ1w7PzI7+7WWhPTbq ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/signcerts/peer0.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/signcerts/peer0.org2.example.com-cert.pem deleted file mode 100644 index 511295ca..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/signcerts/peer0.org2.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGjCCAcCgAwIBAgIRANDlqX1daKI2aN0Qm7vrfKAwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEfMB0GA1UEAxMWcGVlcjAub3JnMi5leGFtcGxlLmNvbTBZ -MBMGByqGSM49AgEGCCqGSM49AwEHA0IABP8N39LBcB0qJyb3v9Y9WIPfYHOfWPna -T8WyWzGisrYvHVF+GLfDLFrjQs0uN8QPsTsqYlnXDs/Mjv7tZaE9NuqjTTBLMA4G -A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIKfUfvpGproH -cwyFD+0sE3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0gAMEUCIQDa1gKe -PRVRN/i8hUptACw02V7V9Yeo7kKlbQ6vWU5fqAIgXg2xAQ4TjwXOHlKbIyYZ7fox -cekBJ+E8yAFm8XQrfy0= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem deleted file mode 100644 index 6d01d67c..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRANX86HJQn/543CANoioLOegwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABBp+58H8VypXHB9Hf/1ExZTmNdcBlTUgAmHH5sb9DizHXwljo6zdyXfZ -cLvTCpoLybJ/rnp4PKJ7NKUDmrQymLWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIHu4uj/xHTyM -9ZK9QyYGLnfQasSWPHt65FkoTfvT61qsMAoGCCqGSM49BAMCA0cAMEQCIBJ9N4PD -mB+2gAPeDWYteAZ5Q2KR/E0zMQ13pDSunHNcAiBwWRzwscXxCPOJp1sjBMVp5Z1a -nfIdbwvBbsl1XV/j0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt deleted file mode 100644 index 6d01d67c..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRANX86HJQn/543CANoioLOegwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABBp+58H8VypXHB9Hf/1ExZTmNdcBlTUgAmHH5sb9DizHXwljo6zdyXfZ -cLvTCpoLybJ/rnp4PKJ7NKUDmrQymLWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIHu4uj/xHTyM -9ZK9QyYGLnfQasSWPHt65FkoTfvT61qsMAoGCCqGSM49BAMCA0cAMEQCIBJ9N4PD -mB+2gAPeDWYteAZ5Q2KR/E0zMQ13pDSunHNcAiBwWRzwscXxCPOJp1sjBMVp5Z1a -nfIdbwvBbsl1XV/j0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt deleted file mode 100644 index 0ab47140..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICcjCCAhmgAwIBAgIRAKTjFkKbLMrbEP10dpOEqz4wCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEAxMWcGVlcjAub3JnMi5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABMDiCfhksPZRhxpGyowvLu8lQjC6 -H4y/SiQuTbhG+ZXK99VRyDDoKzkyzDpUxMco1xvD3gafSDvrXrKlZObN9bOjgaIw -gZ8wDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcD -AjAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIHu4uj/xHTyM9ZK9QyYGLnfQasSW -PHt65FkoTfvT61qsMDMGA1UdEQQsMCqCFnBlZXIwLm9yZzIuZXhhbXBsZS5jb22C -BXBlZXIwgglsb2NhbGhvc3QwCgYIKoZIzj0EAwIDRwAwRAIgf1MZC8BVgrxO76J+ -aCGntiQsicgU1DPMt5l45jXiEeECIAHHYsIZcV8GW7iyKQevvdXSQ3JC7XgyuPrm -eDhWmPcO ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key deleted file mode 100755 index babe991b..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgVlcwZfAKBQZ+W/JX -w64rHF3JiaddhBcUfxk7WuyZxrChRANCAATA4gn4ZLD2UYcaRsqMLy7vJUIwuh+M -v0okLk24RvmVyvfVUcgw6Cs5Msw6VMTHKNcbw94Gn0g7616ypWTmzfWz ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/admincerts/Admin@org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/admincerts/Admin@org2.example.com-cert.pem deleted file mode 100644 index 93086ac9..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/admincerts/Admin@org2.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGjCCAcCgAwIBAgIRAIUbkOONvaq2DLJr9qZbDKwwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWQWRtaW5Ab3JnMi5leGFtcGxlLmNvbTBZ -MBMGByqGSM49AgEGCCqGSM49AwEHA0IABMLKHXm1xN7Tk4YzaWg4GYhLoyNjrjs5 -302o37m12U8LorR7IL5fdFgYILeL4XUPjC/QG4E2o6hPl3uZPUVErbajTTBLMA4G -A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIKfUfvpGproH -cwyFD+0sE3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0gAMEUCIQDa1k6R -+luypvng6JMSKIyibptkwICToEAZlDqLeD+k1gIgGFXm1+p1QqxViOa+c1dUvjl0 -m1UCqGDwNTHDm5mO+es= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem deleted file mode 100644 index a26e1ec2..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQzCCAeqgAwIBAgIRAJEAD5YytxsnFjw+liBjOQkwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UE -AxMTY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA -BFW1K2mz8XYewIsUh1qHqImFNbpW+ugND8c6QYB89mPOMHhxil9pE1fX0j/18+e4 -uohbFKOP8UTB15c1f/mFSEejXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAG -BgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIKfUfvpGproHcwyFD+0s -E3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0cAMEQCIGrkModOvz6mcUDA -Zql4YPXU/3ZUbMLw8VuSNHh47lg7AiAPLSKy/v8y8mhebGRCNTYwdkidQCQFrh+2 -BIirBFsT0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/keystore/27ccb54a06020260c66c65bec91f91e1c9043e3076d3d6128692e7271c4c7a2c_sk b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/keystore/27ccb54a06020260c66c65bec91f91e1c9043e3076d3d6128692e7271c4c7a2c_sk deleted file mode 100755 index fdd7fa73..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/keystore/27ccb54a06020260c66c65bec91f91e1c9043e3076d3d6128692e7271c4c7a2c_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgtRT9fcsCMexhHlCO -dfzBqkDIfC88UFE51dYxRHDSrMShRANCAAS4r7MB6WDw96YKpJIzOvqhXs1dQ3XQ -5QMMX4aOwVLT1vZHOkPghRr2wMhJeQs1vVY+5RcnOWy6OyB/oYCCIPka ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/signcerts/peer1.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/signcerts/peer1.org2.example.com-cert.pem deleted file mode 100644 index 19868dd5..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/signcerts/peer1.org2.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGTCCAb+gAwIBAgIQKeRyEPaHSUPvshfEtmg9tzAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMi5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMzMTla -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMS5vcmcyLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuK+zAelg8PemCqSSMzr6oV7NXUN10OUD -DF+GjsFS09b2RzpD4IUa9sDISXkLNb1WPuUXJzlsujsgf6GAgiD5GqNNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgp9R++kamugdz -DIUP7SwTdd8nNg1yJ/SM3C+A5QVngAUwCgYIKoZIzj0EAwIDSAAwRQIhAMIQLWEv -wpaNibkXEGJlT0IzSIBsCjMJD7VaqZLKm5h9AiAlYmNBB8siyLLxFawvEB/4F26x -e1jgyza7Yg+ardDzlw== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem deleted file mode 100644 index 6d01d67c..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRANX86HJQn/543CANoioLOegwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABBp+58H8VypXHB9Hf/1ExZTmNdcBlTUgAmHH5sb9DizHXwljo6zdyXfZ -cLvTCpoLybJ/rnp4PKJ7NKUDmrQymLWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIHu4uj/xHTyM -9ZK9QyYGLnfQasSWPHt65FkoTfvT61qsMAoGCCqGSM49BAMCA0cAMEQCIBJ9N4PD -mB+2gAPeDWYteAZ5Q2KR/E0zMQ13pDSunHNcAiBwWRzwscXxCPOJp1sjBMVp5Z1a -nfIdbwvBbsl1XV/j0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt deleted file mode 100644 index 6d01d67c..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRANX86HJQn/543CANoioLOegwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABBp+58H8VypXHB9Hf/1ExZTmNdcBlTUgAmHH5sb9DizHXwljo6zdyXfZ -cLvTCpoLybJ/rnp4PKJ7NKUDmrQymLWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIHu4uj/xHTyM -9ZK9QyYGLnfQasSWPHt65FkoTfvT61qsMAoGCCqGSM49BAMCA0cAMEQCIBJ9N4PD -mB+2gAPeDWYteAZ5Q2KR/E0zMQ13pDSunHNcAiBwWRzwscXxCPOJp1sjBMVp5Z1a -nfIdbwvBbsl1XV/j0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/server.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/server.crt deleted file mode 100644 index f75611a0..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/server.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICcjCCAhigAwIBAgIQEV3hkn7yJpdb29dDQvTKWDAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMi5leGFtcGxlLmNvbTAeFw0xNzA2MjMxMjMzMTlaFw0yNzA2MjExMjMz -MTlaMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMS5vcmcyLmV4YW1wbGUuY29t -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEpXRG2CwqI+F0UoMSImo3In9R7lze -S+DuL1pLOjF5s05kVAcH604/9FRI61ujvWp4mYXornB+R1pcQwtolYNzPKOBojCB -nzAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMC -MAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAge7i6P/EdPIz1kr1DJgYud9BqxJY8 -e3rkWShN+9PrWqwwMwYDVR0RBCwwKoIWcGVlcjEub3JnMi5leGFtcGxlLmNvbYIF -cGVlcjGCCWxvY2FsaG9zdDAKBggqhkjOPQQDAgNIADBFAiEAmzFD5Dd4yR5lKy44 -Jdz4hy5AtRLQAmhlmLhli46z0r8CIDXFZJ7EwiD3F/jBT6906IFizjr9CD/DtOC9 -bxT5JhIN ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/server.key b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/server.key deleted file mode 100755 index 89017839..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgxFdgRfevcXrABROv -sV6HvrpoN5PHW6qXIFj71CAwtzyhRANCAASldEbYLCoj4XRSgxIiajcif1HuXN5L -4O4vWks6MXmzTmRUBwfrTj/0VEjrW6O9aniZheiucH5HWlxDC2iVg3M8 ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/tlsca/7bb8ba3ff11d3c8cf592bd4326062e77d06ac4963c7b7ae459284dfbd3eb5aac_sk b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/tlsca/7bb8ba3ff11d3c8cf592bd4326062e77d06ac4963c7b7ae459284dfbd3eb5aac_sk deleted file mode 100755 index e4f49a0d..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/tlsca/7bb8ba3ff11d3c8cf592bd4326062e77d06ac4963c7b7ae459284dfbd3eb5aac_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgXu7VBLhnEUi4mu4d -tU1nT4lcMR9aoG29s5hLPmIKH/mhRANCAAQafufB/FcqVxwfR3/9RMWU5jXXAZU1 -IAJhx+bG/Q4sx18JY6Os3cl32XC70wqaC8myf656eDyiezSlA5q0Mpi1 ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem deleted file mode 100644 index 6d01d67c..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRANX86HJQn/543CANoioLOegwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABBp+58H8VypXHB9Hf/1ExZTmNdcBlTUgAmHH5sb9DizHXwljo6zdyXfZ -cLvTCpoLybJ/rnp4PKJ7NKUDmrQymLWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIHu4uj/xHTyM -9ZK9QyYGLnfQasSWPHt65FkoTfvT61qsMAoGCCqGSM49BAMCA0cAMEQCIBJ9N4PD -mB+2gAPeDWYteAZ5Q2KR/E0zMQ13pDSunHNcAiBwWRzwscXxCPOJp1sjBMVp5Z1a -nfIdbwvBbsl1XV/j0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/admincerts/Admin@org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/admincerts/Admin@org2.example.com-cert.pem deleted file mode 100644 index 93086ac9..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/admincerts/Admin@org2.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGjCCAcCgAwIBAgIRAIUbkOONvaq2DLJr9qZbDKwwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWQWRtaW5Ab3JnMi5leGFtcGxlLmNvbTBZ -MBMGByqGSM49AgEGCCqGSM49AwEHA0IABMLKHXm1xN7Tk4YzaWg4GYhLoyNjrjs5 -302o37m12U8LorR7IL5fdFgYILeL4XUPjC/QG4E2o6hPl3uZPUVErbajTTBLMA4G -A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIKfUfvpGproH -cwyFD+0sE3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0gAMEUCIQDa1k6R -+luypvng6JMSKIyibptkwICToEAZlDqLeD+k1gIgGFXm1+p1QqxViOa+c1dUvjl0 -m1UCqGDwNTHDm5mO+es= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem deleted file mode 100644 index a26e1ec2..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQzCCAeqgAwIBAgIRAJEAD5YytxsnFjw+liBjOQkwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UE -AxMTY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA -BFW1K2mz8XYewIsUh1qHqImFNbpW+ugND8c6QYB89mPOMHhxil9pE1fX0j/18+e4 -uohbFKOP8UTB15c1f/mFSEejXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAG -BgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIKfUfvpGproHcwyFD+0s -E3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0cAMEQCIGrkModOvz6mcUDA -Zql4YPXU/3ZUbMLw8VuSNHh47lg7AiAPLSKy/v8y8mhebGRCNTYwdkidQCQFrh+2 -BIirBFsT0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/1995b11d6573ed3be52fcd7a5fa477bc0f183e1f5f398c8281d0ce7c2c75a076_sk b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/1995b11d6573ed3be52fcd7a5fa477bc0f183e1f5f398c8281d0ce7c2c75a076_sk deleted file mode 100755 index 09b1c6a7..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/1995b11d6573ed3be52fcd7a5fa477bc0f183e1f5f398c8281d0ce7c2c75a076_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgHa4xvmGVQJV5wrMj -KttcA0hh/Yz0dezmXlRLjNk9HyahRANCAATCyh15tcTe05OGM2loOBmIS6MjY647 -Od9NqN+5tdlPC6K0eyC+X3RYGCC3i+F1D4wv0BuBNqOoT5d7mT1FRK22 ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem deleted file mode 100644 index 93086ac9..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGjCCAcCgAwIBAgIRAIUbkOONvaq2DLJr9qZbDKwwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWQWRtaW5Ab3JnMi5leGFtcGxlLmNvbTBZ -MBMGByqGSM49AgEGCCqGSM49AwEHA0IABMLKHXm1xN7Tk4YzaWg4GYhLoyNjrjs5 -302o37m12U8LorR7IL5fdFgYILeL4XUPjC/QG4E2o6hPl3uZPUVErbajTTBLMA4G -A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIKfUfvpGproH -cwyFD+0sE3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0gAMEUCIQDa1k6R -+luypvng6JMSKIyibptkwICToEAZlDqLeD+k1gIgGFXm1+p1QqxViOa+c1dUvjl0 -m1UCqGDwNTHDm5mO+es= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem deleted file mode 100644 index 6d01d67c..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRANX86HJQn/543CANoioLOegwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABBp+58H8VypXHB9Hf/1ExZTmNdcBlTUgAmHH5sb9DizHXwljo6zdyXfZ -cLvTCpoLybJ/rnp4PKJ7NKUDmrQymLWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIHu4uj/xHTyM -9ZK9QyYGLnfQasSWPHt65FkoTfvT61qsMAoGCCqGSM49BAMCA0cAMEQCIBJ9N4PD -mB+2gAPeDWYteAZ5Q2KR/E0zMQ13pDSunHNcAiBwWRzwscXxCPOJp1sjBMVp5Z1a -nfIdbwvBbsl1XV/j0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/tls/ca.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/tls/ca.crt deleted file mode 100644 index 6d01d67c..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/tls/ca.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRANX86HJQn/543CANoioLOegwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABBp+58H8VypXHB9Hf/1ExZTmNdcBlTUgAmHH5sb9DizHXwljo6zdyXfZ -cLvTCpoLybJ/rnp4PKJ7NKUDmrQymLWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIHu4uj/xHTyM -9ZK9QyYGLnfQasSWPHt65FkoTfvT61qsMAoGCCqGSM49BAMCA0cAMEQCIBJ9N4PD -mB+2gAPeDWYteAZ5Q2KR/E0zMQ13pDSunHNcAiBwWRzwscXxCPOJp1sjBMVp5Z1a -nfIdbwvBbsl1XV/j0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/tls/server.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/tls/server.crt deleted file mode 100644 index bc9e1ed0..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/tls/server.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICPDCCAeKgAwIBAgIRAJyMPO3I72b3mbPNKpVYYLMwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWQWRtaW5Ab3JnMi5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABMFNcSoYN82cQnSGoxBiWhzlYi9N -nVbrfOCNdsxMOjhYIfvptjVgBhc87ZqUsQp4sSYVHV1qxAJ7PD50CJRC+4SjbDBq -MA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIw -DAYDVR0TAQH/BAIwADArBgNVHSMEJDAigCB7uLo/8R08jPWSvUMmBi530GrEljx7 -euRZKE370+tarDAKBggqhkjOPQQDAgNIADBFAiEAkPjfzaF3Dxz5n39QChNSfWwC -lpxiBCgw8DMP2D91UFICIC640slBiPu2zx3U7izA6Zu00IIaEt8xGtt4pbhwwqWj ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/tls/server.key b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/tls/server.key deleted file mode 100755 index 1b542d8a..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgOa1azVZZkkb3rRW1 -y3z1TCvqOzftqGI3eELPG2TWK6WhRANCAATBTXEqGDfNnEJ0hqMQYloc5WIvTZ1W -63zgjXbMTDo4WCH76bY1YAYXPO2alLEKeLEmFR1dasQCezw+dAiUQvuE ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/admincerts/User1@org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/admincerts/User1@org2.example.com-cert.pem deleted file mode 100644 index 008d2555..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/admincerts/User1@org2.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGjCCAcCgAwIBAgIRAIPRwJHVLhHK47XK0BbFZJswCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWVXNlcjFAb3JnMi5leGFtcGxlLmNvbTBZ -MBMGByqGSM49AgEGCCqGSM49AwEHA0IABBd9SsEiFH1/JIb3qMEPLR2dygokFVKW -eINcB0Ni4TBRkfIWWUJeCANTUY11Pm/+5gs+fBTqBz8M2UzpJDVX7+2jTTBLMA4G -A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIKfUfvpGproH -cwyFD+0sE3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0gAMEUCIQC8NIMw -e4ym/QRwCJb5umbONNLSVQuEpnPsJrM/ssBPvgIgQpe2oYa3yO3USro9nBHjpM3L -KsFQrpVnF8O6hoHOYZQ= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem deleted file mode 100644 index a26e1ec2..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/cacerts/ca.org2.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQzCCAeqgAwIBAgIRAJEAD5YytxsnFjw+liBjOQkwCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEcMBoGA1UE -AxMTY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA -BFW1K2mz8XYewIsUh1qHqImFNbpW+ugND8c6QYB89mPOMHhxil9pE1fX0j/18+e4 -uohbFKOP8UTB15c1f/mFSEejXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAG -BgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIKfUfvpGproHcwyFD+0s -E3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0cAMEQCIGrkModOvz6mcUDA -Zql4YPXU/3ZUbMLw8VuSNHh47lg7AiAPLSKy/v8y8mhebGRCNTYwdkidQCQFrh+2 -BIirBFsT0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/585175c83bac91fc0c1ce8f9d0ff9aefa47c565678f100ca8673db249ee785ac_sk b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/585175c83bac91fc0c1ce8f9d0ff9aefa47c565678f100ca8673db249ee785ac_sk deleted file mode 100755 index d1ac0c7a..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/keystore/585175c83bac91fc0c1ce8f9d0ff9aefa47c565678f100ca8673db249ee785ac_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgmHG6n4ZvwUeV4jCp -kvAmGSQKZ+vOYsyzRZgYwORO+vChRANCAAQXfUrBIhR9fySG96jBDy0dncoKJBVS -lniDXAdDYuEwUZHyFllCXggDU1GNdT5v/uYLPnwU6gc/DNlM6SQ1V+/t ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem deleted file mode 100644 index 008d2555..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGjCCAcCgAwIBAgIRAIPRwJHVLhHK47XK0BbFZJswCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIzMzE5 -WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWVXNlcjFAb3JnMi5leGFtcGxlLmNvbTBZ -MBMGByqGSM49AgEGCCqGSM49AwEHA0IABBd9SsEiFH1/JIb3qMEPLR2dygokFVKW -eINcB0Ni4TBRkfIWWUJeCANTUY11Pm/+5gs+fBTqBz8M2UzpJDVX7+2jTTBLMA4G -A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIKfUfvpGproH -cwyFD+0sE3XfJzYNcif0jNwvgOUFZ4AFMAoGCCqGSM49BAMCA0gAMEUCIQC8NIMw -e4ym/QRwCJb5umbONNLSVQuEpnPsJrM/ssBPvgIgQpe2oYa3yO3USro9nBHjpM3L -KsFQrpVnF8O6hoHOYZQ= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem deleted file mode 100644 index 6d01d67c..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRANX86HJQn/543CANoioLOegwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABBp+58H8VypXHB9Hf/1ExZTmNdcBlTUgAmHH5sb9DizHXwljo6zdyXfZ -cLvTCpoLybJ/rnp4PKJ7NKUDmrQymLWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIHu4uj/xHTyM -9ZK9QyYGLnfQasSWPHt65FkoTfvT61qsMAoGCCqGSM49BAMCA0cAMEQCIBJ9N4PD -mB+2gAPeDWYteAZ5Q2KR/E0zMQ13pDSunHNcAiBwWRzwscXxCPOJp1sjBMVp5Z1a -nfIdbwvBbsl1XV/j0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/ca.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/ca.crt deleted file mode 100644 index 6d01d67c..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/ca.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRANX86HJQn/543CANoioLOegwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMi5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABBp+58H8VypXHB9Hf/1ExZTmNdcBlTUgAmHH5sb9DizHXwljo6zdyXfZ -cLvTCpoLybJ/rnp4PKJ7NKUDmrQymLWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIHu4uj/xHTyM -9ZK9QyYGLnfQasSWPHt65FkoTfvT61qsMAoGCCqGSM49BAMCA0cAMEQCIBJ9N4PD -mB+2gAPeDWYteAZ5Q2KR/E0zMQ13pDSunHNcAiBwWRzwscXxCPOJp1sjBMVp5Z1a -nfIdbwvBbsl1XV/j0g== ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/server.crt b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/server.crt deleted file mode 100644 index b81ee15c..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/server.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICOzCCAeKgAwIBAgIRAPD3UPMtRDq5GhVZUuS25LUwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzIuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzIuZXhhbXBsZS5jb20wHhcNMTcwNjIzMTIzMzE5WhcNMjcwNjIxMTIz -MzE5WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEfMB0GA1UEAwwWVXNlcjFAb3JnMi5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABLM/EP7l2gwX4RGxW9gX78CTINQ6 -3RRcU01F91HSpT3l+e1H0HACgJWTGkf5ZnwCnUcdZ/z2YD15zfVFHF2fvwejbDBq -MA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIw -DAYDVR0TAQH/BAIwADArBgNVHSMEJDAigCB7uLo/8R08jPWSvUMmBi530GrEljx7 -euRZKE370+tarDAKBggqhkjOPQQDAgNHADBEAiBo0H6ZNg1XJladWoGNnFsdRm3I -u4dLlJBwe9gTrscPAAIgXfsHfA8qVvyK2Pnlca2cwUHvRrJ4cAvaYrWNTMG1t7Q= ------END CERTIFICATE----- diff --git a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/server.key b/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/server.key deleted file mode 100755 index 505f5b33..00000000 --- a/balance-transfer/artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgftZDPdCM6QMMv8ZO -eXbUFGQqnFhEUAiChttdWcSp6QOhRANCAASzPxD+5doMF+ERsVvYF+/AkyDUOt0U -XFNNRfdR0qU95fntR9BwAoCVkxpH+WZ8Ap1HHWf89mA9ec31RRxdn78H ------END PRIVATE KEY----- diff --git a/balance-transfer/artifacts/channel/genesis.block b/balance-transfer/artifacts/channel/genesis.block deleted file mode 100644 index 07b9c8d7..00000000 Binary files a/balance-transfer/artifacts/channel/genesis.block and /dev/null differ diff --git a/balance-transfer/artifacts/channel/mychannel.tx b/balance-transfer/artifacts/channel/mychannel.tx deleted file mode 100644 index 73323fa8..00000000 Binary files a/balance-transfer/artifacts/channel/mychannel.tx and /dev/null differ diff --git a/balance-transfer/artifacts/docker-compose.yaml b/balance-transfer/artifacts/docker-compose.yaml deleted file mode 100644 index 6fd88df2..00000000 --- a/balance-transfer/artifacts/docker-compose.yaml +++ /dev/null @@ -1,142 +0,0 @@ -# -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -version: '2' - -services: - - ca.org1.example.com: - image: hyperledger/fabric-ca - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca-org1 - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/0e729224e8b3f31784c8a93c5b8ef6f4c1c91d9e6e577c45c33163609fe40011_sk - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/0e729224e8b3f31784c8a93c5b8ef6f4c1c91d9e6e577c45c33163609fe40011_sk - ports: - - "7054:7054" - command: sh -c 'fabric-ca-server start -b admin:adminpw -d' - volumes: - - ./channel/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config - container_name: ca_peerOrg1 - - ca.org2.example.com: - image: hyperledger/fabric-ca - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca-org2 - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/a7d47efa46a6ba07730c850fed2c1375df27360d7227f48cdc2f80e505678005_sk - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem - - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/a7d47efa46a6ba07730c850fed2c1375df27360d7227f48cdc2f80e505678005_sk - ports: - - "8054:7054" - command: sh -c 'fabric-ca-server start -b admin:adminpw -d' - volumes: - - ./channel/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config - container_name: ca_peerOrg2 - - orderer.example.com: - container_name: orderer.example.com - image: hyperledger/fabric-orderer - environment: - - FABRIC_LOGGING_SPEC=debug - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/crypto/orderer/msp - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/etc/hyperledger/crypto/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/etc/hyperledger/crypto/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/crypto/orderer/tls/ca.crt, /etc/hyperledger/crypto/peerOrg1/tls/ca.crt, /etc/hyperledger/crypto/peerOrg2/tls/ca.crt] - working_dir: /opt/gopath/src/github.com/hyperledger/fabric/orderers - command: orderer - ports: - - 7050:7050 - volumes: - - ./channel:/etc/hyperledger/configtx - - ./channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/:/etc/hyperledger/crypto/orderer - - ./channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/crypto/peerOrg1 - - ./channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/:/etc/hyperledger/crypto/peerOrg2 - - peer0.org1.example.com: - container_name: peer0.org1.example.com - extends: - file: base.yaml - service: peer-base - environment: - - CORE_PEER_ID=peer0.org1.example.com - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.example.com:7051 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 - ports: - - 7051:7051 - - 7053:7053 - volumes: - - ./channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/crypto/peer - depends_on: - - orderer.example.com - - peer1.org1.example.com: - container_name: peer1.org1.example.com - extends: - file: base.yaml - service: peer-base - environment: - - CORE_PEER_ID=peer1.org1.example.com - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_ADDRESS=peer1.org1.example.com:7051 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051 - ports: - - 7056:7051 - - 7058:7053 - volumes: - - ./channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/:/etc/hyperledger/crypto/peer - depends_on: - - orderer.example.com - - peer0.org2.example.com: - container_name: peer0.org2.example.com - extends: - file: base.yaml - service: peer-base - environment: - - CORE_PEER_ID=peer0.org2.example.com - - CORE_PEER_LOCALMSPID=Org2MSP - - CORE_PEER_ADDRESS=peer0.org2.example.com:7051 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:7051 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051 - ports: - - 8051:7051 - - 8053:7053 - volumes: - - ./channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/:/etc/hyperledger/crypto/peer - depends_on: - - orderer.example.com - - peer1.org2.example.com: - container_name: peer1.org2.example.com - extends: - file: base.yaml - service: peer-base - environment: - - CORE_PEER_ID=peer1.org2.example.com - - CORE_PEER_LOCALMSPID=Org2MSP - - CORE_PEER_ADDRESS=peer1.org2.example.com:7051 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051 - ports: - - 8056:7051 - - 8058:7053 - volumes: - - ./channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/:/etc/hyperledger/crypto/peer - depends_on: - - orderer.example.com diff --git a/balance-transfer/artifacts/network-config-aws.yaml b/balance-transfer/artifacts/network-config-aws.yaml deleted file mode 100644 index 87912d71..00000000 --- a/balance-transfer/artifacts/network-config-aws.yaml +++ /dev/null @@ -1,230 +0,0 @@ ---- -# -# The network connection profile provides client applications the information about the target -# blockchain network that are necessary for the applications to interact with it. These are all -# knowledge that must be acquired from out-of-band sources. This file provides such a source. -# -name: "balance-transfer" - -# -# Any properties with an "x-" prefix will be treated as application-specific, exactly like how naming -# in HTTP headers or swagger properties work. The SDK will simply ignore these fields and leave -# them for the applications to process. This is a mechanism for different components of an application -# to exchange information that are not part of the standard schema described below. In particular, -# the "x-type" property with the "hlfv1" value example below is used by Hyperledger Composer to -# determine the type of Fabric networks (v0.6 vs. v1.0) it needs to work with. -# -x-type: "hlfv1" - -# -# Describe what the target network is/does. -# -description: "Balance Transfer Network" - -# -# Schema version of the content. Used by the SDK to apply the corresponding parsing rules. -# -version: "1.0" - -# -# The client section will be added on a per org basis see org1.yaml and org2.yaml -# -#client: - -# -# [Optional]. But most apps would have this section so that channel objects can be constructed -# based on the content below. If an app is creating channels, then it likely will not need this -# section. -# -channels: - # name of the channel - mychannel: - # Required. list of orderers designated by the application to use for transactions on this - # channel. This list can be a result of access control ("org1" can only access "ordererA"), or - # operational decisions to share loads from applications among the orderers. The values must - # be "names" of orgs defined under "organizations/peers" - orderers: - - orderer.example.com - - # Required. list of peers from participating orgs - peers: - peer0.org1.example.com: - # [Optional]. will this peer be sent transaction proposals for endorsement? The peer must - # have the chaincode installed. The app can also use this property to decide which peers - # to send the chaincode install request. Default: true - endorsingPeer: true - - # [Optional]. will this peer be sent query proposals? The peer must have the chaincode - # installed. The app can also use this property to decide which peers to send the - # chaincode install request. Default: true - chaincodeQuery: true - - # [Optional]. will this peer be sent query proposals that do not require chaincodes, like - # queryBlock(), queryTransaction(), etc. Default: true - ledgerQuery: true - - # [Optional]. will this peer be the target of the SDK's listener registration? All peers can - # produce events but the app typically only needs to connect to one to listen to events. - # Default: true - eventSource: true - - peer1.org1.example.com: - endorsingPeer: false - chaincodeQuery: true - ledgerQuery: true - eventSource: false - - peer0.org2.example.com: - endorsingPeer: true - chaincodeQuery: true - ledgerQuery: true - eventSource: true - - peer1.org2.example.com: - endorsingPeer: false - chaincodeQuery: true - ledgerQuery: true - eventSource: false - - # [Optional]. what chaincodes are expected to exist on this channel? The application can use - # this information to validate that the target peers are in the expected state by comparing - # this list with the query results of getInstalledChaincodes() and getInstantiatedChaincodes() - chaincodes: - # the format follows the "cannonical name" of chaincodes by fabric code - - mycc:v0 - -# -# list of participating organizations in this network -# -organizations: - Org1: - mspid: Org1MSP - - peers: - - peer0.org1.example.com - - peer1.org1.example.com - - # [Optional]. Certificate Authorities issue certificates for identification purposes in a Fabric based - # network. Typically certificates provisioning is done in a separate process outside of the - # runtime network. Fabric-CA is a special certificate authority that provides a REST APIs for - # dynamic certificate management (enroll, revoke, re-enroll). The following section is only for - # Fabric-CA servers. - certificateAuthorities: - - ca-org1 - - # [Optional]. If the application is going to make requests that are reserved to organization - # administrators, including creating/updating channels, installing/instantiating chaincodes, it - # must have access to the admin identity represented by the private key and signing certificate. - # Both properties can be the PEM string or local path to the PEM file. Note that this is mainly for - # convenience in development mode, production systems should not expose sensitive information - # this way. The SDK should allow applications to set the org admin identity via APIs, and only use - # this route as an alternative when it exists. - adminPrivateKey: - path: artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/5890f0061619c06fb29dea8cb304edecc020fe63f41a6db109f1e227cc1cb2a8_sk - signedCert: - path: artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem - - # the profile will contain public information about organizations other than the one it belongs to. - # These are necessary information to make transaction lifecycles work, including MSP IDs and - # peers with a public URL to send transaction proposals. The file will not contain private - # information reserved for members of the organization, such as admin key and certificate, - # fabric-ca registrar enroll ID and secret, etc. - Org2: - mspid: Org2MSP - peers: - - peer0.org2.example.com - - peer1.org2.example.com - certificateAuthorities: - - ca-org2 - adminPrivateKey: - path: artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/1995b11d6573ed3be52fcd7a5fa477bc0f183e1f5f398c8281d0ce7c2c75a076_sk - signedCert: - path: artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem - -# -# List of orderers to send transaction and channel create/update requests to. For the time -# being only one orderer is needed. If more than one is defined, which one get used by the -# SDK is implementation specific. Consult each SDK's documentation for its handling of orderers. -# -orderers: - orderer.example.com: - url: grpcs://ec2-13-59-99-140.us-east-2.compute.amazonaws.com:7050 - - # these are standard properties defined by the gRPC library - # they will be passed in as-is to gRPC client constructor - grpcOptions: - ssl-target-name-override: orderer.example.com - - tlsCACerts: - path: artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt - -# -# List of peers to send various requests to, including endorsement, query -# and event listener registration. -# -peers: - peer0.org1.example.com: - # this URL is used to send endorsement and query requests - url: grpcs://ec2-13-59-99-140.us-east-2.compute.amazonaws.com:7051 - - grpcOptions: - ssl-target-name-override: peer0.org1.example.com - tlsCACerts: - path: artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - - peer1.org1.example.com: - url: grpcs://ec2-13-59-99-140.us-east-2.compute.amazonaws.com:7056 - eventUrl: grpcs://ec2-13-59-99-140.us-east-2.compute.amazonaws.com:7058 - grpcOptions: - ssl-target-name-override: peer1.org1.example.com - tlsCACerts: - path: artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt - - peer0.org2.example.com: - url: grpcs://ec2-13-59-99-140.us-east-2.compute.amazonaws.com:8051 - grpcOptions: - ssl-target-name-override: peer0.org2.example.com - tlsCACerts: - path: artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt - - peer1.org2.example.com: - url: grpcs://ec2-13-59-99-140.us-east-2.compute.amazonaws.com:8056 - grpcOptions: - ssl-target-name-override: peer1.org2.example.com - tlsCACerts: - path: artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt - -# -# Fabric-CA is a special kind of Certificate Authority provided by Hyperledger Fabric which allows -# certificate management to be done via REST APIs. Application may choose to use a standard -# Certificate Authority instead of Fabric-CA, in which case this section would not be specified. -# -certificateAuthorities: - ca-org1: - url: https://ec2-13-59-99-140.us-east-2.compute.amazonaws.com:7054 - # the properties specified under this object are passed to the 'http' client verbatim when - # making the request to the Fabric-CA server - httpOptions: - verify: false - tlsCACerts: - path: artifacts/channel/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - - # Fabric-CA supports dynamic user enrollment via REST APIs. A "root" user, a.k.a registrar, is - # needed to enroll and invoke new users. - registrar: - - enrollId: admin - enrollSecret: adminpw - # [Optional] The optional name of the CA. - caName: ca-org1 - - ca-org2: - url: https://ec2-13-59-99-140.us-east-2.compute.amazonaws.com:8054 - httpOptions: - verify: false - tlsCACerts: - path: artifacts/channel/crypto-config/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem - registrar: - - enrollId: admin - enrollSecret: adminpw - # [Optional] The optional name of the CA. - caName: ca-org2 diff --git a/balance-transfer/artifacts/network-config.yaml b/balance-transfer/artifacts/network-config.yaml deleted file mode 100644 index 1d6d9efe..00000000 --- a/balance-transfer/artifacts/network-config.yaml +++ /dev/null @@ -1,230 +0,0 @@ ---- -# -# The network connection profile provides client applications the information about the target -# blockchain network that are necessary for the applications to interact with it. These are all -# knowledge that must be acquired from out-of-band sources. This file provides such a source. -# -name: "balance-transfer" - -# -# Any properties with an "x-" prefix will be treated as application-specific, exactly like how naming -# in HTTP headers or swagger properties work. The SDK will simply ignore these fields and leave -# them for the applications to process. This is a mechanism for different components of an application -# to exchange information that are not part of the standard schema described below. In particular, -# the "x-type" property with the "hlfv1" value example below is used by Hyperledger Composer to -# determine the type of Fabric networks (v0.6 vs. v1.0) it needs to work with. -# -x-type: "hlfv1" - -# -# Describe what the target network is/does. -# -description: "Balance Transfer Network" - -# -# Schema version of the content. Used by the SDK to apply the corresponding parsing rules. -# -version: "1.0" - -# -# The client section will be added on a per org basis see org1.yaml and org2.yaml -# -#client: - -# -# [Optional]. But most apps would have this section so that channel objects can be constructed -# based on the content below. If an app is creating channels, then it likely will not need this -# section. -# -channels: - # name of the channel - mychannel: - # Required. list of orderers designated by the application to use for transactions on this - # channel. This list can be a result of access control ("org1" can only access "ordererA"), or - # operational decisions to share loads from applications among the orderers. The values must - # be "names" of orgs defined under "organizations/peers" - orderers: - - orderer.example.com - - # Required. list of peers from participating orgs - peers: - peer0.org1.example.com: - # [Optional]. will this peer be sent transaction proposals for endorsement? The peer must - # have the chaincode installed. The app can also use this property to decide which peers - # to send the chaincode install request. Default: true - endorsingPeer: true - - # [Optional]. will this peer be sent query proposals? The peer must have the chaincode - # installed. The app can also use this property to decide which peers to send the - # chaincode install request. Default: true - chaincodeQuery: true - - # [Optional]. will this peer be sent query proposals that do not require chaincodes, like - # queryBlock(), queryTransaction(), etc. Default: true - ledgerQuery: true - - # [Optional]. will this peer be the target of the SDK's listener registration? All peers can - # produce events but the app typically only needs to connect to one to listen to events. - # Default: true - eventSource: true - - peer1.org1.example.com: - endorsingPeer: false - chaincodeQuery: true - ledgerQuery: true - eventSource: false - - peer0.org2.example.com: - endorsingPeer: true - chaincodeQuery: true - ledgerQuery: true - eventSource: true - - peer1.org2.example.com: - endorsingPeer: false - chaincodeQuery: true - ledgerQuery: true - eventSource: false - - # [Optional]. what chaincodes are expected to exist on this channel? The application can use - # this information to validate that the target peers are in the expected state by comparing - # this list with the query results of getInstalledChaincodes() and getInstantiatedChaincodes() - chaincodes: - # the format follows the "cannonical name" of chaincodes by fabric code - - mycc:v0 - -# -# list of participating organizations in this network -# -organizations: - Org1: - mspid: Org1MSP - - peers: - - peer0.org1.example.com - - peer1.org1.example.com - - # [Optional]. Certificate Authorities issue certificates for identification purposes in a Fabric based - # network. Typically certificates provisioning is done in a separate process outside of the - # runtime network. Fabric-CA is a special certificate authority that provides a REST APIs for - # dynamic certificate management (enroll, revoke, re-enroll). The following section is only for - # Fabric-CA servers. - certificateAuthorities: - - ca-org1 - - # [Optional]. If the application is going to make requests that are reserved to organization - # administrators, including creating/updating channels, installing/instantiating chaincodes, it - # must have access to the admin identity represented by the private key and signing certificate. - # Both properties can be the PEM string or local path to the PEM file. Note that this is mainly for - # convenience in development mode, production systems should not expose sensitive information - # this way. The SDK should allow applications to set the org admin identity via APIs, and only use - # this route as an alternative when it exists. - adminPrivateKey: - path: artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/5890f0061619c06fb29dea8cb304edecc020fe63f41a6db109f1e227cc1cb2a8_sk - signedCert: - path: artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem - - # the profile will contain public information about organizations other than the one it belongs to. - # These are necessary information to make transaction lifecycles work, including MSP IDs and - # peers with a public URL to send transaction proposals. The file will not contain private - # information reserved for members of the organization, such as admin key and certificate, - # fabric-ca registrar enroll ID and secret, etc. - Org2: - mspid: Org2MSP - peers: - - peer0.org2.example.com - - peer1.org2.example.com - certificateAuthorities: - - ca-org2 - adminPrivateKey: - path: artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/1995b11d6573ed3be52fcd7a5fa477bc0f183e1f5f398c8281d0ce7c2c75a076_sk - signedCert: - path: artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem - -# -# List of orderers to send transaction and channel create/update requests to. For the time -# being only one orderer is needed. If more than one is defined, which one get used by the -# SDK is implementation specific. Consult each SDK's documentation for its handling of orderers. -# -orderers: - orderer.example.com: - url: grpcs://localhost:7050 - - # these are standard properties defined by the gRPC library - # they will be passed in as-is to gRPC client constructor - grpcOptions: - ssl-target-name-override: orderer.example.com - - tlsCACerts: - path: artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt - -# -# List of peers to send various requests to, including endorsement, query -# and event listener registration. -# -peers: - peer0.org1.example.com: - # this URL is used to send endorsement and query requests - url: grpcs://localhost:7051 - - grpcOptions: - ssl-target-name-override: peer0.org1.example.com - tlsCACerts: - path: artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - - peer1.org1.example.com: - url: grpcs://localhost:7056 - grpcOptions: - ssl-target-name-override: peer1.org1.example.com - tlsCACerts: - path: artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt - - peer0.org2.example.com: - url: grpcs://localhost:8051 - grpcOptions: - ssl-target-name-override: peer0.org2.example.com - tlsCACerts: - path: artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt - - peer1.org2.example.com: - url: grpcs://localhost:8056 - eventUrl: grpcs://localhost:8058 - grpcOptions: - ssl-target-name-override: peer1.org2.example.com - tlsCACerts: - path: artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt - -# -# Fabric-CA is a special kind of Certificate Authority provided by Hyperledger Fabric which allows -# certificate management to be done via REST APIs. Application may choose to use a standard -# Certificate Authority instead of Fabric-CA, in which case this section would not be specified. -# -certificateAuthorities: - ca-org1: - url: https://localhost:7054 - # the properties specified under this object are passed to the 'http' client verbatim when - # making the request to the Fabric-CA server - httpOptions: - verify: false - tlsCACerts: - path: artifacts/channel/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - - # Fabric-CA supports dynamic user enrollment via REST APIs. A "root" user, a.k.a registrar, is - # needed to enroll and invoke new users. - registrar: - - enrollId: admin - enrollSecret: adminpw - # [Optional] The optional name of the CA. - caName: ca-org1 - - ca-org2: - url: https://localhost:8054 - httpOptions: - verify: false - tlsCACerts: - path: artifacts/channel/crypto-config/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem - registrar: - - enrollId: admin - enrollSecret: adminpw - # [Optional] The optional name of the CA. - caName: ca-org2 diff --git a/balance-transfer/artifacts/org1.yaml b/balance-transfer/artifacts/org1.yaml deleted file mode 100644 index 9f80b2a9..00000000 --- a/balance-transfer/artifacts/org1.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -# -# The network connection profile provides client applications the information about the target -# blockchain network that are necessary for the applications to interact with it. These are all -# knowledge that must be acquired from out-of-band sources. This file provides such a source. -# -name: "balance-transfer-org1" - -# -# Any properties with an "x-" prefix will be treated as application-specific, exactly like how naming -# in HTTP headers or swagger properties work. The SDK will simply ignore these fields and leave -# them for the applications to process. This is a mechanism for different components of an application -# to exchange information that are not part of the standard schema described below. In particular, -# the "x-type" property with the "hlfv1" value example below is used by Hyperledger Composer to -# determine the type of Fabric networks (v0.6 vs. v1.0) it needs to work with. -# -x-type: "hlfv1" - -# -# Describe what the target network is/does. -# -description: "Balance Transfer Network - client definition for Org1" - -# -# Schema version of the content. Used by the SDK to apply the corresponding parsing rules. -# -version: "1.0" - -# -# The client section is SDK-specific. The sample below is for the node.js SDK -# -client: - # Which organization does this application instance belong to? The value must be the name of an org - # defined under "organizations" - organization: Org1 - - # Some SDKs support pluggable KV stores, the properties under "credentialStore" - # are implementation specific - credentialStore: - # [Optional]. Specific to FileKeyValueStore.js or similar implementations in other SDKs. Can be others - # if using an alternative impl. For instance, CouchDBKeyValueStore.js would require an object - # here for properties like url, db name, etc. - path: "./fabric-client-kv-org1" - - # [Optional]. Specific to the CryptoSuite implementation. Software-based implementations like - # CryptoSuite_ECDSA_AES.js in node SDK requires a key store. PKCS#11 based implementations does - # not. - cryptoStore: - # Specific to the underlying KeyValueStore that backs the crypto key store. - path: "/tmp/fabric-client-kv-org1" - - # [Optional]. Specific to Composer environment - wallet: wallet-name diff --git a/balance-transfer/artifacts/org2.yaml b/balance-transfer/artifacts/org2.yaml deleted file mode 100644 index 6edc731c..00000000 --- a/balance-transfer/artifacts/org2.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -# -# The network connection profile provides client applications the information about the target -# blockchain network that are necessary for the applications to interact with it. These are all -# knowledge that must be acquired from out-of-band sources. This file provides such a source. -# -name: "balance-transfer-org2" - -# -# Any properties with an "x-" prefix will be treated as application-specific, exactly like how naming -# in HTTP headers or swagger properties work. The SDK will simply ignore these fields and leave -# them for the applications to process. This is a mechanism for different components of an application -# to exchange information that are not part of the standard schema described below. In particular, -# the "x-type" property with the "hlfv1" value example below is used by Hyperledger Composer to -# determine the type of Fabric networks (v0.6 vs. v1.0) it needs to work with. -# -x-type: "hlfv1" - -# -# Describe what the target network is/does. -# -description: "Balance Transfer Network - client definition for Org2" - -# -# Schema version of the content. Used by the SDK to apply the corresponding parsing rules. -# -version: "1.0" - -# -# The client section is SDK-specific. The sample below is for the node.js SDK -# -client: - # Which organization does this application instance belong to? The value must be the name of an org - # defined under "organizations" - organization: Org2 - - # Some SDKs support pluggable KV stores, the properties under "credentialStore" - # are implementation specific - credentialStore: - # [Optional]. Specific to FileKeyValueStore.js or similar implementations in other SDKs. Can be others - # if using an alternative impl. For instance, CouchDBKeyValueStore.js would require an object - # here for properties like url, db name, etc. - path: "./fabric-client-kv-org2" - - # [Optional]. Specific to the CryptoSuite implementation. Software-based implementations like - # CryptoSuite_ECDSA_AES.js in node SDK requires a key store. PKCS#11 based implementations does - # not. - cryptoStore: - # Specific to the underlying KeyValueStore that backs the crypto key store. - path: "/tmp/fabric-client-kv-org2" - - # [Optional]. Specific to Composer environment - wallet: wallet-name diff --git a/balance-transfer/artifacts/src/github.com/example_cc/go/example_cc.go b/balance-transfer/artifacts/src/github.com/example_cc/go/example_cc.go deleted file mode 100644 index 06fd76b9..00000000 --- a/balance-transfer/artifacts/src/github.com/example_cc/go/example_cc.go +++ /dev/null @@ -1,203 +0,0 @@ -/* -Copyright IBM Corp. 2016 All Rights Reserved. - -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. -*/ - -package main - - -import ( - "fmt" - "strconv" - - "github.com/hyperledger/fabric/core/chaincode/shim" - pb "github.com/hyperledger/fabric/protos/peer" -) - -var logger = shim.NewLogger("example_cc0") - -// SimpleChaincode example simple Chaincode implementation -type SimpleChaincode struct { -} - -func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response { - logger.Info("########### example_cc0 Init ###########") - - _, args := stub.GetFunctionAndParameters() - var A, B string // Entities - var Aval, Bval int // Asset holdings - var err error - - // Initialize the chaincode - A = args[0] - Aval, err = strconv.Atoi(args[1]) - if err != nil { - return shim.Error("Expecting integer value for asset holding") - } - B = args[2] - Bval, err = strconv.Atoi(args[3]) - if err != nil { - return shim.Error("Expecting integer value for asset holding") - } - logger.Info("Aval = %d, Bval = %d\n", Aval, Bval) - - // Write the state to the ledger - err = stub.PutState(A, []byte(strconv.Itoa(Aval))) - if err != nil { - return shim.Error(err.Error()) - } - - err = stub.PutState(B, []byte(strconv.Itoa(Bval))) - if err != nil { - return shim.Error(err.Error()) - } - - return shim.Success(nil) - - -} - -// Transaction makes payment of X units from A to B -func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response { - logger.Info("########### example_cc0 Invoke ###########") - - function, args := stub.GetFunctionAndParameters() - - if function == "delete" { - // Deletes an entity from its state - return t.delete(stub, args) - } - - if function == "query" { - // queries an entity state - return t.query(stub, args) - } - if function == "move" { - // Deletes an entity from its state - return t.move(stub, args) - } - - logger.Errorf("Unknown action, check the first argument, must be one of 'delete', 'query', or 'move'. But got: %v", args[0]) - return shim.Error(fmt.Sprintf("Unknown action, check the first argument, must be one of 'delete', 'query', or 'move'. But got: %v", args[0])) -} - -func (t *SimpleChaincode) move(stub shim.ChaincodeStubInterface, args []string) pb.Response { - // must be an invoke - var A, B string // Entities - var Aval, Bval int // Asset holdings - var X int // Transaction value - var err error - - if len(args) != 3 { - return shim.Error("Incorrect number of arguments. Expecting 4, function followed by 2 names and 1 value") - } - - A = args[0] - B = args[1] - - // Get the state from the ledger - // TODO: will be nice to have a GetAllState call to ledger - Avalbytes, err := stub.GetState(A) - if err != nil { - return shim.Error("Failed to get state") - } - if Avalbytes == nil { - return shim.Error("Entity not found") - } - Aval, _ = strconv.Atoi(string(Avalbytes)) - - Bvalbytes, err := stub.GetState(B) - if err != nil { - return shim.Error("Failed to get state") - } - if Bvalbytes == nil { - return shim.Error("Entity not found") - } - Bval, _ = strconv.Atoi(string(Bvalbytes)) - - // Perform the execution - X, err = strconv.Atoi(args[2]) - if err != nil { - return shim.Error("Invalid transaction amount, expecting a integer value") - } - Aval = Aval - X - Bval = Bval + X - logger.Infof("Aval = %d, Bval = %d\n", Aval, Bval) - - // Write the state back to the ledger - err = stub.PutState(A, []byte(strconv.Itoa(Aval))) - if err != nil { - return shim.Error(err.Error()) - } - - err = stub.PutState(B, []byte(strconv.Itoa(Bval))) - if err != nil { - return shim.Error(err.Error()) - } - - return shim.Success(nil); -} - -// Deletes an entity from state -func (t *SimpleChaincode) delete(stub shim.ChaincodeStubInterface, args []string) pb.Response { - if len(args) != 1 { - return shim.Error("Incorrect number of arguments. Expecting 1") - } - - A := args[0] - - // Delete the key from the state in ledger - err := stub.DelState(A) - if err != nil { - return shim.Error("Failed to delete state") - } - - return shim.Success(nil) -} - -// Query callback representing the query of a chaincode -func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response { - - var A string // Entities - var err error - - if len(args) != 1 { - return shim.Error("Incorrect number of arguments. Expecting name of the person to query") - } - - A = args[0] - - // Get the state from the ledger - Avalbytes, err := stub.GetState(A) - if err != nil { - jsonResp := "{\"Error\":\"Failed to get state for " + A + "\"}" - return shim.Error(jsonResp) - } - - if Avalbytes == nil { - jsonResp := "{\"Error\":\"Nil amount for " + A + "\"}" - return shim.Error(jsonResp) - } - - jsonResp := "{\"Name\":\"" + A + "\",\"Amount\":\"" + string(Avalbytes) + "\"}" - logger.Infof("Query Response:%s\n", jsonResp) - return shim.Success(Avalbytes) -} - -func main() { - err := shim.Start(new(SimpleChaincode)) - if err != nil { - logger.Errorf("Error starting Simple chaincode: %s", err) - } -} diff --git a/balance-transfer/artifacts/src/github.com/example_cc/node/example_cc.js b/balance-transfer/artifacts/src/github.com/example_cc/node/example_cc.js deleted file mode 100644 index 9621178f..00000000 --- a/balance-transfer/artifacts/src/github.com/example_cc/node/example_cc.js +++ /dev/null @@ -1,140 +0,0 @@ -/* -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -*/ - -const shim = require('fabric-shim'); -const util = require('util'); - -var Chaincode = class { - - // Initialize the chaincode - async Init(stub) { - console.info('========= example_cc Init ========='); - let ret = stub.getFunctionAndParameters(); - console.info(ret); - let args = ret.params; - // initialise only if 4 parameters passed. - if (args.length != 4) { - return shim.error('Incorrect number of arguments. Expecting 4'); - } - - let A = args[0]; - let B = args[2]; - let Aval = args[1]; - let Bval = args[3]; - - if (typeof parseInt(Aval) !== 'number' || typeof parseInt(Bval) !== 'number') { - return shim.error('Expecting integer value for asset holding'); - } - - try { - await stub.putState(A, Buffer.from(Aval)); - try { - await stub.putState(B, Buffer.from(Bval)); - return shim.success(); - } catch (err) { - return shim.error(err); - } - } catch (err) { - return shim.error(err); - } - } - - async Invoke(stub) { - let ret = stub.getFunctionAndParameters(); - console.info(ret); - let method = this[ret.fcn]; - if (!method) { - console.error('no method of name:' + ret.fcn + ' found'); - return shim.error('no method of name:' + ret.fcn + ' found'); - } - - console.info('\nCalling method : ' + ret.fcn); - try { - let payload = await method(stub, ret.params); - return shim.success(payload); - } catch (err) { - console.log(err); - return shim.error(err); - } - } - - async move(stub, args) { - if (args.length != 3) { - throw new Error('Incorrect number of arguments. Expecting 3'); - } - - let A = args[0]; - let B = args[1]; - if (!A || !B) { - throw new Error('asset holding must not be empty'); - } - - // Get the state from the ledger - let Avalbytes = await stub.getState(A); - if (!Avalbytes) { - throw new Error('Failed to get state of asset holder A'); - } - let Aval = parseInt(Avalbytes.toString()); - - let Bvalbytes = await stub.getState(B); - if (!Bvalbytes) { - throw new Error('Failed to get state of asset holder B'); - } - - let Bval = parseInt(Bvalbytes.toString()); - // Perform the execution - let amount = parseInt(args[2]); - if (typeof amount !== 'number') { - throw new Error('Expecting integer value for amount to be transaferred'); - } - - Aval = Aval - amount; - Bval = Bval + amount; - console.info(util.format('Aval = %d, Bval = %d\n', Aval, Bval)); - - // Write the states back to the ledger - await stub.putState(A, Buffer.from(Aval.toString())); - await stub.putState(B, Buffer.from(Bval.toString())); - - } - - // Deletes an entity from state - async delete(stub, args) { - if (args.length != 1) { - throw new Error('Incorrect number of arguments. Expecting 1'); - } - - let A = args[0]; - - // Delete the key from the state in ledger - await stub.deleteState(A); - } - - // query callback representing the query of a chaincode - async query(stub, args) { - if (args.length != 1) { - throw new Error('Incorrect number of arguments. Expecting name of the person to query') - } - - let jsonResp = {}; - let A = args[0]; - - // Get the state from the ledger - let Avalbytes = await stub.getState(A); - if (!Avalbytes) { - jsonResp.error = 'Failed to get state for ' + A; - throw new Error(JSON.stringify(jsonResp)); - } - - jsonResp.name = A; - jsonResp.amount = Avalbytes.toString(); - console.info('Query Response:'); - console.info(jsonResp); - return Avalbytes; - } -}; - -shim.start(new Chaincode()); diff --git a/balance-transfer/config.js b/balance-transfer/config.js deleted file mode 100644 index a3d1baa0..00000000 --- a/balance-transfer/config.js +++ /dev/null @@ -1,18 +0,0 @@ -var util = require('util'); -var path = require('path'); -var hfc = require('fabric-client'); - -var file = 'network-config%s.yaml'; - -var env = process.env.TARGET_NETWORK; -if (env) - file = util.format(file, '-' + env); -else - file = util.format(file, ''); -// indicate to the application where the setup file is located so it able -// to have the hfc load it to initalize the fabric client instance -hfc.setConfigSetting('network-connection-profile-path',path.join(__dirname, 'artifacts' ,file)); -hfc.setConfigSetting('Org1-connection-profile-path',path.join(__dirname, 'artifacts', 'org1.yaml')); -hfc.setConfigSetting('Org2-connection-profile-path',path.join(__dirname, 'artifacts', 'org2.yaml')); -// some other settings the application might need to know -hfc.addConfigFile(path.join(__dirname, 'config.json')); diff --git a/balance-transfer/config.json b/balance-transfer/config.json deleted file mode 100644 index 3af47311..00000000 --- a/balance-transfer/config.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "host":"localhost", - "port":"4000", - "jwt_expiretime": "36000", - "channelName":"mychannel", - "CC_SRC_PATH":"../artifacts", - "eventWaitTime":"30000", - "admins":[ - { - "username":"admin", - "secret":"adminpw" - } - ] -} diff --git a/balance-transfer/runApp.sh b/balance-transfer/runApp.sh deleted file mode 100755 index e1e7d302..00000000 --- a/balance-transfer/runApp.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -function dkcl(){ - CONTAINER_IDS=$(docker ps -aq) - echo - if [ -z "$CONTAINER_IDS" -o "$CONTAINER_IDS" = " " ]; then - echo "========== No containers available for deletion ==========" - else - docker rm -f $CONTAINER_IDS - fi - echo -} - -function dkrm(){ - DOCKER_IMAGE_IDS=$(docker images | grep "dev\|none\|test-vp\|peer[0-9]-" | awk '{print $3}') - echo - if [ -z "$DOCKER_IMAGE_IDS" -o "$DOCKER_IMAGE_IDS" = " " ]; then - echo "========== No images available for deletion ===========" - else - docker rmi -f $DOCKER_IMAGE_IDS - fi - echo -} - -function restartNetwork() { - echo - - #teardown the network and clean the containers and intermediate images - docker-compose -f ./artifacts/docker-compose.yaml down - dkcl - dkrm - - #Cleanup the stores - rm -rf ./fabric-client-kv-org* - - #Start the network - docker-compose -f ./artifacts/docker-compose.yaml up -d - echo -} - -function installNodeModules() { - echo - if [ -d node_modules ]; then - echo "============== node modules installed already =============" - else - echo "============== Installing node modules =============" - npm install - fi - echo -} - - -restartNetwork - -installNodeModules - -PORT=4000 node app diff --git a/balance-transfer/typescript/.gitignore b/balance-transfer/typescript/.gitignore deleted file mode 100644 index 5e283e61..00000000 --- a/balance-transfer/typescript/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -package-lock.json -dist -types/fabric-client diff --git a/balance-transfer/typescript/README.md b/balance-transfer/typescript/README.md deleted file mode 100644 index bbfdc1f8..00000000 --- a/balance-transfer/typescript/README.md +++ /dev/null @@ -1,303 +0,0 @@ -## Balance transfer - -This is a sample Node.js application written using typescript which demonstrates -the **__fabric-client__** and **__fabric-ca-client__** Node.js SDK APIs for typescript. - -### Prerequisites and setup: - -* [Docker](https://www.docker.com/products/overview) - v1.12 or higher -* [Docker Compose](https://docs.docker.com/compose/overview/) - v1.8 or higher -* [Git client](https://git-scm.com/downloads) - needed for clone commands -* **Node.js** v6.9.0 - 6.10.0 ( __Node v7+ is not supported__ ) -* [Download Docker images](http://hyperledger-fabric.readthedocs.io/en/latest/samples.html#binaries) - -``` -cd fabric-samples/balance-transfer/ -``` - -Once you have completed the above setup, you will have provisioned a local network with the following docker container configuration: - -* 2 CAs -* A SOLO orderer -* 4 peers (2 peers per Org) - -#### Artifacts - -* Crypto material has been generated using the **cryptogen** tool from Hyperledger Fabric and mounted to all peers, the orderering node and CA containers. More details regarding the cryptogen tool are available [here](http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#crypto-generator). - -* An Orderer genesis block (genesis.block) and channel configuration transaction (mychannel.tx) has been pre generated using the **configtxgen** tool from Hyperledger Fabric and placed within the artifacts folder. More details regarding the configtxgen tool are available [here](http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#configuration-transaction-generator). - -## Running the sample program - -There are two options available for running the balance-transfer sample as shown below. - -### Option 1 - -##### Terminal Window 1 - -``` -cd fabric-samples/balance-transfer/typescript - -./runApp.sh - -``` - -This performs the following steps: -* launches the required network on your local machine -* installs the fabric-client and fabric-ca-client node modules -* starts the node app on PORT 4000 - -##### Terminal Window 2 - -NOTE: In order for the following shell script to properly parse the JSON, you must install ``jq``. - -See instructions at [https://stedolan.github.io/jq/](https://stedolan.github.io/jq/). - -Test the APIs as follows: -``` -cd fabric-samples/balance-transfer/typescript - -./testAPIs.sh - -``` - -### Option 2 is a more manual approach - -##### Terminal Window 1 - -* Launch the network using docker-compose - -``` -docker-compose -f artifacts/docker-compose.yaml up -``` -##### Terminal Window 2 - -* Install the fabric-client and fabric-ca-client node modules - -``` -npm install -``` - -*** NOTE - If running this before the new version of the node SDK is published which includes the typescript definition files, you will need to do the following: - -``` -cp types/fabric-client/index.d.tx node_modules/fabric-client/index.d.ts -cp types/fabric-ca-client/index.d.tx node_modules/fabric-ca-client/index.d.ts -``` - -* Start the node app on PORT 4000 - -``` -PORT=4000 ts-node app.ts -``` - -##### Terminal Window 3 - -* Execute the REST APIs from the section [Sample REST APIs Requests](https://github.com/hyperledger/fabric-samples/tree/master/balance-transfer#sample-rest-apis-requests) - -## Sample REST APIs Requests - -### Login Request - -* Register and enroll new users in Organization - **Org1**: - -`curl -s -X POST http://localhost:4000/users -H "content-type: application/x-www-form-urlencoded" -d 'username=Jim&orgName=org1'` - -**OUTPUT:** - -``` -{ - "success": true, - "secret": "RaxhMgevgJcm", - "message": "Jim enrolled Successfully", - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" -} -``` - -The response contains the success/failure status, an **enrollment Secret** and a **JSON Web Token (JWT)** that is a required string in the Request Headers for subsequent requests. - -### Create Channel request - -``` -curl -s -X POST \ - http://localhost:4000/channels \ - -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" \ - -H "content-type: application/json" \ - -d '{ - "channelName":"mychannel", - "channelConfigPath":"../artifacts/channel/mychannel.tx" -}' -``` - -Please note that the Header **authorization** must contain the JWT returned from the `POST /users` call - -### Join Channel request - -``` -curl -s -X POST \ - http://localhost:4000/channels/mychannel/peers \ - -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" \ - -H "content-type: application/json" \ - -d '{ - "peers": ["peer1","peer2"] -}' -``` -### Install chaincode - -``` -curl -s -X POST \ - http://localhost:4000/chaincodes \ - -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" \ - -H "content-type: application/json" \ - -d '{ - "peers": ["peer1","peer2"], - "chaincodeName":"mycc", - "chaincodePath":"github.com/example_cc/go", - "chaincodeVersion":"v0" -}' -``` - -### Instantiate chaincode - -``` -curl -s -X POST \ - http://localhost:4000/channels/mychannel/chaincodes \ - -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" \ - -H "content-type: application/json" \ - -d '{ - "chaincodeName":"mycc", - "chaincodeVersion":"v0", - "args":["a","100","b","200"] -}' -``` - -### Invoke request - -``` -curl -s -X POST \ - http://localhost:4000/channels/mychannel/chaincodes/mycc \ - -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" \ - -H "content-type: application/json" \ - -d '{ - "fcn":"move", - "args":["a","b","10"] -}' -``` -**NOTE:** Ensure that you save the Transaction ID from the response in order to pass this string in the subsequent query transactions. - -### Chaincode Query - -``` -curl -s -X GET \ - "http://localhost:4000/channels/mychannel/chaincodes/mycc?peer=peer1&fcn=query&args=%5B%22a%22%5D" \ - -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" \ - -H "content-type: application/json" -``` - -### Query Block by BlockNumber - -``` -curl -s -X GET \ - "http://localhost:4000/channels/mychannel/blocks/1?peer=peer1" \ - -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" \ - -H "content-type: application/json" -``` - -### Query Transaction by TransactionID - -``` -curl -s -X GET http://localhost:4000/channels/mychannel/transactions/TRX_ID?peer=peer1 \ - -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" \ - -H "content-type: application/json" -``` -**NOTE**: Here the TRX_ID can be from any previous invoke transaction - - -### Query ChainInfo - -``` -curl -s -X GET \ - "http://localhost:4000/channels/mychannel?peer=peer1" \ - -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" \ - -H "content-type: application/json" -``` - -### Query Installed chaincodes - -``` -curl -s -X GET \ - "http://localhost:4000/chaincodes?peer=peer1&type=installed" \ - -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" \ - -H "content-type: application/json" -``` - -### Query Instantiated chaincodes - -``` -curl -s -X GET \ - "http://localhost:4000/chaincodes?peer=peer1&type=instantiated" \ - -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" \ - -H "content-type: application/json" -``` - -### Query Channels - -``` -curl -s -X GET \ - "http://localhost:4000/channels?peer=peer1" \ - -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTQ4NjU1OTEsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE0OTQ4NjE5OTF9.yWaJhFDuTvMQRaZIqg20Is5t-JJ_1BP58yrNLOKxtNI" \ - -H "content-type: application/json" -``` - -### Network configuration considerations - -You have the ability to change configuration parameters by either directly editing the network-config.json file or provide an additional file for an alternative target network. The app uses an optional environment variable "TARGET_NETWORK" to control the configuration files to use. For example, if you deployed the target network on Amazon Web Services EC2, you can add a file "network-config-aws.json", and set the "TARGET_NETWORK" environment to 'aws'. The app will pick up the settings inside the "network-config-aws.json" file. - -#### IP Address** and PORT information - -If you choose to customize your docker-compose yaml file by hardcoding IP Addresses and PORT information for your peers and orderer, then you MUST also add the identical values into the network-config.json file. The paths shown below will need to be adjusted to match your docker-compose yaml file. - -``` - "orderer": { - "url": "grpcs://x.x.x.x:7050", - "server-hostname": "orderer0", - "tls_cacerts": "../artifacts/tls/orderer/ca-cert.pem" - }, - "org1": { - "ca": "http://x.x.x.x:7054", - "peer1": { - "requests": "grpcs://x.x.x.x:7051", - "events": "grpcs://x.x.x.x:7053", - ... - }, - "peer2": { - "requests": "grpcs://x.x.x.x:7056", - "events": "grpcs://x.x.x.x:7058", - ... - } - }, - "org2": { - "ca": "http://x.x.x.x:8054", - "peer1": { - "requests": "grpcs://x.x.x.x:8051", - "events": "grpcs://x.x.x.x:8053", - ... }, - "peer2": { - "requests": "grpcs://x.x.x.x:8056", - "events": "grpcs://x.x.x.x:8058", - ... - } - } - -``` - -#### Discover IP Address - -To retrieve the IP Address for one of your network entities, issue the following command: - -``` -# The following will return the IP Address for peer0 -docker inspect peer0 | grep IPAddress -``` - -Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/balance-transfer/typescript/api/chaincode.ts b/balance-transfer/typescript/api/chaincode.ts deleted file mode 100644 index 4c5fda6b..00000000 --- a/balance-transfer/typescript/api/chaincode.ts +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright 2017 Kapil Sachdeva All Rights Reserved. - * - * 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. - */ - -import * as express from 'express'; -import log4js = require('log4js'); -const logger = log4js.getLogger('SampleWebApp'); -import hfc = require('fabric-client'); -import * as jwt from 'jsonwebtoken'; -import * as helper from '../lib/helper'; -import * as channelApi from '../lib/channel'; -import * as chainCodeApi from '../lib/chaincode'; -import { RequestEx } from '../interfaces'; -import { getErrorMessage } from './utils'; - -export default function chainCodeHandlers(app: express.Application) { - - async function installChainCode(req: RequestEx, res: express.Response) { - logger.debug('==================== INSTALL CHAINCODE =================='); - - const peers = req.body.peers; - const chaincodeName = req.body.chaincodeName; - const chaincodePath = req.body.chaincodePath; - const chaincodeVersion = req.body.chaincodeVersion; - - logger.debug('peers : ' + peers); // target peers list - logger.debug('chaincodeName : ' + chaincodeName); - logger.debug('chaincodePath : ' + chaincodePath); - logger.debug('chaincodeVersion : ' + chaincodeVersion); - - if (!peers || peers.length === 0) { - res.json(getErrorMessage('\'peers\'')); - return; - } - if (!chaincodeName) { - res.json(getErrorMessage('\'chaincodeName\'')); - return; - } - if (!chaincodePath) { - res.json(getErrorMessage('\'chaincodePath\'')); - return; - } - if (!chaincodeVersion) { - res.json(getErrorMessage('\'chaincodeVersion\'')); - return; - } - - const message = await chainCodeApi.installChaincode( - peers, chaincodeName, chaincodePath, chaincodeVersion, req.username, req.orgname); - - res.send(message); - } - - async function queryChainCode(req: RequestEx, res: express.Response) { - const peer = req.query.peer; - const installType = req.query.type; - // TODO: add Constnats - if (installType === 'installed') { - logger.debug( - '================ GET INSTALLED CHAINCODES ======================'); - } else { - logger.debug( - '================ GET INSTANTIATED CHAINCODES ======================'); - } - - const message = await chainCodeApi.getInstalledChaincodes( - peer, installType, req.username, req.orgname); - - res.send(message); - } - - const API_ENDPOINT_CHAINCODE_INSTALL = '/chaincodes'; - const API_ENDPOINT_CHAINCODE_QUERY = '/chaincodes'; - - app.post(API_ENDPOINT_CHAINCODE_INSTALL, installChainCode); - app.get(API_ENDPOINT_CHAINCODE_QUERY, queryChainCode); -} diff --git a/balance-transfer/typescript/api/channel.ts b/balance-transfer/typescript/api/channel.ts deleted file mode 100644 index 49a79c72..00000000 --- a/balance-transfer/typescript/api/channel.ts +++ /dev/null @@ -1,261 +0,0 @@ -/** - * Copyright 2017 Kapil Sachdeva All Rights Reserved. - * - * 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. - */ - -import * as express from 'express'; -import log4js = require('log4js'); -const logger = log4js.getLogger('SampleWebApp'); -import hfc = require('fabric-client'); -import * as jwt from 'jsonwebtoken'; -import * as helper from '../lib/helper'; -import * as channelApi from '../lib/channel'; -import { RequestEx } from '../interfaces'; -import { getErrorMessage } from './utils'; - -export default function channelHandlers(app: express.Application) { - - async function createNewChannel(req: RequestEx, res: express.Response) { - logger.info('<<<<<<<<<<<<<<<<< C R E A T E C H A N N E L >>>>>>>>>>>>>>>>>'); - logger.debug('End point : /channels'); - - const channelName = req.body.channelName; - const channelConfigPath = req.body.channelConfigPath; - - logger.debug('Channel name : ' + channelName); - // ../artifacts/channel/mychannel.tx - logger.debug('channelConfigPath : ' + channelConfigPath); - - if (!channelName) { - res.json(getErrorMessage('\'channelName\'')); - return; - } - if (!channelConfigPath) { - res.json(getErrorMessage('\'channelConfigPath\'')); - return; - } - - const response = await channelApi.createChannel( - channelName, channelConfigPath, req.username, req.orgname); - - res.send(response); - } - - async function joinChannel(req: RequestEx, res: express.Response) { - logger.info('<<<<<<<<<<<<<<<<< J O I N C H A N N E L >>>>>>>>>>>>>>>>>'); - - const channelName = req.params.channelName; - const peers = req.body.peers; - logger.debug('channelName : ' + channelName); - logger.debug('peers : ' + peers); - if (!channelName) { - res.json(getErrorMessage('\'channelName\'')); - return; - } - if (!peers || peers.length === 0) { - res.json(getErrorMessage('\'peers\'')); - return; - } - - const message = await channelApi.joinChannel(channelName, peers, req.username, req.orgname); - res.send(message); - } - - async function instantiateChainCode(req: RequestEx, res: express.Response) { - logger.debug('==================== INSTANTIATE CHAINCODE =================='); - const chaincodeName = req.body.chaincodeName; - const chaincodeVersion = req.body.chaincodeVersion; - const channelName = req.params.channelName; - const fcn = req.body.fcn; - const args = req.body.args; - logger.debug('channelName : ' + channelName); - logger.debug('chaincodeName : ' + chaincodeName); - logger.debug('chaincodeVersion : ' + chaincodeVersion); - logger.debug('fcn : ' + fcn); - logger.debug('args : ' + args); - if (!chaincodeName) { - res.json(getErrorMessage('\'chaincodeName\'')); - return; - } - if (!chaincodeVersion) { - res.json(getErrorMessage('\'chaincodeVersion\'')); - return; - } - if (!channelName) { - res.json(getErrorMessage('\'channelName\'')); - return; - } - if (!args) { - res.json(getErrorMessage('\'args\'')); - return; - } - - const message = await channelApi.instantiateChainCode( - channelName, chaincodeName, chaincodeVersion, fcn, args, req.username, req.orgname); - res.send(message); - } - - async function invokeChainCode(req: RequestEx, res: express.Response) { - logger.debug('==================== INVOKE ON CHAINCODE =================='); - const peers = req.body.peers; - const chaincodeName = req.params.chaincodeName; - const channelName = req.params.channelName; - const fcn = req.body.fcn; - const args = req.body.args; - logger.debug('channelName : ' + channelName); - logger.debug('chaincodeName : ' + chaincodeName); - logger.debug('fcn : ' + fcn); - logger.debug('args : ' + args); - if (!chaincodeName) { - res.json(getErrorMessage('\'chaincodeName\'')); - return; - } - if (!channelName) { - res.json(getErrorMessage('\'channelName\'')); - return; - } - if (!fcn) { - res.json(getErrorMessage('\'fcn\'')); - return; - } - if (!args) { - res.json(getErrorMessage('\'args\'')); - return; - } - - const message = await channelApi.invokeChaincode( - peers, channelName, chaincodeName, fcn, args, req.username, req.orgname); - - res.send(message); - } - - async function queryChainCode(req: RequestEx, res: express.Response) { - const channelName = req.params.channelName; - const chaincodeName = req.params.chaincodeName; - let args = req.query.args; - const fcn = req.query.fcn; - const peer = req.query.peer; - - logger.debug('channelName : ' + channelName); - logger.debug('chaincodeName : ' + chaincodeName); - logger.debug('fcn : ' + fcn); - logger.debug('args : ' + args); - - if (!chaincodeName) { - res.json(getErrorMessage('\'chaincodeName\'')); - return; - } - if (!channelName) { - res.json(getErrorMessage('\'channelName\'')); - return; - } - if (!fcn) { - res.json(getErrorMessage('\'fcn\'')); - return; - } - if (!args) { - res.json(getErrorMessage('\'args\'')); - return; - } - - args = args.replace(/'/g, '"'); - args = JSON.parse(args); - logger.debug(args); - - const message = await channelApi.queryChaincode( - peer, channelName, chaincodeName, args, fcn, req.username, req.orgname); - - res.send(message); - } - - async function queryByBlockNumber(req: RequestEx, res: express.Response) { - logger.debug('==================== GET BLOCK BY NUMBER =================='); - const blockId = req.params.blockId; - const peer = req.query.peer; - logger.debug('channelName : ' + req.params.channelName); - logger.debug('BlockID : ' + blockId); - logger.debug('Peer : ' + peer); - if (!blockId) { - res.json(getErrorMessage('\'blockId\'')); - return; - } - - const message = await channelApi.getBlockByNumber(peer, blockId, req.username, req.orgname); - res.send(message); - } - - async function queryByTransactionId(req: RequestEx, res: express.Response) { - logger.debug( - '================ GET TRANSACTION BY TRANSACTION_ID ======================' - ); - logger.debug('channelName : ' + req.params.channelName); - const trxnId = req.params.trxnId; - const peer = req.query.peer; - if (!trxnId) { - res.json(getErrorMessage('\'trxnId\'')); - return; - } - - const message = await channelApi.getTransactionByID( - peer, trxnId, req.username, req.orgname); - - res.send(message); - } - - async function queryChannelInfo(req: RequestEx, res: express.Response) { - logger.debug( - '================ GET CHANNEL INFORMATION ======================'); - logger.debug('channelName : ' + req.params.channelName); - const peer = req.query.peer; - - const message = await channelApi.getChainInfo(peer, req.username, req.orgname); - - res.send(message); - } - - async function queryChannels(req: RequestEx, res: express.Response) { - logger.debug('================ GET CHANNELS ======================'); - logger.debug('peer: ' + req.query.peer); - const peer = req.query.peer; - if (!peer) { - res.json(getErrorMessage('\'peer\'')); - return; - } - - const message = await channelApi.getChannels(peer, req.username, req.orgname); - res.send(message); - } - - const API_ENDPOINT_CHANNEL_CREATE = '/channels'; - const API_ENDPOINT_CHANNEL_JOIN = '/channels/:channelName/peers'; - const API_ENDPOINT_CHANNEL_INSTANTIATE_CHAINCODE = '/channels/:channelName/chaincodes'; - const API_ENDPOINT_CHANNEL_INVOKE_CHAINCODE = - '/channels/:channelName/chaincodes/:chaincodeName'; - const API_ENDPOINT_CHANNEL_QUERY_CHAINCODE = '/channels/:channelName/chaincodes/:chaincodeName'; - const API_ENDPOINT_CHANNEL_QUERY_BY_BLOCKNUMBER = '/channels/:channelName/blocks/:blockId'; - const API_ENDPOINT_CHANNEL_QUERY_BY_TRANSACTIONID - = '/channels/:channelName/transactions/:trxnId'; - const API_ENDPOINT_CHANNEL_INFO = '/channels/:channelName'; - const API_ENDPOINT_CHANNEL_QUERY = '/channels'; - - app.post(API_ENDPOINT_CHANNEL_CREATE, createNewChannel); - app.post(API_ENDPOINT_CHANNEL_JOIN, joinChannel); - app.post(API_ENDPOINT_CHANNEL_INSTANTIATE_CHAINCODE, instantiateChainCode); - app.post(API_ENDPOINT_CHANNEL_INVOKE_CHAINCODE, invokeChainCode); - app.get(API_ENDPOINT_CHANNEL_QUERY_CHAINCODE, queryChainCode); - app.get(API_ENDPOINT_CHANNEL_QUERY_BY_BLOCKNUMBER, queryByBlockNumber); - app.get(API_ENDPOINT_CHANNEL_QUERY_BY_TRANSACTIONID, queryByTransactionId); - app.get(API_ENDPOINT_CHANNEL_INFO, queryChannelInfo); - app.get(API_ENDPOINT_CHANNEL_QUERY, queryChannels); -} diff --git a/balance-transfer/typescript/api/index.ts b/balance-transfer/typescript/api/index.ts deleted file mode 100644 index f49700e0..00000000 --- a/balance-transfer/typescript/api/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright 2017 Kapil Sachdeva All Rights Reserved. - * - * 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. - */ - -import * as express from 'express'; -import userHandlers from './users'; -import channelHandlers from './channel'; -import chainCodeHandlers from './chaincode'; - -export default function entryPoint(app: express.Application) { - // various handlers - userHandlers(app); - channelHandlers(app); - chainCodeHandlers(app); -} diff --git a/balance-transfer/typescript/api/users.ts b/balance-transfer/typescript/api/users.ts deleted file mode 100644 index d9462555..00000000 --- a/balance-transfer/typescript/api/users.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright 2017 Kapil Sachdeva All Rights Reserved. - * - * 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. - */ - -import { RequestEx } from '../interfaces'; -import * as express from 'express'; -import log4js = require('log4js'); -const logger = log4js.getLogger('SampleWebApp'); -import hfc = require('fabric-client'); -import * as jwt from 'jsonwebtoken'; -import * as helper from '../lib/helper'; -import { getErrorMessage } from './utils'; - -export default function userHandlers(app: express.Application) { - - async function registerUser(req: RequestEx, res: express.Response) { - const username = req.body.username; - const orgName = req.body.orgName; - - logger.debug('End point : /users'); - logger.debug('User name : ' + username); - logger.debug('Org name : ' + orgName); - - if (!username) { - res.json(getErrorMessage('\'username\'')); - return; - } - if (!orgName) { - res.json(getErrorMessage('\'orgName\'')); - return; - } - const token = jwt.sign({ - exp: Math.floor(Date.now() / 1000) + parseInt( - hfc.getConfigSetting('jwt_expiretime'), 10), - username, - orgName - }, app.get('secret')); - - const response = await helper.getRegisteredUsers(username, orgName); - - if (response && typeof response !== 'string') { - res.json({ - success: true, - token - }); - } else { - res.json({ - success: false, - message: response - }); - } - } - - const API_ENDPOINT_REGISTER_USER = '/users'; - - app.post(API_ENDPOINT_REGISTER_USER, registerUser); -} diff --git a/balance-transfer/typescript/api/utils.ts b/balance-transfer/typescript/api/utils.ts deleted file mode 100644 index 128545fe..00000000 --- a/balance-transfer/typescript/api/utils.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2017 Kapil Sachdeva All Rights Reserved. - * - * 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. - */ - -export function getErrorMessage(field: string) { - const response = { - success: false, - message: field + ' field is missing or Invalid in the request' - }; - return response; -} diff --git a/balance-transfer/typescript/app.ts b/balance-transfer/typescript/app.ts deleted file mode 100644 index 66e8680b..00000000 --- a/balance-transfer/typescript/app.ts +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright 2017 Kapil Sachdeva All Rights Reserved. - * - * 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. - */ - -import log4js = require('log4js'); -import * as util from 'util'; -import * as http from 'http'; -import * as express from 'express'; -import * as jwt from 'jsonwebtoken'; -import * as bodyParser from 'body-parser'; -import expressJWT = require('express-jwt'); -// tslint:disable-next-line:no-var-requires -const bearerToken = require('express-bearer-token'); -import cors = require('cors'); -import hfc = require('fabric-client'); -import * as helper from './lib/helper'; -import { RequestEx } from './interfaces'; -import api from './api'; - -helper.init(); - -const SERVER_HOST = process.env.HOST || hfc.getConfigSetting('host'); -const SERVER_PORT = process.env.PORT || hfc.getConfigSetting('port'); - -const logger = log4js.getLogger('SampleWebApp'); - -// create express App -const app = express(); - -app.options('*', cors()); -app.use(cors()); -app.use(bodyParser.json()); -app.use(bodyParser.urlencoded({ - extended: false -})); -app.set('secret', 'thisismysecret'); -app.use(expressJWT({ - secret: 'thisismysecret' -}).unless({ - path: ['/users'] -})); -app.use(bearerToken()); - -app.use((req: RequestEx, res, next) => { - if (req.originalUrl.indexOf('/users') >= 0) { - return next(); - } - - const token = req.token; - jwt.verify(token, app.get('secret'), (err: Error, decoded: any) => { - if (err) { - res.send({ - success: false, - message: 'Failed to authenticate token. Make sure to include the ' + - 'token returned from /users call in the authorization header ' + - ' as a Bearer token' - }); - return; - } else { - // add the decoded user name and org name to the request object - // for the downstream code to use - req.username = decoded.username; - req.orgname = decoded.orgName; - logger.debug( - util.format('Decoded from JWT token: username - %s, orgname - %s', - decoded.username, decoded.orgName)); - return next(); - } - }); -}); - -// configure various routes -api(app); - -const server = http.createServer(app); -server.listen(SERVER_PORT); - -logger.info('****************** SERVER STARTED ************************'); -logger.info('************** http://' + SERVER_HOST + ':' + SERVER_PORT + ' ******************'); -server.timeout = 240000; diff --git a/balance-transfer/typescript/app_config.json b/balance-transfer/typescript/app_config.json deleted file mode 100644 index 6406d66f..00000000 --- a/balance-transfer/typescript/app_config.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "host": "localhost", - "port": "4000", - "jwt_expiretime": "36000", - "channelName": "mychannel", - "CC_SRC_PATH": "../artifacts", - "keyValueStore": "/tmp/fabric-client-kvs", - "eventWaitTime": "30000", - "admins": [{ - "username": "admin", - "secret": "adminpw" - }] -} diff --git a/balance-transfer/typescript/artifacts b/balance-transfer/typescript/artifacts deleted file mode 120000 index 70f9aabc..00000000 --- a/balance-transfer/typescript/artifacts +++ /dev/null @@ -1 +0,0 @@ -../artifacts \ No newline at end of file diff --git a/balance-transfer/typescript/config.ts b/balance-transfer/typescript/config.ts deleted file mode 100644 index 1277eee4..00000000 --- a/balance-transfer/typescript/config.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2017 Kapil Sachdeva All Rights Reserved. - * - * 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. - */ - -import * as util from 'util'; - -let file = 'network-config%s.json'; - -const env = process.env.TARGET_NETWORK; -if (env) { - file = util.format(file, '-' + env); -} else { - file = util.format(file, ''); -} - -export default { - networkConfigFile: file -}; diff --git a/balance-transfer/typescript/interfaces.ts b/balance-transfer/typescript/interfaces.ts deleted file mode 100644 index 6acd2b1b..00000000 --- a/balance-transfer/typescript/interfaces.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2017 Kapil Sachdeva All Rights Reserved. - * - * 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. - */ - -import * as express from 'express'; - -export interface RequestEx extends express.Request { - username?: any; - orgname?: any; - token?: any; -} diff --git a/balance-transfer/typescript/lib/network-config.json b/balance-transfer/typescript/lib/network-config.json deleted file mode 100644 index 2ec10ac9..00000000 --- a/balance-transfer/typescript/lib/network-config.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "network-config": { - "orderer": { - "url": "grpcs://localhost:7050", - "server-hostname": "orderer.example.com", - "tls_cacerts": "../artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt" - }, - "org1": { - "name": "peerOrg1", - "mspid": "Org1MSP", - "ca": "https://localhost:7054", - "peers": { - "peer1": { - "requests": "grpcs://localhost:7051", - "events": "grpcs://localhost:7053", - "server-hostname": "peer0.org1.example.com", - "tls_cacerts": "../artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" - }, - "peer2": { - "requests": "grpcs://localhost:7056", - "events": "grpcs://localhost:7058", - "server-hostname": "peer1.org1.example.com", - "tls_cacerts": "../artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" - } - }, - "admin": { - "key": "../artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore", - "cert": "../artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts" - } - }, - "org2": { - "name": "peerOrg2", - "mspid": "Org2MSP", - "ca": "https://localhost:8054", - "peers": { - "peer1": { - "requests": "grpcs://localhost:8051", - "events": "grpcs://localhost:8053", - "server-hostname": "peer0.org2.example.com", - "tls_cacerts": "../artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" - }, - "peer2": { - "requests": "grpcs://localhost:8056", - "events": "grpcs://localhost:8058", - "server-hostname": "peer1.org2.example.com", - "tls_cacerts": "../artifacts/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt" - } - }, - "admin": { - "key": "../artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore", - "cert": "../artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts" - } - } - } -} diff --git a/balance-transfer/typescript/testAPIs.sh b/balance-transfer/typescript/testAPIs.sh deleted file mode 100755 index 8447ad2c..00000000 --- a/balance-transfer/typescript/testAPIs.sh +++ /dev/null @@ -1,197 +0,0 @@ -#!/bin/bash -# -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -jq --version > /dev/null 2>&1 -if [ $? -ne 0 ]; then - echo "Please Install 'jq' https://stedolan.github.io/jq/ to execute this script" - echo - exit 1 -fi -starttime=$(date +%s) - -echo "POST request Enroll on Org1 ..." -echo -ORG1_TOKEN=$(curl -s -X POST \ - http://localhost:4000/users \ - -H "content-type: application/x-www-form-urlencoded" \ - -d 'username=Jim&orgName=org1') -echo $ORG1_TOKEN -ORG1_TOKEN=$(echo $ORG1_TOKEN | jq ".token" | sed "s/\"//g") -echo -echo "ORG1 token is $ORG1_TOKEN" -echo -echo "POST request Enroll on Org2 ..." -echo -ORG2_TOKEN=$(curl -s -X POST \ - http://localhost:4000/users \ - -H "content-type: application/x-www-form-urlencoded" \ - -d 'username=Barry&orgName=org2') -echo $ORG2_TOKEN -ORG2_TOKEN=$(echo $ORG2_TOKEN | jq ".token" | sed "s/\"//g") -echo -echo "ORG2 token is $ORG2_TOKEN" -echo -echo -echo "POST request Create channel ..." -echo -curl -s -X POST \ - http://localhost:4000/channels \ - -H "authorization: Bearer $ORG1_TOKEN" \ - -H "content-type: application/json" \ - -d '{ - "channelName":"mychannel", - "channelConfigPath":"../artifacts/channel/mychannel.tx" -}' -echo -echo -sleep 5 -echo "POST request Join channel on Org1" -echo -curl -s -X POST \ - http://localhost:4000/channels/mychannel/peers \ - -H "authorization: Bearer $ORG1_TOKEN" \ - -H "content-type: application/json" \ - -d '{ - "peers": ["peer1","peer2"] -}' -echo -echo - -echo "POST request Join channel on Org2" -echo -curl -s -X POST \ - http://localhost:4000/channels/mychannel/peers \ - -H "authorization: Bearer $ORG2_TOKEN" \ - -H "content-type: application/json" \ - -d '{ - "peers": ["peer1","peer2"] -}' -echo -echo - -echo "POST Install chaincode on Org1" -echo -curl -s -X POST \ - http://localhost:4000/chaincodes \ - -H "authorization: Bearer $ORG1_TOKEN" \ - -H "content-type: application/json" \ - -d '{ - "peers": ["peer1", "peer2"], - "chaincodeName":"mycc", - "chaincodePath":"github.com/example_cc/go", - "chaincodeVersion":"v0" -}' -echo -echo - - -echo "POST Install chaincode on Org2" -echo -curl -s -X POST \ - http://localhost:4000/chaincodes \ - -H "authorization: Bearer $ORG2_TOKEN" \ - -H "content-type: application/json" \ - -d '{ - "peers": ["peer1","peer2"], - "chaincodeName":"mycc", - "chaincodePath":"github.com/example_cc/go", - "chaincodeVersion":"v0" -}' -echo -echo - -echo "POST instantiate chaincode on peer1 of Org1" -echo -curl -s -X POST \ - http://localhost:4000/channels/mychannel/chaincodes \ - -H "authorization: Bearer $ORG1_TOKEN" \ - -H "content-type: application/json" \ - -d '{ - "chaincodeName":"mycc", - "chaincodeVersion":"v0", - "args":["a","100","b","200"] -}' -echo -echo - -echo "POST invoke chaincode on peers of Org1 and Org2" -echo -TRX_ID=$(curl -s -X POST \ - http://localhost:4000/channels/mychannel/chaincodes/mycc \ - -H "authorization: Bearer $ORG1_TOKEN" \ - -H "content-type: application/json" \ - -d '{ - "fcn":"move", - "args":["a","b","10"] -}') -echo "Transaction ID is $TRX_ID" -echo -echo - -echo "GET query chaincode on peer1 of Org1" -echo -curl -s -X GET \ - "http://localhost:4000/channels/mychannel/chaincodes/mycc?peer=peer1&fcn=query&args=%5B%22a%22%5D" \ - -H "authorization: Bearer $ORG1_TOKEN" \ - -H "content-type: application/json" -echo -echo - -echo "GET query Block by blockNumber" -echo -curl -s -X GET \ - "http://localhost:4000/channels/mychannel/blocks/1?peer=peer1" \ - -H "authorization: Bearer $ORG1_TOKEN" \ - -H "content-type: application/json" -echo -echo - -echo "GET query Transaction by TransactionID" -echo -curl -s -X GET http://localhost:4000/channels/mychannel/transactions/$TRX_ID?peer=peer1 \ - -H "authorization: Bearer $ORG1_TOKEN" \ - -H "content-type: application/json" -echo -echo - -echo "GET query ChainInfo" -echo -curl -s -X GET \ - "http://localhost:4000/channels/mychannel?peer=peer1" \ - -H "authorization: Bearer $ORG1_TOKEN" \ - -H "content-type: application/json" -echo -echo - -echo "GET query Installed chaincodes" -echo -curl -s -X GET \ - "http://localhost:4000/chaincodes?peer=peer1&type=installed" \ - -H "authorization: Bearer $ORG1_TOKEN" \ - -H "content-type: application/json" -echo -echo - -echo "GET query Instantiated chaincodes" -echo -curl -s -X GET \ - "http://localhost:4000/chaincodes?peer=peer1&type=instantiated" \ - -H "authorization: Bearer $ORG1_TOKEN" \ - -H "content-type: application/json" -echo -echo - -echo "GET query Channels" -echo -curl -s -X GET \ - "http://localhost:4000/channels?peer=peer1" \ - -H "authorization: Bearer $ORG1_TOKEN" \ - -H "content-type: application/json" -echo -echo - -echo "Total execution time : $(($(date +%s)-starttime)) secs ..." diff --git a/balance-transfer/typescript/tsconfig.json b/balance-transfer/typescript/tsconfig.json deleted file mode 100644 index 7d6de875..00000000 --- a/balance-transfer/typescript/tsconfig.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "compilerOptions": { - "removeComments": false, - "preserveConstEnums": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "sourceMap": true, - "declaration": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "suppressImplicitAnyIndexErrors": true, - "moduleResolution": "node", - "module": "commonjs", - "target": "es6", - "outDir": "dist", - "baseUrl": ".", - "typeRoots": [ - "types", - "node_modules/@types" - ] - }, - "formatCodeOptions": { - "indentSize": 2, - "tabSize": 2 - } -} \ No newline at end of file diff --git a/balance-transfer/typescript/tslint.json b/balance-transfer/typescript/tslint.json deleted file mode 100644 index 90646163..00000000 --- a/balance-transfer/typescript/tslint.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "extends": "tslint:recommended", - "rulesDirectory": [ - "tslint-microsoft-contrib" - ], - "rules": { - "trailing-comma": [false, { - "multiline": "always", - "singleline": "never" - }], - "interface-name": [false, "always-prefix"], - "no-console": [true, - "time", - "timeEnd", - "trace" - ], - "max-line-length": [ - true, - 100 - ], - "no-string-literal": false, - "no-use-before-declare": true, - "object-literal-sort-keys": false, - "ordered-imports": [false], - "quotemark": [ - true, - "single", - "avoid-escape" - ], - "variable-name": [ - true, - "allow-leading-underscore", - "allow-pascal-case", - "ban-keywords", - "check-format" - ] - } -} \ No newline at end of file diff --git a/basic-network/README.md b/basic-network/README.md deleted file mode 100644 index ec8acfbc..00000000 --- a/basic-network/README.md +++ /dev/null @@ -1,14 +0,0 @@ -## Basic Network Config - -Note that this basic configuration uses pre-generated certificates and -key material, and also has predefined transactions to initialize a -channel named "mychannel". - -To regenerate this material, simply run ``generate.sh``. - -To start the network, run ``start.sh``. -To stop it, run ``stop.sh`` -To completely remove all incriminating evidence of the network -on your system, run ``teardown.sh``. - -Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License diff --git a/basic-network/config/channel.tx b/basic-network/config/channel.tx deleted file mode 100644 index bba64bed..00000000 Binary files a/basic-network/config/channel.tx and /dev/null differ diff --git a/basic-network/config/genesis.block b/basic-network/config/genesis.block deleted file mode 100644 index 5c47c782..00000000 Binary files a/basic-network/config/genesis.block and /dev/null differ diff --git a/basic-network/configtx.yaml b/basic-network/configtx.yaml deleted file mode 100644 index 98828ebc..00000000 --- a/basic-network/configtx.yaml +++ /dev/null @@ -1,131 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - ---- -################################################################################ -# -# Section: Organizations -# -# - This section defines the different organizational identities which will -# be referenced later in the configuration. -# -################################################################################ -Organizations: - - # SampleOrg defines an MSP using the sampleconfig. It should never be used - # in production but may be used as a template for other definitions - - &OrdererOrg - # DefaultOrg defines the organization which is used in the sampleconfig - # of the fabric.git development environment - Name: OrdererOrg - - # ID to load the MSP definition as - ID: OrdererMSP - - # MSPDir is the filesystem path which contains the MSP configuration - MSPDir: crypto-config/ordererOrganizations/example.com/msp - - - &Org1 - # DefaultOrg defines the organization which is used in the sampleconfig - # of the fabric.git development environment - Name: Org1MSP - - # ID to load the MSP definition as - ID: Org1MSP - - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - - AnchorPeers: - # AnchorPeers defines the location of peers which can be used - # for cross org gossip communication. Note, this value is only - # encoded in the genesis block in the Application section context - - Host: peer0.org1.example.com - Port: 7051 - -################################################################################ -# -# SECTION: Application -# -# - This section defines the values to encode into a config transaction or -# genesis block for application related parameters -# -################################################################################ -Application: &ApplicationDefaults - - # Organizations is the list of orgs which are defined as participants on - # the application side of the network - Organizations: - -################################################################################ -# -# SECTION: Orderer -# -# - This section defines the values to encode into a config transaction or -# genesis block for orderer related parameters -# -################################################################################ -Orderer: &OrdererDefaults - - # Orderer Type: The orderer implementation to start - # Available types are "solo" and "kafka" - OrdererType: solo - - Addresses: - - orderer.example.com:7050 - - # Batch Timeout: The amount of time to wait before creating a batch - BatchTimeout: 2s - - # Batch Size: Controls the number of messages batched into a block - BatchSize: - - # Max Message Count: The maximum number of messages to permit in a batch - MaxMessageCount: 10 - - # Absolute Max Bytes: The absolute maximum number of bytes allowed for - # the serialized messages in a batch. - AbsoluteMaxBytes: 99 MB - - # Preferred Max Bytes: The preferred maximum number of bytes allowed for - # the serialized messages in a batch. A message larger than the preferred - # max bytes will result in a batch larger than preferred max bytes. - PreferredMaxBytes: 512 KB - - Kafka: - # Brokers: A list of Kafka brokers to which the orderer connects - # NOTE: Use IP:port notation - Brokers: - - 127.0.0.1:9092 - - # Organizations is the list of orgs which are defined as participants on - # the orderer side of the network - Organizations: - -################################################################################ -# -# Profile -# -# - Different configuration profiles may be encoded here to be specified -# as parameters to the configtxgen tool -# -################################################################################ -Profiles: - - OneOrgOrdererGenesis: - Orderer: - <<: *OrdererDefaults - Organizations: - - *OrdererOrg - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - OneOrgChannel: - Consortium: SampleConsortium - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 - diff --git a/basic-network/connection.json b/basic-network/connection.json deleted file mode 100644 index 54cfca32..00000000 --- a/basic-network/connection.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "basic-network", - "version": "1.0.0", - "client": { - "organization": "Org1", - "connection": { - "timeout": { - "peer": { - "endorser": "300" - }, - "orderer": "300" - } - } - }, - "channels": { - "mychannel": { - "orderers": [ - "orderer.example.com" - ], - "peers": { - "peer0.org1.example.com": {} - } - } - }, - "organizations": { - "Org1": { - "mspid": "Org1MSP", - "peers": [ - "peer0.org1.example.com" - ], - "certificateAuthorities": [ - "ca.example.com" - ] - } - }, - "orderers": { - "orderer.example.com": { - "url": "grpc://localhost:7050" - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpc://localhost:7051" - } - }, - "certificateAuthorities": { - "ca.example.com": { - "url": "http://localhost:7054", - "caName": "ca.example.com" - } - } -} diff --git a/basic-network/connection.yaml b/basic-network/connection.yaml deleted file mode 100644 index 2493b121..00000000 --- a/basic-network/connection.yaml +++ /dev/null @@ -1,33 +0,0 @@ ---- -name: basic-network -version: 1.0.0 -client: - organization: Org1 - connection: - timeout: - peer: - endorser: '300' - orderer: '300' -channels: - mychannel: - orderers: - - orderer.example.com - peers: - peer0.org1.example.com: {} -organizations: - Org1: - mspid: Org1MSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.example.com -orderers: - orderer.example.com: - url: grpc://localhost:7050 -peers: - peer0.org1.example.com: - url: grpc://localhost:7051 -certificateAuthorities: - ca.example.com: - url: http://localhost:7054 - caName: ca.example.com diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/ca/a0606a4a860a1e31c90a23788da6f3b6b74925ed0d23061af4899409ba46ae6a_sk b/basic-network/crypto-config/ordererOrganizations/example.com/ca/a0606a4a860a1e31c90a23788da6f3b6b74925ed0d23061af4899409ba46ae6a_sk deleted file mode 100755 index eba07e23..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/ca/a0606a4a860a1e31c90a23788da6f3b6b74925ed0d23061af4899409ba46ae6a_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgbIRfBJjk/t3HLnEz -32V4sCllmJtnliVv4UmLfrjZ+B6hRANCAASM01iiFoDgTsTd27nU+R1z7YZbqM4I -Tlz13Mg+SQWsWn25IM6/IwtzNq5SSQZtJwpo7+gtS5IggDn7WJMi6Hy6 ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/ca/ca.example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/ca/ca.example.com-cert.pem deleted file mode 100644 index 240d4289..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/ca/ca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICLjCCAdWgAwIBAgIQHuAANpa/kDL7CPyNttctRjAKBggqhkjOPQQDAjBpMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w -bGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowaTELMAkGA1UE -BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz -Y28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABIzTWKIWgOBOxN3budT5HXPthluo -zghOXPXcyD5JBaxafbkgzr8jC3M2rlJJBm0nCmjv6C1LkiCAOftYkyLofLqjXzBd -MA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMB -Af8wKQYDVR0OBCIEIKBgakqGCh4xyQojeI2m87a3SSXtDSMGGvSJlAm6Rq5qMAoG -CCqGSM49BAMCA0cAMEQCIGShwWIKXmf3oJY3Oow7pKA0SSe89UsRLy2HMxxNzgWx -AiB097hBfmM2JEZsEZfMbEM2U7edQIDyCoPOgm5ha9wDNw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/msp/admincerts/Admin@example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/msp/admincerts/Admin@example.com-cert.pem deleted file mode 100644 index 60d3a0b5..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/msp/admincerts/Admin@example.com-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICCTCCAbCgAwIBAgIQVMXz1cejr3sGgDsXuIBK3zAKBggqhkjOPQQDAjBpMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w -bGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowVjELMAkGA1UE -BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz -Y28xGjAYBgNVBAMMEUFkbWluQGV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZI -zj0DAQcDQgAEFufLmRXBZHc3d7HvYSU4jR4nJnzfmJlWN6Gm0Bm+NsO8lwb1TDa4 -cPzAOgnbIm1VFwhBd+sE3TIzIWsM2Kzv1aNNMEswDgYDVR0PAQH/BAQDAgeAMAwG -A1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgoGBqSoYKHjHJCiN4jabztrdJJe0NIwYa -9ImUCbpGrmowCgYIKoZIzj0EAwIDRwAwRAIgId+xpuBHjfWvL8aAsDbmMjXAoOYy -BgazcJh446kZaDACIDeyvsH5Xwes5w5Sksv7mb6/kr4ceCy00h1Vlt5bwPiu ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/msp/cacerts/ca.example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/msp/cacerts/ca.example.com-cert.pem deleted file mode 100644 index 240d4289..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/msp/cacerts/ca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICLjCCAdWgAwIBAgIQHuAANpa/kDL7CPyNttctRjAKBggqhkjOPQQDAjBpMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w -bGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowaTELMAkGA1UE -BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz -Y28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABIzTWKIWgOBOxN3budT5HXPthluo -zghOXPXcyD5JBaxafbkgzr8jC3M2rlJJBm0nCmjv6C1LkiCAOftYkyLofLqjXzBd -MA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMB -Af8wKQYDVR0OBCIEIKBgakqGCh4xyQojeI2m87a3SSXtDSMGGvSJlAm6Rq5qMAoG -CCqGSM49BAMCA0cAMEQCIGShwWIKXmf3oJY3Oow7pKA0SSe89UsRLy2HMxxNzgWx -AiB097hBfmM2JEZsEZfMbEM2U7edQIDyCoPOgm5ha9wDNw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem deleted file mode 100644 index c0abc7f6..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNTCCAdugAwIBAgIQT0WLBisbcQ6AkirTJApb1TAKBggqhkjOPQQDAjBsMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xGjAYBgNVBAMTEXRsc2NhLmV4 -YW1wbGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowbDELMAkG -A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFu -Y2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5leGFt -cGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGtRFSyePgHhit2JfQNn -Gbda3X9Y+Eb5Ft/4L9uLsxc4zEMLt2TJZewEfO/Uoe9YH9VhFmGj/d9M0d/0HSAn -K8WjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB -/wQFMAMBAf8wKQYDVR0OBCIEII0hhlVshdUV5zfQwNqNDXZyeFtoXLUDvLleU9zC -efunMAoGCCqGSM49BAMCA0gAMEUCIQDxLfsMRqPJuoH77vahGkE6EYMqvzjVI2Ob -aV1DZJfUdwIgHuHXPvKvcoYZgAo7Xc57Uqs6hSpMs0CjzcfLXYiwoVc= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/admincerts/Admin@example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/admincerts/Admin@example.com-cert.pem deleted file mode 100644 index 60d3a0b5..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/admincerts/Admin@example.com-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICCTCCAbCgAwIBAgIQVMXz1cejr3sGgDsXuIBK3zAKBggqhkjOPQQDAjBpMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w -bGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowVjELMAkGA1UE -BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz -Y28xGjAYBgNVBAMMEUFkbWluQGV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZI -zj0DAQcDQgAEFufLmRXBZHc3d7HvYSU4jR4nJnzfmJlWN6Gm0Bm+NsO8lwb1TDa4 -cPzAOgnbIm1VFwhBd+sE3TIzIWsM2Kzv1aNNMEswDgYDVR0PAQH/BAQDAgeAMAwG -A1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgoGBqSoYKHjHJCiN4jabztrdJJe0NIwYa -9ImUCbpGrmowCgYIKoZIzj0EAwIDRwAwRAIgId+xpuBHjfWvL8aAsDbmMjXAoOYy -BgazcJh446kZaDACIDeyvsH5Xwes5w5Sksv7mb6/kr4ceCy00h1Vlt5bwPiu ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/cacerts/ca.example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/cacerts/ca.example.com-cert.pem deleted file mode 100644 index 240d4289..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/cacerts/ca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICLjCCAdWgAwIBAgIQHuAANpa/kDL7CPyNttctRjAKBggqhkjOPQQDAjBpMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w -bGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowaTELMAkGA1UE -BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz -Y28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABIzTWKIWgOBOxN3budT5HXPthluo -zghOXPXcyD5JBaxafbkgzr8jC3M2rlJJBm0nCmjv6C1LkiCAOftYkyLofLqjXzBd -MA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMB -Af8wKQYDVR0OBCIEIKBgakqGCh4xyQojeI2m87a3SSXtDSMGGvSJlAm6Rq5qMAoG -CCqGSM49BAMCA0cAMEQCIGShwWIKXmf3oJY3Oow7pKA0SSe89UsRLy2HMxxNzgWx -AiB097hBfmM2JEZsEZfMbEM2U7edQIDyCoPOgm5ha9wDNw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/keystore/4d2f776c0fef8eac3f460a7c3558dc7859c4fe458e262e674a6c23f242ea33d1_sk b/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/keystore/4d2f776c0fef8eac3f460a7c3558dc7859c4fe458e262e674a6c23f242ea33d1_sk deleted file mode 100755 index ffcf9446..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/keystore/4d2f776c0fef8eac3f460a7c3558dc7859c4fe458e262e674a6c23f242ea33d1_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg730zOAwSLJKj9wle -jbxx4d0P2Qwl314A+znW9n6070mhRANCAARQ4kbOlqzGNLkQmZsUh78a04kkCjqa -EmovJhP08G9VJ1pD9NCUw2WosRmAU/rBz0K2tSn9YOdn8zbMumgM+ORy ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/signcerts/orderer.example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/signcerts/orderer.example.com-cert.pem deleted file mode 100644 index ce1bb447..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/signcerts/orderer.example.com-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICDDCCAbOgAwIBAgIRAK30hdRcBxQJYNPqPkiFo3IwCgYIKoZIzj0EAwIwaTEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFt -cGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0MzJaMFgxCzAJBgNV -BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp -c2NvMRwwGgYDVQQDExNvcmRlcmVyLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYI -KoZIzj0DAQcDQgAEUOJGzpasxjS5EJmbFIe/GtOJJAo6mhJqLyYT9PBvVSdaQ/TQ -lMNlqLEZgFP6wc9CtrUp/WDnZ/M2zLpoDPjkcqNNMEswDgYDVR0PAQH/BAQDAgeA -MAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgoGBqSoYKHjHJCiN4jabztrdJJe0N -IwYa9ImUCbpGrmowCgYIKoZIzj0EAwIDRwAwRAIgHsU1f4jzuul6zYGY/Xn/H5X5 -gDe7/u8dZxJfWwXOGNsCICbXt6yezSzacOFQDkvAPz5/3OYI5YKLSTl+Wilfa/qy ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem deleted file mode 100644 index c0abc7f6..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNTCCAdugAwIBAgIQT0WLBisbcQ6AkirTJApb1TAKBggqhkjOPQQDAjBsMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xGjAYBgNVBAMTEXRsc2NhLmV4 -YW1wbGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowbDELMAkG -A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFu -Y2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5leGFt -cGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGtRFSyePgHhit2JfQNn -Gbda3X9Y+Eb5Ft/4L9uLsxc4zEMLt2TJZewEfO/Uoe9YH9VhFmGj/d9M0d/0HSAn -K8WjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB -/wQFMAMBAf8wKQYDVR0OBCIEII0hhlVshdUV5zfQwNqNDXZyeFtoXLUDvLleU9zC -efunMAoGCCqGSM49BAMCA0gAMEUCIQDxLfsMRqPJuoH77vahGkE6EYMqvzjVI2Ob -aV1DZJfUdwIgHuHXPvKvcoYZgAo7Xc57Uqs6hSpMs0CjzcfLXYiwoVc= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt b/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt deleted file mode 100644 index c0abc7f6..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNTCCAdugAwIBAgIQT0WLBisbcQ6AkirTJApb1TAKBggqhkjOPQQDAjBsMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xGjAYBgNVBAMTEXRsc2NhLmV4 -YW1wbGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowbDELMAkG -A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFu -Y2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5leGFt -cGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGtRFSyePgHhit2JfQNn -Gbda3X9Y+Eb5Ft/4L9uLsxc4zEMLt2TJZewEfO/Uoe9YH9VhFmGj/d9M0d/0HSAn -K8WjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB -/wQFMAMBAf8wKQYDVR0OBCIEII0hhlVshdUV5zfQwNqNDXZyeFtoXLUDvLleU9zC -efunMAoGCCqGSM49BAMCA0gAMEUCIQDxLfsMRqPJuoH77vahGkE6EYMqvzjVI2Ob -aV1DZJfUdwIgHuHXPvKvcoYZgAo7Xc57Uqs6hSpMs0CjzcfLXYiwoVc= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt b/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt deleted file mode 100644 index 020ffe81..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICWTCCAf+gAwIBAgIQLwiilHvhB1gOg5eGs5O9YDAKBggqhkjOPQQDAjBsMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xGjAYBgNVBAMTEXRsc2NhLmV4 -YW1wbGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowWDELMAkG -A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFu -Y2lzY28xHDAaBgNVBAMTE29yZGVyZXIuZXhhbXBsZS5jb20wWTATBgcqhkjOPQIB -BggqhkjOPQMBBwNCAARYRRq90z+ioUM2U9OzPnvqvz9Jpza9JOEsG6UJyEzWB8R7 -bHr0XR1Dl8lodlLh3C5vTrb6vqtpNeVXVsd+VVyIo4GWMIGTMA4GA1UdDwEB/wQE -AwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIw -ADArBgNVHSMEJDAigCCNIYZVbIXVFec30MDajQ12cnhbaFy1A7y5XlPcwnn7pzAn -BgNVHREEIDAeghNvcmRlcmVyLmV4YW1wbGUuY29tggdvcmRlcmVyMAoGCCqGSM49 -BAMCA0gAMEUCIQDwjzlscwNhuVcxF+FQy3PNwxsSRSOsQqjmFbMFNDSG6wIgfNO0 -Mp/QtUShzWepgh1nm8MmDNcnVOOeb4JJy6Gd3Ss= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key b/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key deleted file mode 100755 index 5f76f8a4..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgH/whD1mna09pbmG6 -txGQVIYDx1pZdM/Bkaq1eWYUZqChRANCAARYRRq90z+ioUM2U9OzPnvqvz9Jpza9 -JOEsG6UJyEzWB8R7bHr0XR1Dl8lodlLh3C5vTrb6vqtpNeVXVsd+VVyI ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/tlsca/8d2186556c85d515e737d0c0da8d0d7672785b685cb503bcb95e53dcc279fba7_sk b/basic-network/crypto-config/ordererOrganizations/example.com/tlsca/8d2186556c85d515e737d0c0da8d0d7672785b685cb503bcb95e53dcc279fba7_sk deleted file mode 100755 index f97d39be..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/tlsca/8d2186556c85d515e737d0c0da8d0d7672785b685cb503bcb95e53dcc279fba7_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg6n+vdmDFdoXHLx81 -4KX5d2rChT+6peumwVy6CK6Vld6hRANCAARrURUsnj4B4YrdiX0DZxm3Wt1/WPhG -+Rbf+C/bi7MXOMxDC7dkyWXsBHzv1KHvWB/VYRZho/3fTNHf9B0gJyvF ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem deleted file mode 100644 index c0abc7f6..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNTCCAdugAwIBAgIQT0WLBisbcQ6AkirTJApb1TAKBggqhkjOPQQDAjBsMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xGjAYBgNVBAMTEXRsc2NhLmV4 -YW1wbGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowbDELMAkG -A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFu -Y2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5leGFt -cGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGtRFSyePgHhit2JfQNn -Gbda3X9Y+Eb5Ft/4L9uLsxc4zEMLt2TJZewEfO/Uoe9YH9VhFmGj/d9M0d/0HSAn -K8WjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB -/wQFMAMBAf8wKQYDVR0OBCIEII0hhlVshdUV5zfQwNqNDXZyeFtoXLUDvLleU9zC -efunMAoGCCqGSM49BAMCA0gAMEUCIQDxLfsMRqPJuoH77vahGkE6EYMqvzjVI2Ob -aV1DZJfUdwIgHuHXPvKvcoYZgAo7Xc57Uqs6hSpMs0CjzcfLXYiwoVc= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/admincerts/Admin@example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/admincerts/Admin@example.com-cert.pem deleted file mode 100644 index 60d3a0b5..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/admincerts/Admin@example.com-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICCTCCAbCgAwIBAgIQVMXz1cejr3sGgDsXuIBK3zAKBggqhkjOPQQDAjBpMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w -bGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowVjELMAkGA1UE -BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz -Y28xGjAYBgNVBAMMEUFkbWluQGV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZI -zj0DAQcDQgAEFufLmRXBZHc3d7HvYSU4jR4nJnzfmJlWN6Gm0Bm+NsO8lwb1TDa4 -cPzAOgnbIm1VFwhBd+sE3TIzIWsM2Kzv1aNNMEswDgYDVR0PAQH/BAQDAgeAMAwG -A1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgoGBqSoYKHjHJCiN4jabztrdJJe0NIwYa -9ImUCbpGrmowCgYIKoZIzj0EAwIDRwAwRAIgId+xpuBHjfWvL8aAsDbmMjXAoOYy -BgazcJh446kZaDACIDeyvsH5Xwes5w5Sksv7mb6/kr4ceCy00h1Vlt5bwPiu ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/cacerts/ca.example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/cacerts/ca.example.com-cert.pem deleted file mode 100644 index 240d4289..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/cacerts/ca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICLjCCAdWgAwIBAgIQHuAANpa/kDL7CPyNttctRjAKBggqhkjOPQQDAjBpMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w -bGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowaTELMAkGA1UE -BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz -Y28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFtcGxlLmNv -bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABIzTWKIWgOBOxN3budT5HXPthluo -zghOXPXcyD5JBaxafbkgzr8jC3M2rlJJBm0nCmjv6C1LkiCAOftYkyLofLqjXzBd -MA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMB -Af8wKQYDVR0OBCIEIKBgakqGCh4xyQojeI2m87a3SSXtDSMGGvSJlAm6Rq5qMAoG -CCqGSM49BAMCA0cAMEQCIGShwWIKXmf3oJY3Oow7pKA0SSe89UsRLy2HMxxNzgWx -AiB097hBfmM2JEZsEZfMbEM2U7edQIDyCoPOgm5ha9wDNw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore/1deeab5433fa6e5f045eb763109d6165268fba153211af1281f00d45f54b1022_sk b/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore/1deeab5433fa6e5f045eb763109d6165268fba153211af1281f00d45f54b1022_sk deleted file mode 100755 index 0cf29821..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore/1deeab5433fa6e5f045eb763109d6165268fba153211af1281f00d45f54b1022_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgAKUK8aZ5PJMhPpx4 -7mMQoJaha/3jhprXOSxj83ibaYShRANCAAQW58uZFcFkdzd3se9hJTiNHicmfN+Y -mVY3oabQGb42w7yXBvVMNrhw/MA6CdsibVUXCEF36wTdMjMhawzYrO/V ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/signcerts/Admin@example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/signcerts/Admin@example.com-cert.pem deleted file mode 100644 index 60d3a0b5..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/signcerts/Admin@example.com-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICCTCCAbCgAwIBAgIQVMXz1cejr3sGgDsXuIBK3zAKBggqhkjOPQQDAjBpMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w -bGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowVjELMAkGA1UE -BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz -Y28xGjAYBgNVBAMMEUFkbWluQGV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZI -zj0DAQcDQgAEFufLmRXBZHc3d7HvYSU4jR4nJnzfmJlWN6Gm0Bm+NsO8lwb1TDa4 -cPzAOgnbIm1VFwhBd+sE3TIzIWsM2Kzv1aNNMEswDgYDVR0PAQH/BAQDAgeAMAwG -A1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgoGBqSoYKHjHJCiN4jabztrdJJe0NIwYa -9ImUCbpGrmowCgYIKoZIzj0EAwIDRwAwRAIgId+xpuBHjfWvL8aAsDbmMjXAoOYy -BgazcJh446kZaDACIDeyvsH5Xwes5w5Sksv7mb6/kr4ceCy00h1Vlt5bwPiu ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/tlscacerts/tlsca.example.com-cert.pem b/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/tlscacerts/tlsca.example.com-cert.pem deleted file mode 100644 index c0abc7f6..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/tlscacerts/tlsca.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNTCCAdugAwIBAgIQT0WLBisbcQ6AkirTJApb1TAKBggqhkjOPQQDAjBsMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xGjAYBgNVBAMTEXRsc2NhLmV4 -YW1wbGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowbDELMAkG -A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFu -Y2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5leGFt -cGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGtRFSyePgHhit2JfQNn -Gbda3X9Y+Eb5Ft/4L9uLsxc4zEMLt2TJZewEfO/Uoe9YH9VhFmGj/d9M0d/0HSAn -K8WjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB -/wQFMAMBAf8wKQYDVR0OBCIEII0hhlVshdUV5zfQwNqNDXZyeFtoXLUDvLleU9zC -efunMAoGCCqGSM49BAMCA0gAMEUCIQDxLfsMRqPJuoH77vahGkE6EYMqvzjVI2Ob -aV1DZJfUdwIgHuHXPvKvcoYZgAo7Xc57Uqs6hSpMs0CjzcfLXYiwoVc= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/ca.crt b/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/ca.crt deleted file mode 100644 index c0abc7f6..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/ca.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNTCCAdugAwIBAgIQT0WLBisbcQ6AkirTJApb1TAKBggqhkjOPQQDAjBsMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xGjAYBgNVBAMTEXRsc2NhLmV4 -YW1wbGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowbDELMAkG -A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFu -Y2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRowGAYDVQQDExF0bHNjYS5leGFt -cGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGtRFSyePgHhit2JfQNn -Gbda3X9Y+Eb5Ft/4L9uLsxc4zEMLt2TJZewEfO/Uoe9YH9VhFmGj/d9M0d/0HSAn -K8WjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB -/wQFMAMBAf8wKQYDVR0OBCIEII0hhlVshdUV5zfQwNqNDXZyeFtoXLUDvLleU9zC -efunMAoGCCqGSM49BAMCA0gAMEUCIQDxLfsMRqPJuoH77vahGkE6EYMqvzjVI2Ob -aV1DZJfUdwIgHuHXPvKvcoYZgAo7Xc57Uqs6hSpMs0CjzcfLXYiwoVc= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/server.crt b/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/server.crt deleted file mode 100644 index 634da5ff..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/server.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICKzCCAdKgAwIBAgIQHYv3zMnbbON0eufj3s78FTAKBggqhkjOPQQDAjBsMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xGjAYBgNVBAMTEXRsc2NhLmV4 -YW1wbGUuY29tMB4XDTE3MDgzMTA5MTQzMloXDTI3MDgyOTA5MTQzMlowVjELMAkG -A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFu -Y2lzY28xGjAYBgNVBAMMEUFkbWluQGV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYI -KoZIzj0DAQcDQgAEZsLfeA+tjHJJOyxhJOP31uDluC6eCnMBq0LKawBugaoI3vqh -T8ux5ty+ooSJk7EN3pTQa10m0qX/Y7e0J79JL6NsMGowDgYDVR0PAQH/BAQDAgWg -MB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNVHRMBAf8EAjAAMCsG -A1UdIwQkMCKAII0hhlVshdUV5zfQwNqNDXZyeFtoXLUDvLleU9zCefunMAoGCCqG -SM49BAMCA0cAMEQCIEcK5iAxpGN1wtC5w+590RJrLzD7DOzVCUIxAdJp80BUAiA/ -XMFE+lHMJmqeoqmXG14Z/70xmHChlyHxm6lFR2I6gw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/server.key b/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/server.key deleted file mode 100755 index 2f0e0558..00000000 --- a/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg19ebRLtFBB+n9OCa -KcXLds/nf306mSDnnrA7tlZVjaOhRANCAARmwt94D62Mckk7LGEk4/fW4OW4Lp4K -cwGrQsprAG6Bqgje+qFPy7Hm3L6ihImTsQ3elNBrXSbSpf9jt7Qnv0kv ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/ca/4239aa0dcd76daeeb8ba0cda701851d14504d31aad1b2ddddbac6a57365e497c_sk b/basic-network/crypto-config/peerOrganizations/org1.example.com/ca/4239aa0dcd76daeeb8ba0cda701851d14504d31aad1b2ddddbac6a57365e497c_sk deleted file mode 100755 index 87743a07..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/ca/4239aa0dcd76daeeb8ba0cda701851d14504d31aad1b2ddddbac6a57365e497c_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgYMqNZRu/I7vdcjpm -Tj+O9T4AYXi3MBNW4nzWHJN8nLqhRANCAATNLYBI3trLI/wFhYf+9MpnVb1R/vBF -rbu/43J+R8u4E73sCcx0nRfYCA+dHf22ceuSjq3lMXraorVev5tg4Dc7 ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem deleted file mode 100644 index 8a4119f4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICRDCCAeqgAwIBAgIRAIk/1HQ6XgI0p64PQwvUA3owCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkxNDMy -WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UE -AxMTY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA -BM0tgEje2ssj/AWFh/70ymdVvVH+8EWtu7/jcn5Hy7gTvewJzHSdF9gID50d/bZx -65KOreUxetqitV6/m2DgNzujXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAG -BgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIEI5qg3NdtruuLoM2nAY -UdFFBNMarRst3dusalc2Xkl8MAoGCCqGSM49BAMCA0gAMEUCIQDufxsHbxkSP/y+ -oM2xZGgHL5XSTJVBqBryk1rd08Af6QIgLiAwtR7iKRbf1pKKCkt66MZzItZXC0po -/45uf29T/sc= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/ca/org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/ca/org1.example.com-cert.pem deleted file mode 100644 index ca05efc3..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/ca/org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICFjCCAb2gAwIBAgIUNDCk4a9Z/oaid+BBpYAGT8A18f8wCgYIKoZIzj0EAwIw -aDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK -EwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMt -Y2Etc2VydmVyMB4XDTE3MDgzMTE1MzcwMFoXDTMyMDgyNzE1MzcwMFowaDELMAkG -A1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQKEwtIeXBl -cmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRkwFwYDVQQDExBmYWJyaWMtY2Etc2Vy -dmVyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAExzMhy+KdVYhr6sqA32pAKwM6 -DrPal71NXVNzF/Mdep2jlbhSMu73gwz+q4Hy+SoPnyuIYCpCy5rJhXwEnoQJvaNF -MEMwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYE -FNLXRcya9ZgImWIPbPPsrdTIDuPEMAoGCCqGSM49BAMCA0cAMEQCIGL9qKSaPG6U -IMvw1zolTgimpIxwulGOuQeVybPwYI3oAiBCmOSz5PfASGh8VtCUCCwE+Ef1xQGI -q6Zjh87nj/eyqQ== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem deleted file mode 100644 index df8f568c..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGDCCAb+gAwIBAgIQFSxnLAGsu04zrFkAEwzn6zAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0MzJa -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV1dfmKxsFKWo7o6DNBIaIVebCCPAM9C/ -sLBt4pJRre9pWE987DjXZoZ3glc4+DoPMtTmBRqbPVwYcUvpbYY8p6NNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgQjmqDc122u64 -ugzacBhR0UUE0xqtGy3d26xqVzZeSXwwCgYIKoZIzj0EAwIDRwAwRAIgXMy26AEU -/GUMPfCMs/nQjQME1ZxBHAYZtKEuRR361JsCIEg9BOZdIoioRivJC+ZUzvJUnkXu -o2HkWiuxLsibGxtE ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem deleted file mode 100644 index 8a4119f4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICRDCCAeqgAwIBAgIRAIk/1HQ6XgI0p64PQwvUA3owCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkxNDMy -WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UE -AxMTY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA -BM0tgEje2ssj/AWFh/70ymdVvVH+8EWtu7/jcn5Hy7gTvewJzHSdF9gID50d/bZx -65KOreUxetqitV6/m2DgNzujXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAG -BgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIEI5qg3NdtruuLoM2nAY -UdFFBNMarRst3dusalc2Xkl8MAoGCCqGSM49BAMCA0gAMEUCIQDufxsHbxkSP/y+ -oM2xZGgHL5XSTJVBqBryk1rd08Af6QIgLiAwtR7iKRbf1pKKCkt66MZzItZXC0po -/45uf29T/sc= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem deleted file mode 100644 index b2a4a2d4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRALOo7o5dtcd8yGpCqowtoIUwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkx -NDMyWjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABAftdw28/JThHyrfF4SCTjHUykfeQZ3eqSwYlkCqYF1Lwzae18o97Biz -doz/BBMjisAoJESyzVOrGj7nGD7EzwWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIO0/2COT6V/C -xHWvwRPI0sWR90XRurxNbZzOChrMForLMAoGCCqGSM49BAMCA0cAMEQCIGd4ZaLj -1R4C25obVTI/pWriqWlXXAV7h2ZQfD41nNMYAiAO858VYb4xyLUkF9XGtZJpux4x -0ClsWNgEp49nBBsecw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem deleted file mode 100644 index df8f568c..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGDCCAb+gAwIBAgIQFSxnLAGsu04zrFkAEwzn6zAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0MzJa -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV1dfmKxsFKWo7o6DNBIaIVebCCPAM9C/ -sLBt4pJRre9pWE987DjXZoZ3glc4+DoPMtTmBRqbPVwYcUvpbYY8p6NNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgQjmqDc122u64 -ugzacBhR0UUE0xqtGy3d26xqVzZeSXwwCgYIKoZIzj0EAwIDRwAwRAIgXMy26AEU -/GUMPfCMs/nQjQME1ZxBHAYZtKEuRR361JsCIEg9BOZdIoioRivJC+ZUzvJUnkXu -o2HkWiuxLsibGxtE ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem deleted file mode 100644 index 8a4119f4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICRDCCAeqgAwIBAgIRAIk/1HQ6XgI0p64PQwvUA3owCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkxNDMy -WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UE -AxMTY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA -BM0tgEje2ssj/AWFh/70ymdVvVH+8EWtu7/jcn5Hy7gTvewJzHSdF9gID50d/bZx -65KOreUxetqitV6/m2DgNzujXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAG -BgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIEI5qg3NdtruuLoM2nAY -UdFFBNMarRst3dusalc2Xkl8MAoGCCqGSM49BAMCA0gAMEUCIQDufxsHbxkSP/y+ -oM2xZGgHL5XSTJVBqBryk1rd08Af6QIgLiAwtR7iKRbf1pKKCkt66MZzItZXC0po -/45uf29T/sc= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/keystore/46be1d569fe68f33e517c9e0072a0ccfbfb42727480fb8c8d0223af321a7893d_sk b/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/keystore/46be1d569fe68f33e517c9e0072a0ccfbfb42727480fb8c8d0223af321a7893d_sk deleted file mode 100755 index 6fb7ddea..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/keystore/46be1d569fe68f33e517c9e0072a0ccfbfb42727480fb8c8d0223af321a7893d_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg46tw2jZtucld26uq -RQAPPB1+y8BilJU2luj/OsMinWahRANCAAR4ocVupLNwdvuV3WwFatwgYMUUUWdt -sc86apw/OpypM+3wRJQboZV5diuq08cmNjgTgdLbPJHqmfd8bnkRspq2 ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/signcerts/peer0.org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/signcerts/peer0.org1.example.com-cert.pem deleted file mode 100644 index b06c3bf9..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/signcerts/peer0.org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGjCCAcCgAwIBAgIRAPlwF/rUZUP9mqN4wSml4iswCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkxNDMy -WjBbMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEfMB0GA1UEAxMWcGVlcjAub3JnMS5leGFtcGxlLmNvbTBZ -MBMGByqGSM49AgEGCCqGSM49AwEHA0IABHihxW6ks3B2+5XdbAVq3CBgxRRRZ22x -zzpqnD86nKkz7fBElBuhlXl2K6rTxyY2OBOB0ts8keqZ93xueRGymrajTTBLMA4G -A1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIEI5qg3Ndtru -uLoM2nAYUdFFBNMarRst3dusalc2Xkl8MAoGCCqGSM49BAMCA0gAMEUCIQD4j0Rn -e1rrd0FSCzsR6u+IuuPK5dI/kR/bh7+VLf0TNgIgCfUtkJvfvzVEwZLFoFyjoHtr -tvwzNUS1U0hEqIaDeo4= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem deleted file mode 100644 index b2a4a2d4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRALOo7o5dtcd8yGpCqowtoIUwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkx -NDMyWjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABAftdw28/JThHyrfF4SCTjHUykfeQZ3eqSwYlkCqYF1Lwzae18o97Biz -doz/BBMjisAoJESyzVOrGj7nGD7EzwWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIO0/2COT6V/C -xHWvwRPI0sWR90XRurxNbZzOChrMForLMAoGCCqGSM49BAMCA0cAMEQCIGd4ZaLj -1R4C25obVTI/pWriqWlXXAV7h2ZQfD41nNMYAiAO858VYb4xyLUkF9XGtZJpux4x -0ClsWNgEp49nBBsecw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt b/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt deleted file mode 100644 index b2a4a2d4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRALOo7o5dtcd8yGpCqowtoIUwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkx -NDMyWjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABAftdw28/JThHyrfF4SCTjHUykfeQZ3eqSwYlkCqYF1Lwzae18o97Biz -doz/BBMjisAoJESyzVOrGj7nGD7EzwWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIO0/2COT6V/C -xHWvwRPI0sWR90XRurxNbZzOChrMForLMAoGCCqGSM49BAMCA0cAMEQCIGd4ZaLj -1R4C25obVTI/pWriqWlXXAV7h2ZQfD41nNMYAiAO858VYb4xyLUkF9XGtZJpux4x -0ClsWNgEp49nBBsecw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt b/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt deleted file mode 100644 index c16f404b..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICZjCCAg2gAwIBAgIQenbZk7+46tsIJy8JAgySaDAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0 -MzJaMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcxLmV4YW1wbGUuY29t -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE0AZOhWRZ4aOZeLSBioClHt5VDiNT -CeIxn3rVw9oCzlDDMaIZrBG1lI4o2tXOgOGSIPBmRjy736Njc54InlHlsKOBlzCB -lDAOBgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMC -MAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAg7T/YI5PpX8LEda/BE8jSxZH3RdG6 -vE1tnM4KGswWisswKAYDVR0RBCEwH4IWcGVlcjAub3JnMS5leGFtcGxlLmNvbYIF -cGVlcjAwCgYIKoZIzj0EAwIDRwAwRAIgU9GgYioYa1Mdhhe5MHyZGXfr4G8gBxwe -dqlWU/mGaPsCIGQpA0VoBrP3Neso3htfZnlWKcbrtCD29HBWmT7ImZT1 ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key b/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key deleted file mode 100755 index 14623b32..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgMvwKsTL9m2NygrLw -dfrlMzyQlUaSPendFhF+2yLGaH2hRANCAATQBk6FZFnho5l4tIGKgKUe3lUOI1MJ -4jGfetXD2gLOUMMxohmsEbWUjija1c6A4ZIg8GZGPLvfo2NzngieUeWw ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/tlsca/ed3fd82393e95fc2c475afc113c8d2c591f745d1babc4d6d9cce0a1acc168acb_sk b/basic-network/crypto-config/peerOrganizations/org1.example.com/tlsca/ed3fd82393e95fc2c475afc113c8d2c591f745d1babc4d6d9cce0a1acc168acb_sk deleted file mode 100755 index ddd22ab2..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/tlsca/ed3fd82393e95fc2c475afc113c8d2c591f745d1babc4d6d9cce0a1acc168acb_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgkcI0vNVNanWltD+I -VHz5V1u01+X8VOG3a5ZTLRed0MmhRANCAAQH7XcNvPyU4R8q3xeEgk4x1MpH3kGd -3qksGJZAqmBdS8M2ntfKPewYs3aM/wQTI4rAKCREss1Tqxo+5xg+xM8F ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem deleted file mode 100644 index b2a4a2d4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRALOo7o5dtcd8yGpCqowtoIUwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkx -NDMyWjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABAftdw28/JThHyrfF4SCTjHUykfeQZ3eqSwYlkCqYF1Lwzae18o97Biz -doz/BBMjisAoJESyzVOrGj7nGD7EzwWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIO0/2COT6V/C -xHWvwRPI0sWR90XRurxNbZzOChrMForLMAoGCCqGSM49BAMCA0cAMEQCIGd4ZaLj -1R4C25obVTI/pWriqWlXXAV7h2ZQfD41nNMYAiAO858VYb4xyLUkF9XGtZJpux4x -0ClsWNgEp49nBBsecw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem deleted file mode 100644 index df8f568c..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGDCCAb+gAwIBAgIQFSxnLAGsu04zrFkAEwzn6zAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0MzJa -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV1dfmKxsFKWo7o6DNBIaIVebCCPAM9C/ -sLBt4pJRre9pWE987DjXZoZ3glc4+DoPMtTmBRqbPVwYcUvpbYY8p6NNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgQjmqDc122u64 -ugzacBhR0UUE0xqtGy3d26xqVzZeSXwwCgYIKoZIzj0EAwIDRwAwRAIgXMy26AEU -/GUMPfCMs/nQjQME1ZxBHAYZtKEuRR361JsCIEg9BOZdIoioRivJC+ZUzvJUnkXu -o2HkWiuxLsibGxtE ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem deleted file mode 100644 index 8a4119f4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICRDCCAeqgAwIBAgIRAIk/1HQ6XgI0p64PQwvUA3owCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkxNDMy -WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UE -AxMTY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA -BM0tgEje2ssj/AWFh/70ymdVvVH+8EWtu7/jcn5Hy7gTvewJzHSdF9gID50d/bZx -65KOreUxetqitV6/m2DgNzujXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAG -BgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIEI5qg3NdtruuLoM2nAY -UdFFBNMarRst3dusalc2Xkl8MAoGCCqGSM49BAMCA0gAMEUCIQDufxsHbxkSP/y+ -oM2xZGgHL5XSTJVBqBryk1rd08Af6QIgLiAwtR7iKRbf1pKKCkt66MZzItZXC0po -/45uf29T/sc= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/cd96d5260ad4757551ed4a5a991e62130f8008a0bf996e4e4b84cd097a747fec_sk b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/cd96d5260ad4757551ed4a5a991e62130f8008a0bf996e4e4b84cd097a747fec_sk deleted file mode 100755 index fef217d0..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/cd96d5260ad4757551ed4a5a991e62130f8008a0bf996e4e4b84cd097a747fec_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgRgQr347ij6cjwX7m -KjzbbD8Tlwdfu6FaubjWJWLGyqahRANCAARXV1+YrGwUpajujoM0EhohV5sII8Az -0L+wsG3iklGt72lYT3zsONdmhneCVzj4Og8y1OYFGps9XBhxS+lthjyn ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem deleted file mode 100644 index df8f568c..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGDCCAb+gAwIBAgIQFSxnLAGsu04zrFkAEwzn6zAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0MzJa -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV1dfmKxsFKWo7o6DNBIaIVebCCPAM9C/ -sLBt4pJRre9pWE987DjXZoZ3glc4+DoPMtTmBRqbPVwYcUvpbYY8p6NNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgQjmqDc122u64 -ugzacBhR0UUE0xqtGy3d26xqVzZeSXwwCgYIKoZIzj0EAwIDRwAwRAIgXMy26AEU -/GUMPfCMs/nQjQME1ZxBHAYZtKEuRR361JsCIEg9BOZdIoioRivJC+ZUzvJUnkXu -o2HkWiuxLsibGxtE ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem deleted file mode 100644 index b2a4a2d4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRALOo7o5dtcd8yGpCqowtoIUwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkx -NDMyWjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABAftdw28/JThHyrfF4SCTjHUykfeQZ3eqSwYlkCqYF1Lwzae18o97Biz -doz/BBMjisAoJESyzVOrGj7nGD7EzwWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIO0/2COT6V/C -xHWvwRPI0sWR90XRurxNbZzOChrMForLMAoGCCqGSM49BAMCA0cAMEQCIGd4ZaLj -1R4C25obVTI/pWriqWlXXAV7h2ZQfD41nNMYAiAO858VYb4xyLUkF9XGtZJpux4x -0ClsWNgEp49nBBsecw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/ca.crt b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/ca.crt deleted file mode 100644 index b2a4a2d4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/ca.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRALOo7o5dtcd8yGpCqowtoIUwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkx -NDMyWjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABAftdw28/JThHyrfF4SCTjHUykfeQZ3eqSwYlkCqYF1Lwzae18o97Biz -doz/BBMjisAoJESyzVOrGj7nGD7EzwWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIO0/2COT6V/C -xHWvwRPI0sWR90XRurxNbZzOChrMForLMAoGCCqGSM49BAMCA0cAMEQCIGd4ZaLj -1R4C25obVTI/pWriqWlXXAV7h2ZQfD41nNMYAiAO858VYb4xyLUkF9XGtZJpux4x -0ClsWNgEp49nBBsecw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/server.crt b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/server.crt deleted file mode 100644 index 77b05bfd..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/server.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICOjCCAeGgAwIBAgIQZbszPe722f2AcfnwpG2ENDAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0 -MzJaMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29t -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE5ZfQwNA0oBGCr7zX4I/Ufq1Ht740 -RnkV+6VBceaG4x45bR0a0ZWeslPzmIRXOir9QvqLvnxGY3aJiadX65kNFKNsMGow -DgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAM -BgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIO0/2COT6V/CxHWvwRPI0sWR90XRurxN -bZzOChrMForLMAoGCCqGSM49BAMCA0cAMEQCIF2V2t75M9bgjQ3pktVEYnCS4u0S -Izw6ZNSy8q/i6C6cAiB4V0ejzQYtp5C25F2xMD+JSlwrhBAOJNK1AkTzj9mgWg== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/server.key b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/server.key deleted file mode 100755 index ab4c61cb..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgqAuu2rihnWgQDlHI -7Gqyn+Bap3mMqbJ7UQLXIT6lwtmhRANCAATll9DA0DSgEYKvvNfgj9R+rUe3vjRG -eRX7pUFx5objHjltHRrRlZ6yU/OYhFc6Kv1C+ou+fEZjdomJp1frmQ0U ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/admincerts/User1@org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/admincerts/User1@org1.example.com-cert.pem deleted file mode 100644 index d70ce4c5..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/admincerts/User1@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGTCCAb+gAwIBAgIQPyhm+v0ZIqCo6MATzLc+5jAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0MzJa -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZVc2VyMUBvcmcxLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEL/SomNVO3R5nnsemQ4im/UUZ8Ixs7/nH -3NH1ROfVJ+m7niDf1ZmhvTyiJzrUpI+n5+/OKIX/Z/VhDuAIR/QLLKNNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgQjmqDc122u64 -ugzacBhR0UUE0xqtGy3d26xqVzZeSXwwCgYIKoZIzj0EAwIDSAAwRQIhAJk63AHS -CEvJh64Yx5CnWDgDYNoj0jsi+gGheIxbUYgMAiAi/qPG7KEuuDBL4LlZRfkeatMW -ZKPD7ikt+vOYgVnqlA== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem deleted file mode 100644 index 8a4119f4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICRDCCAeqgAwIBAgIRAIk/1HQ6XgI0p64PQwvUA3owCgYIKoZIzj0EAwIwczEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh -Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkxNDMy -WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN -U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UE -AxMTY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA -BM0tgEje2ssj/AWFh/70ymdVvVH+8EWtu7/jcn5Hy7gTvewJzHSdF9gID50d/bZx -65KOreUxetqitV6/m2DgNzujXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAG -BgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIEI5qg3NdtruuLoM2nAY -UdFFBNMarRst3dusalc2Xkl8MAoGCCqGSM49BAMCA0gAMEUCIQDufxsHbxkSP/y+ -oM2xZGgHL5XSTJVBqBryk1rd08Af6QIgLiAwtR7iKRbf1pKKCkt66MZzItZXC0po -/45uf29T/sc= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/c75bd6911aca808941c3557ee7c97e90f3952e379497dc55eb903f31b50abc83_sk b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/c75bd6911aca808941c3557ee7c97e90f3952e379497dc55eb903f31b50abc83_sk deleted file mode 100755 index 252c00b4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/c75bd6911aca808941c3557ee7c97e90f3952e379497dc55eb903f31b50abc83_sk +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgJ8IrEgxfZzjGsyt+ -0o27jvhwUJE2W1PrFeZi8LwHbiuhRANCAAQv9KiY1U7dHmeex6ZDiKb9RRnwjGzv -+cfc0fVE59Un6bueIN/VmaG9PKInOtSkj6fn784ohf9n9WEO4AhH9Ass ------END PRIVATE KEY----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem deleted file mode 100644 index d70ce4c5..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICGTCCAb+gAwIBAgIQPyhm+v0ZIqCo6MATzLc+5jAKBggqhkjOPQQDAjBzMQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu -b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0MzJa -MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T -YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZVc2VyMUBvcmcxLmV4YW1wbGUuY29tMFkw -EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEL/SomNVO3R5nnsemQ4im/UUZ8Ixs7/nH -3NH1ROfVJ+m7niDf1ZmhvTyiJzrUpI+n5+/OKIX/Z/VhDuAIR/QLLKNNMEswDgYD -VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgQjmqDc122u64 -ugzacBhR0UUE0xqtGy3d26xqVzZeSXwwCgYIKoZIzj0EAwIDSAAwRQIhAJk63AHS -CEvJh64Yx5CnWDgDYNoj0jsi+gGheIxbUYgMAiAi/qPG7KEuuDBL4LlZRfkeatMW -ZKPD7ikt+vOYgVnqlA== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem deleted file mode 100644 index b2a4a2d4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRALOo7o5dtcd8yGpCqowtoIUwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkx -NDMyWjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABAftdw28/JThHyrfF4SCTjHUykfeQZ3eqSwYlkCqYF1Lwzae18o97Biz -doz/BBMjisAoJESyzVOrGj7nGD7EzwWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIO0/2COT6V/C -xHWvwRPI0sWR90XRurxNbZzOChrMForLMAoGCCqGSM49BAMCA0cAMEQCIGd4ZaLj -1R4C25obVTI/pWriqWlXXAV7h2ZQfD41nNMYAiAO858VYb4xyLUkF9XGtZJpux4x -0ClsWNgEp49nBBsecw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/ca.crt b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/ca.crt deleted file mode 100644 index b2a4a2d4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/ca.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICSTCCAfCgAwIBAgIRALOo7o5dtcd8yGpCqowtoIUwCgYIKoZIzj0EAwIwdjEL -MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG -cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHzAdBgNVBAMTFnRs -c2NhLm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkx -NDMyWjB2MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UE -BxMNU2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0G -A1UEAxMWdGxzY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49 -AwEHA0IABAftdw28/JThHyrfF4SCTjHUykfeQZ3eqSwYlkCqYF1Lwzae18o97Biz -doz/BBMjisAoJESyzVOrGj7nGD7EzwWjXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNV -HSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIO0/2COT6V/C -xHWvwRPI0sWR90XRurxNbZzOChrMForLMAoGCCqGSM49BAMCA0cAMEQCIGd4ZaLj -1R4C25obVTI/pWriqWlXXAV7h2ZQfD41nNMYAiAO858VYb4xyLUkF9XGtZJpux4x -0ClsWNgEp49nBBsecw== ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/server.crt b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/server.crt deleted file mode 100644 index 3e99dbf4..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/server.crt +++ /dev/null @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICOzCCAeGgAwIBAgIQat+rcnuTNMrNDQULaEwq7zAKBggqhkjOPQQDAjB2MQsw -CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy -YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz -Y2Eub3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0 -MzJaMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH -Ew1TYW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZVc2VyMUBvcmcxLmV4YW1wbGUuY29t -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFcqqFuh5CXSij4Ma6/tySXB9hYZn -2oFaVJWPn0JIhqj8rl9vHuNzgwoI1ZNR9fKGmrovqaZjcSg87jxh7gZSeaNsMGow -DgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAM -BgNVHRMBAf8EAjAAMCsGA1UdIwQkMCKAIO0/2COT6V/CxHWvwRPI0sWR90XRurxN -bZzOChrMForLMAoGCCqGSM49BAMCA0gAMEUCIQCWp1joCFbOhXbZ2sPW1e6gJBNG -ZK+JY6Lm0bGk4vBk6QIgLQ5nzPRWHJNRaqIbigk0OLBKQtzv/Nfbsi6DnhNQoZU= ------END CERTIFICATE----- diff --git a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/server.key b/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/server.key deleted file mode 100755 index 02043b8c..00000000 --- a/basic-network/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/tls/server.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgf8ybpxd0cfNqWnfX -KRoa6e/hEJGs0zMCkE+5si/xuV+hRANCAAQVyqoW6HkJdKKPgxrr+3JJcH2Fhmfa -gVpUlY+fQkiGqPyuX28e43ODCgjVk1H18oaaui+ppmNxKDzuPGHuBlJ5 ------END PRIVATE KEY----- diff --git a/basic-network/docker-compose.yml b/basic-network/docker-compose.yml deleted file mode 100644 index 8a8663e1..00000000 --- a/basic-network/docker-compose.yml +++ /dev/null @@ -1,125 +0,0 @@ -# -# Copyright IBM Corp All Rights Reserved -# -# SPDX-License-Identifier: Apache-2.0 -# -version: '2' - -networks: - basic: - -services: - ca.example.com: - image: hyperledger/fabric-ca - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/4239aa0dcd76daeeb8ba0cda701851d14504d31aad1b2ddddbac6a57365e497c_sk - ports: - - "7054:7054" - command: sh -c 'fabric-ca-server start -b admin:adminpw' - volumes: - - ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config - container_name: ca.example.com - networks: - - basic - - orderer.example.com: - container_name: orderer.example.com - image: hyperledger/fabric-orderer - environment: - - FABRIC_LOGGING_SPEC=info - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis.block - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp - working_dir: /opt/gopath/src/github.com/hyperledger/fabric/orderer - command: orderer - ports: - - 7050:7050 - volumes: - - ./config/:/etc/hyperledger/configtx - - ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/:/etc/hyperledger/msp/orderer - - ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/msp/peerOrg1 - networks: - - basic - - peer0.org1.example.com: - container_name: peer0.org1.example.com - image: hyperledger/fabric-peer - environment: - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - CORE_PEER_ID=peer0.org1.example.com - - FABRIC_LOGGING_SPEC=info - - CORE_CHAINCODE_LOGGING_LEVEL=info - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/peer/ - - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - # # the following setting starts chaincode containers on the same - # # bridge network as the peers - # # https://docs.docker.com/compose/networking/ - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_basic - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984 - # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD - # provide the credentials for ledger to connect to CouchDB. The username and password must - # match the username and password set for the associated CouchDB. - - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME= - - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD= - working_dir: /opt/gopath/src/github.com/hyperledger/fabric - command: peer node start - # command: peer node start --peer-chaincodedev=true - ports: - - 7051:7051 - - 7053:7053 - volumes: - - /var/run/:/host/var/run/ - - ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/msp/peer - - ./crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/msp/users - - ./config:/etc/hyperledger/configtx - depends_on: - - orderer.example.com - - couchdb - networks: - - basic - - couchdb: - container_name: couchdb - image: hyperledger/fabric-couchdb - # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password - # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. - environment: - - COUCHDB_USER= - - COUCHDB_PASSWORD= - ports: - - 5984:5984 - networks: - - basic - - cli: - container_name: cli - image: hyperledger/fabric-tools - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=info - - CORE_PEER_ID=cli - - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp - - CORE_CHAINCODE_KEEPALIVE=10 - working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer - command: /bin/bash - volumes: - - /var/run/:/host/var/run/ - - ./../chaincode/:/opt/gopath/src/github.com/ - - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ - networks: - - basic - #depends_on: - # - orderer.example.com - # - peer0.org1.example.com - # - couchdb diff --git a/basic-network/generate.sh b/basic-network/generate.sh deleted file mode 100755 index e5308a6e..00000000 --- a/basic-network/generate.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# -# Copyright IBM Corp All Rights Reserved -# -# SPDX-License-Identifier: Apache-2.0 -# -export PATH=$GOPATH/src/github.com/hyperledger/fabric/build/bin:${PWD}/../bin:${PWD}:$PATH -export FABRIC_CFG_PATH=${PWD} -CHANNEL_NAME=mychannel - -# remove previous crypto material and config transactions -rm -fr config/* -rm -fr crypto-config/* - -# generate crypto material -cryptogen generate --config=./crypto-config.yaml -if [ "$?" -ne 0 ]; then - echo "Failed to generate crypto material..." - exit 1 -fi - -# generate genesis block for orderer -configtxgen -profile OneOrgOrdererGenesis -outputBlock ./config/genesis.block -if [ "$?" -ne 0 ]; then - echo "Failed to generate orderer genesis block..." - exit 1 -fi - -# generate channel configuration transaction -configtxgen -profile OneOrgChannel -outputCreateChannelTx ./config/channel.tx -channelID $CHANNEL_NAME -if [ "$?" -ne 0 ]; then - echo "Failed to generate channel configuration transaction..." - exit 1 -fi - -# generate anchor peer transaction -configtxgen -profile OneOrgChannel -outputAnchorPeersUpdate ./config/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP -if [ "$?" -ne 0 ]; then - echo "Failed to generate anchor peer update for Org1MSP..." - exit 1 -fi diff --git a/basic-network/init.sh b/basic-network/init.sh deleted file mode 100755 index caf7c76d..00000000 --- a/basic-network/init.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# -# Copyright IBM Corp All Rights Reserved -# -# SPDX-License-Identifier: Apache-2.0 -# - -# Exit on first error, print all commands. -set -ev -# delete previous creds -rm -rf ~/.hfc-key-store/* - -# copy peer admin credentials into the keyValStore -mkdir -p ~/.hfc-key-store diff --git a/basic-network/stop.sh b/basic-network/stop.sh deleted file mode 100755 index 53ad5160..00000000 --- a/basic-network/stop.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# -# Copyright IBM Corp All Rights Reserved -# -# SPDX-License-Identifier: Apache-2.0 -# -# Exit on first error, print all commands. -set -ev - -# Shut down the Docker containers that might be currently running. -docker-compose -f docker-compose.yml stop diff --git a/basic-network/teardown.sh b/basic-network/teardown.sh deleted file mode 100755 index 189b6070..00000000 --- a/basic-network/teardown.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright IBM Corp All Rights Reserved -# -# SPDX-License-Identifier: Apache-2.0 -# -# Exit on first error, print all commands. -set -e - -# Shut down the Docker containers for the system tests. -docker-compose -f docker-compose.yml kill && docker-compose -f docker-compose.yml down - -# remove the local state -rm -f ~/.hfc-key-store/* - -# remove chaincode docker images -docker rm $(docker ps -aq) -docker rmi $(docker images dev-* -q) - -# Your system is now clean diff --git a/chaincode-docker-devmode/.gitignore b/chaincode-docker-devmode/.gitignore index 699c14a5..3bb4c8e8 100644 --- a/chaincode-docker-devmode/.gitignore +++ b/chaincode-docker-devmode/.gitignore @@ -1,3 +1,3 @@ /myc.block -/chaincode/sacc/sacc -/chaincode/chaincode_example02/chaincode_example02 +/chaincode/sacc/go/sacc +/chaincode/abstore/go/abstore diff --git a/chaincode-docker-devmode/README.rst b/chaincode-docker-devmode/README.rst index a681cb01..315056f2 100644 --- a/chaincode-docker-devmode/README.rst +++ b/chaincode-docker-devmode/README.rst @@ -69,6 +69,8 @@ one for the chaincode environment and a CLI to interact with the chaincode. The commands for create and join channel are embedded in the CLI container, so we can jump immediately to the chaincode calls. +.. note:: TLS is not enabled as it is not supported when running chaincode in dev mode. + Terminal 2 - Build & start the chaincode ---------------------------------------- @@ -86,14 +88,14 @@ Now, compile your chaincode: .. code:: sh - cd chaincode_example02/go - go build -o chaincode_example02 + cd abstore/go + go build -o abstore Now run the chaincode: .. code:: sh - CORE_PEER_ADDRESS=peer:7052 CORE_CHAINCODE_ID_NAME=mycc:0 ./chaincode_example02 + CORE_CHAINCODE_ID_NAME=mycc:0 CORE_PEER_TLS_ENABLED=false ./abstore -peer.address peer:7052 The chaincode is started with peer and chaincode logs indicating successful registration with the peer. Note that at this stage the chaincode is not associated with any channel. This is done in subsequent steps @@ -114,7 +116,7 @@ We'll leverage the CLI container to drive these calls. .. code:: bash - peer chaincode install -p chaincodedev/chaincode/chaincode_example02/go -n mycc -v 0 + peer chaincode install -p chaincodedev/chaincode/abstore/go -n mycc -v 0 peer chaincode instantiate -n mycc -v 0 -c '{"Args":["init","a","100","b","200"]}' -C myc Now issue an invoke to move ``10`` from ``a`` to ``b``. @@ -132,7 +134,7 @@ Finally, query ``a``. We should see a value of ``90``. Testing new chaincode --------------------- -By default, we mount only ``chaincode_example02``. However, you can easily test different +By default, we mount only ``abstore``. However, you can easily test different chaincodes by adding them to the ``chaincode`` subdirectory and relaunching your network. At this point they will be accessible in your ``chaincode`` container. diff --git a/chaincode-docker-devmode/docker-compose-simple.yaml b/chaincode-docker-devmode/docker-compose-simple.yaml index 18c07255..076b6051 100644 --- a/chaincode-docker-devmode/docker-compose-simple.yaml +++ b/chaincode-docker-devmode/docker-compose-simple.yaml @@ -7,8 +7,8 @@ services: environment: - FABRIC_LOGGING_SPEC=debug - ORDERER_GENERAL_LISTENADDRESS=orderer - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_GENESISFILE=orderer.block + - ORDERER_GENERAL_BOOTSTRAPMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=orderer.block - ORDERER_GENERAL_LOCALMSPID=DEFAULT - ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp - GRPC_TRACE=all=true, @@ -70,10 +70,9 @@ services: image: hyperledger/fabric-ccenv tty: true environment: - - GOPATH=/opt/gopath - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - FABRIC_LOGGING_SPEC=DEBUG - - CORE_PEER_ID=example02 + - CORE_PEER_ID=abstore - CORE_PEER_ADDRESS=peer:7051 - CORE_PEER_LOCALMSPID=DEFAULT - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp diff --git a/chaincode/abac/go/abac.go b/chaincode/abac/go/abac.go index b54367bf..2d66cdfa 100644 --- a/chaincode/abac/go/abac.go +++ b/chaincode/abac/go/abac.go @@ -20,9 +20,9 @@ import ( "fmt" "strconv" - "github.com/hyperledger/fabric/core/chaincode/shim/ext/cid" - "github.com/hyperledger/fabric/core/chaincode/shim" - pb "github.com/hyperledger/fabric/protos/peer" + "github.com/hyperledger/fabric-chaincode-go/pkg/cid" + "github.com/hyperledger/fabric-chaincode-go/shim" + pb "github.com/hyperledger/fabric-protos-go/peer" ) // SimpleChaincode example simple Chaincode implementation diff --git a/chaincode/abac/go/abac_test.go b/chaincode/abac/go/abac_test.go new file mode 100644 index 00000000..0ea98f6e --- /dev/null +++ b/chaincode/abac/go/abac_test.go @@ -0,0 +1,142 @@ +/* +Copyright Hitachi America Ltd. All Rights Reserved. + +SPDX-License-Identifier: Apache-2.0 +*/ + +package main + +import ( + "fmt" + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/hyperledger/fabric-chaincode-go/shim" + "github.com/hyperledger/fabric-chaincode-go/shimtest" + "github.com/hyperledger/fabric-protos-go/msp" +) + +// Cert with attribute. "abac.init":"true" +const certWithAttrs = `-----BEGIN CERTIFICATE----- +MIIC2TCCAn+gAwIBAgIUQ0IZAeWJyRqPFpcFshvpVbY1RzMwCgYIKoZIzj0EAwIw +ZjELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK +EwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGY2xpZW50MRcwFQYDVQQDEw5yY2Etb3Jn +MS1hZG1pbjAeFw0xODExMTMxNzQ4MDBaFw0xOTExMTMxNzUzMDBaMG8xCzAJBgNV +BAYTAlVTMRcwFQYDVQQIEw5Ob3J0aCBDYXJvbGluYTEUMBIGA1UEChMLSHlwZXJs +ZWRnZXIxHDANBgNVBAsTBmNsaWVudDALBgNVBAsTBG9yZzExEzARBgNVBAMTCmFk +bWluLW9yZzEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAR196Xv7te+C5gkz7Ui +h8t2gl8QjjSs6iOLFTk18IEH5vLh+DovGT9q3ylvZpExtOap5zFkCva9GnChxP05 +4A0eo4IBADCB/TAOBgNVHQ8BAf8EBAMCB4AwDAYDVR0TAQH/BAIwADAdBgNVHQ4E +FgQUXf9wjawRl/KosmHcVnYB4ay8IqswHwYDVR0jBBgwFoAUwqQ3h+jBjt2e2wC1 +f1amDdCHY7QwFwYDVR0RBBAwDoIMZjExN2MxODEyYzM3MIGDBggqAwQFBgcIAQR3 +eyJhdHRycyI6eyJhYmFjLmluaXQiOiJ0cnVlIiwiYWRtaW4iOiJ0cnVlIiwiaGYu +QWZmaWxpYXRpb24iOiJvcmcxIiwiaGYuRW5yb2xsbWVudElEIjoiYWRtaW4tb3Jn +MSIsImhmLlR5cGUiOiJjbGllbnQifX0wCgYIKoZIzj0EAwIDSAAwRQIhAN1v/XK0 +WmZf5u9X9FG5uGxwcJ9d5K/eFAC7KahSbs65AiB/GzS2u1cYznXzTDWoBm9oflxY +w8Ou1Sh9IjeXj/SDAA== +-----END CERTIFICATE----- +` + +func checkInit(t *testing.T, stub *shimtest.MockStub, args [][]byte) { + res := stub.MockInit("1", args) + if res.Status != shim.OK { + fmt.Println("Init failed", string(res.Message)) + t.FailNow() + } +} + +func checkState(t *testing.T, stub *shimtest.MockStub, name string, value string) { + bytes := stub.State[name] + if bytes == nil { + fmt.Println("State", name, "failed to get value") + t.FailNow() + } + if string(bytes) != value { + fmt.Println("State value", name, "was not", value, "as expected") + t.FailNow() + } +} + +func checkQuery(t *testing.T, stub *shimtest.MockStub, name string, value string) { + res := stub.MockInvoke("1", [][]byte{[]byte("query"), []byte(name)}) + if res.Status != shim.OK { + fmt.Println("Query", name, "failed", string(res.Message)) + t.FailNow() + } + if res.Payload == nil { + fmt.Println("Query", name, "failed to get value") + t.FailNow() + } + if string(res.Payload) != value { + fmt.Println("Query value", name, "was not", value, "as expected") + t.FailNow() + } +} + +func checkInvoke(t *testing.T, stub *shimtest.MockStub, args [][]byte) { + res := stub.MockInvoke("1", args) + if res.Status != shim.OK { + fmt.Println("Invoke", args, "failed", string(res.Message)) + t.FailNow() + } +} + +func setCreator(t *testing.T, stub *shimtest.MockStub, mspID string, idbytes []byte) { + sid := &msp.SerializedIdentity{Mspid: mspID, IdBytes: idbytes} + b, err := proto.Marshal(sid) + if err != nil { + t.FailNow() + } + stub.Creator = b +} + +func TestAbac_Init(t *testing.T) { + scc := new(SimpleChaincode) + stub := shimtest.NewMockStub("abac", scc) + + setCreator(t, stub, "org1MSP", []byte(certWithAttrs)) + + // Init A=123 B=234 + checkInit(t, stub, [][]byte{[]byte("init"), []byte("A"), []byte("123"), []byte("B"), []byte("234")}) + + checkState(t, stub, "A", "123") + checkState(t, stub, "B", "234") +} + +func TestAbac_Query(t *testing.T) { + scc := new(SimpleChaincode) + stub := shimtest.NewMockStub("abac", scc) + + setCreator(t, stub, "org1MSP", []byte(certWithAttrs)) + + // Init A=345 B=456 + checkInit(t, stub, [][]byte{[]byte("init"), []byte("A"), []byte("345"), []byte("B"), []byte("456")}) + + // Query A + checkQuery(t, stub, "A", "345") + + // Query B + checkQuery(t, stub, "B", "456") +} + +func TestAbac_Invoke(t *testing.T) { + scc := new(SimpleChaincode) + stub := shimtest.NewMockStub("abac", scc) + + setCreator(t, stub, "org1MSP", []byte(certWithAttrs)) + + // Init A=567 B=678 + checkInit(t, stub, [][]byte{[]byte("init"), []byte("A"), []byte("567"), []byte("B"), []byte("678")}) + + // Invoke A->B for 123 + checkInvoke(t, stub, [][]byte{[]byte("invoke"), []byte("A"), []byte("B"), []byte("123")}) + checkQuery(t, stub, "A", "444") + checkQuery(t, stub, "B", "801") + + // Invoke B->A for 234 + checkInvoke(t, stub, [][]byte{[]byte("invoke"), []byte("B"), []byte("A"), []byte("234")}) + checkQuery(t, stub, "A", "678") + checkQuery(t, stub, "B", "567") + checkQuery(t, stub, "A", "678") + checkQuery(t, stub, "B", "567") +} diff --git a/chaincode/abac/go/go.mod b/chaincode/abac/go/go.mod new file mode 100644 index 00000000..c04ae304 --- /dev/null +++ b/chaincode/abac/go/go.mod @@ -0,0 +1,13 @@ +module github.com/hyperledger/fabric-samples/chaincode/abac/go + +go 1.12 + +require ( + github.com/gogo/protobuf v1.2.1 + github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 + github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 + golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect + golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect + golang.org/x/text v0.3.2 // indirect + google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect +) diff --git a/chaincode/abac/go/go.sum b/chaincode/abac/go/go.sum new file mode 100644 index 00000000..da5b5719 --- /dev/null +++ b/chaincode/abac/go/go.sum @@ -0,0 +1,82 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 h1:VEm3tPRTCzq3J/1XpVERh1PbOSnshUVwx2G5s3cLiTw= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85/go.mod h1:HZK6PKLWrvdD/t0oSLiyaRaUM6fZ7qjJuOlb0zrn0mo= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 h1:WzttYAPO5xkQ87ZrxzEhvDZknfarSNu1PZt3NPMTE3Y= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/LICENSE b/chaincode/abac/go/vendor/github.com/golang/protobuf/LICENSE deleted file mode 100644 index 0f646931..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright 2010 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/clone.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/clone.go deleted file mode 100644 index 3cd3249f..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/clone.go +++ /dev/null @@ -1,253 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Protocol buffer deep copy and merge. -// TODO: RawMessage. - -package proto - -import ( - "fmt" - "log" - "reflect" - "strings" -) - -// Clone returns a deep copy of a protocol buffer. -func Clone(src Message) Message { - in := reflect.ValueOf(src) - if in.IsNil() { - return src - } - out := reflect.New(in.Type().Elem()) - dst := out.Interface().(Message) - Merge(dst, src) - return dst -} - -// Merger is the interface representing objects that can merge messages of the same type. -type Merger interface { - // Merge merges src into this message. - // Required and optional fields that are set in src will be set to that value in dst. - // Elements of repeated fields will be appended. - // - // Merge may panic if called with a different argument type than the receiver. - Merge(src Message) -} - -// generatedMerger is the custom merge method that generated protos will have. -// We must add this method since a generate Merge method will conflict with -// many existing protos that have a Merge data field already defined. -type generatedMerger interface { - XXX_Merge(src Message) -} - -// Merge merges src into dst. -// Required and optional fields that are set in src will be set to that value in dst. -// Elements of repeated fields will be appended. -// Merge panics if src and dst are not the same type, or if dst is nil. -func Merge(dst, src Message) { - if m, ok := dst.(Merger); ok { - m.Merge(src) - return - } - - in := reflect.ValueOf(src) - out := reflect.ValueOf(dst) - if out.IsNil() { - panic("proto: nil destination") - } - if in.Type() != out.Type() { - panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src)) - } - if in.IsNil() { - return // Merge from nil src is a noop - } - if m, ok := dst.(generatedMerger); ok { - m.XXX_Merge(src) - return - } - mergeStruct(out.Elem(), in.Elem()) -} - -func mergeStruct(out, in reflect.Value) { - sprop := GetProperties(in.Type()) - for i := 0; i < in.NumField(); i++ { - f := in.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) - } - - if emIn, err := extendable(in.Addr().Interface()); err == nil { - emOut, _ := extendable(out.Addr().Interface()) - mIn, muIn := emIn.extensionsRead() - if mIn != nil { - mOut := emOut.extensionsWrite() - muIn.Lock() - mergeExtension(mOut, mIn) - muIn.Unlock() - } - } - - uf := in.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return - } - uin := uf.Bytes() - if len(uin) > 0 { - out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) - } -} - -// mergeAny performs a merge between two values of the same type. -// viaPtr indicates whether the values were indirected through a pointer (implying proto2). -// prop is set if this is a struct field (it may be nil). -func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { - if in.Type() == protoMessageType { - if !in.IsNil() { - if out.IsNil() { - out.Set(reflect.ValueOf(Clone(in.Interface().(Message)))) - } else { - Merge(out.Interface().(Message), in.Interface().(Message)) - } - } - return - } - switch in.Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - if !viaPtr && isProto3Zero(in) { - return - } - out.Set(in) - case reflect.Interface: - // Probably a oneof field; copy non-nil values. - if in.IsNil() { - return - } - // Allocate destination if it is not set, or set to a different type. - // Otherwise we will merge as normal. - if out.IsNil() || out.Elem().Type() != in.Elem().Type() { - out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T) - } - mergeAny(out.Elem(), in.Elem(), false, nil) - case reflect.Map: - if in.Len() == 0 { - return - } - if out.IsNil() { - out.Set(reflect.MakeMap(in.Type())) - } - // For maps with value types of *T or []byte we need to deep copy each value. - elemKind := in.Type().Elem().Kind() - for _, key := range in.MapKeys() { - var val reflect.Value - switch elemKind { - case reflect.Ptr: - val = reflect.New(in.Type().Elem().Elem()) - mergeAny(val, in.MapIndex(key), false, nil) - case reflect.Slice: - val = in.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - default: - val = in.MapIndex(key) - } - out.SetMapIndex(key, val) - } - case reflect.Ptr: - if in.IsNil() { - return - } - if out.IsNil() { - out.Set(reflect.New(in.Elem().Type())) - } - mergeAny(out.Elem(), in.Elem(), true, nil) - case reflect.Slice: - if in.IsNil() { - return - } - if in.Type().Elem().Kind() == reflect.Uint8 { - // []byte is a scalar bytes field, not a repeated field. - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value, and should not - // be merged. - if prop != nil && prop.proto3 && in.Len() == 0 { - return - } - - // Make a deep copy. - // Append to []byte{} instead of []byte(nil) so that we never end up - // with a nil result. - out.SetBytes(append([]byte{}, in.Bytes()...)) - return - } - n := in.Len() - if out.IsNil() { - out.Set(reflect.MakeSlice(in.Type(), 0, n)) - } - switch in.Type().Elem().Kind() { - case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, - reflect.String, reflect.Uint32, reflect.Uint64: - out.Set(reflect.AppendSlice(out, in)) - default: - for i := 0; i < n; i++ { - x := reflect.Indirect(reflect.New(in.Type().Elem())) - mergeAny(x, in.Index(i), false, nil) - out.Set(reflect.Append(out, x)) - } - } - case reflect.Struct: - mergeStruct(out, in) - default: - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to copy %v", in) - } -} - -func mergeExtension(out, in map[int32]Extension) { - for extNum, eIn := range in { - eOut := Extension{desc: eIn.desc} - if eIn.value != nil { - v := reflect.New(reflect.TypeOf(eIn.value)).Elem() - mergeAny(v, reflect.ValueOf(eIn.value), false, nil) - eOut.value = v.Interface() - } - if eIn.enc != nil { - eOut.enc = make([]byte, len(eIn.enc)) - copy(eOut.enc, eIn.enc) - } - - out[extNum] = eOut - } -} diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/decode.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/decode.go deleted file mode 100644 index 63b0f08b..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/decode.go +++ /dev/null @@ -1,427 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Routines for decoding protocol buffer data to construct in-memory representations. - */ - -import ( - "errors" - "fmt" - "io" -) - -// errOverflow is returned when an integer is too large to be represented. -var errOverflow = errors.New("proto: integer overflow") - -// ErrInternalBadWireType is returned by generated code when an incorrect -// wire type is encountered. It does not get returned to user code. -var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") - -// DecodeVarint reads a varint-encoded integer from the slice. -// It returns the integer and the number of bytes consumed, or -// zero if there is not enough. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func DecodeVarint(buf []byte) (x uint64, n int) { - for shift := uint(0); shift < 64; shift += 7 { - if n >= len(buf) { - return 0, 0 - } - b := uint64(buf[n]) - n++ - x |= (b & 0x7F) << shift - if (b & 0x80) == 0 { - return x, n - } - } - - // The number is too large to represent in a 64-bit value. - return 0, 0 -} - -func (p *Buffer) decodeVarintSlow() (x uint64, err error) { - i := p.index - l := len(p.buf) - - for shift := uint(0); shift < 64; shift += 7 { - if i >= l { - err = io.ErrUnexpectedEOF - return - } - b := p.buf[i] - i++ - x |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - p.index = i - return - } - } - - // The number is too large to represent in a 64-bit value. - err = errOverflow - return -} - -// DecodeVarint reads a varint-encoded integer from the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) DecodeVarint() (x uint64, err error) { - i := p.index - buf := p.buf - - if i >= len(buf) { - return 0, io.ErrUnexpectedEOF - } else if buf[i] < 0x80 { - p.index++ - return uint64(buf[i]), nil - } else if len(buf)-i < 10 { - return p.decodeVarintSlow() - } - - var b uint64 - // we already checked the first byte - x = uint64(buf[i]) - 0x80 - i++ - - b = uint64(buf[i]) - i++ - x += b << 7 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 7 - - b = uint64(buf[i]) - i++ - x += b << 14 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 14 - - b = uint64(buf[i]) - i++ - x += b << 21 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 21 - - b = uint64(buf[i]) - i++ - x += b << 28 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 28 - - b = uint64(buf[i]) - i++ - x += b << 35 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 35 - - b = uint64(buf[i]) - i++ - x += b << 42 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 42 - - b = uint64(buf[i]) - i++ - x += b << 49 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 49 - - b = uint64(buf[i]) - i++ - x += b << 56 - if b&0x80 == 0 { - goto done - } - x -= 0x80 << 56 - - b = uint64(buf[i]) - i++ - x += b << 63 - if b&0x80 == 0 { - goto done - } - - return 0, errOverflow - -done: - p.index = i - return x, nil -} - -// DecodeFixed64 reads a 64-bit integer from the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) DecodeFixed64() (x uint64, err error) { - // x, err already 0 - i := p.index + 8 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-8]) - x |= uint64(p.buf[i-7]) << 8 - x |= uint64(p.buf[i-6]) << 16 - x |= uint64(p.buf[i-5]) << 24 - x |= uint64(p.buf[i-4]) << 32 - x |= uint64(p.buf[i-3]) << 40 - x |= uint64(p.buf[i-2]) << 48 - x |= uint64(p.buf[i-1]) << 56 - return -} - -// DecodeFixed32 reads a 32-bit integer from the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) DecodeFixed32() (x uint64, err error) { - // x, err already 0 - i := p.index + 4 - if i < 0 || i > len(p.buf) { - err = io.ErrUnexpectedEOF - return - } - p.index = i - - x = uint64(p.buf[i-4]) - x |= uint64(p.buf[i-3]) << 8 - x |= uint64(p.buf[i-2]) << 16 - x |= uint64(p.buf[i-1]) << 24 - return -} - -// DecodeZigzag64 reads a zigzag-encoded 64-bit integer -// from the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) DecodeZigzag64() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63) - return -} - -// DecodeZigzag32 reads a zigzag-encoded 32-bit integer -// from the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) DecodeZigzag32() (x uint64, err error) { - x, err = p.DecodeVarint() - if err != nil { - return - } - x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31)) - return -} - -// DecodeRawBytes reads a count-delimited byte buffer from the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) { - n, err := p.DecodeVarint() - if err != nil { - return nil, err - } - - nb := int(n) - if nb < 0 { - return nil, fmt.Errorf("proto: bad byte length %d", nb) - } - end := p.index + nb - if end < p.index || end > len(p.buf) { - return nil, io.ErrUnexpectedEOF - } - - if !alloc { - // todo: check if can get more uses of alloc=false - buf = p.buf[p.index:end] - p.index += nb - return - } - - buf = make([]byte, nb) - copy(buf, p.buf[p.index:]) - p.index += nb - return -} - -// DecodeStringBytes reads an encoded string from the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) DecodeStringBytes() (s string, err error) { - buf, err := p.DecodeRawBytes(false) - if err != nil { - return - } - return string(buf), nil -} - -// Unmarshaler is the interface representing objects that can -// unmarshal themselves. The argument points to data that may be -// overwritten, so implementations should not keep references to the -// buffer. -// Unmarshal implementations should not clear the receiver. -// Any unmarshaled data should be merged into the receiver. -// Callers of Unmarshal that do not want to retain existing data -// should Reset the receiver before calling Unmarshal. -type Unmarshaler interface { - Unmarshal([]byte) error -} - -// newUnmarshaler is the interface representing objects that can -// unmarshal themselves. The semantics are identical to Unmarshaler. -// -// This exists to support protoc-gen-go generated messages. -// The proto package will stop type-asserting to this interface in the future. -// -// DO NOT DEPEND ON THIS. -type newUnmarshaler interface { - XXX_Unmarshal([]byte) error -} - -// Unmarshal parses the protocol buffer representation in buf and places the -// decoded result in pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// Unmarshal resets pb before starting to unmarshal, so any -// existing data in pb is always removed. Use UnmarshalMerge -// to preserve and append to existing data. -func Unmarshal(buf []byte, pb Message) error { - pb.Reset() - if u, ok := pb.(newUnmarshaler); ok { - return u.XXX_Unmarshal(buf) - } - if u, ok := pb.(Unmarshaler); ok { - return u.Unmarshal(buf) - } - return NewBuffer(buf).Unmarshal(pb) -} - -// UnmarshalMerge parses the protocol buffer representation in buf and -// writes the decoded result to pb. If the struct underlying pb does not match -// the data in buf, the results can be unpredictable. -// -// UnmarshalMerge merges into existing data in pb. -// Most code should use Unmarshal instead. -func UnmarshalMerge(buf []byte, pb Message) error { - if u, ok := pb.(newUnmarshaler); ok { - return u.XXX_Unmarshal(buf) - } - if u, ok := pb.(Unmarshaler); ok { - // NOTE: The history of proto have unfortunately been inconsistent - // whether Unmarshaler should or should not implicitly clear itself. - // Some implementations do, most do not. - // Thus, calling this here may or may not do what people want. - // - // See https://github.com/golang/protobuf/issues/424 - return u.Unmarshal(buf) - } - return NewBuffer(buf).Unmarshal(pb) -} - -// DecodeMessage reads a count-delimited message from the Buffer. -func (p *Buffer) DecodeMessage(pb Message) error { - enc, err := p.DecodeRawBytes(false) - if err != nil { - return err - } - return NewBuffer(enc).Unmarshal(pb) -} - -// DecodeGroup reads a tag-delimited group from the Buffer. -// StartGroup tag is already consumed. This function consumes -// EndGroup tag. -func (p *Buffer) DecodeGroup(pb Message) error { - b := p.buf[p.index:] - x, y := findEndGroup(b) - if x < 0 { - return io.ErrUnexpectedEOF - } - err := Unmarshal(b[:x], pb) - p.index += y - return err -} - -// Unmarshal parses the protocol buffer representation in the -// Buffer and places the decoded result in pb. If the struct -// underlying pb does not match the data in the buffer, the results can be -// unpredictable. -// -// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. -func (p *Buffer) Unmarshal(pb Message) error { - // If the object can unmarshal itself, let it. - if u, ok := pb.(newUnmarshaler); ok { - err := u.XXX_Unmarshal(p.buf[p.index:]) - p.index = len(p.buf) - return err - } - if u, ok := pb.(Unmarshaler); ok { - // NOTE: The history of proto have unfortunately been inconsistent - // whether Unmarshaler should or should not implicitly clear itself. - // Some implementations do, most do not. - // Thus, calling this here may or may not do what people want. - // - // See https://github.com/golang/protobuf/issues/424 - err := u.Unmarshal(p.buf[p.index:]) - p.index = len(p.buf) - return err - } - - // Slow workaround for messages that aren't Unmarshalers. - // This includes some hand-coded .pb.go files and - // bootstrap protos. - // TODO: fix all of those and then add Unmarshal to - // the Message interface. Then: - // The cast above and code below can be deleted. - // The old unmarshaler can be deleted. - // Clients can call Unmarshal directly (can already do that, actually). - var info InternalMessageInfo - err := info.Unmarshal(pb, p.buf[p.index:]) - p.index = len(p.buf) - return err -} diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/deprecated.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/deprecated.go deleted file mode 100644 index 69de0ea0..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/deprecated.go +++ /dev/null @@ -1,38 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2018 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -// Deprecated: do not use. -type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } - -// Deprecated: do not use. -func GetStats() Stats { return Stats{} } diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/discard.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/discard.go deleted file mode 100644 index dea2617c..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/discard.go +++ /dev/null @@ -1,350 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2017 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "fmt" - "reflect" - "strings" - "sync" - "sync/atomic" -) - -type generatedDiscarder interface { - XXX_DiscardUnknown() -} - -// DiscardUnknown recursively discards all unknown fields from this message -// and all embedded messages. -// -// When unmarshaling a message with unrecognized fields, the tags and values -// of such fields are preserved in the Message. This allows a later call to -// marshal to be able to produce a message that continues to have those -// unrecognized fields. To avoid this, DiscardUnknown is used to -// explicitly clear the unknown fields after unmarshaling. -// -// For proto2 messages, the unknown fields of message extensions are only -// discarded from messages that have been accessed via GetExtension. -func DiscardUnknown(m Message) { - if m, ok := m.(generatedDiscarder); ok { - m.XXX_DiscardUnknown() - return - } - // TODO: Dynamically populate a InternalMessageInfo for legacy messages, - // but the master branch has no implementation for InternalMessageInfo, - // so it would be more work to replicate that approach. - discardLegacy(m) -} - -// DiscardUnknown recursively discards all unknown fields. -func (a *InternalMessageInfo) DiscardUnknown(m Message) { - di := atomicLoadDiscardInfo(&a.discard) - if di == nil { - di = getDiscardInfo(reflect.TypeOf(m).Elem()) - atomicStoreDiscardInfo(&a.discard, di) - } - di.discard(toPointer(&m)) -} - -type discardInfo struct { - typ reflect.Type - - initialized int32 // 0: only typ is valid, 1: everything is valid - lock sync.Mutex - - fields []discardFieldInfo - unrecognized field -} - -type discardFieldInfo struct { - field field // Offset of field, guaranteed to be valid - discard func(src pointer) -} - -var ( - discardInfoMap = map[reflect.Type]*discardInfo{} - discardInfoLock sync.Mutex -) - -func getDiscardInfo(t reflect.Type) *discardInfo { - discardInfoLock.Lock() - defer discardInfoLock.Unlock() - di := discardInfoMap[t] - if di == nil { - di = &discardInfo{typ: t} - discardInfoMap[t] = di - } - return di -} - -func (di *discardInfo) discard(src pointer) { - if src.isNil() { - return // Nothing to do. - } - - if atomic.LoadInt32(&di.initialized) == 0 { - di.computeDiscardInfo() - } - - for _, fi := range di.fields { - sfp := src.offset(fi.field) - fi.discard(sfp) - } - - // For proto2 messages, only discard unknown fields in message extensions - // that have been accessed via GetExtension. - if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil { - // Ignore lock since DiscardUnknown is not concurrency safe. - emm, _ := em.extensionsRead() - for _, mx := range emm { - if m, ok := mx.value.(Message); ok { - DiscardUnknown(m) - } - } - } - - if di.unrecognized.IsValid() { - *src.offset(di.unrecognized).toBytes() = nil - } -} - -func (di *discardInfo) computeDiscardInfo() { - di.lock.Lock() - defer di.lock.Unlock() - if di.initialized != 0 { - return - } - t := di.typ - n := t.NumField() - - for i := 0; i < n; i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - - dfi := discardFieldInfo{field: toField(&f)} - tf := f.Type - - // Unwrap tf to get its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic(fmt.Sprintf("%v.%s cannot be a slice of pointers to primitive types", t, f.Name)) - } - - switch tf.Kind() { - case reflect.Struct: - switch { - case !isPointer: - panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name)) - case isSlice: // E.g., []*pb.T - di := getDiscardInfo(tf) - dfi.discard = func(src pointer) { - sps := src.getPointerSlice() - for _, sp := range sps { - if !sp.isNil() { - di.discard(sp) - } - } - } - default: // E.g., *pb.T - di := getDiscardInfo(tf) - dfi.discard = func(src pointer) { - sp := src.getPointer() - if !sp.isNil() { - di.discard(sp) - } - } - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%v.%s cannot be a pointer to a map or a slice of map values", t, f.Name)) - default: // E.g., map[K]V - if tf.Elem().Kind() == reflect.Ptr { // Proto struct (e.g., *T) - dfi.discard = func(src pointer) { - sm := src.asPointerTo(tf).Elem() - if sm.Len() == 0 { - return - } - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - DiscardUnknown(val.Interface().(Message)) - } - } - } else { - dfi.discard = func(pointer) {} // Noop - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%v.%s cannot be a pointer to a interface or a slice of interface values", t, f.Name)) - default: // E.g., interface{} - // TODO: Make this faster? - dfi.discard = func(src pointer) { - su := src.asPointerTo(tf).Elem() - if !su.IsNil() { - sv := su.Elem().Elem().Field(0) - if sv.Kind() == reflect.Ptr && sv.IsNil() { - return - } - switch sv.Type().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - DiscardUnknown(sv.Interface().(Message)) - } - } - } - } - default: - continue - } - di.fields = append(di.fields, dfi) - } - - di.unrecognized = invalidField - if f, ok := t.FieldByName("XXX_unrecognized"); ok { - if f.Type != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - di.unrecognized = toField(&f) - } - - atomic.StoreInt32(&di.initialized, 1) -} - -func discardLegacy(m Message) { - v := reflect.ValueOf(m) - if v.Kind() != reflect.Ptr || v.IsNil() { - return - } - v = v.Elem() - if v.Kind() != reflect.Struct { - return - } - t := v.Type() - - for i := 0; i < v.NumField(); i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - vf := v.Field(i) - tf := f.Type - - // Unwrap tf to get its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name)) - } - - switch tf.Kind() { - case reflect.Struct: - switch { - case !isPointer: - panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name)) - case isSlice: // E.g., []*pb.T - for j := 0; j < vf.Len(); j++ { - discardLegacy(vf.Index(j).Interface().(Message)) - } - default: // E.g., *pb.T - discardLegacy(vf.Interface().(Message)) - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name)) - default: // E.g., map[K]V - tv := vf.Type().Elem() - if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T) - for _, key := range vf.MapKeys() { - val := vf.MapIndex(key) - discardLegacy(val.Interface().(Message)) - } - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name)) - default: // E.g., test_proto.isCommunique_Union interface - if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" { - vf = vf.Elem() // E.g., *test_proto.Communique_Msg - if !vf.IsNil() { - vf = vf.Elem() // E.g., test_proto.Communique_Msg - vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value - if vf.Kind() == reflect.Ptr { - discardLegacy(vf.Interface().(Message)) - } - } - } - } - } - } - - if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { - if vf.Type() != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - vf.Set(reflect.ValueOf([]byte(nil))) - } - - // For proto2 messages, only discard unknown fields in message extensions - // that have been accessed via GetExtension. - if em, err := extendable(m); err == nil { - // Ignore lock since discardLegacy is not concurrency safe. - emm, _ := em.extensionsRead() - for _, mx := range emm { - if m, ok := mx.value.(Message); ok { - discardLegacy(m) - } - } - } -} diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/encode.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/encode.go deleted file mode 100644 index 3abfed2c..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/encode.go +++ /dev/null @@ -1,203 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "errors" - "reflect" -) - -var ( - // errRepeatedHasNil is the error returned if Marshal is called with - // a struct with a repeated field containing a nil element. - errRepeatedHasNil = errors.New("proto: repeated field has nil element") - - // errOneofHasNil is the error returned if Marshal is called with - // a struct with a oneof field containing a nil element. - errOneofHasNil = errors.New("proto: oneof field has nil value") - - // ErrNil is the error returned if Marshal is called with nil. - ErrNil = errors.New("proto: Marshal called with nil") - - // ErrTooLarge is the error returned if Marshal is called with a - // message that encodes to >2GB. - ErrTooLarge = errors.New("proto: message encodes to over 2 GB") -) - -// The fundamental encoders that put bytes on the wire. -// Those that take integer types all accept uint64 and are -// therefore of type valueEncoder. - -const maxVarintBytes = 10 // maximum length of a varint - -// EncodeVarint returns the varint encoding of x. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -// Not used by the package itself, but helpful to clients -// wishing to use the same encoding. -func EncodeVarint(x uint64) []byte { - var buf [maxVarintBytes]byte - var n int - for n = 0; x > 127; n++ { - buf[n] = 0x80 | uint8(x&0x7F) - x >>= 7 - } - buf[n] = uint8(x) - n++ - return buf[0:n] -} - -// EncodeVarint writes a varint-encoded integer to the Buffer. -// This is the format for the -// int32, int64, uint32, uint64, bool, and enum -// protocol buffer types. -func (p *Buffer) EncodeVarint(x uint64) error { - for x >= 1<<7 { - p.buf = append(p.buf, uint8(x&0x7f|0x80)) - x >>= 7 - } - p.buf = append(p.buf, uint8(x)) - return nil -} - -// SizeVarint returns the varint encoding size of an integer. -func SizeVarint(x uint64) int { - switch { - case x < 1<<7: - return 1 - case x < 1<<14: - return 2 - case x < 1<<21: - return 3 - case x < 1<<28: - return 4 - case x < 1<<35: - return 5 - case x < 1<<42: - return 6 - case x < 1<<49: - return 7 - case x < 1<<56: - return 8 - case x < 1<<63: - return 9 - } - return 10 -} - -// EncodeFixed64 writes a 64-bit integer to the Buffer. -// This is the format for the -// fixed64, sfixed64, and double protocol buffer types. -func (p *Buffer) EncodeFixed64(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24), - uint8(x>>32), - uint8(x>>40), - uint8(x>>48), - uint8(x>>56)) - return nil -} - -// EncodeFixed32 writes a 32-bit integer to the Buffer. -// This is the format for the -// fixed32, sfixed32, and float protocol buffer types. -func (p *Buffer) EncodeFixed32(x uint64) error { - p.buf = append(p.buf, - uint8(x), - uint8(x>>8), - uint8(x>>16), - uint8(x>>24)) - return nil -} - -// EncodeZigzag64 writes a zigzag-encoded 64-bit integer -// to the Buffer. -// This is the format used for the sint64 protocol buffer type. -func (p *Buffer) EncodeZigzag64(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} - -// EncodeZigzag32 writes a zigzag-encoded 32-bit integer -// to the Buffer. -// This is the format used for the sint32 protocol buffer type. -func (p *Buffer) EncodeZigzag32(x uint64) error { - // use signed number to get arithmetic right shift. - return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) -} - -// EncodeRawBytes writes a count-delimited byte buffer to the Buffer. -// This is the format used for the bytes protocol buffer -// type and for embedded messages. -func (p *Buffer) EncodeRawBytes(b []byte) error { - p.EncodeVarint(uint64(len(b))) - p.buf = append(p.buf, b...) - return nil -} - -// EncodeStringBytes writes an encoded string to the Buffer. -// This is the format used for the proto2 string type. -func (p *Buffer) EncodeStringBytes(s string) error { - p.EncodeVarint(uint64(len(s))) - p.buf = append(p.buf, s...) - return nil -} - -// Marshaler is the interface representing objects that can marshal themselves. -type Marshaler interface { - Marshal() ([]byte, error) -} - -// EncodeMessage writes the protocol buffer to the Buffer, -// prefixed by a varint-encoded length. -func (p *Buffer) EncodeMessage(pb Message) error { - siz := Size(pb) - p.EncodeVarint(uint64(siz)) - return p.Marshal(pb) -} - -// All protocol buffer fields are nillable, but be careful. -func isNil(v reflect.Value) bool { - switch v.Kind() { - case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: - return v.IsNil() - } - return false -} diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/equal.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/equal.go deleted file mode 100644 index d4db5a1c..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/equal.go +++ /dev/null @@ -1,300 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2011 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Protocol buffer comparison. - -package proto - -import ( - "bytes" - "log" - "reflect" - "strings" -) - -/* -Equal returns true iff protocol buffers a and b are equal. -The arguments must both be pointers to protocol buffer structs. - -Equality is defined in this way: - - Two messages are equal iff they are the same type, - corresponding fields are equal, unknown field sets - are equal, and extensions sets are equal. - - Two set scalar fields are equal iff their values are equal. - If the fields are of a floating-point type, remember that - NaN != x for all x, including NaN. If the message is defined - in a proto3 .proto file, fields are not "set"; specifically, - zero length proto3 "bytes" fields are equal (nil == {}). - - Two repeated fields are equal iff their lengths are the same, - and their corresponding elements are equal. Note a "bytes" field, - although represented by []byte, is not a repeated field and the - rule for the scalar fields described above applies. - - Two unset fields are equal. - - Two unknown field sets are equal if their current - encoded state is equal. - - Two extension sets are equal iff they have corresponding - elements that are pairwise equal. - - Two map fields are equal iff their lengths are the same, - and they contain the same set of elements. Zero-length map - fields are equal. - - Every other combination of things are not equal. - -The return value is undefined if a and b are not protocol buffers. -*/ -func Equal(a, b Message) bool { - if a == nil || b == nil { - return a == b - } - v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b) - if v1.Type() != v2.Type() { - return false - } - if v1.Kind() == reflect.Ptr { - if v1.IsNil() { - return v2.IsNil() - } - if v2.IsNil() { - return false - } - v1, v2 = v1.Elem(), v2.Elem() - } - if v1.Kind() != reflect.Struct { - return false - } - return equalStruct(v1, v2) -} - -// v1 and v2 are known to have the same type. -func equalStruct(v1, v2 reflect.Value) bool { - sprop := GetProperties(v1.Type()) - for i := 0; i < v1.NumField(); i++ { - f := v1.Type().Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - f1, f2 := v1.Field(i), v2.Field(i) - if f.Type.Kind() == reflect.Ptr { - if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 { - // both unset - continue - } else if n1 != n2 { - // set/unset mismatch - return false - } - f1, f2 = f1.Elem(), f2.Elem() - } - if !equalAny(f1, f2, sprop.Prop[i]) { - return false - } - } - - if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_InternalExtensions") - if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) { - return false - } - } - - if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() { - em2 := v2.FieldByName("XXX_extensions") - if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) { - return false - } - } - - uf := v1.FieldByName("XXX_unrecognized") - if !uf.IsValid() { - return true - } - - u1 := uf.Bytes() - u2 := v2.FieldByName("XXX_unrecognized").Bytes() - return bytes.Equal(u1, u2) -} - -// v1 and v2 are known to have the same type. -// prop may be nil. -func equalAny(v1, v2 reflect.Value, prop *Properties) bool { - if v1.Type() == protoMessageType { - m1, _ := v1.Interface().(Message) - m2, _ := v2.Interface().(Message) - return Equal(m1, m2) - } - switch v1.Kind() { - case reflect.Bool: - return v1.Bool() == v2.Bool() - case reflect.Float32, reflect.Float64: - return v1.Float() == v2.Float() - case reflect.Int32, reflect.Int64: - return v1.Int() == v2.Int() - case reflect.Interface: - // Probably a oneof field; compare the inner values. - n1, n2 := v1.IsNil(), v2.IsNil() - if n1 || n2 { - return n1 == n2 - } - e1, e2 := v1.Elem(), v2.Elem() - if e1.Type() != e2.Type() { - return false - } - return equalAny(e1, e2, nil) - case reflect.Map: - if v1.Len() != v2.Len() { - return false - } - for _, key := range v1.MapKeys() { - val2 := v2.MapIndex(key) - if !val2.IsValid() { - // This key was not found in the second map. - return false - } - if !equalAny(v1.MapIndex(key), val2, nil) { - return false - } - } - return true - case reflect.Ptr: - // Maps may have nil values in them, so check for nil. - if v1.IsNil() && v2.IsNil() { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return equalAny(v1.Elem(), v2.Elem(), prop) - case reflect.Slice: - if v1.Type().Elem().Kind() == reflect.Uint8 { - // short circuit: []byte - - // Edge case: if this is in a proto3 message, a zero length - // bytes field is considered the zero value. - if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 { - return true - } - if v1.IsNil() != v2.IsNil() { - return false - } - return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte)) - } - - if v1.Len() != v2.Len() { - return false - } - for i := 0; i < v1.Len(); i++ { - if !equalAny(v1.Index(i), v2.Index(i), prop) { - return false - } - } - return true - case reflect.String: - return v1.Interface().(string) == v2.Interface().(string) - case reflect.Struct: - return equalStruct(v1, v2) - case reflect.Uint32, reflect.Uint64: - return v1.Uint() == v2.Uint() - } - - // unknown type, so not a protocol buffer - log.Printf("proto: don't know how to compare %v", v1) - return false -} - -// base is the struct type that the extensions are based on. -// x1 and x2 are InternalExtensions. -func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool { - em1, _ := x1.extensionsRead() - em2, _ := x2.extensionsRead() - return equalExtMap(base, em1, em2) -} - -func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { - if len(em1) != len(em2) { - return false - } - - for extNum, e1 := range em1 { - e2, ok := em2[extNum] - if !ok { - return false - } - - m1, m2 := e1.value, e2.value - - if m1 == nil && m2 == nil { - // Both have only encoded form. - if bytes.Equal(e1.enc, e2.enc) { - continue - } - // The bytes are different, but the extensions might still be - // equal. We need to decode them to compare. - } - - if m1 != nil && m2 != nil { - // Both are unencoded. - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - continue - } - - // At least one is encoded. To do a semantically correct comparison - // we need to unmarshal them first. - var desc *ExtensionDesc - if m := extensionMaps[base]; m != nil { - desc = m[extNum] - } - if desc == nil { - // If both have only encoded form and the bytes are the same, - // it is handled above. We get here when the bytes are different. - // We don't know how to decode it, so just compare them as byte - // slices. - log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) - return false - } - var err error - if m1 == nil { - m1, err = decodeExtension(e1.enc, desc) - } - if m2 == nil && err == nil { - m2, err = decodeExtension(e2.enc, desc) - } - if err != nil { - // The encoded form is invalid. - log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err) - return false - } - if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { - return false - } - } - - return true -} diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/extensions.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/extensions.go deleted file mode 100644 index dacdd22d..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/extensions.go +++ /dev/null @@ -1,543 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Types and routines for supporting protocol buffer extensions. - */ - -import ( - "errors" - "fmt" - "io" - "reflect" - "strconv" - "sync" -) - -// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message. -var ErrMissingExtension = errors.New("proto: missing extension") - -// ExtensionRange represents a range of message extensions for a protocol buffer. -// Used in code generated by the protocol compiler. -type ExtensionRange struct { - Start, End int32 // both inclusive -} - -// extendableProto is an interface implemented by any protocol buffer generated by the current -// proto compiler that may be extended. -type extendableProto interface { - Message - ExtensionRangeArray() []ExtensionRange - extensionsWrite() map[int32]Extension - extensionsRead() (map[int32]Extension, sync.Locker) -} - -// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous -// version of the proto compiler that may be extended. -type extendableProtoV1 interface { - Message - ExtensionRangeArray() []ExtensionRange - ExtensionMap() map[int32]Extension -} - -// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto. -type extensionAdapter struct { - extendableProtoV1 -} - -func (e extensionAdapter) extensionsWrite() map[int32]Extension { - return e.ExtensionMap() -} - -func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { - return e.ExtensionMap(), notLocker{} -} - -// notLocker is a sync.Locker whose Lock and Unlock methods are nops. -type notLocker struct{} - -func (n notLocker) Lock() {} -func (n notLocker) Unlock() {} - -// extendable returns the extendableProto interface for the given generated proto message. -// If the proto message has the old extension format, it returns a wrapper that implements -// the extendableProto interface. -func extendable(p interface{}) (extendableProto, error) { - switch p := p.(type) { - case extendableProto: - if isNilPtr(p) { - return nil, fmt.Errorf("proto: nil %T is not extendable", p) - } - return p, nil - case extendableProtoV1: - if isNilPtr(p) { - return nil, fmt.Errorf("proto: nil %T is not extendable", p) - } - return extensionAdapter{p}, nil - } - // Don't allocate a specific error containing %T: - // this is the hot path for Clone and MarshalText. - return nil, errNotExtendable -} - -var errNotExtendable = errors.New("proto: not an extendable proto.Message") - -func isNilPtr(x interface{}) bool { - v := reflect.ValueOf(x) - return v.Kind() == reflect.Ptr && v.IsNil() -} - -// XXX_InternalExtensions is an internal representation of proto extensions. -// -// Each generated message struct type embeds an anonymous XXX_InternalExtensions field, -// thus gaining the unexported 'extensions' method, which can be called only from the proto package. -// -// The methods of XXX_InternalExtensions are not concurrency safe in general, -// but calls to logically read-only methods such as has and get may be executed concurrently. -type XXX_InternalExtensions struct { - // The struct must be indirect so that if a user inadvertently copies a - // generated message and its embedded XXX_InternalExtensions, they - // avoid the mayhem of a copied mutex. - // - // The mutex serializes all logically read-only operations to p.extensionMap. - // It is up to the client to ensure that write operations to p.extensionMap are - // mutually exclusive with other accesses. - p *struct { - mu sync.Mutex - extensionMap map[int32]Extension - } -} - -// extensionsWrite returns the extension map, creating it on first use. -func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension { - if e.p == nil { - e.p = new(struct { - mu sync.Mutex - extensionMap map[int32]Extension - }) - e.p.extensionMap = make(map[int32]Extension) - } - return e.p.extensionMap -} - -// extensionsRead returns the extensions map for read-only use. It may be nil. -// The caller must hold the returned mutex's lock when accessing Elements within the map. -func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) { - if e.p == nil { - return nil, nil - } - return e.p.extensionMap, &e.p.mu -} - -// ExtensionDesc represents an extension specification. -// Used in generated code from the protocol compiler. -type ExtensionDesc struct { - ExtendedType Message // nil pointer to the type that is being extended - ExtensionType interface{} // nil pointer to the extension type - Field int32 // field number - Name string // fully-qualified name of extension, for text formatting - Tag string // protobuf tag style - Filename string // name of the file in which the extension is defined -} - -func (ed *ExtensionDesc) repeated() bool { - t := reflect.TypeOf(ed.ExtensionType) - return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 -} - -// Extension represents an extension in a message. -type Extension struct { - // When an extension is stored in a message using SetExtension - // only desc and value are set. When the message is marshaled - // enc will be set to the encoded form of the message. - // - // When a message is unmarshaled and contains extensions, each - // extension will have only enc set. When such an extension is - // accessed using GetExtension (or GetExtensions) desc and value - // will be set. - desc *ExtensionDesc - value interface{} - enc []byte -} - -// SetRawExtension is for testing only. -func SetRawExtension(base Message, id int32, b []byte) { - epb, err := extendable(base) - if err != nil { - return - } - extmap := epb.extensionsWrite() - extmap[id] = Extension{enc: b} -} - -// isExtensionField returns true iff the given field number is in an extension range. -func isExtensionField(pb extendableProto, field int32) bool { - for _, er := range pb.ExtensionRangeArray() { - if er.Start <= field && field <= er.End { - return true - } - } - return false -} - -// checkExtensionTypes checks that the given extension is valid for pb. -func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { - var pbi interface{} = pb - // Check the extended type. - if ea, ok := pbi.(extensionAdapter); ok { - pbi = ea.extendableProtoV1 - } - if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { - return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a) - } - // Check the range. - if !isExtensionField(pb, extension.Field) { - return errors.New("proto: bad extension number; not in declared ranges") - } - return nil -} - -// extPropKey is sufficient to uniquely identify an extension. -type extPropKey struct { - base reflect.Type - field int32 -} - -var extProp = struct { - sync.RWMutex - m map[extPropKey]*Properties -}{ - m: make(map[extPropKey]*Properties), -} - -func extensionProperties(ed *ExtensionDesc) *Properties { - key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field} - - extProp.RLock() - if prop, ok := extProp.m[key]; ok { - extProp.RUnlock() - return prop - } - extProp.RUnlock() - - extProp.Lock() - defer extProp.Unlock() - // Check again. - if prop, ok := extProp.m[key]; ok { - return prop - } - - prop := new(Properties) - prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil) - extProp.m[key] = prop - return prop -} - -// HasExtension returns whether the given extension is present in pb. -func HasExtension(pb Message, extension *ExtensionDesc) bool { - // TODO: Check types, field numbers, etc.? - epb, err := extendable(pb) - if err != nil { - return false - } - extmap, mu := epb.extensionsRead() - if extmap == nil { - return false - } - mu.Lock() - _, ok := extmap[extension.Field] - mu.Unlock() - return ok -} - -// ClearExtension removes the given extension from pb. -func ClearExtension(pb Message, extension *ExtensionDesc) { - epb, err := extendable(pb) - if err != nil { - return - } - // TODO: Check types, field numbers, etc.? - extmap := epb.extensionsWrite() - delete(extmap, extension.Field) -} - -// GetExtension retrieves a proto2 extended field from pb. -// -// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), -// then GetExtension parses the encoded field and returns a Go value of the specified type. -// If the field is not present, then the default value is returned (if one is specified), -// otherwise ErrMissingExtension is reported. -// -// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil), -// then GetExtension returns the raw encoded bytes of the field extension. -func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { - epb, err := extendable(pb) - if err != nil { - return nil, err - } - - if extension.ExtendedType != nil { - // can only check type if this is a complete descriptor - if err := checkExtensionTypes(epb, extension); err != nil { - return nil, err - } - } - - emap, mu := epb.extensionsRead() - if emap == nil { - return defaultExtensionValue(extension) - } - mu.Lock() - defer mu.Unlock() - e, ok := emap[extension.Field] - if !ok { - // defaultExtensionValue returns the default value or - // ErrMissingExtension if there is no default. - return defaultExtensionValue(extension) - } - - if e.value != nil { - // Already decoded. Check the descriptor, though. - if e.desc != extension { - // This shouldn't happen. If it does, it means that - // GetExtension was called twice with two different - // descriptors with the same field number. - return nil, errors.New("proto: descriptor conflict") - } - return e.value, nil - } - - if extension.ExtensionType == nil { - // incomplete descriptor - return e.enc, nil - } - - v, err := decodeExtension(e.enc, extension) - if err != nil { - return nil, err - } - - // Remember the decoded version and drop the encoded version. - // That way it is safe to mutate what we return. - e.value = v - e.desc = extension - e.enc = nil - emap[extension.Field] = e - return e.value, nil -} - -// defaultExtensionValue returns the default value for extension. -// If no default for an extension is defined ErrMissingExtension is returned. -func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { - if extension.ExtensionType == nil { - // incomplete descriptor, so no default - return nil, ErrMissingExtension - } - - t := reflect.TypeOf(extension.ExtensionType) - props := extensionProperties(extension) - - sf, _, err := fieldDefault(t, props) - if err != nil { - return nil, err - } - - if sf == nil || sf.value == nil { - // There is no default value. - return nil, ErrMissingExtension - } - - if t.Kind() != reflect.Ptr { - // We do not need to return a Ptr, we can directly return sf.value. - return sf.value, nil - } - - // We need to return an interface{} that is a pointer to sf.value. - value := reflect.New(t).Elem() - value.Set(reflect.New(value.Type().Elem())) - if sf.kind == reflect.Int32 { - // We may have an int32 or an enum, but the underlying data is int32. - // Since we can't set an int32 into a non int32 reflect.value directly - // set it as a int32. - value.Elem().SetInt(int64(sf.value.(int32))) - } else { - value.Elem().Set(reflect.ValueOf(sf.value)) - } - return value.Interface(), nil -} - -// decodeExtension decodes an extension encoded in b. -func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { - t := reflect.TypeOf(extension.ExtensionType) - unmarshal := typeUnmarshaler(t, extension.Tag) - - // t is a pointer to a struct, pointer to basic type or a slice. - // Allocate space to store the pointer/slice. - value := reflect.New(t).Elem() - - var err error - for { - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - wire := int(x) & 7 - - b, err = unmarshal(b, valToPointer(value.Addr()), wire) - if err != nil { - return nil, err - } - - if len(b) == 0 { - break - } - } - return value.Interface(), nil -} - -// GetExtensions returns a slice of the extensions present in pb that are also listed in es. -// The returned slice has the same length as es; missing extensions will appear as nil elements. -func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { - epb, err := extendable(pb) - if err != nil { - return nil, err - } - extensions = make([]interface{}, len(es)) - for i, e := range es { - extensions[i], err = GetExtension(epb, e) - if err == ErrMissingExtension { - err = nil - } - if err != nil { - return - } - } - return -} - -// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order. -// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing -// just the Field field, which defines the extension's field number. -func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { - epb, err := extendable(pb) - if err != nil { - return nil, err - } - registeredExtensions := RegisteredExtensions(pb) - - emap, mu := epb.extensionsRead() - if emap == nil { - return nil, nil - } - mu.Lock() - defer mu.Unlock() - extensions := make([]*ExtensionDesc, 0, len(emap)) - for extid, e := range emap { - desc := e.desc - if desc == nil { - desc = registeredExtensions[extid] - if desc == nil { - desc = &ExtensionDesc{Field: extid} - } - } - - extensions = append(extensions, desc) - } - return extensions, nil -} - -// SetExtension sets the specified extension of pb to the specified value. -func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { - epb, err := extendable(pb) - if err != nil { - return err - } - if err := checkExtensionTypes(epb, extension); err != nil { - return err - } - typ := reflect.TypeOf(extension.ExtensionType) - if typ != reflect.TypeOf(value) { - return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", value, extension.ExtensionType) - } - // nil extension values need to be caught early, because the - // encoder can't distinguish an ErrNil due to a nil extension - // from an ErrNil due to a missing field. Extensions are - // always optional, so the encoder would just swallow the error - // and drop all the extensions from the encoded message. - if reflect.ValueOf(value).IsNil() { - return fmt.Errorf("proto: SetExtension called with nil value of type %T", value) - } - - extmap := epb.extensionsWrite() - extmap[extension.Field] = Extension{desc: extension, value: value} - return nil -} - -// ClearAllExtensions clears all extensions from pb. -func ClearAllExtensions(pb Message) { - epb, err := extendable(pb) - if err != nil { - return - } - m := epb.extensionsWrite() - for k := range m { - delete(m, k) - } -} - -// A global registry of extensions. -// The generated code will register the generated descriptors by calling RegisterExtension. - -var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc) - -// RegisterExtension is called from the generated code. -func RegisterExtension(desc *ExtensionDesc) { - st := reflect.TypeOf(desc.ExtendedType).Elem() - m := extensionMaps[st] - if m == nil { - m = make(map[int32]*ExtensionDesc) - extensionMaps[st] = m - } - if _, ok := m[desc.Field]; ok { - panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field))) - } - m[desc.Field] = desc -} - -// RegisteredExtensions returns a map of the registered extensions of a -// protocol buffer struct, indexed by the extension number. -// The argument pb should be a nil pointer to the struct type. -func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { - return extensionMaps[reflect.TypeOf(pb).Elem()] -} diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/lib.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/lib.go deleted file mode 100644 index c076dbdb..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/lib.go +++ /dev/null @@ -1,959 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/* -Package proto converts data structures to and from the wire format of -protocol buffers. It works in concert with the Go source code generated -for .proto files by the protocol compiler. - -A summary of the properties of the protocol buffer interface -for a protocol buffer variable v: - - - Names are turned from camel_case to CamelCase for export. - - There are no methods on v to set fields; just treat - them as structure fields. - - There are getters that return a field's value if set, - and return the field's default value if unset. - The getters work even if the receiver is a nil message. - - The zero value for a struct is its correct initialization state. - All desired fields must be set before marshaling. - - A Reset() method will restore a protobuf struct to its zero state. - - Non-repeated fields are pointers to the values; nil means unset. - That is, optional or required field int32 f becomes F *int32. - - Repeated fields are slices. - - Helper functions are available to aid the setting of fields. - msg.Foo = proto.String("hello") // set field - - Constants are defined to hold the default values of all fields that - have them. They have the form Default_StructName_FieldName. - Because the getter methods handle defaulted values, - direct use of these constants should be rare. - - Enums are given type names and maps from names to values. - Enum values are prefixed by the enclosing message's name, or by the - enum's type name if it is a top-level enum. Enum types have a String - method, and a Enum method to assist in message construction. - - Nested messages, groups and enums have type names prefixed with the name of - the surrounding message type. - - Extensions are given descriptor names that start with E_, - followed by an underscore-delimited list of the nested messages - that contain it (if any) followed by the CamelCased name of the - extension field itself. HasExtension, ClearExtension, GetExtension - and SetExtension are functions for manipulating extensions. - - Oneof field sets are given a single field in their message, - with distinguished wrapper types for each possible field value. - - Marshal and Unmarshal are functions to encode and decode the wire format. - -When the .proto file specifies `syntax="proto3"`, there are some differences: - - - Non-repeated fields of non-message type are values instead of pointers. - - Enum types do not get an Enum method. - -The simplest way to describe this is to see an example. -Given file test.proto, containing - - package example; - - enum FOO { X = 17; } - - message Test { - required string label = 1; - optional int32 type = 2 [default=77]; - repeated int64 reps = 3; - optional group OptionalGroup = 4 { - required string RequiredField = 5; - } - oneof union { - int32 number = 6; - string name = 7; - } - } - -The resulting file, test.pb.go, is: - - package example - - import proto "github.com/golang/protobuf/proto" - import math "math" - - type FOO int32 - const ( - FOO_X FOO = 17 - ) - var FOO_name = map[int32]string{ - 17: "X", - } - var FOO_value = map[string]int32{ - "X": 17, - } - - func (x FOO) Enum() *FOO { - p := new(FOO) - *p = x - return p - } - func (x FOO) String() string { - return proto.EnumName(FOO_name, int32(x)) - } - func (x *FOO) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(FOO_value, data) - if err != nil { - return err - } - *x = FOO(value) - return nil - } - - type Test struct { - Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"` - Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"` - Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"` - Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"` - // Types that are valid to be assigned to Union: - // *Test_Number - // *Test_Name - Union isTest_Union `protobuf_oneof:"union"` - XXX_unrecognized []byte `json:"-"` - } - func (m *Test) Reset() { *m = Test{} } - func (m *Test) String() string { return proto.CompactTextString(m) } - func (*Test) ProtoMessage() {} - - type isTest_Union interface { - isTest_Union() - } - - type Test_Number struct { - Number int32 `protobuf:"varint,6,opt,name=number"` - } - type Test_Name struct { - Name string `protobuf:"bytes,7,opt,name=name"` - } - - func (*Test_Number) isTest_Union() {} - func (*Test_Name) isTest_Union() {} - - func (m *Test) GetUnion() isTest_Union { - if m != nil { - return m.Union - } - return nil - } - const Default_Test_Type int32 = 77 - - func (m *Test) GetLabel() string { - if m != nil && m.Label != nil { - return *m.Label - } - return "" - } - - func (m *Test) GetType() int32 { - if m != nil && m.Type != nil { - return *m.Type - } - return Default_Test_Type - } - - func (m *Test) GetOptionalgroup() *Test_OptionalGroup { - if m != nil { - return m.Optionalgroup - } - return nil - } - - type Test_OptionalGroup struct { - RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"` - } - func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} } - func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) } - - func (m *Test_OptionalGroup) GetRequiredField() string { - if m != nil && m.RequiredField != nil { - return *m.RequiredField - } - return "" - } - - func (m *Test) GetNumber() int32 { - if x, ok := m.GetUnion().(*Test_Number); ok { - return x.Number - } - return 0 - } - - func (m *Test) GetName() string { - if x, ok := m.GetUnion().(*Test_Name); ok { - return x.Name - } - return "" - } - - func init() { - proto.RegisterEnum("example.FOO", FOO_name, FOO_value) - } - -To create and play with a Test object: - - package main - - import ( - "log" - - "github.com/golang/protobuf/proto" - pb "./example.pb" - ) - - func main() { - test := &pb.Test{ - Label: proto.String("hello"), - Type: proto.Int32(17), - Reps: []int64{1, 2, 3}, - Optionalgroup: &pb.Test_OptionalGroup{ - RequiredField: proto.String("good bye"), - }, - Union: &pb.Test_Name{"fred"}, - } - data, err := proto.Marshal(test) - if err != nil { - log.Fatal("marshaling error: ", err) - } - newTest := &pb.Test{} - err = proto.Unmarshal(data, newTest) - if err != nil { - log.Fatal("unmarshaling error: ", err) - } - // Now test and newTest contain the same data. - if test.GetLabel() != newTest.GetLabel() { - log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel()) - } - // Use a type switch to determine which oneof was set. - switch u := test.Union.(type) { - case *pb.Test_Number: // u.Number contains the number. - case *pb.Test_Name: // u.Name contains the string. - } - // etc. - } -*/ -package proto - -import ( - "encoding/json" - "fmt" - "log" - "reflect" - "sort" - "strconv" - "sync" -) - -// RequiredNotSetError is an error type returned by either Marshal or Unmarshal. -// Marshal reports this when a required field is not initialized. -// Unmarshal reports this when a required field is missing from the wire data. -type RequiredNotSetError struct{ field string } - -func (e *RequiredNotSetError) Error() string { - if e.field == "" { - return fmt.Sprintf("proto: required field not set") - } - return fmt.Sprintf("proto: required field %q not set", e.field) -} -func (e *RequiredNotSetError) RequiredNotSet() bool { - return true -} - -type invalidUTF8Error struct{ field string } - -func (e *invalidUTF8Error) Error() string { - if e.field == "" { - return "proto: invalid UTF-8 detected" - } - return fmt.Sprintf("proto: field %q contains invalid UTF-8", e.field) -} -func (e *invalidUTF8Error) InvalidUTF8() bool { - return true -} - -// errInvalidUTF8 is a sentinel error to identify fields with invalid UTF-8. -// This error should not be exposed to the external API as such errors should -// be recreated with the field information. -var errInvalidUTF8 = &invalidUTF8Error{} - -// isNonFatal reports whether the error is either a RequiredNotSet error -// or a InvalidUTF8 error. -func isNonFatal(err error) bool { - if re, ok := err.(interface{ RequiredNotSet() bool }); ok && re.RequiredNotSet() { - return true - } - if re, ok := err.(interface{ InvalidUTF8() bool }); ok && re.InvalidUTF8() { - return true - } - return false -} - -type nonFatal struct{ E error } - -// Merge merges err into nf and reports whether it was successful. -// Otherwise it returns false for any fatal non-nil errors. -func (nf *nonFatal) Merge(err error) (ok bool) { - if err == nil { - return true // not an error - } - if !isNonFatal(err) { - return false // fatal error - } - if nf.E == nil { - nf.E = err // store first instance of non-fatal error - } - return true -} - -// Message is implemented by generated protocol buffer messages. -type Message interface { - Reset() - String() string - ProtoMessage() -} - -// A Buffer is a buffer manager for marshaling and unmarshaling -// protocol buffers. It may be reused between invocations to -// reduce memory usage. It is not necessary to use a Buffer; -// the global functions Marshal and Unmarshal create a -// temporary Buffer and are fine for most applications. -type Buffer struct { - buf []byte // encode/decode byte stream - index int // read point - - deterministic bool -} - -// NewBuffer allocates a new Buffer and initializes its internal data to -// the contents of the argument slice. -func NewBuffer(e []byte) *Buffer { - return &Buffer{buf: e} -} - -// Reset resets the Buffer, ready for marshaling a new protocol buffer. -func (p *Buffer) Reset() { - p.buf = p.buf[0:0] // for reading/writing - p.index = 0 // for reading -} - -// SetBuf replaces the internal buffer with the slice, -// ready for unmarshaling the contents of the slice. -func (p *Buffer) SetBuf(s []byte) { - p.buf = s - p.index = 0 -} - -// Bytes returns the contents of the Buffer. -func (p *Buffer) Bytes() []byte { return p.buf } - -// SetDeterministic sets whether to use deterministic serialization. -// -// Deterministic serialization guarantees that for a given binary, equal -// messages will always be serialized to the same bytes. This implies: -// -// - Repeated serialization of a message will return the same bytes. -// - Different processes of the same binary (which may be executing on -// different machines) will serialize equal messages to the same bytes. -// -// Note that the deterministic serialization is NOT canonical across -// languages. It is not guaranteed to remain stable over time. It is unstable -// across different builds with schema changes due to unknown fields. -// Users who need canonical serialization (e.g., persistent storage in a -// canonical form, fingerprinting, etc.) should define their own -// canonicalization specification and implement their own serializer rather -// than relying on this API. -// -// If deterministic serialization is requested, map entries will be sorted -// by keys in lexographical order. This is an implementation detail and -// subject to change. -func (p *Buffer) SetDeterministic(deterministic bool) { - p.deterministic = deterministic -} - -/* - * Helper routines for simplifying the creation of optional fields of basic type. - */ - -// Bool is a helper routine that allocates a new bool value -// to store v and returns a pointer to it. -func Bool(v bool) *bool { - return &v -} - -// Int32 is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it. -func Int32(v int32) *int32 { - return &v -} - -// Int is a helper routine that allocates a new int32 value -// to store v and returns a pointer to it, but unlike Int32 -// its argument value is an int. -func Int(v int) *int32 { - p := new(int32) - *p = int32(v) - return p -} - -// Int64 is a helper routine that allocates a new int64 value -// to store v and returns a pointer to it. -func Int64(v int64) *int64 { - return &v -} - -// Float32 is a helper routine that allocates a new float32 value -// to store v and returns a pointer to it. -func Float32(v float32) *float32 { - return &v -} - -// Float64 is a helper routine that allocates a new float64 value -// to store v and returns a pointer to it. -func Float64(v float64) *float64 { - return &v -} - -// Uint32 is a helper routine that allocates a new uint32 value -// to store v and returns a pointer to it. -func Uint32(v uint32) *uint32 { - return &v -} - -// Uint64 is a helper routine that allocates a new uint64 value -// to store v and returns a pointer to it. -func Uint64(v uint64) *uint64 { - return &v -} - -// String is a helper routine that allocates a new string value -// to store v and returns a pointer to it. -func String(v string) *string { - return &v -} - -// EnumName is a helper function to simplify printing protocol buffer enums -// by name. Given an enum map and a value, it returns a useful string. -func EnumName(m map[int32]string, v int32) string { - s, ok := m[v] - if ok { - return s - } - return strconv.Itoa(int(v)) -} - -// UnmarshalJSONEnum is a helper function to simplify recovering enum int values -// from their JSON-encoded representation. Given a map from the enum's symbolic -// names to its int values, and a byte buffer containing the JSON-encoded -// value, it returns an int32 that can be cast to the enum type by the caller. -// -// The function can deal with both JSON representations, numeric and symbolic. -func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { - if data[0] == '"' { - // New style: enums are strings. - var repr string - if err := json.Unmarshal(data, &repr); err != nil { - return -1, err - } - val, ok := m[repr] - if !ok { - return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr) - } - return val, nil - } - // Old style: enums are ints. - var val int32 - if err := json.Unmarshal(data, &val); err != nil { - return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName) - } - return val, nil -} - -// DebugPrint dumps the encoded data in b in a debugging format with a header -// including the string s. Used in testing but made available for general debugging. -func (p *Buffer) DebugPrint(s string, b []byte) { - var u uint64 - - obuf := p.buf - index := p.index - p.buf = b - p.index = 0 - depth := 0 - - fmt.Printf("\n--- %s ---\n", s) - -out: - for { - for i := 0; i < depth; i++ { - fmt.Print(" ") - } - - index := p.index - if index == len(p.buf) { - break - } - - op, err := p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: fetching op err %v\n", index, err) - break out - } - tag := op >> 3 - wire := op & 7 - - switch wire { - default: - fmt.Printf("%3d: t=%3d unknown wire=%d\n", - index, tag, wire) - break out - - case WireBytes: - var r []byte - - r, err = p.DecodeRawBytes(false) - if err != nil { - break out - } - fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r)) - if len(r) <= 6 { - for i := 0; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } else { - for i := 0; i < 3; i++ { - fmt.Printf(" %.2x", r[i]) - } - fmt.Printf(" ..") - for i := len(r) - 3; i < len(r); i++ { - fmt.Printf(" %.2x", r[i]) - } - } - fmt.Printf("\n") - - case WireFixed32: - u, err = p.DecodeFixed32() - if err != nil { - fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u) - - case WireFixed64: - u, err = p.DecodeFixed64() - if err != nil { - fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u) - - case WireVarint: - u, err = p.DecodeVarint() - if err != nil { - fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err) - break out - } - fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u) - - case WireStartGroup: - fmt.Printf("%3d: t=%3d start\n", index, tag) - depth++ - - case WireEndGroup: - depth-- - fmt.Printf("%3d: t=%3d end\n", index, tag) - } - } - - if depth != 0 { - fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth) - } - fmt.Printf("\n") - - p.buf = obuf - p.index = index -} - -// SetDefaults sets unset protocol buffer fields to their default values. -// It only modifies fields that are both unset and have defined defaults. -// It recursively sets default values in any non-nil sub-messages. -func SetDefaults(pb Message) { - setDefaults(reflect.ValueOf(pb), true, false) -} - -// v is a pointer to a struct. -func setDefaults(v reflect.Value, recur, zeros bool) { - v = v.Elem() - - defaultMu.RLock() - dm, ok := defaults[v.Type()] - defaultMu.RUnlock() - if !ok { - dm = buildDefaultMessage(v.Type()) - defaultMu.Lock() - defaults[v.Type()] = dm - defaultMu.Unlock() - } - - for _, sf := range dm.scalars { - f := v.Field(sf.index) - if !f.IsNil() { - // field already set - continue - } - dv := sf.value - if dv == nil && !zeros { - // no explicit default, and don't want to set zeros - continue - } - fptr := f.Addr().Interface() // **T - // TODO: Consider batching the allocations we do here. - switch sf.kind { - case reflect.Bool: - b := new(bool) - if dv != nil { - *b = dv.(bool) - } - *(fptr.(**bool)) = b - case reflect.Float32: - f := new(float32) - if dv != nil { - *f = dv.(float32) - } - *(fptr.(**float32)) = f - case reflect.Float64: - f := new(float64) - if dv != nil { - *f = dv.(float64) - } - *(fptr.(**float64)) = f - case reflect.Int32: - // might be an enum - if ft := f.Type(); ft != int32PtrType { - // enum - f.Set(reflect.New(ft.Elem())) - if dv != nil { - f.Elem().SetInt(int64(dv.(int32))) - } - } else { - // int32 field - i := new(int32) - if dv != nil { - *i = dv.(int32) - } - *(fptr.(**int32)) = i - } - case reflect.Int64: - i := new(int64) - if dv != nil { - *i = dv.(int64) - } - *(fptr.(**int64)) = i - case reflect.String: - s := new(string) - if dv != nil { - *s = dv.(string) - } - *(fptr.(**string)) = s - case reflect.Uint8: - // exceptional case: []byte - var b []byte - if dv != nil { - db := dv.([]byte) - b = make([]byte, len(db)) - copy(b, db) - } else { - b = []byte{} - } - *(fptr.(*[]byte)) = b - case reflect.Uint32: - u := new(uint32) - if dv != nil { - *u = dv.(uint32) - } - *(fptr.(**uint32)) = u - case reflect.Uint64: - u := new(uint64) - if dv != nil { - *u = dv.(uint64) - } - *(fptr.(**uint64)) = u - default: - log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind) - } - } - - for _, ni := range dm.nested { - f := v.Field(ni) - // f is *T or []*T or map[T]*T - switch f.Kind() { - case reflect.Ptr: - if f.IsNil() { - continue - } - setDefaults(f, recur, zeros) - - case reflect.Slice: - for i := 0; i < f.Len(); i++ { - e := f.Index(i) - if e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - - case reflect.Map: - for _, k := range f.MapKeys() { - e := f.MapIndex(k) - if e.IsNil() { - continue - } - setDefaults(e, recur, zeros) - } - } - } -} - -var ( - // defaults maps a protocol buffer struct type to a slice of the fields, - // with its scalar fields set to their proto-declared non-zero default values. - defaultMu sync.RWMutex - defaults = make(map[reflect.Type]defaultMessage) - - int32PtrType = reflect.TypeOf((*int32)(nil)) -) - -// defaultMessage represents information about the default values of a message. -type defaultMessage struct { - scalars []scalarField - nested []int // struct field index of nested messages -} - -type scalarField struct { - index int // struct field index - kind reflect.Kind // element type (the T in *T or []T) - value interface{} // the proto-declared default value, or nil -} - -// t is a struct type. -func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { - sprop := GetProperties(t) - for _, prop := range sprop.Prop { - fi, ok := sprop.decoderTags.get(prop.Tag) - if !ok { - // XXX_unrecognized - continue - } - ft := t.Field(fi).Type - - sf, nested, err := fieldDefault(ft, prop) - switch { - case err != nil: - log.Print(err) - case nested: - dm.nested = append(dm.nested, fi) - case sf != nil: - sf.index = fi - dm.scalars = append(dm.scalars, *sf) - } - } - - return dm -} - -// fieldDefault returns the scalarField for field type ft. -// sf will be nil if the field can not have a default. -// nestedMessage will be true if this is a nested message. -// Note that sf.index is not set on return. -func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { - var canHaveDefault bool - switch ft.Kind() { - case reflect.Ptr: - if ft.Elem().Kind() == reflect.Struct { - nestedMessage = true - } else { - canHaveDefault = true // proto2 scalar field - } - - case reflect.Slice: - switch ft.Elem().Kind() { - case reflect.Ptr: - nestedMessage = true // repeated message - case reflect.Uint8: - canHaveDefault = true // bytes field - } - - case reflect.Map: - if ft.Elem().Kind() == reflect.Ptr { - nestedMessage = true // map with message values - } - } - - if !canHaveDefault { - if nestedMessage { - return nil, true, nil - } - return nil, false, nil - } - - // We now know that ft is a pointer or slice. - sf = &scalarField{kind: ft.Elem().Kind()} - - // scalar fields without defaults - if !prop.HasDefault { - return sf, false, nil - } - - // a scalar field: either *T or []byte - switch ft.Elem().Kind() { - case reflect.Bool: - x, err := strconv.ParseBool(prop.Default) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Float32: - x, err := strconv.ParseFloat(prop.Default, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err) - } - sf.value = float32(x) - case reflect.Float64: - x, err := strconv.ParseFloat(prop.Default, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.Int32: - x, err := strconv.ParseInt(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err) - } - sf.value = int32(x) - case reflect.Int64: - x, err := strconv.ParseInt(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err) - } - sf.value = x - case reflect.String: - sf.value = prop.Default - case reflect.Uint8: - // []byte (not *uint8) - sf.value = []byte(prop.Default) - case reflect.Uint32: - x, err := strconv.ParseUint(prop.Default, 10, 32) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err) - } - sf.value = uint32(x) - case reflect.Uint64: - x, err := strconv.ParseUint(prop.Default, 10, 64) - if err != nil { - return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err) - } - sf.value = x - default: - return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind()) - } - - return sf, false, nil -} - -// mapKeys returns a sort.Interface to be used for sorting the map keys. -// Map fields may have key types of non-float scalars, strings and enums. -func mapKeys(vs []reflect.Value) sort.Interface { - s := mapKeySorter{vs: vs} - - // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps. - if len(vs) == 0 { - return s - } - switch vs[0].Kind() { - case reflect.Int32, reflect.Int64: - s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } - case reflect.Uint32, reflect.Uint64: - s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } - case reflect.Bool: - s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true - case reflect.String: - s.less = func(a, b reflect.Value) bool { return a.String() < b.String() } - default: - panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind())) - } - - return s -} - -type mapKeySorter struct { - vs []reflect.Value - less func(a, b reflect.Value) bool -} - -func (s mapKeySorter) Len() int { return len(s.vs) } -func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] } -func (s mapKeySorter) Less(i, j int) bool { - return s.less(s.vs[i], s.vs[j]) -} - -// isProto3Zero reports whether v is a zero proto3 value. -func isProto3Zero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return !v.Bool() - case reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint32, reflect.Uint64: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.String: - return v.String() == "" - } - return false -} - -// ProtoPackageIsVersion2 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const ProtoPackageIsVersion2 = true - -// ProtoPackageIsVersion1 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const ProtoPackageIsVersion1 = true - -// InternalMessageInfo is a type used internally by generated .pb.go files. -// This type is not intended to be used by non-generated code. -// This type is not subject to any compatibility guarantee. -type InternalMessageInfo struct { - marshal *marshalInfo - unmarshal *unmarshalInfo - merge *mergeInfo - discard *discardInfo -} diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/message_set.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/message_set.go deleted file mode 100644 index 3b6ca41d..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/message_set.go +++ /dev/null @@ -1,314 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Support for message sets. - */ - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "reflect" - "sort" - "sync" -) - -// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. -// A message type ID is required for storing a protocol buffer in a message set. -var errNoMessageTypeID = errors.New("proto does not have a message type ID") - -// The first two types (_MessageSet_Item and messageSet) -// model what the protocol compiler produces for the following protocol message: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } -// That is the MessageSet wire format. We can't use a proto to generate these -// because that would introduce a circular dependency between it and this package. - -type _MessageSet_Item struct { - TypeId *int32 `protobuf:"varint,2,req,name=type_id"` - Message []byte `protobuf:"bytes,3,req,name=message"` -} - -type messageSet struct { - Item []*_MessageSet_Item `protobuf:"group,1,rep"` - XXX_unrecognized []byte - // TODO: caching? -} - -// Make sure messageSet is a Message. -var _ Message = (*messageSet)(nil) - -// messageTypeIder is an interface satisfied by a protocol buffer type -// that may be stored in a MessageSet. -type messageTypeIder interface { - MessageTypeId() int32 -} - -func (ms *messageSet) find(pb Message) *_MessageSet_Item { - mti, ok := pb.(messageTypeIder) - if !ok { - return nil - } - id := mti.MessageTypeId() - for _, item := range ms.Item { - if *item.TypeId == id { - return item - } - } - return nil -} - -func (ms *messageSet) Has(pb Message) bool { - return ms.find(pb) != nil -} - -func (ms *messageSet) Unmarshal(pb Message) error { - if item := ms.find(pb); item != nil { - return Unmarshal(item.Message, pb) - } - if _, ok := pb.(messageTypeIder); !ok { - return errNoMessageTypeID - } - return nil // TODO: return error instead? -} - -func (ms *messageSet) Marshal(pb Message) error { - msg, err := Marshal(pb) - if err != nil { - return err - } - if item := ms.find(pb); item != nil { - // reuse existing item - item.Message = msg - return nil - } - - mti, ok := pb.(messageTypeIder) - if !ok { - return errNoMessageTypeID - } - - mtid := mti.MessageTypeId() - ms.Item = append(ms.Item, &_MessageSet_Item{ - TypeId: &mtid, - Message: msg, - }) - return nil -} - -func (ms *messageSet) Reset() { *ms = messageSet{} } -func (ms *messageSet) String() string { return CompactTextString(ms) } -func (*messageSet) ProtoMessage() {} - -// Support for the message_set_wire_format message option. - -func skipVarint(buf []byte) []byte { - i := 0 - for ; buf[i]&0x80 != 0; i++ { - } - return buf[i+1:] -} - -// MarshalMessageSet encodes the extension map represented by m in the message set wire format. -// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option. -func MarshalMessageSet(exts interface{}) ([]byte, error) { - return marshalMessageSet(exts, false) -} - -// marshaMessageSet implements above function, with the opt to turn on / off deterministic during Marshal. -func marshalMessageSet(exts interface{}, deterministic bool) ([]byte, error) { - switch exts := exts.(type) { - case *XXX_InternalExtensions: - var u marshalInfo - siz := u.sizeMessageSet(exts) - b := make([]byte, 0, siz) - return u.appendMessageSet(b, exts, deterministic) - - case map[int32]Extension: - // This is an old-style extension map. - // Wrap it in a new-style XXX_InternalExtensions. - ie := XXX_InternalExtensions{ - p: &struct { - mu sync.Mutex - extensionMap map[int32]Extension - }{ - extensionMap: exts, - }, - } - - var u marshalInfo - siz := u.sizeMessageSet(&ie) - b := make([]byte, 0, siz) - return u.appendMessageSet(b, &ie, deterministic) - - default: - return nil, errors.New("proto: not an extension map") - } -} - -// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. -// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. -func UnmarshalMessageSet(buf []byte, exts interface{}) error { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - m = exts.extensionsWrite() - case map[int32]Extension: - m = exts - default: - return errors.New("proto: not an extension map") - } - - ms := new(messageSet) - if err := Unmarshal(buf, ms); err != nil { - return err - } - for _, item := range ms.Item { - id := *item.TypeId - msg := item.Message - - // Restore wire type and field number varint, plus length varint. - // Be careful to preserve duplicate items. - b := EncodeVarint(uint64(id)<<3 | WireBytes) - if ext, ok := m[id]; ok { - // Existing data; rip off the tag and length varint - // so we join the new data correctly. - // We can assume that ext.enc is set because we are unmarshaling. - o := ext.enc[len(b):] // skip wire type and field number - _, n := DecodeVarint(o) // calculate length of length varint - o = o[n:] // skip length varint - msg = append(o, msg...) // join old data and new data - } - b = append(b, EncodeVarint(uint64(len(msg)))...) - b = append(b, msg...) - - m[id] = Extension{enc: b} - } - return nil -} - -// MarshalMessageSetJSON encodes the extension map represented by m in JSON format. -// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option. -func MarshalMessageSetJSON(exts interface{}) ([]byte, error) { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - var mu sync.Locker - m, mu = exts.extensionsRead() - if m != nil { - // Keep the extensions map locked until we're done marshaling to prevent - // races between marshaling and unmarshaling the lazily-{en,de}coded - // values. - mu.Lock() - defer mu.Unlock() - } - case map[int32]Extension: - m = exts - default: - return nil, errors.New("proto: not an extension map") - } - var b bytes.Buffer - b.WriteByte('{') - - // Process the map in key order for deterministic output. - ids := make([]int32, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) // int32Slice defined in text.go - - for i, id := range ids { - ext := m[id] - msd, ok := messageSetMap[id] - if !ok { - // Unknown type; we can't render it, so skip it. - continue - } - - if i > 0 && b.Len() > 1 { - b.WriteByte(',') - } - - fmt.Fprintf(&b, `"[%s]":`, msd.name) - - x := ext.value - if x == nil { - x = reflect.New(msd.t.Elem()).Interface() - if err := Unmarshal(ext.enc, x.(Message)); err != nil { - return nil, err - } - } - d, err := json.Marshal(x) - if err != nil { - return nil, err - } - b.Write(d) - } - b.WriteByte('}') - return b.Bytes(), nil -} - -// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format. -// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option. -func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error { - // Common-case fast path. - if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) { - return nil - } - - // This is fairly tricky, and it's not clear that it is needed. - return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented") -} - -// A global registry of types that can be used in a MessageSet. - -var messageSetMap = make(map[int32]messageSetDesc) - -type messageSetDesc struct { - t reflect.Type // pointer to struct - name string -} - -// RegisterMessageSetType is called from the generated code. -func RegisterMessageSetType(m Message, fieldNum int32, name string) { - messageSetMap[fieldNum] = messageSetDesc{ - t: reflect.TypeOf(m), - name: name, - } -} diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/pointer_reflect.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/pointer_reflect.go deleted file mode 100644 index b6cad908..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/pointer_reflect.go +++ /dev/null @@ -1,357 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// +build purego appengine js - -// This file contains an implementation of proto field accesses using package reflect. -// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can -// be used on App Engine. - -package proto - -import ( - "reflect" - "sync" -) - -const unsafeAllowed = false - -// A field identifies a field in a struct, accessible from a pointer. -// In this implementation, a field is identified by the sequence of field indices -// passed to reflect's FieldByIndex. -type field []int - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return f.Index -} - -// invalidField is an invalid field identifier. -var invalidField = field(nil) - -// zeroField is a noop when calling pointer.offset. -var zeroField = field([]int{}) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { return f != nil } - -// The pointer type is for the table-driven decoder. -// The implementation here uses a reflect.Value of pointer type to -// create a generic pointer. In pointer_unsafe.go we use unsafe -// instead of reflect to implement the same (but faster) interface. -type pointer struct { - v reflect.Value -} - -// toPointer converts an interface of pointer type to a pointer -// that points to the same target. -func toPointer(i *Message) pointer { - return pointer{v: reflect.ValueOf(*i)} -} - -// toAddrPointer converts an interface to a pointer that points to -// the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { - v := reflect.ValueOf(*i) - u := reflect.New(v.Type()) - u.Elem().Set(v) - return pointer{v: u} -} - -// valToPointer converts v to a pointer. v must be of pointer type. -func valToPointer(v reflect.Value) pointer { - return pointer{v: v} -} - -// offset converts from a pointer to a structure to a pointer to -// one of its fields. -func (p pointer) offset(f field) pointer { - return pointer{v: p.v.Elem().FieldByIndex(f).Addr()} -} - -func (p pointer) isNil() bool { - return p.v.IsNil() -} - -// grow updates the slice s in place to make it one element longer. -// s must be addressable. -// Returns the (addressable) new element. -func grow(s reflect.Value) reflect.Value { - n, m := s.Len(), s.Cap() - if n < m { - s.SetLen(n + 1) - } else { - s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem()))) - } - return s.Index(n) -} - -func (p pointer) toInt64() *int64 { - return p.v.Interface().(*int64) -} -func (p pointer) toInt64Ptr() **int64 { - return p.v.Interface().(**int64) -} -func (p pointer) toInt64Slice() *[]int64 { - return p.v.Interface().(*[]int64) -} - -var int32ptr = reflect.TypeOf((*int32)(nil)) - -func (p pointer) toInt32() *int32 { - return p.v.Convert(int32ptr).Interface().(*int32) -} - -// The toInt32Ptr/Slice methods don't work because of enums. -// Instead, we must use set/get methods for the int32ptr/slice case. -/* - func (p pointer) toInt32Ptr() **int32 { - return p.v.Interface().(**int32) -} - func (p pointer) toInt32Slice() *[]int32 { - return p.v.Interface().(*[]int32) -} -*/ -func (p pointer) getInt32Ptr() *int32 { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - return p.v.Elem().Interface().(*int32) - } - // an enum - return p.v.Elem().Convert(int32PtrType).Interface().(*int32) -} -func (p pointer) setInt32Ptr(v int32) { - // Allocate value in a *int32. Possibly convert that to a *enum. - // Then assign it to a **int32 or **enum. - // Note: we can convert *int32 to *enum, but we can't convert - // **int32 to **enum! - p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem())) -} - -// getInt32Slice copies []int32 from p as a new slice. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) getInt32Slice() []int32 { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - return p.v.Elem().Interface().([]int32) - } - // an enum - // Allocate a []int32, then assign []enum's values into it. - // Note: we can't convert []enum to []int32. - slice := p.v.Elem() - s := make([]int32, slice.Len()) - for i := 0; i < slice.Len(); i++ { - s[i] = int32(slice.Index(i).Int()) - } - return s -} - -// setInt32Slice copies []int32 into p as a new slice. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) setInt32Slice(v []int32) { - if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { - // raw int32 type - p.v.Elem().Set(reflect.ValueOf(v)) - return - } - // an enum - // Allocate a []enum, then assign []int32's values into it. - // Note: we can't convert []enum to []int32. - slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v)) - for i, x := range v { - slice.Index(i).SetInt(int64(x)) - } - p.v.Elem().Set(slice) -} -func (p pointer) appendInt32Slice(v int32) { - grow(p.v.Elem()).SetInt(int64(v)) -} - -func (p pointer) toUint64() *uint64 { - return p.v.Interface().(*uint64) -} -func (p pointer) toUint64Ptr() **uint64 { - return p.v.Interface().(**uint64) -} -func (p pointer) toUint64Slice() *[]uint64 { - return p.v.Interface().(*[]uint64) -} -func (p pointer) toUint32() *uint32 { - return p.v.Interface().(*uint32) -} -func (p pointer) toUint32Ptr() **uint32 { - return p.v.Interface().(**uint32) -} -func (p pointer) toUint32Slice() *[]uint32 { - return p.v.Interface().(*[]uint32) -} -func (p pointer) toBool() *bool { - return p.v.Interface().(*bool) -} -func (p pointer) toBoolPtr() **bool { - return p.v.Interface().(**bool) -} -func (p pointer) toBoolSlice() *[]bool { - return p.v.Interface().(*[]bool) -} -func (p pointer) toFloat64() *float64 { - return p.v.Interface().(*float64) -} -func (p pointer) toFloat64Ptr() **float64 { - return p.v.Interface().(**float64) -} -func (p pointer) toFloat64Slice() *[]float64 { - return p.v.Interface().(*[]float64) -} -func (p pointer) toFloat32() *float32 { - return p.v.Interface().(*float32) -} -func (p pointer) toFloat32Ptr() **float32 { - return p.v.Interface().(**float32) -} -func (p pointer) toFloat32Slice() *[]float32 { - return p.v.Interface().(*[]float32) -} -func (p pointer) toString() *string { - return p.v.Interface().(*string) -} -func (p pointer) toStringPtr() **string { - return p.v.Interface().(**string) -} -func (p pointer) toStringSlice() *[]string { - return p.v.Interface().(*[]string) -} -func (p pointer) toBytes() *[]byte { - return p.v.Interface().(*[]byte) -} -func (p pointer) toBytesSlice() *[][]byte { - return p.v.Interface().(*[][]byte) -} -func (p pointer) toExtensions() *XXX_InternalExtensions { - return p.v.Interface().(*XXX_InternalExtensions) -} -func (p pointer) toOldExtensions() *map[int32]Extension { - return p.v.Interface().(*map[int32]Extension) -} -func (p pointer) getPointer() pointer { - return pointer{v: p.v.Elem()} -} -func (p pointer) setPointer(q pointer) { - p.v.Elem().Set(q.v) -} -func (p pointer) appendPointer(q pointer) { - grow(p.v.Elem()).Set(q.v) -} - -// getPointerSlice copies []*T from p as a new []pointer. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) getPointerSlice() []pointer { - if p.v.IsNil() { - return nil - } - n := p.v.Elem().Len() - s := make([]pointer, n) - for i := 0; i < n; i++ { - s[i] = pointer{v: p.v.Elem().Index(i)} - } - return s -} - -// setPointerSlice copies []pointer into p as a new []*T. -// This behavior differs from the implementation in pointer_unsafe.go. -func (p pointer) setPointerSlice(v []pointer) { - if v == nil { - p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem()) - return - } - s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v)) - for _, p := range v { - s = reflect.Append(s, p.v) - } - p.v.Elem().Set(s) -} - -// getInterfacePointer returns a pointer that points to the -// interface data of the interface pointed by p. -func (p pointer) getInterfacePointer() pointer { - if p.v.Elem().IsNil() { - return pointer{v: p.v.Elem()} - } - return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct -} - -func (p pointer) asPointerTo(t reflect.Type) reflect.Value { - // TODO: check that p.v.Type().Elem() == t? - return p.v -} - -func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} -func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { - atomicLock.Lock() - defer atomicLock.Unlock() - return *p -} -func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { - atomicLock.Lock() - defer atomicLock.Unlock() - *p = v -} - -var atomicLock sync.Mutex diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go deleted file mode 100644 index d55a335d..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go +++ /dev/null @@ -1,308 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2012 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// +build !purego,!appengine,!js - -// This file contains the implementation of the proto field accesses using package unsafe. - -package proto - -import ( - "reflect" - "sync/atomic" - "unsafe" -) - -const unsafeAllowed = true - -// A field identifies a field in a struct, accessible from a pointer. -// In this implementation, a field is identified by its byte offset from the start of the struct. -type field uintptr - -// toField returns a field equivalent to the given reflect field. -func toField(f *reflect.StructField) field { - return field(f.Offset) -} - -// invalidField is an invalid field identifier. -const invalidField = ^field(0) - -// zeroField is a noop when calling pointer.offset. -const zeroField = field(0) - -// IsValid reports whether the field identifier is valid. -func (f field) IsValid() bool { - return f != invalidField -} - -// The pointer type below is for the new table-driven encoder/decoder. -// The implementation here uses unsafe.Pointer to create a generic pointer. -// In pointer_reflect.go we use reflect instead of unsafe to implement -// the same (but slower) interface. -type pointer struct { - p unsafe.Pointer -} - -// size of pointer -var ptrSize = unsafe.Sizeof(uintptr(0)) - -// toPointer converts an interface of pointer type to a pointer -// that points to the same target. -func toPointer(i *Message) pointer { - // Super-tricky - read pointer out of data word of interface value. - // Saves ~25ns over the equivalent: - // return valToPointer(reflect.ValueOf(*i)) - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} -} - -// toAddrPointer converts an interface to a pointer that points to -// the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { - // Super-tricky - read or get the address of data word of interface value. - if isptr { - // The interface is of pointer type, thus it is a direct interface. - // The data word is the pointer data itself. We take its address. - return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} - } - // The interface is not of pointer type. The data word is the pointer - // to the data. - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} -} - -// valToPointer converts v to a pointer. v must be of pointer type. -func valToPointer(v reflect.Value) pointer { - return pointer{p: unsafe.Pointer(v.Pointer())} -} - -// offset converts from a pointer to a structure to a pointer to -// one of its fields. -func (p pointer) offset(f field) pointer { - // For safety, we should panic if !f.IsValid, however calling panic causes - // this to no longer be inlineable, which is a serious performance cost. - /* - if !f.IsValid() { - panic("invalid field") - } - */ - return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))} -} - -func (p pointer) isNil() bool { - return p.p == nil -} - -func (p pointer) toInt64() *int64 { - return (*int64)(p.p) -} -func (p pointer) toInt64Ptr() **int64 { - return (**int64)(p.p) -} -func (p pointer) toInt64Slice() *[]int64 { - return (*[]int64)(p.p) -} -func (p pointer) toInt32() *int32 { - return (*int32)(p.p) -} - -// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist. -/* - func (p pointer) toInt32Ptr() **int32 { - return (**int32)(p.p) - } - func (p pointer) toInt32Slice() *[]int32 { - return (*[]int32)(p.p) - } -*/ -func (p pointer) getInt32Ptr() *int32 { - return *(**int32)(p.p) -} -func (p pointer) setInt32Ptr(v int32) { - *(**int32)(p.p) = &v -} - -// getInt32Slice loads a []int32 from p. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) getInt32Slice() []int32 { - return *(*[]int32)(p.p) -} - -// setInt32Slice stores a []int32 to p. -// The value set is aliased with the input slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) setInt32Slice(v []int32) { - *(*[]int32)(p.p) = v -} - -// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead? -func (p pointer) appendInt32Slice(v int32) { - s := (*[]int32)(p.p) - *s = append(*s, v) -} - -func (p pointer) toUint64() *uint64 { - return (*uint64)(p.p) -} -func (p pointer) toUint64Ptr() **uint64 { - return (**uint64)(p.p) -} -func (p pointer) toUint64Slice() *[]uint64 { - return (*[]uint64)(p.p) -} -func (p pointer) toUint32() *uint32 { - return (*uint32)(p.p) -} -func (p pointer) toUint32Ptr() **uint32 { - return (**uint32)(p.p) -} -func (p pointer) toUint32Slice() *[]uint32 { - return (*[]uint32)(p.p) -} -func (p pointer) toBool() *bool { - return (*bool)(p.p) -} -func (p pointer) toBoolPtr() **bool { - return (**bool)(p.p) -} -func (p pointer) toBoolSlice() *[]bool { - return (*[]bool)(p.p) -} -func (p pointer) toFloat64() *float64 { - return (*float64)(p.p) -} -func (p pointer) toFloat64Ptr() **float64 { - return (**float64)(p.p) -} -func (p pointer) toFloat64Slice() *[]float64 { - return (*[]float64)(p.p) -} -func (p pointer) toFloat32() *float32 { - return (*float32)(p.p) -} -func (p pointer) toFloat32Ptr() **float32 { - return (**float32)(p.p) -} -func (p pointer) toFloat32Slice() *[]float32 { - return (*[]float32)(p.p) -} -func (p pointer) toString() *string { - return (*string)(p.p) -} -func (p pointer) toStringPtr() **string { - return (**string)(p.p) -} -func (p pointer) toStringSlice() *[]string { - return (*[]string)(p.p) -} -func (p pointer) toBytes() *[]byte { - return (*[]byte)(p.p) -} -func (p pointer) toBytesSlice() *[][]byte { - return (*[][]byte)(p.p) -} -func (p pointer) toExtensions() *XXX_InternalExtensions { - return (*XXX_InternalExtensions)(p.p) -} -func (p pointer) toOldExtensions() *map[int32]Extension { - return (*map[int32]Extension)(p.p) -} - -// getPointerSlice loads []*T from p as a []pointer. -// The value returned is aliased with the original slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) getPointerSlice() []pointer { - // Super-tricky - p should point to a []*T where T is a - // message type. We load it as []pointer. - return *(*[]pointer)(p.p) -} - -// setPointerSlice stores []pointer into p as a []*T. -// The value set is aliased with the input slice. -// This behavior differs from the implementation in pointer_reflect.go. -func (p pointer) setPointerSlice(v []pointer) { - // Super-tricky - p should point to a []*T where T is a - // message type. We store it as []pointer. - *(*[]pointer)(p.p) = v -} - -// getPointer loads the pointer at p and returns it. -func (p pointer) getPointer() pointer { - return pointer{p: *(*unsafe.Pointer)(p.p)} -} - -// setPointer stores the pointer q at p. -func (p pointer) setPointer(q pointer) { - *(*unsafe.Pointer)(p.p) = q.p -} - -// append q to the slice pointed to by p. -func (p pointer) appendPointer(q pointer) { - s := (*[]unsafe.Pointer)(p.p) - *s = append(*s, q.p) -} - -// getInterfacePointer returns a pointer that points to the -// interface data of the interface pointed by p. -func (p pointer) getInterfacePointer() pointer { - // Super-tricky - read pointer out of data word of interface value. - return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]} -} - -// asPointerTo returns a reflect.Value that is a pointer to an -// object of type t stored at p. -func (p pointer) asPointerTo(t reflect.Type) reflect.Value { - return reflect.NewAt(t, p.p) -} - -func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { - return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { - return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { - return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} -func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { - return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) -} -func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) -} diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/properties.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/properties.go deleted file mode 100644 index dce098e6..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/properties.go +++ /dev/null @@ -1,535 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -/* - * Routines for encoding data into the wire format for protocol buffers. - */ - -import ( - "fmt" - "log" - "os" - "reflect" - "sort" - "strconv" - "strings" - "sync" -) - -const debug bool = false - -// Constants that identify the encoding of a value on the wire. -const ( - WireVarint = 0 - WireFixed64 = 1 - WireBytes = 2 - WireStartGroup = 3 - WireEndGroup = 4 - WireFixed32 = 5 -) - -// tagMap is an optimization over map[int]int for typical protocol buffer -// use-cases. Encoded protocol buffers are often in tag order with small tag -// numbers. -type tagMap struct { - fastTags []int - slowTags map[int]int -} - -// tagMapFastLimit is the upper bound on the tag number that will be stored in -// the tagMap slice rather than its map. -const tagMapFastLimit = 1024 - -func (p *tagMap) get(t int) (int, bool) { - if t > 0 && t < tagMapFastLimit { - if t >= len(p.fastTags) { - return 0, false - } - fi := p.fastTags[t] - return fi, fi >= 0 - } - fi, ok := p.slowTags[t] - return fi, ok -} - -func (p *tagMap) put(t int, fi int) { - if t > 0 && t < tagMapFastLimit { - for len(p.fastTags) < t+1 { - p.fastTags = append(p.fastTags, -1) - } - p.fastTags[t] = fi - return - } - if p.slowTags == nil { - p.slowTags = make(map[int]int) - } - p.slowTags[t] = fi -} - -// StructProperties represents properties for all the fields of a struct. -// decoderTags and decoderOrigNames should only be used by the decoder. -type StructProperties struct { - Prop []*Properties // properties for each field - reqCount int // required count - decoderTags tagMap // map from proto tag to struct field number - decoderOrigNames map[string]int // map from original name to struct field number - order []int // list of struct field numbers in tag order - - // OneofTypes contains information about the oneof fields in this message. - // It is keyed by the original name of a field. - OneofTypes map[string]*OneofProperties -} - -// OneofProperties represents information about a specific field in a oneof. -type OneofProperties struct { - Type reflect.Type // pointer to generated struct type for this oneof field - Field int // struct field number of the containing oneof in the message - Prop *Properties -} - -// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec. -// See encode.go, (*Buffer).enc_struct. - -func (sp *StructProperties) Len() int { return len(sp.order) } -func (sp *StructProperties) Less(i, j int) bool { - return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag -} -func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] } - -// Properties represents the protocol-specific behavior of a single struct field. -type Properties struct { - Name string // name of the field, for error messages - OrigName string // original name before protocol compiler (always set) - JSONName string // name to use for JSON; determined by protoc - Wire string - WireType int - Tag int - Required bool - Optional bool - Repeated bool - Packed bool // relevant for repeated primitives only - Enum string // set for enum types only - proto3 bool // whether this is known to be a proto3 field - oneof bool // whether this is a oneof field - - Default string // default value - HasDefault bool // whether an explicit default was provided - - stype reflect.Type // set for struct types only - sprop *StructProperties // set for struct types only - - mtype reflect.Type // set for map types only - MapKeyProp *Properties // set for map types only - MapValProp *Properties // set for map types only -} - -// String formats the properties in the protobuf struct field tag style. -func (p *Properties) String() string { - s := p.Wire - s += "," - s += strconv.Itoa(p.Tag) - if p.Required { - s += ",req" - } - if p.Optional { - s += ",opt" - } - if p.Repeated { - s += ",rep" - } - if p.Packed { - s += ",packed" - } - s += ",name=" + p.OrigName - if p.JSONName != p.OrigName { - s += ",json=" + p.JSONName - } - if p.proto3 { - s += ",proto3" - } - if p.oneof { - s += ",oneof" - } - if len(p.Enum) > 0 { - s += ",enum=" + p.Enum - } - if p.HasDefault { - s += ",def=" + p.Default - } - return s -} - -// Parse populates p by parsing a string in the protobuf struct field tag style. -func (p *Properties) Parse(s string) { - // "bytes,49,opt,name=foo,def=hello!" - fields := strings.Split(s, ",") // breaks def=, but handled below. - if len(fields) < 2 { - fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) - return - } - - p.Wire = fields[0] - switch p.Wire { - case "varint": - p.WireType = WireVarint - case "fixed32": - p.WireType = WireFixed32 - case "fixed64": - p.WireType = WireFixed64 - case "zigzag32": - p.WireType = WireVarint - case "zigzag64": - p.WireType = WireVarint - case "bytes", "group": - p.WireType = WireBytes - // no numeric converter for non-numeric types - default: - fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) - return - } - - var err error - p.Tag, err = strconv.Atoi(fields[1]) - if err != nil { - return - } - -outer: - for i := 2; i < len(fields); i++ { - f := fields[i] - switch { - case f == "req": - p.Required = true - case f == "opt": - p.Optional = true - case f == "rep": - p.Repeated = true - case f == "packed": - p.Packed = true - case strings.HasPrefix(f, "name="): - p.OrigName = f[5:] - case strings.HasPrefix(f, "json="): - p.JSONName = f[5:] - case strings.HasPrefix(f, "enum="): - p.Enum = f[5:] - case f == "proto3": - p.proto3 = true - case f == "oneof": - p.oneof = true - case strings.HasPrefix(f, "def="): - p.HasDefault = true - p.Default = f[4:] // rest of string - if i+1 < len(fields) { - // Commas aren't escaped, and def is always last. - p.Default += "," + strings.Join(fields[i+1:], ",") - break outer - } - } - } -} - -var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() - -// setFieldProps initializes the field properties for submessages and maps. -func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { - switch t1 := typ; t1.Kind() { - case reflect.Ptr: - if t1.Elem().Kind() == reflect.Struct { - p.stype = t1.Elem() - } - - case reflect.Slice: - if t2 := t1.Elem(); t2.Kind() == reflect.Ptr && t2.Elem().Kind() == reflect.Struct { - p.stype = t2.Elem() - } - - case reflect.Map: - p.mtype = t1 - p.MapKeyProp = &Properties{} - p.MapKeyProp.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) - p.MapValProp = &Properties{} - vtype := p.mtype.Elem() - if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { - // The value type is not a message (*T) or bytes ([]byte), - // so we need encoders for the pointer to this type. - vtype = reflect.PtrTo(vtype) - } - p.MapValProp.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) - } - - if p.stype != nil { - if lockGetProp { - p.sprop = GetProperties(p.stype) - } else { - p.sprop = getPropertiesLocked(p.stype) - } - } -} - -var ( - marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() -) - -// Init populates the properties from a protocol buffer struct tag. -func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { - p.init(typ, name, tag, f, true) -} - -func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) { - // "bytes,49,opt,def=hello!" - p.Name = name - p.OrigName = name - if tag == "" { - return - } - p.Parse(tag) - p.setFieldProps(typ, f, lockGetProp) -} - -var ( - propertiesMu sync.RWMutex - propertiesMap = make(map[reflect.Type]*StructProperties) -) - -// GetProperties returns the list of properties for the type represented by t. -// t must represent a generated struct type of a protocol message. -func GetProperties(t reflect.Type) *StructProperties { - if t.Kind() != reflect.Struct { - panic("proto: type must have kind struct") - } - - // Most calls to GetProperties in a long-running program will be - // retrieving details for types we have seen before. - propertiesMu.RLock() - sprop, ok := propertiesMap[t] - propertiesMu.RUnlock() - if ok { - return sprop - } - - propertiesMu.Lock() - sprop = getPropertiesLocked(t) - propertiesMu.Unlock() - return sprop -} - -// getPropertiesLocked requires that propertiesMu is held. -func getPropertiesLocked(t reflect.Type) *StructProperties { - if prop, ok := propertiesMap[t]; ok { - return prop - } - - prop := new(StructProperties) - // in case of recursive protos, fill this in now. - propertiesMap[t] = prop - - // build properties - prop.Prop = make([]*Properties, t.NumField()) - prop.order = make([]int, t.NumField()) - - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - p := new(Properties) - name := f.Name - p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) - - oneof := f.Tag.Get("protobuf_oneof") // special case - if oneof != "" { - // Oneof fields don't use the traditional protobuf tag. - p.OrigName = oneof - } - prop.Prop[i] = p - prop.order[i] = i - if debug { - print(i, " ", f.Name, " ", t.String(), " ") - if p.Tag > 0 { - print(p.String()) - } - print("\n") - } - } - - // Re-order prop.order. - sort.Sort(prop) - - type oneofMessage interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) - } - if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok { - var oots []interface{} - _, _, _, oots = om.XXX_OneofFuncs() - - // Interpret oneof metadata. - prop.OneofTypes = make(map[string]*OneofProperties) - for _, oot := range oots { - oop := &OneofProperties{ - Type: reflect.ValueOf(oot).Type(), // *T - Prop: new(Properties), - } - sft := oop.Type.Elem().Field(0) - oop.Prop.Name = sft.Name - oop.Prop.Parse(sft.Tag.Get("protobuf")) - // There will be exactly one interface field that - // this new value is assignable to. - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Type.Kind() != reflect.Interface { - continue - } - if !oop.Type.AssignableTo(f.Type) { - continue - } - oop.Field = i - break - } - prop.OneofTypes[oop.Prop.OrigName] = oop - } - } - - // build required counts - // build tags - reqCount := 0 - prop.decoderOrigNames = make(map[string]int) - for i, p := range prop.Prop { - if strings.HasPrefix(p.Name, "XXX_") { - // Internal fields should not appear in tags/origNames maps. - // They are handled specially when encoding and decoding. - continue - } - if p.Required { - reqCount++ - } - prop.decoderTags.put(p.Tag, i) - prop.decoderOrigNames[p.OrigName] = i - } - prop.reqCount = reqCount - - return prop -} - -// A global registry of enum types. -// The generated code will register the generated maps by calling RegisterEnum. - -var enumValueMaps = make(map[string]map[string]int32) - -// RegisterEnum is called from the generated code to install the enum descriptor -// maps into the global table to aid parsing text format protocol buffers. -func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) { - if _, ok := enumValueMaps[typeName]; ok { - panic("proto: duplicate enum registered: " + typeName) - } - enumValueMaps[typeName] = valueMap -} - -// EnumValueMap returns the mapping from names to integers of the -// enum type enumType, or a nil if not found. -func EnumValueMap(enumType string) map[string]int32 { - return enumValueMaps[enumType] -} - -// A registry of all linked message types. -// The string is a fully-qualified proto name ("pkg.Message"). -var ( - protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers - protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types - revProtoTypes = make(map[reflect.Type]string) -) - -// RegisterType is called from generated code and maps from the fully qualified -// proto name to the type (pointer to struct) of the protocol buffer. -func RegisterType(x Message, name string) { - if _, ok := protoTypedNils[name]; ok { - // TODO: Some day, make this a panic. - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { - // Generated code always calls RegisterType with nil x. - // This check is just for extra safety. - protoTypedNils[name] = x - } else { - protoTypedNils[name] = reflect.Zero(t).Interface().(Message) - } - revProtoTypes[t] = name -} - -// RegisterMapType is called from generated code and maps from the fully qualified -// proto name to the native map type of the proto map definition. -func RegisterMapType(x interface{}, name string) { - if reflect.TypeOf(x).Kind() != reflect.Map { - panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) - } - if _, ok := protoMapTypes[name]; ok { - log.Printf("proto: duplicate proto type registered: %s", name) - return - } - t := reflect.TypeOf(x) - protoMapTypes[name] = t - revProtoTypes[t] = name -} - -// MessageName returns the fully-qualified proto name for the given message type. -func MessageName(x Message) string { - type xname interface { - XXX_MessageName() string - } - if m, ok := x.(xname); ok { - return m.XXX_MessageName() - } - return revProtoTypes[reflect.TypeOf(x)] -} - -// MessageType returns the message type (pointer to struct) for a named message. -// The type is not guaranteed to implement proto.Message if the name refers to a -// map entry. -func MessageType(name string) reflect.Type { - if t, ok := protoTypedNils[name]; ok { - return reflect.TypeOf(t) - } - return protoMapTypes[name] -} - -// A registry of all linked proto files. -var ( - protoFiles = make(map[string][]byte) // file name => fileDescriptor -) - -// RegisterFile is called from generated code and maps from the -// full file name of a .proto file to its compressed FileDescriptorProto. -func RegisterFile(filename string, fileDescriptor []byte) { - protoFiles[filename] = fileDescriptor -} - -// FileDescriptor returns the compressed FileDescriptorProto for a .proto file. -func FileDescriptor(filename string) []byte { return protoFiles[filename] } diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/table_marshal.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/table_marshal.go deleted file mode 100644 index f3a2d16a..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/table_marshal.go +++ /dev/null @@ -1,2767 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "errors" - "fmt" - "math" - "reflect" - "sort" - "strconv" - "strings" - "sync" - "sync/atomic" - "unicode/utf8" -) - -// a sizer takes a pointer to a field and the size of its tag, computes the size of -// the encoded data. -type sizer func(pointer, int) int - -// a marshaler takes a byte slice, a pointer to a field, and its tag (in wire format), -// marshals the field to the end of the slice, returns the slice and error (if any). -type marshaler func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) - -// marshalInfo is the information used for marshaling a message. -type marshalInfo struct { - typ reflect.Type - fields []*marshalFieldInfo - unrecognized field // offset of XXX_unrecognized - extensions field // offset of XXX_InternalExtensions - v1extensions field // offset of XXX_extensions - sizecache field // offset of XXX_sizecache - initialized int32 // 0 -- only typ is set, 1 -- fully initialized - messageset bool // uses message set wire format - hasmarshaler bool // has custom marshaler - sync.RWMutex // protect extElems map, also for initialization - extElems map[int32]*marshalElemInfo // info of extension elements -} - -// marshalFieldInfo is the information used for marshaling a field of a message. -type marshalFieldInfo struct { - field field - wiretag uint64 // tag in wire format - tagsize int // size of tag in wire format - sizer sizer - marshaler marshaler - isPointer bool - required bool // field is required - name string // name of the field, for error reporting - oneofElems map[reflect.Type]*marshalElemInfo // info of oneof elements -} - -// marshalElemInfo is the information used for marshaling an extension or oneof element. -type marshalElemInfo struct { - wiretag uint64 // tag in wire format - tagsize int // size of tag in wire format - sizer sizer - marshaler marshaler - isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only) -} - -var ( - marshalInfoMap = map[reflect.Type]*marshalInfo{} - marshalInfoLock sync.Mutex -) - -// getMarshalInfo returns the information to marshal a given type of message. -// The info it returns may not necessarily initialized. -// t is the type of the message (NOT the pointer to it). -func getMarshalInfo(t reflect.Type) *marshalInfo { - marshalInfoLock.Lock() - u, ok := marshalInfoMap[t] - if !ok { - u = &marshalInfo{typ: t} - marshalInfoMap[t] = u - } - marshalInfoLock.Unlock() - return u -} - -// Size is the entry point from generated code, -// and should be ONLY called by generated code. -// It computes the size of encoded data of msg. -// a is a pointer to a place to store cached marshal info. -func (a *InternalMessageInfo) Size(msg Message) int { - u := getMessageMarshalInfo(msg, a) - ptr := toPointer(&msg) - if ptr.isNil() { - // We get here if msg is a typed nil ((*SomeMessage)(nil)), - // so it satisfies the interface, and msg == nil wouldn't - // catch it. We don't want crash in this case. - return 0 - } - return u.size(ptr) -} - -// Marshal is the entry point from generated code, -// and should be ONLY called by generated code. -// It marshals msg to the end of b. -// a is a pointer to a place to store cached marshal info. -func (a *InternalMessageInfo) Marshal(b []byte, msg Message, deterministic bool) ([]byte, error) { - u := getMessageMarshalInfo(msg, a) - ptr := toPointer(&msg) - if ptr.isNil() { - // We get here if msg is a typed nil ((*SomeMessage)(nil)), - // so it satisfies the interface, and msg == nil wouldn't - // catch it. We don't want crash in this case. - return b, ErrNil - } - return u.marshal(b, ptr, deterministic) -} - -func getMessageMarshalInfo(msg interface{}, a *InternalMessageInfo) *marshalInfo { - // u := a.marshal, but atomically. - // We use an atomic here to ensure memory consistency. - u := atomicLoadMarshalInfo(&a.marshal) - if u == nil { - // Get marshal information from type of message. - t := reflect.ValueOf(msg).Type() - if t.Kind() != reflect.Ptr { - panic(fmt.Sprintf("cannot handle non-pointer message type %v", t)) - } - u = getMarshalInfo(t.Elem()) - // Store it in the cache for later users. - // a.marshal = u, but atomically. - atomicStoreMarshalInfo(&a.marshal, u) - } - return u -} - -// size is the main function to compute the size of the encoded data of a message. -// ptr is the pointer to the message. -func (u *marshalInfo) size(ptr pointer) int { - if atomic.LoadInt32(&u.initialized) == 0 { - u.computeMarshalInfo() - } - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if u.hasmarshaler { - m := ptr.asPointerTo(u.typ).Interface().(Marshaler) - b, _ := m.Marshal() - return len(b) - } - - n := 0 - for _, f := range u.fields { - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // nil pointer always marshals to nothing - continue - } - n += f.sizer(ptr.offset(f.field), f.tagsize) - } - if u.extensions.IsValid() { - e := ptr.offset(u.extensions).toExtensions() - if u.messageset { - n += u.sizeMessageSet(e) - } else { - n += u.sizeExtensions(e) - } - } - if u.v1extensions.IsValid() { - m := *ptr.offset(u.v1extensions).toOldExtensions() - n += u.sizeV1Extensions(m) - } - if u.unrecognized.IsValid() { - s := *ptr.offset(u.unrecognized).toBytes() - n += len(s) - } - // cache the result for use in marshal - if u.sizecache.IsValid() { - atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n)) - } - return n -} - -// cachedsize gets the size from cache. If there is no cache (i.e. message is not generated), -// fall back to compute the size. -func (u *marshalInfo) cachedsize(ptr pointer) int { - if u.sizecache.IsValid() { - return int(atomic.LoadInt32(ptr.offset(u.sizecache).toInt32())) - } - return u.size(ptr) -} - -// marshal is the main function to marshal a message. It takes a byte slice and appends -// the encoded data to the end of the slice, returns the slice and error (if any). -// ptr is the pointer to the message. -// If deterministic is true, map is marshaled in deterministic order. -func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte, error) { - if atomic.LoadInt32(&u.initialized) == 0 { - u.computeMarshalInfo() - } - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if u.hasmarshaler { - m := ptr.asPointerTo(u.typ).Interface().(Marshaler) - b1, err := m.Marshal() - b = append(b, b1...) - return b, err - } - - var err, errLater error - // The old marshaler encodes extensions at beginning. - if u.extensions.IsValid() { - e := ptr.offset(u.extensions).toExtensions() - if u.messageset { - b, err = u.appendMessageSet(b, e, deterministic) - } else { - b, err = u.appendExtensions(b, e, deterministic) - } - if err != nil { - return b, err - } - } - if u.v1extensions.IsValid() { - m := *ptr.offset(u.v1extensions).toOldExtensions() - b, err = u.appendV1Extensions(b, m, deterministic) - if err != nil { - return b, err - } - } - for _, f := range u.fields { - if f.required { - if ptr.offset(f.field).getPointer().isNil() { - // Required field is not set. - // We record the error but keep going, to give a complete marshaling. - if errLater == nil { - errLater = &RequiredNotSetError{f.name} - } - continue - } - } - if f.isPointer && ptr.offset(f.field).getPointer().isNil() { - // nil pointer always marshals to nothing - continue - } - b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic) - if err != nil { - if err1, ok := err.(*RequiredNotSetError); ok { - // Required field in submessage is not set. - // We record the error but keep going, to give a complete marshaling. - if errLater == nil { - errLater = &RequiredNotSetError{f.name + "." + err1.field} - } - continue - } - if err == errRepeatedHasNil { - err = errors.New("proto: repeated field " + f.name + " has nil element") - } - if err == errInvalidUTF8 { - if errLater == nil { - fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name - errLater = &invalidUTF8Error{fullName} - } - continue - } - return b, err - } - } - if u.unrecognized.IsValid() { - s := *ptr.offset(u.unrecognized).toBytes() - b = append(b, s...) - } - return b, errLater -} - -// computeMarshalInfo initializes the marshal info. -func (u *marshalInfo) computeMarshalInfo() { - u.Lock() - defer u.Unlock() - if u.initialized != 0 { // non-atomic read is ok as it is protected by the lock - return - } - - t := u.typ - u.unrecognized = invalidField - u.extensions = invalidField - u.v1extensions = invalidField - u.sizecache = invalidField - - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - if reflect.PtrTo(t).Implements(marshalerType) { - u.hasmarshaler = true - atomic.StoreInt32(&u.initialized, 1) - return - } - - // get oneof implementers - var oneofImplementers []interface{} - if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok { - _, _, _, oneofImplementers = m.XXX_OneofFuncs() - } - - n := t.NumField() - - // deal with XXX fields first - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if !strings.HasPrefix(f.Name, "XXX_") { - continue - } - switch f.Name { - case "XXX_sizecache": - u.sizecache = toField(&f) - case "XXX_unrecognized": - u.unrecognized = toField(&f) - case "XXX_InternalExtensions": - u.extensions = toField(&f) - u.messageset = f.Tag.Get("protobuf_messageset") == "1" - case "XXX_extensions": - u.v1extensions = toField(&f) - case "XXX_NoUnkeyedLiteral": - // nothing to do - default: - panic("unknown XXX field: " + f.Name) - } - n-- - } - - // normal fields - fields := make([]marshalFieldInfo, n) // batch allocation - u.fields = make([]*marshalFieldInfo, 0, n) - for i, j := 0, 0; i < t.NumField(); i++ { - f := t.Field(i) - - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - field := &fields[j] - j++ - field.name = f.Name - u.fields = append(u.fields, field) - if f.Tag.Get("protobuf_oneof") != "" { - field.computeOneofFieldInfo(&f, oneofImplementers) - continue - } - if f.Tag.Get("protobuf") == "" { - // field has no tag (not in generated message), ignore it - u.fields = u.fields[:len(u.fields)-1] - j-- - continue - } - field.computeMarshalFieldInfo(&f) - } - - // fields are marshaled in tag order on the wire. - sort.Sort(byTag(u.fields)) - - atomic.StoreInt32(&u.initialized, 1) -} - -// helper for sorting fields by tag -type byTag []*marshalFieldInfo - -func (a byTag) Len() int { return len(a) } -func (a byTag) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a byTag) Less(i, j int) bool { return a[i].wiretag < a[j].wiretag } - -// getExtElemInfo returns the information to marshal an extension element. -// The info it returns is initialized. -func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo { - // get from cache first - u.RLock() - e, ok := u.extElems[desc.Field] - u.RUnlock() - if ok { - return e - } - - t := reflect.TypeOf(desc.ExtensionType) // pointer or slice to basic type or struct - tags := strings.Split(desc.Tag, ",") - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - sizer, marshaler := typeMarshaler(t, tags, false, false) - e = &marshalElemInfo{ - wiretag: uint64(tag)<<3 | wt, - tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizer, - marshaler: marshaler, - isptr: t.Kind() == reflect.Ptr, - } - - // update cache - u.Lock() - if u.extElems == nil { - u.extElems = make(map[int32]*marshalElemInfo) - } - u.extElems[desc.Field] = e - u.Unlock() - return e -} - -// computeMarshalFieldInfo fills up the information to marshal a field. -func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) { - // parse protobuf tag of the field. - // tag has format of "bytes,49,opt,name=foo,def=hello!" - tags := strings.Split(f.Tag.Get("protobuf"), ",") - if tags[0] == "" { - return - } - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - if tags[2] == "req" { - fi.required = true - } - fi.setTag(f, tag, wt) - fi.setMarshaler(f, tags) -} - -func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { - fi.field = toField(f) - fi.wiretag = math.MaxInt32 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. - fi.isPointer = true - fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) - fi.oneofElems = make(map[reflect.Type]*marshalElemInfo) - - ityp := f.Type // interface type - for _, o := range oneofImplementers { - t := reflect.TypeOf(o) - if !t.Implements(ityp) { - continue - } - sf := t.Elem().Field(0) // oneof implementer is a struct with a single field - tags := strings.Split(sf.Tag.Get("protobuf"), ",") - tag, err := strconv.Atoi(tags[1]) - if err != nil { - panic("tag is not an integer") - } - wt := wiretype(tags[0]) - sizer, marshaler := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value - fi.oneofElems[t.Elem()] = &marshalElemInfo{ - wiretag: uint64(tag)<<3 | wt, - tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizer, - marshaler: marshaler, - } - } -} - -type oneofMessage interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) -} - -// wiretype returns the wire encoding of the type. -func wiretype(encoding string) uint64 { - switch encoding { - case "fixed32": - return WireFixed32 - case "fixed64": - return WireFixed64 - case "varint", "zigzag32", "zigzag64": - return WireVarint - case "bytes": - return WireBytes - case "group": - return WireStartGroup - } - panic("unknown wire type " + encoding) -} - -// setTag fills up the tag (in wire format) and its size in the info of a field. -func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) { - fi.field = toField(f) - fi.wiretag = uint64(tag)<<3 | wt - fi.tagsize = SizeVarint(uint64(tag) << 3) -} - -// setMarshaler fills up the sizer and marshaler in the info of a field. -func (fi *marshalFieldInfo) setMarshaler(f *reflect.StructField, tags []string) { - switch f.Type.Kind() { - case reflect.Map: - // map field - fi.isPointer = true - fi.sizer, fi.marshaler = makeMapMarshaler(f) - return - case reflect.Ptr, reflect.Slice: - fi.isPointer = true - } - fi.sizer, fi.marshaler = typeMarshaler(f.Type, tags, true, false) -} - -// typeMarshaler returns the sizer and marshaler of a given field. -// t is the type of the field. -// tags is the generated "protobuf" tag of the field. -// If nozero is true, zero value is not marshaled to the wire. -// If oneof is true, it is a oneof field. -func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, marshaler) { - encoding := tags[0] - - pointer := false - slice := false - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - slice = true - t = t.Elem() - } - if t.Kind() == reflect.Ptr { - pointer = true - t = t.Elem() - } - - packed := false - proto3 := false - validateUTF8 := true - for i := 2; i < len(tags); i++ { - if tags[i] == "packed" { - packed = true - } - if tags[i] == "proto3" { - proto3 = true - } - } - validateUTF8 = validateUTF8 && proto3 - - switch t.Kind() { - case reflect.Bool: - if pointer { - return sizeBoolPtr, appendBoolPtr - } - if slice { - if packed { - return sizeBoolPackedSlice, appendBoolPackedSlice - } - return sizeBoolSlice, appendBoolSlice - } - if nozero { - return sizeBoolValueNoZero, appendBoolValueNoZero - } - return sizeBoolValue, appendBoolValue - case reflect.Uint32: - switch encoding { - case "fixed32": - if pointer { - return sizeFixed32Ptr, appendFixed32Ptr - } - if slice { - if packed { - return sizeFixed32PackedSlice, appendFixed32PackedSlice - } - return sizeFixed32Slice, appendFixed32Slice - } - if nozero { - return sizeFixed32ValueNoZero, appendFixed32ValueNoZero - } - return sizeFixed32Value, appendFixed32Value - case "varint": - if pointer { - return sizeVarint32Ptr, appendVarint32Ptr - } - if slice { - if packed { - return sizeVarint32PackedSlice, appendVarint32PackedSlice - } - return sizeVarint32Slice, appendVarint32Slice - } - if nozero { - return sizeVarint32ValueNoZero, appendVarint32ValueNoZero - } - return sizeVarint32Value, appendVarint32Value - } - case reflect.Int32: - switch encoding { - case "fixed32": - if pointer { - return sizeFixedS32Ptr, appendFixedS32Ptr - } - if slice { - if packed { - return sizeFixedS32PackedSlice, appendFixedS32PackedSlice - } - return sizeFixedS32Slice, appendFixedS32Slice - } - if nozero { - return sizeFixedS32ValueNoZero, appendFixedS32ValueNoZero - } - return sizeFixedS32Value, appendFixedS32Value - case "varint": - if pointer { - return sizeVarintS32Ptr, appendVarintS32Ptr - } - if slice { - if packed { - return sizeVarintS32PackedSlice, appendVarintS32PackedSlice - } - return sizeVarintS32Slice, appendVarintS32Slice - } - if nozero { - return sizeVarintS32ValueNoZero, appendVarintS32ValueNoZero - } - return sizeVarintS32Value, appendVarintS32Value - case "zigzag32": - if pointer { - return sizeZigzag32Ptr, appendZigzag32Ptr - } - if slice { - if packed { - return sizeZigzag32PackedSlice, appendZigzag32PackedSlice - } - return sizeZigzag32Slice, appendZigzag32Slice - } - if nozero { - return sizeZigzag32ValueNoZero, appendZigzag32ValueNoZero - } - return sizeZigzag32Value, appendZigzag32Value - } - case reflect.Uint64: - switch encoding { - case "fixed64": - if pointer { - return sizeFixed64Ptr, appendFixed64Ptr - } - if slice { - if packed { - return sizeFixed64PackedSlice, appendFixed64PackedSlice - } - return sizeFixed64Slice, appendFixed64Slice - } - if nozero { - return sizeFixed64ValueNoZero, appendFixed64ValueNoZero - } - return sizeFixed64Value, appendFixed64Value - case "varint": - if pointer { - return sizeVarint64Ptr, appendVarint64Ptr - } - if slice { - if packed { - return sizeVarint64PackedSlice, appendVarint64PackedSlice - } - return sizeVarint64Slice, appendVarint64Slice - } - if nozero { - return sizeVarint64ValueNoZero, appendVarint64ValueNoZero - } - return sizeVarint64Value, appendVarint64Value - } - case reflect.Int64: - switch encoding { - case "fixed64": - if pointer { - return sizeFixedS64Ptr, appendFixedS64Ptr - } - if slice { - if packed { - return sizeFixedS64PackedSlice, appendFixedS64PackedSlice - } - return sizeFixedS64Slice, appendFixedS64Slice - } - if nozero { - return sizeFixedS64ValueNoZero, appendFixedS64ValueNoZero - } - return sizeFixedS64Value, appendFixedS64Value - case "varint": - if pointer { - return sizeVarintS64Ptr, appendVarintS64Ptr - } - if slice { - if packed { - return sizeVarintS64PackedSlice, appendVarintS64PackedSlice - } - return sizeVarintS64Slice, appendVarintS64Slice - } - if nozero { - return sizeVarintS64ValueNoZero, appendVarintS64ValueNoZero - } - return sizeVarintS64Value, appendVarintS64Value - case "zigzag64": - if pointer { - return sizeZigzag64Ptr, appendZigzag64Ptr - } - if slice { - if packed { - return sizeZigzag64PackedSlice, appendZigzag64PackedSlice - } - return sizeZigzag64Slice, appendZigzag64Slice - } - if nozero { - return sizeZigzag64ValueNoZero, appendZigzag64ValueNoZero - } - return sizeZigzag64Value, appendZigzag64Value - } - case reflect.Float32: - if pointer { - return sizeFloat32Ptr, appendFloat32Ptr - } - if slice { - if packed { - return sizeFloat32PackedSlice, appendFloat32PackedSlice - } - return sizeFloat32Slice, appendFloat32Slice - } - if nozero { - return sizeFloat32ValueNoZero, appendFloat32ValueNoZero - } - return sizeFloat32Value, appendFloat32Value - case reflect.Float64: - if pointer { - return sizeFloat64Ptr, appendFloat64Ptr - } - if slice { - if packed { - return sizeFloat64PackedSlice, appendFloat64PackedSlice - } - return sizeFloat64Slice, appendFloat64Slice - } - if nozero { - return sizeFloat64ValueNoZero, appendFloat64ValueNoZero - } - return sizeFloat64Value, appendFloat64Value - case reflect.String: - if validateUTF8 { - if pointer { - return sizeStringPtr, appendUTF8StringPtr - } - if slice { - return sizeStringSlice, appendUTF8StringSlice - } - if nozero { - return sizeStringValueNoZero, appendUTF8StringValueNoZero - } - return sizeStringValue, appendUTF8StringValue - } - if pointer { - return sizeStringPtr, appendStringPtr - } - if slice { - return sizeStringSlice, appendStringSlice - } - if nozero { - return sizeStringValueNoZero, appendStringValueNoZero - } - return sizeStringValue, appendStringValue - case reflect.Slice: - if slice { - return sizeBytesSlice, appendBytesSlice - } - if oneof { - // Oneof bytes field may also have "proto3" tag. - // We want to marshal it as a oneof field. Do this - // check before the proto3 check. - return sizeBytesOneof, appendBytesOneof - } - if proto3 { - return sizeBytes3, appendBytes3 - } - return sizeBytes, appendBytes - case reflect.Struct: - switch encoding { - case "group": - if slice { - return makeGroupSliceMarshaler(getMarshalInfo(t)) - } - return makeGroupMarshaler(getMarshalInfo(t)) - case "bytes": - if slice { - return makeMessageSliceMarshaler(getMarshalInfo(t)) - } - return makeMessageMarshaler(getMarshalInfo(t)) - } - } - panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding)) -} - -// Below are functions to size/marshal a specific type of a field. -// They are stored in the field's info, and called by function pointers. -// They have type sizer or marshaler. - -func sizeFixed32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFixed32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFixed32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFixed32Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - return (4 + tagsize) * len(s) -} -func sizeFixed32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFixedS32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFixedS32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFixedS32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFixedS32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - return (4 + tagsize) * len(s) -} -func sizeFixedS32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFloat32Value(_ pointer, tagsize int) int { - return 4 + tagsize -} -func sizeFloat32ValueNoZero(ptr pointer, tagsize int) int { - v := math.Float32bits(*ptr.toFloat32()) - if v == 0 { - return 0 - } - return 4 + tagsize -} -func sizeFloat32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toFloat32Ptr() - if p == nil { - return 0 - } - return 4 + tagsize -} -func sizeFloat32Slice(ptr pointer, tagsize int) int { - s := *ptr.toFloat32Slice() - return (4 + tagsize) * len(s) -} -func sizeFloat32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toFloat32Slice() - if len(s) == 0 { - return 0 - } - return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize -} -func sizeFixed64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFixed64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFixed64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFixed64Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - return (8 + tagsize) * len(s) -} -func sizeFixed64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeFixedS64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFixedS64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFixedS64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFixedS64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - return (8 + tagsize) * len(s) -} -func sizeFixedS64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeFloat64Value(_ pointer, tagsize int) int { - return 8 + tagsize -} -func sizeFloat64ValueNoZero(ptr pointer, tagsize int) int { - v := math.Float64bits(*ptr.toFloat64()) - if v == 0 { - return 0 - } - return 8 + tagsize -} -func sizeFloat64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toFloat64Ptr() - if p == nil { - return 0 - } - return 8 + tagsize -} -func sizeFloat64Slice(ptr pointer, tagsize int) int { - s := *ptr.toFloat64Slice() - return (8 + tagsize) * len(s) -} -func sizeFloat64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toFloat64Slice() - if len(s) == 0 { - return 0 - } - return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize -} -func sizeVarint32Value(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarint32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint32() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarint32Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint32Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarint32Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarint32PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarintS32Value(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarintS32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarintS32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarint64Value(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - return SizeVarint(v) + tagsize -} -func sizeVarint64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toUint64() - if v == 0 { - return 0 - } - return SizeVarint(v) + tagsize -} -func sizeVarint64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toUint64Ptr() - if p == nil { - return 0 - } - return SizeVarint(*p) + tagsize -} -func sizeVarint64Slice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(v) + tagsize - } - return n -} -func sizeVarint64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(v) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeVarintS64Value(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v)) + tagsize -} -func sizeVarintS64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - return SizeVarint(uint64(*p)) + tagsize -} -func sizeVarintS64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) + tagsize - } - return n -} -func sizeVarintS64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeZigzag32Value(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt32() - if v == 0 { - return 0 - } - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32Ptr(ptr pointer, tagsize int) int { - p := ptr.getInt32Ptr() - if p == nil { - return 0 - } - v := *p - return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize -} -func sizeZigzag32Slice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize - } - return n -} -func sizeZigzag32PackedSlice(ptr pointer, tagsize int) int { - s := ptr.getInt32Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeZigzag64Value(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64ValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toInt64() - if v == 0 { - return 0 - } - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64Ptr(ptr pointer, tagsize int) int { - p := *ptr.toInt64Ptr() - if p == nil { - return 0 - } - v := *p - return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize -} -func sizeZigzag64Slice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize - } - return n -} -func sizeZigzag64PackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return 0 - } - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) - } - return n + SizeVarint(uint64(n)) + tagsize -} -func sizeBoolValue(_ pointer, tagsize int) int { - return 1 + tagsize -} -func sizeBoolValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toBool() - if !v { - return 0 - } - return 1 + tagsize -} -func sizeBoolPtr(ptr pointer, tagsize int) int { - p := *ptr.toBoolPtr() - if p == nil { - return 0 - } - return 1 + tagsize -} -func sizeBoolSlice(ptr pointer, tagsize int) int { - s := *ptr.toBoolSlice() - return (1 + tagsize) * len(s) -} -func sizeBoolPackedSlice(ptr pointer, tagsize int) int { - s := *ptr.toBoolSlice() - if len(s) == 0 { - return 0 - } - return len(s) + SizeVarint(uint64(len(s))) + tagsize -} -func sizeStringValue(ptr pointer, tagsize int) int { - v := *ptr.toString() - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringValueNoZero(ptr pointer, tagsize int) int { - v := *ptr.toString() - if v == "" { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringPtr(ptr pointer, tagsize int) int { - p := *ptr.toStringPtr() - if p == nil { - return 0 - } - v := *p - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeStringSlice(ptr pointer, tagsize int) int { - s := *ptr.toStringSlice() - n := 0 - for _, v := range s { - n += len(v) + SizeVarint(uint64(len(v))) + tagsize - } - return n -} -func sizeBytes(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - if v == nil { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytes3(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - if len(v) == 0 { - return 0 - } - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytesOneof(ptr pointer, tagsize int) int { - v := *ptr.toBytes() - return len(v) + SizeVarint(uint64(len(v))) + tagsize -} -func sizeBytesSlice(ptr pointer, tagsize int) int { - s := *ptr.toBytesSlice() - n := 0 - for _, v := range s { - n += len(v) + SizeVarint(uint64(len(v))) + tagsize - } - return n -} - -// appendFixed32 appends an encoded fixed32 to b. -func appendFixed32(b []byte, v uint32) []byte { - b = append(b, - byte(v), - byte(v>>8), - byte(v>>16), - byte(v>>24)) - return b -} - -// appendFixed64 appends an encoded fixed64 to b. -func appendFixed64(b []byte, v uint64) []byte { - b = append(b, - byte(v), - byte(v>>8), - byte(v>>16), - byte(v>>24), - byte(v>>32), - byte(v>>40), - byte(v>>48), - byte(v>>56)) - return b -} - -// appendVarint appends an encoded varint to b. -func appendVarint(b []byte, v uint64) []byte { - // TODO: make 1-byte (maybe 2-byte) case inline-able, once we - // have non-leaf inliner. - switch { - case v < 1<<7: - b = append(b, byte(v)) - case v < 1<<14: - b = append(b, - byte(v&0x7f|0x80), - byte(v>>7)) - case v < 1<<21: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte(v>>14)) - case v < 1<<28: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte(v>>21)) - case v < 1<<35: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte(v>>28)) - case v < 1<<42: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte(v>>35)) - case v < 1<<49: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte(v>>42)) - case v < 1<<56: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte(v>>49)) - case v < 1<<63: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte(v>>56)) - default: - b = append(b, - byte(v&0x7f|0x80), - byte((v>>7)&0x7f|0x80), - byte((v>>14)&0x7f|0x80), - byte((v>>21)&0x7f|0x80), - byte((v>>28)&0x7f|0x80), - byte((v>>35)&0x7f|0x80), - byte((v>>42)&0x7f|0x80), - byte((v>>49)&0x7f|0x80), - byte((v>>56)&0x7f|0x80), - 1) - } - return b -} - -func appendFixed32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFixed32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFixed32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, *p) - return b, nil -} -func appendFixed32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - } - return b, nil -} -func appendFixed32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, v) - } - return b, nil -} -func appendFixedS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - return b, nil -} -func appendFixedS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - return b, nil -} -func appendFixedS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(*p)) - return b, nil -} -func appendFixedS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, uint32(v)) - } - return b, nil -} -func appendFixedS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, uint32(v)) - } - return b, nil -} -func appendFloat32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float32bits(*ptr.toFloat32()) - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFloat32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float32bits(*ptr.toFloat32()) - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, v) - return b, nil -} -func appendFloat32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toFloat32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed32(b, math.Float32bits(*p)) - return b, nil -} -func appendFloat32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed32(b, math.Float32bits(v)) - } - return b, nil -} -func appendFloat32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(4*len(s))) - for _, v := range s { - b = appendFixed32(b, math.Float32bits(v)) - } - return b, nil -} -func appendFixed64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFixed64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFixed64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, *p) - return b, nil -} -func appendFixed64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - } - return b, nil -} -func appendFixed64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, v) - } - return b, nil -} -func appendFixedS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - return b, nil -} -func appendFixedS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - return b, nil -} -func appendFixedS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(*p)) - return b, nil -} -func appendFixedS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, uint64(v)) - } - return b, nil -} -func appendFixedS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, uint64(v)) - } - return b, nil -} -func appendFloat64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float64bits(*ptr.toFloat64()) - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFloat64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := math.Float64bits(*ptr.toFloat64()) - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, v) - return b, nil -} -func appendFloat64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toFloat64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendFixed64(b, math.Float64bits(*p)) - return b, nil -} -func appendFloat64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendFixed64(b, math.Float64bits(v)) - } - return b, nil -} -func appendFloat64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toFloat64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(8*len(s))) - for _, v := range s { - b = appendFixed64(b, math.Float64bits(v)) - } - return b, nil -} -func appendVarint32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarint32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarint32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarint32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarint32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarintS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarint64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - return b, nil -} -func appendVarint64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toUint64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - return b, nil -} -func appendVarint64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toUint64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, *p) - return b, nil -} -func appendVarint64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, v) - } - return b, nil -} -func appendVarint64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toUint64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(v) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, v) - } - return b, nil -} -func appendVarintS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - return b, nil -} -func appendVarintS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(*p)) - return b, nil -} -func appendVarintS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendVarintS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v)) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v)) - } - return b, nil -} -func appendZigzag32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt32() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := ptr.getInt32Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - v := *p - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - return b, nil -} -func appendZigzag32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - } - return b, nil -} -func appendZigzag32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := ptr.getInt32Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31)))) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) - } - return b, nil -} -func appendZigzag64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toInt64() - if v == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toInt64Ptr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - v := *p - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - return b, nil -} -func appendZigzag64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - } - return b, nil -} -func appendZigzag64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toInt64Slice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - // compute size - n := 0 - for _, v := range s { - n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63))) - } - b = appendVarint(b, uint64(n)) - for _, v := range s { - b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63))) - } - return b, nil -} -func appendBoolValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBool() - b = appendVarint(b, wiretag) - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - return b, nil -} -func appendBoolValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBool() - if !v { - return b, nil - } - b = appendVarint(b, wiretag) - b = append(b, 1) - return b, nil -} - -func appendBoolPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toBoolPtr() - if p == nil { - return b, nil - } - b = appendVarint(b, wiretag) - if *p { - b = append(b, 1) - } else { - b = append(b, 0) - } - return b, nil -} -func appendBoolSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBoolSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - } - return b, nil -} -func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBoolSlice() - if len(s) == 0 { - return b, nil - } - b = appendVarint(b, wiretag&^7|WireBytes) - b = appendVarint(b, uint64(len(s))) - for _, v := range s { - if v { - b = append(b, 1) - } else { - b = append(b, 0) - } - } - return b, nil -} -func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toString() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toString() - if v == "" { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - p := *ptr.toStringPtr() - if p == nil { - return b, nil - } - v := *p - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toStringSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - return b, nil -} -func appendUTF8StringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - v := *ptr.toString() - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - v := *ptr.toString() - if v == "" { - return b, nil - } - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - p := *ptr.toStringPtr() - if p == nil { - return b, nil - } - v := *p - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendUTF8StringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - var invalidUTF8 bool - s := *ptr.toStringSlice() - for _, v := range s { - if !utf8.ValidString(v) { - invalidUTF8 = true - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - if invalidUTF8 { - return b, errInvalidUTF8 - } - return b, nil -} -func appendBytes(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - if v == nil { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytes3(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - if len(v) == 0 { - return b, nil - } - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytesOneof(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - v := *ptr.toBytes() - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - return b, nil -} -func appendBytesSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) { - s := *ptr.toBytesSlice() - for _, v := range s { - b = appendVarint(b, wiretag) - b = appendVarint(b, uint64(len(v))) - b = append(b, v...) - } - return b, nil -} - -// makeGroupMarshaler returns the sizer and marshaler for a group. -// u is the marshal info of the underlying message. -func makeGroupMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - p := ptr.getPointer() - if p.isNil() { - return 0 - } - return u.size(p) + 2*tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - p := ptr.getPointer() - if p.isNil() { - return b, nil - } - var err error - b = appendVarint(b, wiretag) // start group - b, err = u.marshal(b, p, deterministic) - b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group - return b, err - } -} - -// makeGroupSliceMarshaler returns the sizer and marshaler for a group slice. -// u is the marshal info of the underlying message. -func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getPointerSlice() - n := 0 - for _, v := range s { - if v.isNil() { - continue - } - n += u.size(v) + 2*tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getPointerSlice() - var err error - var nerr nonFatal - for _, v := range s { - if v.isNil() { - return b, errRepeatedHasNil - } - b = appendVarint(b, wiretag) // start group - b, err = u.marshal(b, v, deterministic) - b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group - if !nerr.Merge(err) { - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - return b, nerr.E - } -} - -// makeMessageMarshaler returns the sizer and marshaler for a message field. -// u is the marshal info of the message. -func makeMessageMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - p := ptr.getPointer() - if p.isNil() { - return 0 - } - siz := u.size(p) - return siz + SizeVarint(uint64(siz)) + tagsize - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - p := ptr.getPointer() - if p.isNil() { - return b, nil - } - b = appendVarint(b, wiretag) - siz := u.cachedsize(p) - b = appendVarint(b, uint64(siz)) - return u.marshal(b, p, deterministic) - } -} - -// makeMessageSliceMarshaler returns the sizer and marshaler for a message slice. -// u is the marshal info of the message. -func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) { - return func(ptr pointer, tagsize int) int { - s := ptr.getPointerSlice() - n := 0 - for _, v := range s { - if v.isNil() { - continue - } - siz := u.size(v) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { - s := ptr.getPointerSlice() - var err error - var nerr nonFatal - for _, v := range s { - if v.isNil() { - return b, errRepeatedHasNil - } - b = appendVarint(b, wiretag) - siz := u.cachedsize(v) - b = appendVarint(b, uint64(siz)) - b, err = u.marshal(b, v, deterministic) - - if !nerr.Merge(err) { - if err == ErrNil { - err = errRepeatedHasNil - } - return b, err - } - } - return b, nerr.E - } -} - -// makeMapMarshaler returns the sizer and marshaler for a map field. -// f is the pointer to the reflect data structure of the field. -func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { - // figure out key and value type - t := f.Type - keyType := t.Key() - valType := t.Elem() - keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",") - valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") - keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map - valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map - keyWireTag := 1<<3 | wiretype(keyTags[0]) - valWireTag := 2<<3 | wiretype(valTags[0]) - - // We create an interface to get the addresses of the map key and value. - // If value is pointer-typed, the interface is a direct interface, the - // idata itself is the value. Otherwise, the idata is the pointer to the - // value. - // Key cannot be pointer-typed. - valIsPtr := valType.Kind() == reflect.Ptr - - // If value is a message with nested maps, calling - // valSizer in marshal may be quadratic. We should use - // cached version in marshal (but not in size). - // If value is not message type, we don't have size cache, - // but it cannot be nested either. Just use valSizer. - valCachedSizer := valSizer - if valIsPtr && valType.Elem().Kind() == reflect.Struct { - u := getMarshalInfo(valType.Elem()) - valCachedSizer = func(ptr pointer, tagsize int) int { - // Same as message sizer, but use cache. - p := ptr.getPointer() - if p.isNil() { - return 0 - } - siz := u.cachedsize(p) - return siz + SizeVarint(uint64(siz)) + tagsize - } - } - return func(ptr pointer, tagsize int) int { - m := ptr.asPointerTo(t).Elem() // the map - n := 0 - for _, k := range m.MapKeys() { - ki := k.Interface() - vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value - siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) - n += siz + SizeVarint(uint64(siz)) + tagsize - } - return n - }, - func(b []byte, ptr pointer, tag uint64, deterministic bool) ([]byte, error) { - m := ptr.asPointerTo(t).Elem() // the map - var err error - keys := m.MapKeys() - if len(keys) > 1 && deterministic { - sort.Sort(mapKeys(keys)) - } - - var nerr nonFatal - for _, k := range keys { - ki := k.Interface() - vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value - b = appendVarint(b, tag) - siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) - b = appendVarint(b, uint64(siz)) - b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic) - if !nerr.Merge(err) { - return b, err - } - b, err = valMarshaler(b, vaddr, valWireTag, deterministic) - if err != ErrNil && !nerr.Merge(err) { // allow nil value in map - return b, err - } - } - return b, nerr.E - } -} - -// makeOneOfMarshaler returns the sizer and marshaler for a oneof field. -// fi is the marshal info of the field. -// f is the pointer to the reflect data structure of the field. -func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, marshaler) { - // Oneof field is an interface. We need to get the actual data type on the fly. - t := f.Type - return func(ptr pointer, _ int) int { - p := ptr.getInterfacePointer() - if p.isNil() { - return 0 - } - v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct - telem := v.Type() - e := fi.oneofElems[telem] - return e.sizer(p, e.tagsize) - }, - func(b []byte, ptr pointer, _ uint64, deterministic bool) ([]byte, error) { - p := ptr.getInterfacePointer() - if p.isNil() { - return b, nil - } - v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct - telem := v.Type() - if telem.Field(0).Type.Kind() == reflect.Ptr && p.getPointer().isNil() { - return b, errOneofHasNil - } - e := fi.oneofElems[telem] - return e.marshaler(b, p, e.wiretag, deterministic) - } -} - -// sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field. -func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { - m, mu := ext.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - - n := 0 - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, ei.tagsize) - } - mu.Unlock() - return n -} - -// appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b. -func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m, mu := ext.extensionsRead() - if m == nil { - return b, nil - } - mu.Lock() - defer mu.Unlock() - - var err error - var nerr nonFatal - - // Fast-path for common cases: zero or one extensions. - // Don't bother sorting the keys. - if len(m) <= 1 { - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E - } - - // Sort the keys to provide a deterministic encoding. - // Not sure this is required, but the old code does it. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, k := range keys { - e := m[int32(k)] - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// message set format is: -// message MessageSet { -// repeated group Item = 1 { -// required int32 type_id = 2; -// required string message = 3; -// }; -// } - -// sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field -// in message set format (above). -func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { - m, mu := ext.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - - n := 0 - for id, e := range m { - n += 2 // start group, end group. tag = 1 (size=1) - n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - siz := len(msgWithLen) - n += siz + 1 // message, tag = 3 (size=1) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, 1) // message, tag = 3 (size=1) - } - mu.Unlock() - return n -} - -// appendMessageSet marshals a XXX_InternalExtensions field in message set format (above) -// to the end of byte slice b. -func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) { - m, mu := ext.extensionsRead() - if m == nil { - return b, nil - } - mu.Lock() - defer mu.Unlock() - - var err error - var nerr nonFatal - - // Fast-path for common cases: zero or one extensions. - // Don't bother sorting the keys. - if len(m) <= 1 { - for id, e := range m { - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) - if !nerr.Merge(err) { - return b, err - } - b = append(b, 1<<3|WireEndGroup) - } - return b, nerr.E - } - - // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, id := range keys { - e := m[int32(id)] - b = append(b, 1<<3|WireStartGroup) - b = append(b, 2<<3|WireVarint) - b = appendVarint(b, uint64(id)) - - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint - b = append(b, 3<<3|WireBytes) - b = append(b, msgWithLen...) - b = append(b, 1<<3|WireEndGroup) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) - b = append(b, 1<<3|WireEndGroup) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// sizeV1Extensions computes the size of encoded data for a V1-API extension field. -func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { - if m == nil { - return 0 - } - - n := 0 - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - n += ei.sizer(p, ei.tagsize) - } - return n -} - -// appendV1Extensions marshals a V1-API extension field to the end of byte slice b. -func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) { - if m == nil { - return b, nil - } - - // Sort the keys to provide a deterministic encoding. - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - var err error - var nerr nonFatal - for _, k := range keys { - e := m[int32(k)] - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - b = append(b, e.enc...) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - ei := u.getExtElemInfo(e.desc) - v := e.value - p := toAddrPointer(&v, ei.isptr) - b, err = ei.marshaler(b, p, ei.wiretag, deterministic) - if !nerr.Merge(err) { - return b, err - } - } - return b, nerr.E -} - -// newMarshaler is the interface representing objects that can marshal themselves. -// -// This exists to support protoc-gen-go generated messages. -// The proto package will stop type-asserting to this interface in the future. -// -// DO NOT DEPEND ON THIS. -type newMarshaler interface { - XXX_Size() int - XXX_Marshal(b []byte, deterministic bool) ([]byte, error) -} - -// Size returns the encoded size of a protocol buffer message. -// This is the main entry point. -func Size(pb Message) int { - if m, ok := pb.(newMarshaler); ok { - return m.XXX_Size() - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - b, _ := m.Marshal() - return len(b) - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return 0 - } - var info InternalMessageInfo - return info.Size(pb) -} - -// Marshal takes a protocol buffer message -// and encodes it into the wire format, returning the data. -// This is the main entry point. -func Marshal(pb Message) ([]byte, error) { - if m, ok := pb.(newMarshaler); ok { - siz := m.XXX_Size() - b := make([]byte, 0, siz) - return m.XXX_Marshal(b, false) - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - return m.Marshal() - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return nil, ErrNil - } - var info InternalMessageInfo - siz := info.Size(pb) - b := make([]byte, 0, siz) - return info.Marshal(b, pb, false) -} - -// Marshal takes a protocol buffer message -// and encodes it into the wire format, writing the result to the -// Buffer. -// This is an alternative entry point. It is not necessary to use -// a Buffer for most applications. -func (p *Buffer) Marshal(pb Message) error { - var err error - if m, ok := pb.(newMarshaler); ok { - siz := m.XXX_Size() - p.grow(siz) // make sure buf has enough capacity - p.buf, err = m.XXX_Marshal(p.buf, p.deterministic) - return err - } - if m, ok := pb.(Marshaler); ok { - // If the message can marshal itself, let it do it, for compatibility. - // NOTE: This is not efficient. - b, err := m.Marshal() - p.buf = append(p.buf, b...) - return err - } - // in case somehow we didn't generate the wrapper - if pb == nil { - return ErrNil - } - var info InternalMessageInfo - siz := info.Size(pb) - p.grow(siz) // make sure buf has enough capacity - p.buf, err = info.Marshal(p.buf, pb, p.deterministic) - return err -} - -// grow grows the buffer's capacity, if necessary, to guarantee space for -// another n bytes. After grow(n), at least n bytes can be written to the -// buffer without another allocation. -func (p *Buffer) grow(n int) { - need := len(p.buf) + n - if need <= cap(p.buf) { - return - } - newCap := len(p.buf) * 2 - if newCap < need { - newCap = need - } - p.buf = append(make([]byte, 0, newCap), p.buf...) -} diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/table_merge.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/table_merge.go deleted file mode 100644 index 5525def6..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/table_merge.go +++ /dev/null @@ -1,654 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "fmt" - "reflect" - "strings" - "sync" - "sync/atomic" -) - -// Merge merges the src message into dst. -// This assumes that dst and src of the same type and are non-nil. -func (a *InternalMessageInfo) Merge(dst, src Message) { - mi := atomicLoadMergeInfo(&a.merge) - if mi == nil { - mi = getMergeInfo(reflect.TypeOf(dst).Elem()) - atomicStoreMergeInfo(&a.merge, mi) - } - mi.merge(toPointer(&dst), toPointer(&src)) -} - -type mergeInfo struct { - typ reflect.Type - - initialized int32 // 0: only typ is valid, 1: everything is valid - lock sync.Mutex - - fields []mergeFieldInfo - unrecognized field // Offset of XXX_unrecognized -} - -type mergeFieldInfo struct { - field field // Offset of field, guaranteed to be valid - - // isPointer reports whether the value in the field is a pointer. - // This is true for the following situations: - // * Pointer to struct - // * Pointer to basic type (proto2 only) - // * Slice (first value in slice header is a pointer) - // * String (first value in string header is a pointer) - isPointer bool - - // basicWidth reports the width of the field assuming that it is directly - // embedded in the struct (as is the case for basic types in proto3). - // The possible values are: - // 0: invalid - // 1: bool - // 4: int32, uint32, float32 - // 8: int64, uint64, float64 - basicWidth int - - // Where dst and src are pointers to the types being merged. - merge func(dst, src pointer) -} - -var ( - mergeInfoMap = map[reflect.Type]*mergeInfo{} - mergeInfoLock sync.Mutex -) - -func getMergeInfo(t reflect.Type) *mergeInfo { - mergeInfoLock.Lock() - defer mergeInfoLock.Unlock() - mi := mergeInfoMap[t] - if mi == nil { - mi = &mergeInfo{typ: t} - mergeInfoMap[t] = mi - } - return mi -} - -// merge merges src into dst assuming they are both of type *mi.typ. -func (mi *mergeInfo) merge(dst, src pointer) { - if dst.isNil() { - panic("proto: nil destination") - } - if src.isNil() { - return // Nothing to do. - } - - if atomic.LoadInt32(&mi.initialized) == 0 { - mi.computeMergeInfo() - } - - for _, fi := range mi.fields { - sfp := src.offset(fi.field) - - // As an optimization, we can avoid the merge function call cost - // if we know for sure that the source will have no effect - // by checking if it is the zero value. - if unsafeAllowed { - if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string - continue - } - if fi.basicWidth > 0 { - switch { - case fi.basicWidth == 1 && !*sfp.toBool(): - continue - case fi.basicWidth == 4 && *sfp.toUint32() == 0: - continue - case fi.basicWidth == 8 && *sfp.toUint64() == 0: - continue - } - } - } - - dfp := dst.offset(fi.field) - fi.merge(dfp, sfp) - } - - // TODO: Make this faster? - out := dst.asPointerTo(mi.typ).Elem() - in := src.asPointerTo(mi.typ).Elem() - if emIn, err := extendable(in.Addr().Interface()); err == nil { - emOut, _ := extendable(out.Addr().Interface()) - mIn, muIn := emIn.extensionsRead() - if mIn != nil { - mOut := emOut.extensionsWrite() - muIn.Lock() - mergeExtension(mOut, mIn) - muIn.Unlock() - } - } - - if mi.unrecognized.IsValid() { - if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 { - *dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...) - } - } -} - -func (mi *mergeInfo) computeMergeInfo() { - mi.lock.Lock() - defer mi.lock.Unlock() - if mi.initialized != 0 { - return - } - t := mi.typ - n := t.NumField() - - props := GetProperties(t) - for i := 0; i < n; i++ { - f := t.Field(i) - if strings.HasPrefix(f.Name, "XXX_") { - continue - } - - mfi := mergeFieldInfo{field: toField(&f)} - tf := f.Type - - // As an optimization, we can avoid the merge function call cost - // if we know for sure that the source will have no effect - // by checking if it is the zero value. - if unsafeAllowed { - switch tf.Kind() { - case reflect.Ptr, reflect.Slice, reflect.String: - // As a special case, we assume slices and strings are pointers - // since we know that the first field in the SliceSlice or - // StringHeader is a data pointer. - mfi.isPointer = true - case reflect.Bool: - mfi.basicWidth = 1 - case reflect.Int32, reflect.Uint32, reflect.Float32: - mfi.basicWidth = 4 - case reflect.Int64, reflect.Uint64, reflect.Float64: - mfi.basicWidth = 8 - } - } - - // Unwrap tf to get at its most basic type. - var isPointer, isSlice bool - if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { - isSlice = true - tf = tf.Elem() - } - if tf.Kind() == reflect.Ptr { - isPointer = true - tf = tf.Elem() - } - if isPointer && isSlice && tf.Kind() != reflect.Struct { - panic("both pointer and slice for basic type in " + tf.Name()) - } - - switch tf.Kind() { - case reflect.Int32: - switch { - case isSlice: // E.g., []int32 - mfi.merge = func(dst, src pointer) { - // NOTE: toInt32Slice is not defined (see pointer_reflect.go). - /* - sfsp := src.toInt32Slice() - if *sfsp != nil { - dfsp := dst.toInt32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []int64{} - } - } - */ - sfs := src.getInt32Slice() - if sfs != nil { - dfs := dst.getInt32Slice() - dfs = append(dfs, sfs...) - if dfs == nil { - dfs = []int32{} - } - dst.setInt32Slice(dfs) - } - } - case isPointer: // E.g., *int32 - mfi.merge = func(dst, src pointer) { - // NOTE: toInt32Ptr is not defined (see pointer_reflect.go). - /* - sfpp := src.toInt32Ptr() - if *sfpp != nil { - dfpp := dst.toInt32Ptr() - if *dfpp == nil { - *dfpp = Int32(**sfpp) - } else { - **dfpp = **sfpp - } - } - */ - sfp := src.getInt32Ptr() - if sfp != nil { - dfp := dst.getInt32Ptr() - if dfp == nil { - dst.setInt32Ptr(*sfp) - } else { - *dfp = *sfp - } - } - } - default: // E.g., int32 - mfi.merge = func(dst, src pointer) { - if v := *src.toInt32(); v != 0 { - *dst.toInt32() = v - } - } - } - case reflect.Int64: - switch { - case isSlice: // E.g., []int64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toInt64Slice() - if *sfsp != nil { - dfsp := dst.toInt64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []int64{} - } - } - } - case isPointer: // E.g., *int64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toInt64Ptr() - if *sfpp != nil { - dfpp := dst.toInt64Ptr() - if *dfpp == nil { - *dfpp = Int64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., int64 - mfi.merge = func(dst, src pointer) { - if v := *src.toInt64(); v != 0 { - *dst.toInt64() = v - } - } - } - case reflect.Uint32: - switch { - case isSlice: // E.g., []uint32 - mfi.merge = func(dst, src pointer) { - sfsp := src.toUint32Slice() - if *sfsp != nil { - dfsp := dst.toUint32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []uint32{} - } - } - } - case isPointer: // E.g., *uint32 - mfi.merge = func(dst, src pointer) { - sfpp := src.toUint32Ptr() - if *sfpp != nil { - dfpp := dst.toUint32Ptr() - if *dfpp == nil { - *dfpp = Uint32(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., uint32 - mfi.merge = func(dst, src pointer) { - if v := *src.toUint32(); v != 0 { - *dst.toUint32() = v - } - } - } - case reflect.Uint64: - switch { - case isSlice: // E.g., []uint64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toUint64Slice() - if *sfsp != nil { - dfsp := dst.toUint64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []uint64{} - } - } - } - case isPointer: // E.g., *uint64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toUint64Ptr() - if *sfpp != nil { - dfpp := dst.toUint64Ptr() - if *dfpp == nil { - *dfpp = Uint64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., uint64 - mfi.merge = func(dst, src pointer) { - if v := *src.toUint64(); v != 0 { - *dst.toUint64() = v - } - } - } - case reflect.Float32: - switch { - case isSlice: // E.g., []float32 - mfi.merge = func(dst, src pointer) { - sfsp := src.toFloat32Slice() - if *sfsp != nil { - dfsp := dst.toFloat32Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []float32{} - } - } - } - case isPointer: // E.g., *float32 - mfi.merge = func(dst, src pointer) { - sfpp := src.toFloat32Ptr() - if *sfpp != nil { - dfpp := dst.toFloat32Ptr() - if *dfpp == nil { - *dfpp = Float32(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., float32 - mfi.merge = func(dst, src pointer) { - if v := *src.toFloat32(); v != 0 { - *dst.toFloat32() = v - } - } - } - case reflect.Float64: - switch { - case isSlice: // E.g., []float64 - mfi.merge = func(dst, src pointer) { - sfsp := src.toFloat64Slice() - if *sfsp != nil { - dfsp := dst.toFloat64Slice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []float64{} - } - } - } - case isPointer: // E.g., *float64 - mfi.merge = func(dst, src pointer) { - sfpp := src.toFloat64Ptr() - if *sfpp != nil { - dfpp := dst.toFloat64Ptr() - if *dfpp == nil { - *dfpp = Float64(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., float64 - mfi.merge = func(dst, src pointer) { - if v := *src.toFloat64(); v != 0 { - *dst.toFloat64() = v - } - } - } - case reflect.Bool: - switch { - case isSlice: // E.g., []bool - mfi.merge = func(dst, src pointer) { - sfsp := src.toBoolSlice() - if *sfsp != nil { - dfsp := dst.toBoolSlice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []bool{} - } - } - } - case isPointer: // E.g., *bool - mfi.merge = func(dst, src pointer) { - sfpp := src.toBoolPtr() - if *sfpp != nil { - dfpp := dst.toBoolPtr() - if *dfpp == nil { - *dfpp = Bool(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., bool - mfi.merge = func(dst, src pointer) { - if v := *src.toBool(); v { - *dst.toBool() = v - } - } - } - case reflect.String: - switch { - case isSlice: // E.g., []string - mfi.merge = func(dst, src pointer) { - sfsp := src.toStringSlice() - if *sfsp != nil { - dfsp := dst.toStringSlice() - *dfsp = append(*dfsp, *sfsp...) - if *dfsp == nil { - *dfsp = []string{} - } - } - } - case isPointer: // E.g., *string - mfi.merge = func(dst, src pointer) { - sfpp := src.toStringPtr() - if *sfpp != nil { - dfpp := dst.toStringPtr() - if *dfpp == nil { - *dfpp = String(**sfpp) - } else { - **dfpp = **sfpp - } - } - } - default: // E.g., string - mfi.merge = func(dst, src pointer) { - if v := *src.toString(); v != "" { - *dst.toString() = v - } - } - } - case reflect.Slice: - isProto3 := props.Prop[i].proto3 - switch { - case isPointer: - panic("bad pointer in byte slice case in " + tf.Name()) - case tf.Elem().Kind() != reflect.Uint8: - panic("bad element kind in byte slice case in " + tf.Name()) - case isSlice: // E.g., [][]byte - mfi.merge = func(dst, src pointer) { - sbsp := src.toBytesSlice() - if *sbsp != nil { - dbsp := dst.toBytesSlice() - for _, sb := range *sbsp { - if sb == nil { - *dbsp = append(*dbsp, nil) - } else { - *dbsp = append(*dbsp, append([]byte{}, sb...)) - } - } - if *dbsp == nil { - *dbsp = [][]byte{} - } - } - } - default: // E.g., []byte - mfi.merge = func(dst, src pointer) { - sbp := src.toBytes() - if *sbp != nil { - dbp := dst.toBytes() - if !isProto3 || len(*sbp) > 0 { - *dbp = append([]byte{}, *sbp...) - } - } - } - } - case reflect.Struct: - switch { - case !isPointer: - panic(fmt.Sprintf("message field %s without pointer", tf)) - case isSlice: // E.g., []*pb.T - mi := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - sps := src.getPointerSlice() - if sps != nil { - dps := dst.getPointerSlice() - for _, sp := range sps { - var dp pointer - if !sp.isNil() { - dp = valToPointer(reflect.New(tf)) - mi.merge(dp, sp) - } - dps = append(dps, dp) - } - if dps == nil { - dps = []pointer{} - } - dst.setPointerSlice(dps) - } - } - default: // E.g., *pb.T - mi := getMergeInfo(tf) - mfi.merge = func(dst, src pointer) { - sp := src.getPointer() - if !sp.isNil() { - dp := dst.getPointer() - if dp.isNil() { - dp = valToPointer(reflect.New(tf)) - dst.setPointer(dp) - } - mi.merge(dp, sp) - } - } - } - case reflect.Map: - switch { - case isPointer || isSlice: - panic("bad pointer or slice in map case in " + tf.Name()) - default: // E.g., map[K]V - mfi.merge = func(dst, src pointer) { - sm := src.asPointerTo(tf).Elem() - if sm.Len() == 0 { - return - } - dm := dst.asPointerTo(tf).Elem() - if dm.IsNil() { - dm.Set(reflect.MakeMap(tf)) - } - - switch tf.Elem().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - val = reflect.ValueOf(Clone(val.Interface().(Message))) - dm.SetMapIndex(key, val) - } - case reflect.Slice: // E.g. Bytes type (e.g., []byte) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) - dm.SetMapIndex(key, val) - } - default: // Basic type (e.g., string) - for _, key := range sm.MapKeys() { - val := sm.MapIndex(key) - dm.SetMapIndex(key, val) - } - } - } - } - case reflect.Interface: - // Must be oneof field. - switch { - case isPointer || isSlice: - panic("bad pointer or slice in interface case in " + tf.Name()) - default: // E.g., interface{} - // TODO: Make this faster? - mfi.merge = func(dst, src pointer) { - su := src.asPointerTo(tf).Elem() - if !su.IsNil() { - du := dst.asPointerTo(tf).Elem() - typ := su.Elem().Type() - if du.IsNil() || du.Elem().Type() != typ { - du.Set(reflect.New(typ.Elem())) // Initialize interface if empty - } - sv := su.Elem().Elem().Field(0) - if sv.Kind() == reflect.Ptr && sv.IsNil() { - return - } - dv := du.Elem().Elem().Field(0) - if dv.Kind() == reflect.Ptr && dv.IsNil() { - dv.Set(reflect.New(sv.Type().Elem())) // Initialize proto message if empty - } - switch sv.Type().Kind() { - case reflect.Ptr: // Proto struct (e.g., *T) - Merge(dv.Interface().(Message), sv.Interface().(Message)) - case reflect.Slice: // E.g. Bytes type (e.g., []byte) - dv.Set(reflect.ValueOf(append([]byte{}, sv.Bytes()...))) - default: // Basic type (e.g., string) - dv.Set(sv) - } - } - } - } - default: - panic(fmt.Sprintf("merger not found for type:%s", tf)) - } - mi.fields = append(mi.fields, mfi) - } - - mi.unrecognized = invalidField - if f, ok := t.FieldByName("XXX_unrecognized"); ok { - if f.Type != reflect.TypeOf([]byte{}) { - panic("expected XXX_unrecognized to be of type []byte") - } - mi.unrecognized = toField(&f) - } - - atomic.StoreInt32(&mi.initialized, 1) -} diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/table_unmarshal.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/table_unmarshal.go deleted file mode 100644 index fd4afec8..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/table_unmarshal.go +++ /dev/null @@ -1,2051 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2016 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -import ( - "errors" - "fmt" - "io" - "math" - "reflect" - "strconv" - "strings" - "sync" - "sync/atomic" - "unicode/utf8" -) - -// Unmarshal is the entry point from the generated .pb.go files. -// This function is not intended to be used by non-generated code. -// This function is not subject to any compatibility guarantee. -// msg contains a pointer to a protocol buffer struct. -// b is the data to be unmarshaled into the protocol buffer. -// a is a pointer to a place to store cached unmarshal information. -func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error { - // Load the unmarshal information for this message type. - // The atomic load ensures memory consistency. - u := atomicLoadUnmarshalInfo(&a.unmarshal) - if u == nil { - // Slow path: find unmarshal info for msg, update a with it. - u = getUnmarshalInfo(reflect.TypeOf(msg).Elem()) - atomicStoreUnmarshalInfo(&a.unmarshal, u) - } - // Then do the unmarshaling. - err := u.unmarshal(toPointer(&msg), b) - return err -} - -type unmarshalInfo struct { - typ reflect.Type // type of the protobuf struct - - // 0 = only typ field is initialized - // 1 = completely initialized - initialized int32 - lock sync.Mutex // prevents double initialization - dense []unmarshalFieldInfo // fields indexed by tag # - sparse map[uint64]unmarshalFieldInfo // fields indexed by tag # - reqFields []string // names of required fields - reqMask uint64 // 1< 0 { - // Read tag and wire type. - // Special case 1 and 2 byte varints. - var x uint64 - if b[0] < 128 { - x = uint64(b[0]) - b = b[1:] - } else if len(b) >= 2 && b[1] < 128 { - x = uint64(b[0]&0x7f) + uint64(b[1])<<7 - b = b[2:] - } else { - var n int - x, n = decodeVarint(b) - if n == 0 { - return io.ErrUnexpectedEOF - } - b = b[n:] - } - tag := x >> 3 - wire := int(x) & 7 - - // Dispatch on the tag to one of the unmarshal* functions below. - var f unmarshalFieldInfo - if tag < uint64(len(u.dense)) { - f = u.dense[tag] - } else { - f = u.sparse[tag] - } - if fn := f.unmarshal; fn != nil { - var err error - b, err = fn(b, m.offset(f.field), wire) - if err == nil { - reqMask |= f.reqMask - continue - } - if r, ok := err.(*RequiredNotSetError); ok { - // Remember this error, but keep parsing. We need to produce - // a full parse even if a required field is missing. - if errLater == nil { - errLater = r - } - reqMask |= f.reqMask - continue - } - if err != errInternalBadWireType { - if err == errInvalidUTF8 { - if errLater == nil { - fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name - errLater = &invalidUTF8Error{fullName} - } - continue - } - return err - } - // Fragments with bad wire type are treated as unknown fields. - } - - // Unknown tag. - if !u.unrecognized.IsValid() { - // Don't keep unrecognized data; just skip it. - var err error - b, err = skipField(b, wire) - if err != nil { - return err - } - continue - } - // Keep unrecognized data around. - // maybe in extensions, maybe in the unrecognized field. - z := m.offset(u.unrecognized).toBytes() - var emap map[int32]Extension - var e Extension - for _, r := range u.extensionRanges { - if uint64(r.Start) <= tag && tag <= uint64(r.End) { - if u.extensions.IsValid() { - mp := m.offset(u.extensions).toExtensions() - emap = mp.extensionsWrite() - e = emap[int32(tag)] - z = &e.enc - break - } - if u.oldExtensions.IsValid() { - p := m.offset(u.oldExtensions).toOldExtensions() - emap = *p - if emap == nil { - emap = map[int32]Extension{} - *p = emap - } - e = emap[int32(tag)] - z = &e.enc - break - } - panic("no extensions field available") - } - } - - // Use wire type to skip data. - var err error - b0 := b - b, err = skipField(b, wire) - if err != nil { - return err - } - *z = encodeVarint(*z, tag<<3|uint64(wire)) - *z = append(*z, b0[:len(b0)-len(b)]...) - - if emap != nil { - emap[int32(tag)] = e - } - } - if reqMask != u.reqMask && errLater == nil { - // A required field of this message is missing. - for _, n := range u.reqFields { - if reqMask&1 == 0 { - errLater = &RequiredNotSetError{n} - } - reqMask >>= 1 - } - } - return errLater -} - -// computeUnmarshalInfo fills in u with information for use -// in unmarshaling protocol buffers of type u.typ. -func (u *unmarshalInfo) computeUnmarshalInfo() { - u.lock.Lock() - defer u.lock.Unlock() - if u.initialized != 0 { - return - } - t := u.typ - n := t.NumField() - - // Set up the "not found" value for the unrecognized byte buffer. - // This is the default for proto3. - u.unrecognized = invalidField - u.extensions = invalidField - u.oldExtensions = invalidField - - // List of the generated type and offset for each oneof field. - type oneofField struct { - ityp reflect.Type // interface type of oneof field - field field // offset in containing message - } - var oneofFields []oneofField - - for i := 0; i < n; i++ { - f := t.Field(i) - if f.Name == "XXX_unrecognized" { - // The byte slice used to hold unrecognized input is special. - if f.Type != reflect.TypeOf(([]byte)(nil)) { - panic("bad type for XXX_unrecognized field: " + f.Type.Name()) - } - u.unrecognized = toField(&f) - continue - } - if f.Name == "XXX_InternalExtensions" { - // Ditto here. - if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) { - panic("bad type for XXX_InternalExtensions field: " + f.Type.Name()) - } - u.extensions = toField(&f) - if f.Tag.Get("protobuf_messageset") == "1" { - u.isMessageSet = true - } - continue - } - if f.Name == "XXX_extensions" { - // An older form of the extensions field. - if f.Type != reflect.TypeOf((map[int32]Extension)(nil)) { - panic("bad type for XXX_extensions field: " + f.Type.Name()) - } - u.oldExtensions = toField(&f) - continue - } - if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" { - continue - } - - oneof := f.Tag.Get("protobuf_oneof") - if oneof != "" { - oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)}) - // The rest of oneof processing happens below. - continue - } - - tags := f.Tag.Get("protobuf") - tagArray := strings.Split(tags, ",") - if len(tagArray) < 2 { - panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags) - } - tag, err := strconv.Atoi(tagArray[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tagArray[1]) - } - - name := "" - for _, tag := range tagArray[3:] { - if strings.HasPrefix(tag, "name=") { - name = tag[5:] - } - } - - // Extract unmarshaling function from the field (its type and tags). - unmarshal := fieldUnmarshaler(&f) - - // Required field? - var reqMask uint64 - if tagArray[2] == "req" { - bit := len(u.reqFields) - u.reqFields = append(u.reqFields, name) - reqMask = uint64(1) << uint(bit) - // TODO: if we have more than 64 required fields, we end up - // not verifying that all required fields are present. - // Fix this, perhaps using a count of required fields? - } - - // Store the info in the correct slot in the message. - u.setTag(tag, toField(&f), unmarshal, reqMask, name) - } - - // Find any types associated with oneof fields. - // TODO: XXX_OneofFuncs returns more info than we need. Get rid of some of it? - fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("XXX_OneofFuncs") - if fn.IsValid() { - res := fn.Call(nil)[3] // last return value from XXX_OneofFuncs: []interface{} - for i := res.Len() - 1; i >= 0; i-- { - v := res.Index(i) // interface{} - tptr := reflect.ValueOf(v.Interface()).Type() // *Msg_X - typ := tptr.Elem() // Msg_X - - f := typ.Field(0) // oneof implementers have one field - baseUnmarshal := fieldUnmarshaler(&f) - tags := strings.Split(f.Tag.Get("protobuf"), ",") - fieldNum, err := strconv.Atoi(tags[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tags[1]) - } - var name string - for _, tag := range tags { - if strings.HasPrefix(tag, "name=") { - name = strings.TrimPrefix(tag, "name=") - break - } - } - - // Find the oneof field that this struct implements. - // Might take O(n^2) to process all of the oneofs, but who cares. - for _, of := range oneofFields { - if tptr.Implements(of.ityp) { - // We have found the corresponding interface for this struct. - // That lets us know where this struct should be stored - // when we encounter it during unmarshaling. - unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) - u.setTag(fieldNum, of.field, unmarshal, 0, name) - } - } - } - } - - // Get extension ranges, if any. - fn = reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") - if fn.IsValid() { - if !u.extensions.IsValid() && !u.oldExtensions.IsValid() { - panic("a message with extensions, but no extensions field in " + t.Name()) - } - u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange) - } - - // Explicitly disallow tag 0. This will ensure we flag an error - // when decoding a buffer of all zeros. Without this code, we - // would decode and skip an all-zero buffer of even length. - // [0 0] is [tag=0/wiretype=varint varint-encoded-0]. - u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) { - return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w) - }, 0, "") - - // Set mask for required field check. - u.reqMask = uint64(1)<= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here? - for len(u.dense) <= tag { - u.dense = append(u.dense, unmarshalFieldInfo{}) - } - u.dense[tag] = i - return - } - if u.sparse == nil { - u.sparse = map[uint64]unmarshalFieldInfo{} - } - u.sparse[uint64(tag)] = i -} - -// fieldUnmarshaler returns an unmarshaler for the given field. -func fieldUnmarshaler(f *reflect.StructField) unmarshaler { - if f.Type.Kind() == reflect.Map { - return makeUnmarshalMap(f) - } - return typeUnmarshaler(f.Type, f.Tag.Get("protobuf")) -} - -// typeUnmarshaler returns an unmarshaler for the given field type / field tag pair. -func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { - tagArray := strings.Split(tags, ",") - encoding := tagArray[0] - name := "unknown" - proto3 := false - validateUTF8 := true - for _, tag := range tagArray[3:] { - if strings.HasPrefix(tag, "name=") { - name = tag[5:] - } - if tag == "proto3" { - proto3 = true - } - } - validateUTF8 = validateUTF8 && proto3 - - // Figure out packaging (pointer, slice, or both) - slice := false - pointer := false - if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { - slice = true - t = t.Elem() - } - if t.Kind() == reflect.Ptr { - pointer = true - t = t.Elem() - } - - // We'll never have both pointer and slice for basic types. - if pointer && slice && t.Kind() != reflect.Struct { - panic("both pointer and slice for basic type in " + t.Name()) - } - - switch t.Kind() { - case reflect.Bool: - if pointer { - return unmarshalBoolPtr - } - if slice { - return unmarshalBoolSlice - } - return unmarshalBoolValue - case reflect.Int32: - switch encoding { - case "fixed32": - if pointer { - return unmarshalFixedS32Ptr - } - if slice { - return unmarshalFixedS32Slice - } - return unmarshalFixedS32Value - case "varint": - // this could be int32 or enum - if pointer { - return unmarshalInt32Ptr - } - if slice { - return unmarshalInt32Slice - } - return unmarshalInt32Value - case "zigzag32": - if pointer { - return unmarshalSint32Ptr - } - if slice { - return unmarshalSint32Slice - } - return unmarshalSint32Value - } - case reflect.Int64: - switch encoding { - case "fixed64": - if pointer { - return unmarshalFixedS64Ptr - } - if slice { - return unmarshalFixedS64Slice - } - return unmarshalFixedS64Value - case "varint": - if pointer { - return unmarshalInt64Ptr - } - if slice { - return unmarshalInt64Slice - } - return unmarshalInt64Value - case "zigzag64": - if pointer { - return unmarshalSint64Ptr - } - if slice { - return unmarshalSint64Slice - } - return unmarshalSint64Value - } - case reflect.Uint32: - switch encoding { - case "fixed32": - if pointer { - return unmarshalFixed32Ptr - } - if slice { - return unmarshalFixed32Slice - } - return unmarshalFixed32Value - case "varint": - if pointer { - return unmarshalUint32Ptr - } - if slice { - return unmarshalUint32Slice - } - return unmarshalUint32Value - } - case reflect.Uint64: - switch encoding { - case "fixed64": - if pointer { - return unmarshalFixed64Ptr - } - if slice { - return unmarshalFixed64Slice - } - return unmarshalFixed64Value - case "varint": - if pointer { - return unmarshalUint64Ptr - } - if slice { - return unmarshalUint64Slice - } - return unmarshalUint64Value - } - case reflect.Float32: - if pointer { - return unmarshalFloat32Ptr - } - if slice { - return unmarshalFloat32Slice - } - return unmarshalFloat32Value - case reflect.Float64: - if pointer { - return unmarshalFloat64Ptr - } - if slice { - return unmarshalFloat64Slice - } - return unmarshalFloat64Value - case reflect.Map: - panic("map type in typeUnmarshaler in " + t.Name()) - case reflect.Slice: - if pointer { - panic("bad pointer in slice case in " + t.Name()) - } - if slice { - return unmarshalBytesSlice - } - return unmarshalBytesValue - case reflect.String: - if validateUTF8 { - if pointer { - return unmarshalUTF8StringPtr - } - if slice { - return unmarshalUTF8StringSlice - } - return unmarshalUTF8StringValue - } - if pointer { - return unmarshalStringPtr - } - if slice { - return unmarshalStringSlice - } - return unmarshalStringValue - case reflect.Struct: - // message or group field - if !pointer { - panic(fmt.Sprintf("message/group field %s:%s without pointer", t, encoding)) - } - switch encoding { - case "bytes": - if slice { - return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name) - case "group": - if slice { - return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name) - } - return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name) - } - } - panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding)) -} - -// Below are all the unmarshalers for individual fields of various types. - -func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - *f.toInt64() = v - return b, nil -} - -func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - *f.toInt64Ptr() = &v - return b, nil -} - -func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - s := f.toInt64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x) - s := f.toInt64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - *f.toInt64() = v - return b, nil -} - -func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - *f.toInt64Ptr() = &v - return b, nil -} - -func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - s := f.toInt64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int64(x>>1) ^ int64(x)<<63>>63 - s := f.toInt64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - *f.toUint64() = v - return b, nil -} - -func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - *f.toUint64Ptr() = &v - return b, nil -} - -func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - s := f.toUint64Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint64(x) - s := f.toUint64Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - *f.toInt32() = v - return b, nil -} - -func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.setInt32Ptr(v) - return b, nil -} - -func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.appendInt32Slice(v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x) - f.appendInt32Slice(v) - return b, nil -} - -func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - *f.toInt32() = v - return b, nil -} - -func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.setInt32Ptr(v) - return b, nil -} - -func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.appendInt32Slice(v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := int32(x>>1) ^ int32(x)<<31>>31 - f.appendInt32Slice(v) - return b, nil -} - -func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - *f.toUint32() = v - return b, nil -} - -func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - *f.toUint32Ptr() = &v - return b, nil -} - -func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - s := f.toUint32Slice() - *s = append(*s, v) - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - v := uint32(x) - s := f.toUint32Slice() - *s = append(*s, v) - return b, nil -} - -func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - *f.toUint64() = v - return b[8:], nil -} - -func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - *f.toUint64Ptr() = &v - return b[8:], nil -} - -func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - s := f.toUint64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - s := f.toUint64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - *f.toInt64() = v - return b[8:], nil -} - -func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - *f.toInt64Ptr() = &v - return b[8:], nil -} - -func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - s := f.toInt64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56 - s := f.toInt64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - *f.toUint32() = v - return b[4:], nil -} - -func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - *f.toUint32Ptr() = &v - return b[4:], nil -} - -func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - s := f.toUint32Slice() - *s = append(*s, v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 - s := f.toUint32Slice() - *s = append(*s, v) - return b[4:], nil -} - -func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - *f.toInt32() = v - return b[4:], nil -} - -func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.setInt32Ptr(v) - return b[4:], nil -} - -func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.appendInt32Slice(v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 - f.appendInt32Slice(v) - return b[4:], nil -} - -func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - // Note: any length varint is allowed, even though any sane - // encoder will use one byte. - // See https://github.com/golang/protobuf/issues/76 - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - // TODO: check if x>1? Tests seem to indicate no. - v := x != 0 - *f.toBool() = v - return b[n:], nil -} - -func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - *f.toBoolPtr() = &v - return b[n:], nil -} - -func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - x, n = decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - s := f.toBoolSlice() - *s = append(*s, v) - b = b[n:] - } - return res, nil - } - if w != WireVarint { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - v := x != 0 - s := f.toBoolSlice() - *s = append(*s, v) - return b[n:], nil -} - -func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - *f.toFloat64() = v - return b[8:], nil -} - -func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - *f.toFloat64Ptr() = &v - return b[8:], nil -} - -func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - s := f.toFloat64Slice() - *s = append(*s, v) - b = b[8:] - } - return res, nil - } - if w != WireFixed64 { - return b, errInternalBadWireType - } - if len(b) < 8 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56) - s := f.toFloat64Slice() - *s = append(*s, v) - return b[8:], nil -} - -func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - *f.toFloat32() = v - return b[4:], nil -} - -func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - *f.toFloat32Ptr() = &v - return b[4:], nil -} - -func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) { - if w == WireBytes { // packed - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - res := b[x:] - b = b[:x] - for len(b) > 0 { - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - s := f.toFloat32Slice() - *s = append(*s, v) - b = b[4:] - } - return res, nil - } - if w != WireFixed32 { - return b, errInternalBadWireType - } - if len(b) < 4 { - return nil, io.ErrUnexpectedEOF - } - v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24) - s := f.toFloat32Slice() - *s = append(*s, v) - return b[4:], nil -} - -func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toString() = v - return b[x:], nil -} - -func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toStringPtr() = &v - return b[x:], nil -} - -func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - s := f.toStringSlice() - *s = append(*s, v) - return b[x:], nil -} - -func unmarshalUTF8StringValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toString() = v - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -func unmarshalUTF8StringPtr(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - *f.toStringPtr() = &v - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -func unmarshalUTF8StringSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := string(b[:x]) - s := f.toStringSlice() - *s = append(*s, v) - if !utf8.ValidString(v) { - return b[x:], errInvalidUTF8 - } - return b[x:], nil -} - -var emptyBuf [0]byte - -func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // The use of append here is a trick which avoids the zeroing - // that would be required if we used a make/copy pair. - // We append to emptyBuf instead of nil because we want - // a non-nil result even when the length is 0. - v := append(emptyBuf[:], b[:x]...) - *f.toBytes() = v - return b[x:], nil -} - -func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := append(emptyBuf[:], b[:x]...) - s := f.toBytesSlice() - *s = append(*s, v) - return b[x:], nil -} - -func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - // First read the message field to see if something is there. - // The semantics of multiple submessages are weird. Instead of - // the last one winning (as it is for all other fields), multiple - // submessages are merged. - v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[x:], err - } -} - -func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireBytes { - return b, errInternalBadWireType - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendPointer(v) - return b[x:], err - } -} - -func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireStartGroup { - return b, errInternalBadWireType - } - x, y := findEndGroup(b) - if x < 0 { - return nil, io.ErrUnexpectedEOF - } - v := f.getPointer() - if v.isNil() { - v = valToPointer(reflect.New(sub.typ)) - f.setPointer(v) - } - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - return b[y:], err - } -} - -func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler { - return func(b []byte, f pointer, w int) ([]byte, error) { - if w != WireStartGroup { - return b, errInternalBadWireType - } - x, y := findEndGroup(b) - if x < 0 { - return nil, io.ErrUnexpectedEOF - } - v := valToPointer(reflect.New(sub.typ)) - err := sub.unmarshal(v, b[:x]) - if err != nil { - if r, ok := err.(*RequiredNotSetError); ok { - r.field = name + "." + r.field - } else { - return nil, err - } - } - f.appendPointer(v) - return b[y:], err - } -} - -func makeUnmarshalMap(f *reflect.StructField) unmarshaler { - t := f.Type - kt := t.Key() - vt := t.Elem() - unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key")) - unmarshalVal := typeUnmarshaler(vt, f.Tag.Get("protobuf_val")) - return func(b []byte, f pointer, w int) ([]byte, error) { - // The map entry is a submessage. Figure out how big it is. - if w != WireBytes { - return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes) - } - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - b = b[n:] - if x > uint64(len(b)) { - return nil, io.ErrUnexpectedEOF - } - r := b[x:] // unused data to return - b = b[:x] // data for map entry - - // Note: we could use #keys * #values ~= 200 functions - // to do map decoding without reflection. Probably not worth it. - // Maps will be somewhat slow. Oh well. - - // Read key and value from data. - var nerr nonFatal - k := reflect.New(kt) - v := reflect.New(vt) - for len(b) > 0 { - x, n := decodeVarint(b) - if n == 0 { - return nil, io.ErrUnexpectedEOF - } - wire := int(x) & 7 - b = b[n:] - - var err error - switch x >> 3 { - case 1: - b, err = unmarshalKey(b, valToPointer(k), wire) - case 2: - b, err = unmarshalVal(b, valToPointer(v), wire) - default: - err = errInternalBadWireType // skip unknown tag - } - - if nerr.Merge(err) { - continue - } - if err != errInternalBadWireType { - return nil, err - } - - // Skip past unknown fields. - b, err = skipField(b, wire) - if err != nil { - return nil, err - } - } - - // Get map, allocate if needed. - m := f.asPointerTo(t).Elem() // an addressable map[K]T - if m.IsNil() { - m.Set(reflect.MakeMap(t)) - } - - // Insert into map. - m.SetMapIndex(k.Elem(), v.Elem()) - - return r, nerr.E - } -} - -// makeUnmarshalOneof makes an unmarshaler for oneof fields. -// for: -// message Msg { -// oneof F { -// int64 X = 1; -// float64 Y = 2; -// } -// } -// typ is the type of the concrete entry for a oneof case (e.g. Msg_X). -// ityp is the interface type of the oneof field (e.g. isMsg_F). -// unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64). -// Note that this function will be called once for each case in the oneof. -func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler { - sf := typ.Field(0) - field0 := toField(&sf) - return func(b []byte, f pointer, w int) ([]byte, error) { - // Allocate holder for value. - v := reflect.New(typ) - - // Unmarshal data into holder. - // We unmarshal into the first field of the holder object. - var err error - var nerr nonFatal - b, err = unmarshal(b, valToPointer(v).offset(field0), w) - if !nerr.Merge(err) { - return nil, err - } - - // Write pointer to holder into target field. - f.asPointerTo(ityp).Elem().Set(v) - - return b, nerr.E - } -} - -// Error used by decode internally. -var errInternalBadWireType = errors.New("proto: internal error: bad wiretype") - -// skipField skips past a field of type wire and returns the remaining bytes. -func skipField(b []byte, wire int) ([]byte, error) { - switch wire { - case WireVarint: - _, k := decodeVarint(b) - if k == 0 { - return b, io.ErrUnexpectedEOF - } - b = b[k:] - case WireFixed32: - if len(b) < 4 { - return b, io.ErrUnexpectedEOF - } - b = b[4:] - case WireFixed64: - if len(b) < 8 { - return b, io.ErrUnexpectedEOF - } - b = b[8:] - case WireBytes: - m, k := decodeVarint(b) - if k == 0 || uint64(len(b)-k) < m { - return b, io.ErrUnexpectedEOF - } - b = b[uint64(k)+m:] - case WireStartGroup: - _, i := findEndGroup(b) - if i == -1 { - return b, io.ErrUnexpectedEOF - } - b = b[i:] - default: - return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire) - } - return b, nil -} - -// findEndGroup finds the index of the next EndGroup tag. -// Groups may be nested, so the "next" EndGroup tag is the first -// unpaired EndGroup. -// findEndGroup returns the indexes of the start and end of the EndGroup tag. -// Returns (-1,-1) if it can't find one. -func findEndGroup(b []byte) (int, int) { - depth := 1 - i := 0 - for { - x, n := decodeVarint(b[i:]) - if n == 0 { - return -1, -1 - } - j := i - i += n - switch x & 7 { - case WireVarint: - _, k := decodeVarint(b[i:]) - if k == 0 { - return -1, -1 - } - i += k - case WireFixed32: - if len(b)-4 < i { - return -1, -1 - } - i += 4 - case WireFixed64: - if len(b)-8 < i { - return -1, -1 - } - i += 8 - case WireBytes: - m, k := decodeVarint(b[i:]) - if k == 0 { - return -1, -1 - } - i += k - if uint64(len(b)-i) < m { - return -1, -1 - } - i += int(m) - case WireStartGroup: - depth++ - case WireEndGroup: - depth-- - if depth == 0 { - return j, i - } - default: - return -1, -1 - } - } -} - -// encodeVarint appends a varint-encoded integer to b and returns the result. -func encodeVarint(b []byte, x uint64) []byte { - for x >= 1<<7 { - b = append(b, byte(x&0x7f|0x80)) - x >>= 7 - } - return append(b, byte(x)) -} - -// decodeVarint reads a varint-encoded integer from b. -// Returns the decoded integer and the number of bytes read. -// If there is an error, it returns 0,0. -func decodeVarint(b []byte) (uint64, int) { - var x, y uint64 - if len(b) == 0 { - goto bad - } - x = uint64(b[0]) - if x < 0x80 { - return x, 1 - } - x -= 0x80 - - if len(b) <= 1 { - goto bad - } - y = uint64(b[1]) - x += y << 7 - if y < 0x80 { - return x, 2 - } - x -= 0x80 << 7 - - if len(b) <= 2 { - goto bad - } - y = uint64(b[2]) - x += y << 14 - if y < 0x80 { - return x, 3 - } - x -= 0x80 << 14 - - if len(b) <= 3 { - goto bad - } - y = uint64(b[3]) - x += y << 21 - if y < 0x80 { - return x, 4 - } - x -= 0x80 << 21 - - if len(b) <= 4 { - goto bad - } - y = uint64(b[4]) - x += y << 28 - if y < 0x80 { - return x, 5 - } - x -= 0x80 << 28 - - if len(b) <= 5 { - goto bad - } - y = uint64(b[5]) - x += y << 35 - if y < 0x80 { - return x, 6 - } - x -= 0x80 << 35 - - if len(b) <= 6 { - goto bad - } - y = uint64(b[6]) - x += y << 42 - if y < 0x80 { - return x, 7 - } - x -= 0x80 << 42 - - if len(b) <= 7 { - goto bad - } - y = uint64(b[7]) - x += y << 49 - if y < 0x80 { - return x, 8 - } - x -= 0x80 << 49 - - if len(b) <= 8 { - goto bad - } - y = uint64(b[8]) - x += y << 56 - if y < 0x80 { - return x, 9 - } - x -= 0x80 << 56 - - if len(b) <= 9 { - goto bad - } - y = uint64(b[9]) - x += y << 63 - if y < 2 { - return x, 10 - } - -bad: - return 0, 0 -} diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/text.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/text.go deleted file mode 100644 index 1aaee725..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/text.go +++ /dev/null @@ -1,843 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -// Functions for writing the text protocol buffer format. - -import ( - "bufio" - "bytes" - "encoding" - "errors" - "fmt" - "io" - "log" - "math" - "reflect" - "sort" - "strings" -) - -var ( - newline = []byte("\n") - spaces = []byte(" ") - endBraceNewline = []byte("}\n") - backslashN = []byte{'\\', 'n'} - backslashR = []byte{'\\', 'r'} - backslashT = []byte{'\\', 't'} - backslashDQ = []byte{'\\', '"'} - backslashBS = []byte{'\\', '\\'} - posInf = []byte("inf") - negInf = []byte("-inf") - nan = []byte("nan") -) - -type writer interface { - io.Writer - WriteByte(byte) error -} - -// textWriter is an io.Writer that tracks its indentation level. -type textWriter struct { - ind int - complete bool // if the current position is a complete line - compact bool // whether to write out as a one-liner - w writer -} - -func (w *textWriter) WriteString(s string) (n int, err error) { - if !strings.Contains(s, "\n") { - if !w.compact && w.complete { - w.writeIndent() - } - w.complete = false - return io.WriteString(w.w, s) - } - // WriteString is typically called without newlines, so this - // codepath and its copy are rare. We copy to avoid - // duplicating all of Write's logic here. - return w.Write([]byte(s)) -} - -func (w *textWriter) Write(p []byte) (n int, err error) { - newlines := bytes.Count(p, newline) - if newlines == 0 { - if !w.compact && w.complete { - w.writeIndent() - } - n, err = w.w.Write(p) - w.complete = false - return n, err - } - - frags := bytes.SplitN(p, newline, newlines+1) - if w.compact { - for i, frag := range frags { - if i > 0 { - if err := w.w.WriteByte(' '); err != nil { - return n, err - } - n++ - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - } - return n, nil - } - - for i, frag := range frags { - if w.complete { - w.writeIndent() - } - nn, err := w.w.Write(frag) - n += nn - if err != nil { - return n, err - } - if i+1 < len(frags) { - if err := w.w.WriteByte('\n'); err != nil { - return n, err - } - n++ - } - } - w.complete = len(frags[len(frags)-1]) == 0 - return n, nil -} - -func (w *textWriter) WriteByte(c byte) error { - if w.compact && c == '\n' { - c = ' ' - } - if !w.compact && w.complete { - w.writeIndent() - } - err := w.w.WriteByte(c) - w.complete = c == '\n' - return err -} - -func (w *textWriter) indent() { w.ind++ } - -func (w *textWriter) unindent() { - if w.ind == 0 { - log.Print("proto: textWriter unindented too far") - return - } - w.ind-- -} - -func writeName(w *textWriter, props *Properties) error { - if _, err := w.WriteString(props.OrigName); err != nil { - return err - } - if props.Wire != "group" { - return w.WriteByte(':') - } - return nil -} - -func requiresQuotes(u string) bool { - // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. - for _, ch := range u { - switch { - case ch == '.' || ch == '/' || ch == '_': - continue - case '0' <= ch && ch <= '9': - continue - case 'A' <= ch && ch <= 'Z': - continue - case 'a' <= ch && ch <= 'z': - continue - default: - return true - } - } - return false -} - -// isAny reports whether sv is a google.protobuf.Any message -func isAny(sv reflect.Value) bool { - type wkt interface { - XXX_WellKnownType() string - } - t, ok := sv.Addr().Interface().(wkt) - return ok && t.XXX_WellKnownType() == "Any" -} - -// writeProto3Any writes an expanded google.protobuf.Any message. -// -// It returns (false, nil) if sv value can't be unmarshaled (e.g. because -// required messages are not linked in). -// -// It returns (true, error) when sv was written in expanded format or an error -// was encountered. -func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) { - turl := sv.FieldByName("TypeUrl") - val := sv.FieldByName("Value") - if !turl.IsValid() || !val.IsValid() { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - b, ok := val.Interface().([]byte) - if !ok { - return true, errors.New("proto: invalid google.protobuf.Any message") - } - - parts := strings.Split(turl.String(), "/") - mt := MessageType(parts[len(parts)-1]) - if mt == nil { - return false, nil - } - m := reflect.New(mt.Elem()) - if err := Unmarshal(b, m.Interface().(Message)); err != nil { - return false, nil - } - w.Write([]byte("[")) - u := turl.String() - if requiresQuotes(u) { - writeString(w, u) - } else { - w.Write([]byte(u)) - } - if w.compact { - w.Write([]byte("]:<")) - } else { - w.Write([]byte("]: <\n")) - w.ind++ - } - if err := tm.writeStruct(w, m.Elem()); err != nil { - return true, err - } - if w.compact { - w.Write([]byte("> ")) - } else { - w.ind-- - w.Write([]byte(">\n")) - } - return true, nil -} - -func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { - if tm.ExpandAny && isAny(sv) { - if canExpand, err := tm.writeProto3Any(w, sv); canExpand { - return err - } - } - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < sv.NumField(); i++ { - fv := sv.Field(i) - props := sprops.Prop[i] - name := st.Field(i).Name - - if name == "XXX_NoUnkeyedLiteral" { - continue - } - - if strings.HasPrefix(name, "XXX_") { - // There are two XXX_ fields: - // XXX_unrecognized []byte - // XXX_extensions map[int32]proto.Extension - // The first is handled here; - // the second is handled at the bottom of this function. - if name == "XXX_unrecognized" && !fv.IsNil() { - if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Field not filled in. This could be an optional field or - // a required field that wasn't filled in. Either way, there - // isn't anything we can show for it. - continue - } - if fv.Kind() == reflect.Slice && fv.IsNil() { - // Repeated field that is empty, or a bytes field that is unused. - continue - } - - if props.Repeated && fv.Kind() == reflect.Slice { - // Repeated field. - for j := 0; j < fv.Len(); j++ { - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - v := fv.Index(j) - if v.Kind() == reflect.Ptr && v.IsNil() { - // A nil message in a repeated field is not valid, - // but we can handle that more gracefully than panicking. - if _, err := w.Write([]byte("\n")); err != nil { - return err - } - continue - } - if err := tm.writeAny(w, v, props); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if fv.Kind() == reflect.Map { - // Map fields are rendered as a repeated struct with key/value fields. - keys := fv.MapKeys() - sort.Sort(mapKeys(keys)) - for _, key := range keys { - val := fv.MapIndex(key) - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - // open struct - if err := w.WriteByte('<'); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - // key - if _, err := w.WriteString("key:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, key, props.MapKeyProp); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - // nil values aren't legal, but we can avoid panicking because of them. - if val.Kind() != reflect.Ptr || !val.IsNil() { - // value - if _, err := w.WriteString("value:"); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, val, props.MapValProp); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - // close struct - w.unindent() - if err := w.WriteByte('>'); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - } - continue - } - if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 { - // empty bytes field - continue - } - if fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice { - // proto3 non-repeated scalar field; skip if zero value - if isProto3Zero(fv) { - continue - } - } - - if fv.Kind() == reflect.Interface { - // Check if it is a oneof. - if st.Field(i).Tag.Get("protobuf_oneof") != "" { - // fv is nil, or holds a pointer to generated struct. - // That generated struct has exactly one field, - // which has a protobuf struct tag. - if fv.IsNil() { - continue - } - inner := fv.Elem().Elem() // interface -> *T -> T - tag := inner.Type().Field(0).Tag.Get("protobuf") - props = new(Properties) // Overwrite the outer props var, but not its pointee. - props.Parse(tag) - // Write the value in the oneof, not the oneof itself. - fv = inner.Field(0) - - // Special case to cope with malformed messages gracefully: - // If the value in the oneof is a nil pointer, don't panic - // in writeAny. - if fv.Kind() == reflect.Ptr && fv.IsNil() { - // Use errors.New so writeAny won't render quotes. - msg := errors.New("/* nil */") - fv = reflect.ValueOf(&msg).Elem() - } - } - } - - if err := writeName(w, props); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - - // Enums have a String method, so writeAny will work fine. - if err := tm.writeAny(w, fv, props); err != nil { - return err - } - - if err := w.WriteByte('\n'); err != nil { - return err - } - } - - // Extensions (the XXX_extensions field). - pv := sv.Addr() - if _, err := extendable(pv.Interface()); err == nil { - if err := tm.writeExtensions(w, pv); err != nil { - return err - } - } - - return nil -} - -// writeAny writes an arbitrary field. -func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { - v = reflect.Indirect(v) - - // Floats have special cases. - if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { - x := v.Float() - var b []byte - switch { - case math.IsInf(x, 1): - b = posInf - case math.IsInf(x, -1): - b = negInf - case math.IsNaN(x): - b = nan - } - if b != nil { - _, err := w.Write(b) - return err - } - // Other values are handled below. - } - - // We don't attempt to serialise every possible value type; only those - // that can occur in protocol buffers. - switch v.Kind() { - case reflect.Slice: - // Should only be a []byte; repeated fields are handled in writeStruct. - if err := writeString(w, string(v.Bytes())); err != nil { - return err - } - case reflect.String: - if err := writeString(w, v.String()); err != nil { - return err - } - case reflect.Struct: - // Required/optional group/message. - var bra, ket byte = '<', '>' - if props != nil && props.Wire == "group" { - bra, ket = '{', '}' - } - if err := w.WriteByte(bra); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - if v.CanAddr() { - // Calling v.Interface on a struct causes the reflect package to - // copy the entire struct. This is racy with the new Marshaler - // since we atomically update the XXX_sizecache. - // - // Thus, we retrieve a pointer to the struct if possible to avoid - // a race since v.Interface on the pointer doesn't copy the struct. - // - // If v is not addressable, then we are not worried about a race - // since it implies that the binary Marshaler cannot possibly be - // mutating this value. - v = v.Addr() - } - if etm, ok := v.Interface().(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = w.Write(text); err != nil { - return err - } - } else { - if v.Kind() == reflect.Ptr { - v = v.Elem() - } - if err := tm.writeStruct(w, v); err != nil { - return err - } - } - w.unindent() - if err := w.WriteByte(ket); err != nil { - return err - } - default: - _, err := fmt.Fprint(w, v.Interface()) - return err - } - return nil -} - -// equivalent to C's isprint. -func isprint(c byte) bool { - return c >= 0x20 && c < 0x7f -} - -// writeString writes a string in the protocol buffer text format. -// It is similar to strconv.Quote except we don't use Go escape sequences, -// we treat the string as a byte sequence, and we use octal escapes. -// These differences are to maintain interoperability with the other -// languages' implementations of the text format. -func writeString(w *textWriter, s string) error { - // use WriteByte here to get any needed indent - if err := w.WriteByte('"'); err != nil { - return err - } - // Loop over the bytes, not the runes. - for i := 0; i < len(s); i++ { - var err error - // Divergence from C++: we don't escape apostrophes. - // There's no need to escape them, and the C++ parser - // copes with a naked apostrophe. - switch c := s[i]; c { - case '\n': - _, err = w.w.Write(backslashN) - case '\r': - _, err = w.w.Write(backslashR) - case '\t': - _, err = w.w.Write(backslashT) - case '"': - _, err = w.w.Write(backslashDQ) - case '\\': - _, err = w.w.Write(backslashBS) - default: - if isprint(c) { - err = w.w.WriteByte(c) - } else { - _, err = fmt.Fprintf(w.w, "\\%03o", c) - } - } - if err != nil { - return err - } - } - return w.WriteByte('"') -} - -func writeUnknownStruct(w *textWriter, data []byte) (err error) { - if !w.compact { - if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil { - return err - } - } - b := NewBuffer(data) - for b.index < len(b.buf) { - x, err := b.DecodeVarint() - if err != nil { - _, err := fmt.Fprintf(w, "/* %v */\n", err) - return err - } - wire, tag := x&7, x>>3 - if wire == WireEndGroup { - w.unindent() - if _, err := w.Write(endBraceNewline); err != nil { - return err - } - continue - } - if _, err := fmt.Fprint(w, tag); err != nil { - return err - } - if wire != WireStartGroup { - if err := w.WriteByte(':'); err != nil { - return err - } - } - if !w.compact || wire == WireStartGroup { - if err := w.WriteByte(' '); err != nil { - return err - } - } - switch wire { - case WireBytes: - buf, e := b.DecodeRawBytes(false) - if e == nil { - _, err = fmt.Fprintf(w, "%q", buf) - } else { - _, err = fmt.Fprintf(w, "/* %v */", e) - } - case WireFixed32: - x, err = b.DecodeFixed32() - err = writeUnknownInt(w, x, err) - case WireFixed64: - x, err = b.DecodeFixed64() - err = writeUnknownInt(w, x, err) - case WireStartGroup: - err = w.WriteByte('{') - w.indent() - case WireVarint: - x, err = b.DecodeVarint() - err = writeUnknownInt(w, x, err) - default: - _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire) - } - if err != nil { - return err - } - if err = w.WriteByte('\n'); err != nil { - return err - } - } - return nil -} - -func writeUnknownInt(w *textWriter, x uint64, err error) error { - if err == nil { - _, err = fmt.Fprint(w, x) - } else { - _, err = fmt.Fprintf(w, "/* %v */", err) - } - return err -} - -type int32Slice []int32 - -func (s int32Slice) Len() int { return len(s) } -func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } -func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -// writeExtensions writes all the extensions in pv. -// pv is assumed to be a pointer to a protocol message struct that is extendable. -func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error { - emap := extensionMaps[pv.Type().Elem()] - ep, _ := extendable(pv.Interface()) - - // Order the extensions by ID. - // This isn't strictly necessary, but it will give us - // canonical output, which will also make testing easier. - m, mu := ep.extensionsRead() - if m == nil { - return nil - } - mu.Lock() - ids := make([]int32, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) - mu.Unlock() - - for _, extNum := range ids { - ext := m[extNum] - var desc *ExtensionDesc - if emap != nil { - desc = emap[extNum] - } - if desc == nil { - // Unknown extension. - if err := writeUnknownStruct(w, ext.enc); err != nil { - return err - } - continue - } - - pb, err := GetExtension(ep, desc) - if err != nil { - return fmt.Errorf("failed getting extension: %v", err) - } - - // Repeated extensions will appear as a slice. - if !desc.repeated() { - if err := tm.writeExtension(w, desc.Name, pb); err != nil { - return err - } - } else { - v := reflect.ValueOf(pb) - for i := 0; i < v.Len(); i++ { - if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil { - return err - } - } - } - } - return nil -} - -func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error { - if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte(' '); err != nil { - return err - } - } - if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil { - return err - } - if err := w.WriteByte('\n'); err != nil { - return err - } - return nil -} - -func (w *textWriter) writeIndent() { - if !w.complete { - return - } - remain := w.ind * 2 - for remain > 0 { - n := remain - if n > len(spaces) { - n = len(spaces) - } - w.w.Write(spaces[:n]) - remain -= n - } - w.complete = false -} - -// TextMarshaler is a configurable text format marshaler. -type TextMarshaler struct { - Compact bool // use compact text format (one line). - ExpandAny bool // expand google.protobuf.Any messages of known types -} - -// Marshal writes a given protocol buffer in text format. -// The only errors returned are from w. -func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error { - val := reflect.ValueOf(pb) - if pb == nil || val.IsNil() { - w.Write([]byte("")) - return nil - } - var bw *bufio.Writer - ww, ok := w.(writer) - if !ok { - bw = bufio.NewWriter(w) - ww = bw - } - aw := &textWriter{ - w: ww, - complete: true, - compact: tm.Compact, - } - - if etm, ok := pb.(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() - if err != nil { - return err - } - if _, err = aw.Write(text); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil - } - // Dereference the received pointer so we don't have outer < and >. - v := reflect.Indirect(val) - if err := tm.writeStruct(aw, v); err != nil { - return err - } - if bw != nil { - return bw.Flush() - } - return nil -} - -// Text is the same as Marshal, but returns the string directly. -func (tm *TextMarshaler) Text(pb Message) string { - var buf bytes.Buffer - tm.Marshal(&buf, pb) - return buf.String() -} - -var ( - defaultTextMarshaler = TextMarshaler{} - compactTextMarshaler = TextMarshaler{Compact: true} -) - -// TODO: consider removing some of the Marshal functions below. - -// MarshalText writes a given protocol buffer in text format. -// The only errors returned are from w. -func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) } - -// MarshalTextString is the same as MarshalText, but returns the string directly. -func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) } - -// CompactText writes a given protocol buffer in compact text format (one line). -func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) } - -// CompactTextString is the same as CompactText, but returns the string directly. -func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) } diff --git a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/text_parser.go b/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/text_parser.go deleted file mode 100644 index bb55a3af..00000000 --- a/chaincode/abac/go/vendor/github.com/golang/protobuf/proto/text_parser.go +++ /dev/null @@ -1,880 +0,0 @@ -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// https://github.com/golang/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package proto - -// Functions for parsing the Text protocol buffer format. -// TODO: message sets. - -import ( - "encoding" - "errors" - "fmt" - "reflect" - "strconv" - "strings" - "unicode/utf8" -) - -// Error string emitted when deserializing Any and fields are already set -const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set" - -type ParseError struct { - Message string - Line int // 1-based line number - Offset int // 0-based byte offset from start of input -} - -func (p *ParseError) Error() string { - if p.Line == 1 { - // show offset only for first line - return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message) - } - return fmt.Sprintf("line %d: %v", p.Line, p.Message) -} - -type token struct { - value string - err *ParseError - line int // line number - offset int // byte number from start of input, not start of line - unquoted string // the unquoted version of value, if it was a quoted string -} - -func (t *token) String() string { - if t.err == nil { - return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset) - } - return fmt.Sprintf("parse error: %v", t.err) -} - -type textParser struct { - s string // remaining input - done bool // whether the parsing is finished (success or error) - backed bool // whether back() was called - offset, line int - cur token -} - -func newTextParser(s string) *textParser { - p := new(textParser) - p.s = s - p.line = 1 - p.cur.line = 1 - return p -} - -func (p *textParser) errorf(format string, a ...interface{}) *ParseError { - pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset} - p.cur.err = pe - p.done = true - return pe -} - -// Numbers and identifiers are matched by [-+._A-Za-z0-9] -func isIdentOrNumberChar(c byte) bool { - switch { - case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z': - return true - case '0' <= c && c <= '9': - return true - } - switch c { - case '-', '+', '.', '_': - return true - } - return false -} - -func isWhitespace(c byte) bool { - switch c { - case ' ', '\t', '\n', '\r': - return true - } - return false -} - -func isQuote(c byte) bool { - switch c { - case '"', '\'': - return true - } - return false -} - -func (p *textParser) skipWhitespace() { - i := 0 - for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') { - if p.s[i] == '#' { - // comment; skip to end of line or input - for i < len(p.s) && p.s[i] != '\n' { - i++ - } - if i == len(p.s) { - break - } - } - if p.s[i] == '\n' { - p.line++ - } - i++ - } - p.offset += i - p.s = p.s[i:len(p.s)] - if len(p.s) == 0 { - p.done = true - } -} - -func (p *textParser) advance() { - // Skip whitespace - p.skipWhitespace() - if p.done { - return - } - - // Start of non-whitespace - p.cur.err = nil - p.cur.offset, p.cur.line = p.offset, p.line - p.cur.unquoted = "" - switch p.s[0] { - case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/': - // Single symbol - p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)] - case '"', '\'': - // Quoted string - i := 1 - for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' { - if p.s[i] == '\\' && i+1 < len(p.s) { - // skip escaped char - i++ - } - i++ - } - if i >= len(p.s) || p.s[i] != p.s[0] { - p.errorf("unmatched quote") - return - } - unq, err := unquoteC(p.s[1:i], rune(p.s[0])) - if err != nil { - p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err) - return - } - p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)] - p.cur.unquoted = unq - default: - i := 0 - for i < len(p.s) && isIdentOrNumberChar(p.s[i]) { - i++ - } - if i == 0 { - p.errorf("unexpected byte %#x", p.s[0]) - return - } - p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)] - } - p.offset += len(p.cur.value) -} - -var ( - errBadUTF8 = errors.New("proto: bad UTF-8") -) - -func unquoteC(s string, quote rune) (string, error) { - // This is based on C++'s tokenizer.cc. - // Despite its name, this is *not* parsing C syntax. - // For instance, "\0" is an invalid quoted string. - - // Avoid allocation in trivial cases. - simple := true - for _, r := range s { - if r == '\\' || r == quote { - simple = false - break - } - } - if simple { - return s, nil - } - - buf := make([]byte, 0, 3*len(s)/2) - for len(s) > 0 { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", errBadUTF8 - } - s = s[n:] - if r != '\\' { - if r < utf8.RuneSelf { - buf = append(buf, byte(r)) - } else { - buf = append(buf, string(r)...) - } - continue - } - - ch, tail, err := unescape(s) - if err != nil { - return "", err - } - buf = append(buf, ch...) - s = tail - } - return string(buf), nil -} - -func unescape(s string) (ch string, tail string, err error) { - r, n := utf8.DecodeRuneInString(s) - if r == utf8.RuneError && n == 1 { - return "", "", errBadUTF8 - } - s = s[n:] - switch r { - case 'a': - return "\a", s, nil - case 'b': - return "\b", s, nil - case 'f': - return "\f", s, nil - case 'n': - return "\n", s, nil - case 'r': - return "\r", s, nil - case 't': - return "\t", s, nil - case 'v': - return "\v", s, nil - case '?': - return "?", s, nil // trigraph workaround - case '\'', '"', '\\': - return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7': - if len(s) < 2 { - return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) - } - ss := string(r) + s[:2] - s = s[2:] - i, err := strconv.ParseUint(ss, 8, 8) - if err != nil { - return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) - } - return string([]byte{byte(i)}), s, nil - case 'x', 'X', 'u', 'U': - var n int - switch r { - case 'x', 'X': - n = 2 - case 'u': - n = 4 - case 'U': - n = 8 - } - if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) - } - ss := s[:n] - s = s[n:] - i, err := strconv.ParseUint(ss, 16, 64) - if err != nil { - return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) - } - if r == 'x' || r == 'X' { - return string([]byte{byte(i)}), s, nil - } - if i > utf8.MaxRune { - return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) - } - return string(i), s, nil - } - return "", "", fmt.Errorf(`unknown escape \%c`, r) -} - -// Back off the parser by one token. Can only be done between calls to next(). -// It makes the next advance() a no-op. -func (p *textParser) back() { p.backed = true } - -// Advances the parser and returns the new current token. -func (p *textParser) next() *token { - if p.backed || p.done { - p.backed = false - return &p.cur - } - p.advance() - if p.done { - p.cur.value = "" - } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) { - // Look for multiple quoted strings separated by whitespace, - // and concatenate them. - cat := p.cur - for { - p.skipWhitespace() - if p.done || !isQuote(p.s[0]) { - break - } - p.advance() - if p.cur.err != nil { - return &p.cur - } - cat.value += " " + p.cur.value - cat.unquoted += p.cur.unquoted - } - p.done = false // parser may have seen EOF, but we want to return cat - p.cur = cat - } - return &p.cur -} - -func (p *textParser) consumeToken(s string) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != s { - p.back() - return p.errorf("expected %q, found %q", s, tok.value) - } - return nil -} - -// Return a RequiredNotSetError indicating which required field was not set. -func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError { - st := sv.Type() - sprops := GetProperties(st) - for i := 0; i < st.NumField(); i++ { - if !isNil(sv.Field(i)) { - continue - } - - props := sprops.Prop[i] - if props.Required { - return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)} - } - } - return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen -} - -// Returns the index in the struct for the named field, as well as the parsed tag properties. -func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) { - i, ok := sprops.decoderOrigNames[name] - if ok { - return i, sprops.Prop[i], true - } - return -1, nil, false -} - -// Consume a ':' from the input stream (if the next token is a colon), -// returning an error if a colon is needed but not present. -func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ":" { - // Colon is optional when the field is a group or message. - needColon := true - switch props.Wire { - case "group": - needColon = false - case "bytes": - // A "bytes" field is either a message, a string, or a repeated field; - // those three become *T, *string and []T respectively, so we can check for - // this field being a pointer to a non-string. - if typ.Kind() == reflect.Ptr { - // *T or *string - if typ.Elem().Kind() == reflect.String { - break - } - } else if typ.Kind() == reflect.Slice { - // []T or []*T - if typ.Elem().Kind() != reflect.Ptr { - break - } - } else if typ.Kind() == reflect.String { - // The proto3 exception is for a string field, - // which requires a colon. - break - } - needColon = false - } - if needColon { - return p.errorf("expected ':', found %q", tok.value) - } - p.back() - } - return nil -} - -func (p *textParser) readStruct(sv reflect.Value, terminator string) error { - st := sv.Type() - sprops := GetProperties(st) - reqCount := sprops.reqCount - var reqFieldErr error - fieldSet := make(map[string]bool) - // A struct is a sequence of "name: value", terminated by one of - // '>' or '}', or the end of the input. A name may also be - // "[extension]" or "[type/url]". - // - // The whole struct can also be an expanded Any message, like: - // [type/url] < ... struct contents ... > - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - if tok.value == "[" { - // Looks like an extension or an Any. - // - // TODO: Check whether we need to handle - // namespace rooted names (e.g. ".something.Foo"). - extName, err := p.consumeExtName() - if err != nil { - return err - } - - if s := strings.LastIndex(extName, "/"); s >= 0 { - // If it contains a slash, it's an Any type URL. - messageName := extName[s+1:] - mt := MessageType(messageName) - if mt == nil { - return p.errorf("unrecognized message %q in google.protobuf.Any", messageName) - } - tok = p.next() - if tok.err != nil { - return tok.err - } - // consume an optional colon - if tok.value == ":" { - tok = p.next() - if tok.err != nil { - return tok.err - } - } - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - v := reflect.New(mt.Elem()) - if pe := p.readStruct(v.Elem(), terminator); pe != nil { - return pe - } - b, err := Marshal(v.Interface().(Message)) - if err != nil { - return p.errorf("failed to marshal message of type %q: %v", messageName, err) - } - if fieldSet["type_url"] { - return p.errorf(anyRepeatedlyUnpacked, "type_url") - } - if fieldSet["value"] { - return p.errorf(anyRepeatedlyUnpacked, "value") - } - sv.FieldByName("TypeUrl").SetString(extName) - sv.FieldByName("Value").SetBytes(b) - fieldSet["type_url"] = true - fieldSet["value"] = true - continue - } - - var desc *ExtensionDesc - // This could be faster, but it's functional. - // TODO: Do something smarter than a linear scan. - for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) { - if d.Name == extName { - desc = d - break - } - } - if desc == nil { - return p.errorf("unrecognized extension %q", extName) - } - - props := &Properties{} - props.Parse(desc.Tag) - - typ := reflect.TypeOf(desc.ExtensionType) - if err := p.checkForColon(props, typ); err != nil { - return err - } - - rep := desc.repeated() - - // Read the extension structure, and set it in - // the value we're constructing. - var ext reflect.Value - if !rep { - ext = reflect.New(typ).Elem() - } else { - ext = reflect.New(typ.Elem()).Elem() - } - if err := p.readAny(ext, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - ep := sv.Addr().Interface().(Message) - if !rep { - SetExtension(ep, desc, ext.Interface()) - } else { - old, err := GetExtension(ep, desc) - var sl reflect.Value - if err == nil { - sl = reflect.ValueOf(old) // existing slice - } else { - sl = reflect.MakeSlice(typ, 0, 1) - } - sl = reflect.Append(sl, ext) - SetExtension(ep, desc, sl.Interface()) - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - continue - } - - // This is a normal, non-extension field. - name := tok.value - var dst reflect.Value - fi, props, ok := structFieldByName(sprops, name) - if ok { - dst = sv.Field(fi) - } else if oop, ok := sprops.OneofTypes[name]; ok { - // It is a oneof. - props = oop.Prop - nv := reflect.New(oop.Type.Elem()) - dst = nv.Elem().Field(0) - field := sv.Field(oop.Field) - if !field.IsNil() { - return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) - } - field.Set(nv) - } - if !dst.IsValid() { - return p.errorf("unknown field name %q in %v", name, st) - } - - if dst.Kind() == reflect.Map { - // Consume any colon. - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Construct the map if it doesn't already exist. - if dst.IsNil() { - dst.Set(reflect.MakeMap(dst.Type())) - } - key := reflect.New(dst.Type().Key()).Elem() - val := reflect.New(dst.Type().Elem()).Elem() - - // The map entry should be this sequence of tokens: - // < key : KEY value : VALUE > - // However, implementations may omit key or value, and technically - // we should support them in any order. See b/28924776 for a time - // this went wrong. - - tok := p.next() - var terminator string - switch tok.value { - case "<": - terminator = ">" - case "{": - terminator = "}" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - for { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == terminator { - break - } - switch tok.value { - case "key": - if err := p.consumeToken(":"); err != nil { - return err - } - if err := p.readAny(key, props.MapKeyProp); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - case "value": - if err := p.checkForColon(props.MapValProp, dst.Type().Elem()); err != nil { - return err - } - if err := p.readAny(val, props.MapValProp); err != nil { - return err - } - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - default: - p.back() - return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value) - } - } - - dst.SetMapIndex(key, val) - continue - } - - // Check that it's not already set if it's not a repeated field. - if !props.Repeated && fieldSet[name] { - return p.errorf("non-repeated field %q was repeated", name) - } - - if err := p.checkForColon(props, dst.Type()); err != nil { - return err - } - - // Parse into the field. - fieldSet[name] = true - if err := p.readAny(dst, props); err != nil { - if _, ok := err.(*RequiredNotSetError); !ok { - return err - } - reqFieldErr = err - } - if props.Required { - reqCount-- - } - - if err := p.consumeOptionalSeparator(); err != nil { - return err - } - - } - - if reqCount > 0 { - return p.missingRequiredFieldError(sv) - } - return reqFieldErr -} - -// consumeExtName consumes extension name or expanded Any type URL and the -// following ']'. It returns the name or URL consumed. -func (p *textParser) consumeExtName() (string, error) { - tok := p.next() - if tok.err != nil { - return "", tok.err - } - - // If extension name or type url is quoted, it's a single token. - if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] { - name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0])) - if err != nil { - return "", err - } - return name, p.consumeToken("]") - } - - // Consume everything up to "]" - var parts []string - for tok.value != "]" { - parts = append(parts, tok.value) - tok = p.next() - if tok.err != nil { - return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) - } - if p.done && tok.value != "]" { - return "", p.errorf("unclosed type_url or extension name") - } - } - return strings.Join(parts, ""), nil -} - -// consumeOptionalSeparator consumes an optional semicolon or comma. -// It is used in readStruct to provide backward compatibility. -func (p *textParser) consumeOptionalSeparator() error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value != ";" && tok.value != "," { - p.back() - } - return nil -} - -func (p *textParser) readAny(v reflect.Value, props *Properties) error { - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == "" { - return p.errorf("unexpected EOF") - } - - switch fv := v; fv.Kind() { - case reflect.Slice: - at := v.Type() - if at.Elem().Kind() == reflect.Uint8 { - // Special case for []byte - if tok.value[0] != '"' && tok.value[0] != '\'' { - // Deliberately written out here, as the error after - // this switch statement would write "invalid []byte: ...", - // which is not as user-friendly. - return p.errorf("invalid string: %v", tok.value) - } - bytes := []byte(tok.unquoted) - fv.Set(reflect.ValueOf(bytes)) - return nil - } - // Repeated field. - if tok.value == "[" { - // Repeated field with list notation, like [1,2,3]. - for { - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - err := p.readAny(fv.Index(fv.Len()-1), props) - if err != nil { - return err - } - tok := p.next() - if tok.err != nil { - return tok.err - } - if tok.value == "]" { - break - } - if tok.value != "," { - return p.errorf("Expected ']' or ',' found %q", tok.value) - } - } - return nil - } - // One value of the repeated field. - p.back() - fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem())) - return p.readAny(fv.Index(fv.Len()-1), props) - case reflect.Bool: - // true/1/t/True or false/f/0/False. - switch tok.value { - case "true", "1", "t", "True": - fv.SetBool(true) - return nil - case "false", "0", "f", "False": - fv.SetBool(false) - return nil - } - case reflect.Float32, reflect.Float64: - v := tok.value - // Ignore 'f' for compatibility with output generated by C++, but don't - // remove 'f' when the value is "-inf" or "inf". - if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" { - v = v[:len(v)-1] - } - if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil { - fv.SetFloat(f) - return nil - } - case reflect.Int32: - if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { - fv.SetInt(x) - return nil - } - - if len(props.Enum) == 0 { - break - } - m, ok := enumValueMaps[props.Enum] - if !ok { - break - } - x, ok := m[tok.value] - if !ok { - break - } - fv.SetInt(int64(x)) - return nil - case reflect.Int64: - if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil { - fv.SetInt(x) - return nil - } - - case reflect.Ptr: - // A basic field (indirected through pointer), or a repeated message/group - p.back() - fv.Set(reflect.New(fv.Type().Elem())) - return p.readAny(fv.Elem(), props) - case reflect.String: - if tok.value[0] == '"' || tok.value[0] == '\'' { - fv.SetString(tok.unquoted) - return nil - } - case reflect.Struct: - var terminator string - switch tok.value { - case "{": - terminator = "}" - case "<": - terminator = ">" - default: - return p.errorf("expected '{' or '<', found %q", tok.value) - } - // TODO: Handle nested messages which implement encoding.TextUnmarshaler. - return p.readStruct(fv, terminator) - case reflect.Uint32: - if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - fv.SetUint(uint64(x)) - return nil - } - case reflect.Uint64: - if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil { - fv.SetUint(x) - return nil - } - } - return p.errorf("invalid %v: %v", v.Type(), tok.value) -} - -// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb -// before starting to unmarshal, so any existing data in pb is always removed. -// If a required field is not set and no other error occurs, -// UnmarshalText returns *RequiredNotSetError. -func UnmarshalText(s string, pb Message) error { - if um, ok := pb.(encoding.TextUnmarshaler); ok { - return um.UnmarshalText([]byte(s)) - } - pb.Reset() - v := reflect.ValueOf(pb) - return newTextParser(s).readStruct(v.Elem(), "") -} diff --git a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/LICENSE b/chaincode/abac/go/vendor/github.com/hyperledger/fabric/LICENSE deleted file mode 100644 index 8f71f43f..00000000 --- a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/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/chaincode/abac/go/vendor/github.com/hyperledger/fabric/core/chaincode/shim/ext/attrmgr/attrmgr.go b/chaincode/abac/go/vendor/github.com/hyperledger/fabric/core/chaincode/shim/ext/attrmgr/attrmgr.go deleted file mode 100644 index a446f5a2..00000000 --- a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/core/chaincode/shim/ext/attrmgr/attrmgr.go +++ /dev/null @@ -1,260 +0,0 @@ -/* -Copyright IBM Corp. 2017 All Rights Reserved. - -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. -*/ - -/* - * The attrmgr package contains utilities for managing attributes. - * Attributes are added to an X509 certificate as an extension. - */ - -package attrmgr - -import ( - "crypto/x509" - "crypto/x509/pkix" - "encoding/asn1" - "encoding/json" - "fmt" - - "github.com/golang/protobuf/proto" - "github.com/hyperledger/fabric/protos/msp" - "github.com/pkg/errors" -) - -var ( - // AttrOID is the ASN.1 object identifier for an attribute extension in an - // X509 certificate - AttrOID = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6, 7, 8, 1} - // AttrOIDString is the string version of AttrOID - AttrOIDString = "1.2.3.4.5.6.7.8.1" -) - -// Attribute is a name/value pair -type Attribute interface { - // GetName returns the name of the attribute - GetName() string - // GetValue returns the value of the attribute - GetValue() string -} - -// AttributeRequest is a request for an attribute -type AttributeRequest interface { - // GetName returns the name of an attribute - GetName() string - // IsRequired returns true if the attribute is required - IsRequired() bool -} - -// New constructs an attribute manager -func New() *Mgr { return &Mgr{} } - -// Mgr is the attribute manager and is the main object for this package -type Mgr struct{} - -// ProcessAttributeRequestsForCert add attributes to an X509 certificate, given -// attribute requests and attributes. -func (mgr *Mgr) ProcessAttributeRequestsForCert(requests []AttributeRequest, attributes []Attribute, cert *x509.Certificate) error { - attrs, err := mgr.ProcessAttributeRequests(requests, attributes) - if err != nil { - return err - } - return mgr.AddAttributesToCert(attrs, cert) -} - -// ProcessAttributeRequests takes an array of attribute requests and an identity's attributes -// and returns an Attributes object containing the requested attributes. -func (mgr *Mgr) ProcessAttributeRequests(requests []AttributeRequest, attributes []Attribute) (*Attributes, error) { - attrsMap := map[string]string{} - attrs := &Attributes{Attrs: attrsMap} - missingRequiredAttrs := []string{} - // For each of the attribute requests - for _, req := range requests { - // Get the attribute - name := req.GetName() - attr := getAttrByName(name, attributes) - if attr == nil { - if req.IsRequired() { - // Didn't find attribute and it was required; return error below - missingRequiredAttrs = append(missingRequiredAttrs, name) - } - // Skip attribute requests which aren't required - continue - } - attrsMap[name] = attr.GetValue() - } - if len(missingRequiredAttrs) > 0 { - return nil, errors.Errorf("The following required attributes are missing: %+v", - missingRequiredAttrs) - } - return attrs, nil -} - -// AddAttributesToCert adds public attribute info to an X509 certificate. -func (mgr *Mgr) AddAttributesToCert(attrs *Attributes, cert *x509.Certificate) error { - buf, err := json.Marshal(attrs) - if err != nil { - return errors.Wrap(err, "Failed to marshal attributes") - } - ext := pkix.Extension{ - Id: AttrOID, - Critical: false, - Value: buf, - } - cert.Extensions = append(cert.Extensions, ext) - return nil -} - -// GetAttributesFromCert gets the attributes from a certificate. -func (mgr *Mgr) GetAttributesFromCert(cert *x509.Certificate) (*Attributes, error) { - // Get certificate attributes from the certificate if it exists - buf, err := getAttributesFromCert(cert) - if err != nil { - return nil, err - } - // Unmarshal into attributes object - attrs := &Attributes{} - if buf != nil { - err := json.Unmarshal(buf, attrs) - if err != nil { - return nil, errors.Wrap(err, "Failed to unmarshal attributes from certificate") - } - } - return attrs, nil -} - -func (mgr *Mgr) GetAttributesFromIdemix(creator []byte) (*Attributes, error) { - if creator == nil { - return nil, errors.New("creator is nil") - } - - sid := &msp.SerializedIdentity{} - err := proto.Unmarshal(creator, sid) - if err != nil { - return nil, errors.Wrap(err, "failed to unmarshal transaction invoker's identity") - } - idemixID := &msp.SerializedIdemixIdentity{} - err = proto.Unmarshal(sid.IdBytes, idemixID) - if err != nil { - return nil, errors.Wrap(err, "failed to unmarshal transaction invoker's idemix identity") - } - // Unmarshal into attributes object - attrs := &Attributes{ - Attrs: make(map[string]string), - } - - ou := &msp.OrganizationUnit{} - err = proto.Unmarshal(idemixID.Ou, ou) - if err != nil { - return nil, errors.Wrap(err, "failed to unmarshal transaction invoker's ou") - } - attrs.Attrs["ou"] = ou.OrganizationalUnitIdentifier - - role := &msp.MSPRole{} - err = proto.Unmarshal(idemixID.Role, role) - if err != nil { - return nil, errors.Wrap(err, "failed to unmarshal transaction invoker's role") - } - var roleStr string - switch role.Role { - case 0: - roleStr = "member" - case 1: - roleStr = "admin" - case 2: - roleStr = "client" - case 3: - roleStr = "peer" - } - attrs.Attrs["role"] = roleStr - - return attrs, nil -} - -// Attributes contains attribute names and values -type Attributes struct { - Attrs map[string]string `json:"attrs"` -} - -// Names returns the names of the attributes -func (a *Attributes) Names() []string { - i := 0 - names := make([]string, len(a.Attrs)) - for name := range a.Attrs { - names[i] = name - i++ - } - return names -} - -// Contains returns true if the named attribute is found -func (a *Attributes) Contains(name string) bool { - _, ok := a.Attrs[name] - return ok -} - -// Value returns an attribute's value -func (a *Attributes) Value(name string) (string, bool, error) { - attr, ok := a.Attrs[name] - return attr, ok, nil -} - -// True returns nil if the value of attribute 'name' is true; -// otherwise, an appropriate error is returned. -func (a *Attributes) True(name string) error { - val, ok, err := a.Value(name) - if err != nil { - return err - } - if !ok { - return fmt.Errorf("Attribute '%s' was not found", name) - } - if val != "true" { - return fmt.Errorf("Attribute '%s' is not true", name) - } - return nil -} - -// Get the attribute info from a certificate extension, or return nil if not found -func getAttributesFromCert(cert *x509.Certificate) ([]byte, error) { - for _, ext := range cert.Extensions { - if isAttrOID(ext.Id) { - return ext.Value, nil - } - } - return nil, nil -} - -// Is the object ID equal to the attribute info object ID? -func isAttrOID(oid asn1.ObjectIdentifier) bool { - if len(oid) != len(AttrOID) { - return false - } - for idx, val := range oid { - if val != AttrOID[idx] { - return false - } - } - return true -} - -// Get an attribute from 'attrs' by its name, or nil if not found -func getAttrByName(name string, attrs []Attribute) Attribute { - for _, attr := range attrs { - if attr.GetName() == name { - return attr - } - } - return nil -} diff --git a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/core/chaincode/shim/ext/cid/README.md b/chaincode/abac/go/vendor/github.com/hyperledger/fabric/core/chaincode/shim/ext/cid/README.md deleted file mode 100644 index b3add7dc..00000000 --- a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/core/chaincode/shim/ext/cid/README.md +++ /dev/null @@ -1,214 +0,0 @@ -# Client Identity Chaincode Library - -The client identity chaincode library enables you to write chaincode which -makes access control decisions based on the identity of the client -(i.e. the invoker of the chaincode). In particular, you may make access -control decisions based on either or both of the following associated with -the client: - -* the client identity's MSP (Membership Service Provider) ID -* an attribute associated with the client identity - -Attributes are simply name and value pairs associated with an identity. -For example, `email=me@gmail.com` indicates an identity has the `email` -attribute with a value of `me@gmail.com`. - - -## Using the client identity chaincode library - -This section describes how to use the client identity chaincode library. - -All code samples below assume two things: -1. The type of the `stub` variable is `ChaincodeStubInterface` as passed - to your chaincode. -2. You have added the following import statement to your chaincode. - ``` - import "github.com/hyperledger/fabric/core/chaincode/lib/cid" - ``` -#### Getting the client's ID - -The following demonstrates how to get an ID for the client which is guaranteed -to be unique within the MSP: - -``` -id, err := cid.GetID(stub) -``` - -#### Getting the MSP ID - -The following demonstrates how to get the MSP ID of the client's identity: - -``` -mspid, err := cid.GetMSPID(stub) -``` - -#### Getting an attribute value - -The following demonstrates how to get the value of the *attr1* attribute: - -``` -val, ok, err := cid.GetAttributeValue(stub, "attr1") -if err != nil { - // There was an error trying to retrieve the attribute -} -if !ok { - // The client identity does not possess the attribute -} -// Do something with the value of 'val' -``` - -#### Asserting an attribute value - -Often all you want to do is to make an access control decision based on the value -of an attribute, i.e. to assert the value of an attribute. For example, the following -will return an error if the client does not have the `myapp.admin` attribute -with a value of `true`: - -``` -err := cid.AssertAttributeValue(stub, "myapp.admin", "true") -if err != nil { - // Return an error -} -``` - -This is effectively using attributes to implement role-based access control, -or RBAC for short. - -#### Getting the client's X509 certificate - -The following demonstrates how to get the X509 certificate of the client, or -nil if the client's identity was not based on an X509 certificate: - -``` -cert, err := cid.GetX509Certificate(stub) -``` - -Note that both `cert` and `err` may be nil as will be the case if the identity -is not using an X509 certificate. - -#### Performing multiple operations more efficiently - -Sometimes you may need to perform multiple operations in order to make an access -decision. For example, the following demonstrates how to grant access to -identities with MSP *org1MSP* and *attr1* OR with MSP *org1MSP* and *attr2*. - -``` -// Get the client ID object -id, err := cid.New(stub) -if err != nil { - // Handle error -} -mspid, err := id.GetMSPID() -if err != nil { - // Handle error -} -switch mspid { - case "org1MSP": - err = id.AssertAttributeValue("attr1", "true") - case "org2MSP": - err = id.AssertAttributeValue("attr2", "true") - default: - err = errors.New("Wrong MSP") -} -``` -Although it is not required, it is more efficient to make the `cid.New` call -to get the ClientIdentity object if you need to perform multiple operations, -as demonstrated above. - -## Adding Attributes to Identities - -This section describes how to add custom attributes to certificates when -using Hyperledger Fabric CA as well as when using an external CA. - -#### Managing attributes with Fabric CA - -There are two methods of adding attributes to an enrollment certificate -with fabric-ca: - - 1. When you register an identity, you can specify that an enrollment certificate - issued for the identity should by default contain an attribute. This behavior - can be overridden at enrollment time, but this is useful for establishing - default behavior and, assuming registration occurs outside of your application, - does not require any application change. - - The following shows how to register *user1* with two attributes: - *app1Admin* and *email*. - The ":ecert" suffix causes the *appAdmin* attribute to be inserted into user1's - enrollment certificate by default. The *email* attribute is not added - to the enrollment certificate by default. - - ``` - fabric-ca-client register --id.name user1 --id.secret user1pw --id.type user --id.affiliation org1 --id.attrs 'app1Admin=true:ecert,email=user1@gmail.com' - ``` - - 2. When you enroll an identity, you may request that one or more attributes - be added to the certificate. - For each attribute requested, you may specify whether the attribute is - optional or not. If it is not optional but does not exist for the identity, - enrollment fails. - - The following shows how to enroll *user1* with the *email* attribute, - without the *app1Admin* attribute and optionally with the *phone* attribute - (if the user possesses *phone* attribute). - ``` - fabric-ca-client enroll -u http://user1:user1pw@localhost:7054 --enrollment.attrs "email,phone:opt" - ``` -#### Attribute format in a certificate - -Attributes are stored inside an X509 certificate as an extension with an -ASN.1 OID (Abstract Syntax Notation Object IDentifier) -of `1.2.3.4.5.6.7.8.1`. The value of the extension is a JSON string of the -form `{"attrs":{: 0 { - s += "," - } - for j, tv := range rdn { - if j > 0 { - s += "+" - } - typeString := tv.Type.String() - typeName, ok := attributeTypeNames[typeString] - if !ok { - derBytes, err := asn1.Marshal(tv.Value) - if err == nil { - s += typeString + "=#" + hex.EncodeToString(derBytes) - continue // No value escaping necessary. - } - typeName = typeString - } - valueString := fmt.Sprint(tv.Value) - escaped := "" - begin := 0 - for idx, c := range valueString { - if (idx == 0 && (c == ' ' || c == '#')) || - (idx == len(valueString)-1 && c == ' ') { - escaped += valueString[begin:idx] - escaped += "\\" + string(c) - begin = idx + 1 - continue - } - switch c { - case ',', '+', '"', '\\', '<', '>', ';': - escaped += valueString[begin:idx] - escaped += "\\" + string(c) - begin = idx + 1 - } - } - escaped += valueString[begin:] - s += typeName + "=" + escaped - } - } - return s -} - -var attributeTypeNames = map[string]string{ - "2.5.4.6": "C", - "2.5.4.10": "O", - "2.5.4.11": "OU", - "2.5.4.3": "CN", - "2.5.4.5": "SERIALNUMBER", - "2.5.4.7": "L", - "2.5.4.8": "ST", - "2.5.4.9": "STREET", - "2.5.4.17": "POSTALCODE", -} diff --git a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/core/chaincode/shim/ext/cid/interfaces.go b/chaincode/abac/go/vendor/github.com/hyperledger/fabric/core/chaincode/shim/ext/cid/interfaces.go deleted file mode 100644 index d5ed94a8..00000000 --- a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/core/chaincode/shim/ext/cid/interfaces.go +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright IBM Corp. 2017 All Rights Reserved. - -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. -*/ - -package cid - -import "crypto/x509" - -// ChaincodeStubInterface is used by deployable chaincode apps to get identity -// of the agent (or user) submitting the transaction. -type ChaincodeStubInterface interface { - // GetCreator returns `SignatureHeader.Creator` (e.g. an identity) - // of the `SignedProposal`. This is the identity of the agent (or user) - // submitting the transaction. - GetCreator() ([]byte, error) -} - -// ClientIdentity represents information about the identity that submitted the -// transaction -type ClientIdentity interface { - - // GetID returns the ID associated with the invoking identity. This ID - // is guaranteed to be unique within the MSP. - GetID() (string, error) - - // Return the MSP ID of the client - GetMSPID() (string, error) - - // GetAttributeValue returns the value of the client's attribute named `attrName`. - // If the client possesses the attribute, `found` is true and `value` equals the - // value of the attribute. - // If the client does not possess the attribute, `found` is false and `value` - // equals "". - GetAttributeValue(attrName string) (value string, found bool, err error) - - // AssertAttributeValue verifies that the client has the attribute named `attrName` - // with a value of `attrValue`; otherwise, an error is returned. - AssertAttributeValue(attrName, attrValue string) error - - // GetX509Certificate returns the X509 certificate associated with the client, - // or nil if it was not identified by an X509 certificate. - GetX509Certificate() (*x509.Certificate, error) -} diff --git a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/identities.pb.go b/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/identities.pb.go deleted file mode 100644 index ddea9c95..00000000 --- a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/identities.pb.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: msp/identities.proto - -package msp // import "github.com/hyperledger/fabric/protos/msp" - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -// This struct represents an Identity -// (with its MSP identifier) to be used -// to serialize it and deserialize it -type SerializedIdentity struct { - // The identifier of the associated membership service provider - Mspid string `protobuf:"bytes,1,opt,name=mspid,proto3" json:"mspid,omitempty"` - // the Identity, serialized according to the rules of its MPS - IdBytes []byte `protobuf:"bytes,2,opt,name=id_bytes,json=idBytes,proto3" json:"id_bytes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SerializedIdentity) Reset() { *m = SerializedIdentity{} } -func (m *SerializedIdentity) String() string { return proto.CompactTextString(m) } -func (*SerializedIdentity) ProtoMessage() {} -func (*SerializedIdentity) Descriptor() ([]byte, []int) { - return fileDescriptor_identities_8fa8af3e5bf2070a, []int{0} -} -func (m *SerializedIdentity) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SerializedIdentity.Unmarshal(m, b) -} -func (m *SerializedIdentity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SerializedIdentity.Marshal(b, m, deterministic) -} -func (dst *SerializedIdentity) XXX_Merge(src proto.Message) { - xxx_messageInfo_SerializedIdentity.Merge(dst, src) -} -func (m *SerializedIdentity) XXX_Size() int { - return xxx_messageInfo_SerializedIdentity.Size(m) -} -func (m *SerializedIdentity) XXX_DiscardUnknown() { - xxx_messageInfo_SerializedIdentity.DiscardUnknown(m) -} - -var xxx_messageInfo_SerializedIdentity proto.InternalMessageInfo - -func (m *SerializedIdentity) GetMspid() string { - if m != nil { - return m.Mspid - } - return "" -} - -func (m *SerializedIdentity) GetIdBytes() []byte { - if m != nil { - return m.IdBytes - } - return nil -} - -// This struct represents an Idemix Identity -// to be used to serialize it and deserialize it. -// The IdemixMSP will first serialize an idemix identity to bytes using -// this proto, and then uses these bytes as id_bytes in SerializedIdentity -type SerializedIdemixIdentity struct { - // nym_x is the X-component of the pseudonym elliptic curve point. - // It is a []byte representation of an amcl.BIG - // The pseudonym can be seen as a public key of the identity, it is used to verify signatures. - NymX []byte `protobuf:"bytes,1,opt,name=nym_x,json=nymX,proto3" json:"nym_x,omitempty"` - // nym_y is the Y-component of the pseudonym elliptic curve point. - // It is a []byte representation of an amcl.BIG - // The pseudonym can be seen as a public key of the identity, it is used to verify signatures. - NymY []byte `protobuf:"bytes,2,opt,name=nym_y,json=nymY,proto3" json:"nym_y,omitempty"` - // ou contains the organizational unit of the idemix identity - Ou []byte `protobuf:"bytes,3,opt,name=ou,proto3" json:"ou,omitempty"` - // role contains the role of this identity (e.g., ADMIN or MEMBER) - Role []byte `protobuf:"bytes,4,opt,name=role,proto3" json:"role,omitempty"` - // proof contains the cryptographic evidence that this identity is valid - Proof []byte `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SerializedIdemixIdentity) Reset() { *m = SerializedIdemixIdentity{} } -func (m *SerializedIdemixIdentity) String() string { return proto.CompactTextString(m) } -func (*SerializedIdemixIdentity) ProtoMessage() {} -func (*SerializedIdemixIdentity) Descriptor() ([]byte, []int) { - return fileDescriptor_identities_8fa8af3e5bf2070a, []int{1} -} -func (m *SerializedIdemixIdentity) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SerializedIdemixIdentity.Unmarshal(m, b) -} -func (m *SerializedIdemixIdentity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SerializedIdemixIdentity.Marshal(b, m, deterministic) -} -func (dst *SerializedIdemixIdentity) XXX_Merge(src proto.Message) { - xxx_messageInfo_SerializedIdemixIdentity.Merge(dst, src) -} -func (m *SerializedIdemixIdentity) XXX_Size() int { - return xxx_messageInfo_SerializedIdemixIdentity.Size(m) -} -func (m *SerializedIdemixIdentity) XXX_DiscardUnknown() { - xxx_messageInfo_SerializedIdemixIdentity.DiscardUnknown(m) -} - -var xxx_messageInfo_SerializedIdemixIdentity proto.InternalMessageInfo - -func (m *SerializedIdemixIdentity) GetNymX() []byte { - if m != nil { - return m.NymX - } - return nil -} - -func (m *SerializedIdemixIdentity) GetNymY() []byte { - if m != nil { - return m.NymY - } - return nil -} - -func (m *SerializedIdemixIdentity) GetOu() []byte { - if m != nil { - return m.Ou - } - return nil -} - -func (m *SerializedIdemixIdentity) GetRole() []byte { - if m != nil { - return m.Role - } - return nil -} - -func (m *SerializedIdemixIdentity) GetProof() []byte { - if m != nil { - return m.Proof - } - return nil -} - -func init() { - proto.RegisterType((*SerializedIdentity)(nil), "msp.SerializedIdentity") - proto.RegisterType((*SerializedIdemixIdentity)(nil), "msp.SerializedIdemixIdentity") -} - -func init() { proto.RegisterFile("msp/identities.proto", fileDescriptor_identities_8fa8af3e5bf2070a) } - -var fileDescriptor_identities_8fa8af3e5bf2070a = []byte{ - // 238 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x8f, 0x3f, 0x4f, 0xc3, 0x30, - 0x10, 0x47, 0x95, 0x34, 0xe1, 0x8f, 0x55, 0x31, 0x98, 0x0e, 0x66, 0x2b, 0x9d, 0x32, 0xc5, 0x03, - 0xdf, 0xa0, 0x12, 0x03, 0x03, 0x4b, 0x58, 0x80, 0xa5, 0x6a, 0xea, 0x6b, 0x7a, 0x52, 0x2e, 0x67, - 0xd9, 0x8e, 0x54, 0x33, 0xf0, 0xd9, 0x51, 0x62, 0x40, 0xb0, 0xdd, 0xef, 0xe9, 0xe9, 0xc9, 0x16, - 0x2b, 0xf2, 0x56, 0xa3, 0x81, 0x21, 0x60, 0x40, 0xf0, 0xb5, 0x75, 0x1c, 0x58, 0x2e, 0xc8, 0xdb, - 0xcd, 0xa3, 0x90, 0x2f, 0xe0, 0x70, 0xdf, 0xe3, 0x07, 0x98, 0xa7, 0xa4, 0x44, 0xb9, 0x12, 0x25, - 0x79, 0x8b, 0x46, 0x65, 0xeb, 0xac, 0xba, 0x6e, 0xd2, 0x90, 0x77, 0xe2, 0x0a, 0xcd, 0xae, 0x8d, - 0x01, 0xbc, 0xca, 0xd7, 0x59, 0xb5, 0x6c, 0x2e, 0xd1, 0x6c, 0xa7, 0xb9, 0xf9, 0x14, 0xea, 0x5f, - 0x86, 0xf0, 0xfc, 0x1b, 0xbb, 0x15, 0xe5, 0x10, 0x69, 0x77, 0x9e, 0x63, 0xcb, 0xa6, 0x18, 0x22, - 0xbd, 0xfe, 0xc0, 0xf8, 0x1d, 0x9a, 0xe0, 0x9b, 0xbc, 0x11, 0x39, 0x8f, 0x6a, 0x31, 0x93, 0x9c, - 0x47, 0x29, 0x45, 0xe1, 0xb8, 0x07, 0x55, 0x24, 0x67, 0xba, 0xa7, 0xa7, 0x59, 0xc7, 0x7c, 0x54, - 0xe5, 0x0c, 0xd3, 0xd8, 0x3e, 0x8b, 0x7b, 0x76, 0x5d, 0x7d, 0x8a, 0x16, 0x5c, 0x0f, 0xa6, 0x03, - 0x57, 0x1f, 0xf7, 0xad, 0xc3, 0x43, 0xfa, 0xab, 0xaf, 0xc9, 0xdb, 0xf7, 0xaa, 0xc3, 0x70, 0x1a, - 0xdb, 0xfa, 0xc0, 0xa4, 0xff, 0x98, 0x3a, 0x99, 0x3a, 0x99, 0x9a, 0xbc, 0x6d, 0x2f, 0xe6, 0xfb, - 0xe1, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x13, 0xdc, 0xc8, 0x62, 0x39, 0x01, 0x00, 0x00, -} diff --git a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/identities.proto b/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/identities.proto deleted file mode 100644 index fef457c8..00000000 --- a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/identities.proto +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright IBM Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - - -syntax = "proto3"; - -option go_package = "github.com/hyperledger/fabric/protos/msp"; -option java_package = "org.hyperledger.fabric.protos.msp"; - -package msp; - -// This struct represents an Identity -// (with its MSP identifier) to be used -// to serialize it and deserialize it -message SerializedIdentity { - // The identifier of the associated membership service provider - string mspid = 1; - - // the Identity, serialized according to the rules of its MPS - bytes id_bytes = 2; -} - -// This struct represents an Idemix Identity -// to be used to serialize it and deserialize it. -// The IdemixMSP will first serialize an idemix identity to bytes using -// this proto, and then uses these bytes as id_bytes in SerializedIdentity -message SerializedIdemixIdentity { - // nym_x is the X-component of the pseudonym elliptic curve point. - // It is a []byte representation of an amcl.BIG - // The pseudonym can be seen as a public key of the identity, it is used to verify signatures. - bytes nym_x = 1; - - // nym_y is the Y-component of the pseudonym elliptic curve point. - // It is a []byte representation of an amcl.BIG - // The pseudonym can be seen as a public key of the identity, it is used to verify signatures. - bytes nym_y = 2; - - // ou contains the organizational unit of the idemix identity - bytes ou = 3; - - // role contains the role of this identity (e.g., ADMIN or MEMBER) - bytes role = 4; - - // proof contains the cryptographic evidence that this identity is valid - bytes proof = 5; -} \ No newline at end of file diff --git a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_config.go b/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_config.go deleted file mode 100644 index 9394550c..00000000 --- a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_config.go +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright IBM Corp. 2017 All Rights Reserved. - -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. -*/ - -package msp - -import ( - "fmt" - - "github.com/golang/protobuf/proto" -) - -func (mc *MSPConfig) VariablyOpaqueFields() []string { - return []string{"config"} -} - -func (mc *MSPConfig) VariablyOpaqueFieldProto(name string) (proto.Message, error) { - if name != mc.VariablyOpaqueFields()[0] { - return nil, fmt.Errorf("not a marshaled field: %s", name) - } - switch mc.Type { - case 0: - return &FabricMSPConfig{}, nil - case 1: - return &IdemixMSPConfig{}, nil - default: - return nil, fmt.Errorf("unable to decode MSP type: %v", mc.Type) - } -} diff --git a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_config.pb.go b/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_config.pb.go deleted file mode 100644 index eb9066a6..00000000 --- a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_config.pb.go +++ /dev/null @@ -1,743 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: msp/msp_config.proto - -package msp // import "github.com/hyperledger/fabric/protos/msp" - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -// MSPConfig collects all the configuration information for -// an MSP. The Config field should be unmarshalled in a way -// that depends on the Type -type MSPConfig struct { - // Type holds the type of the MSP; the default one would - // be of type FABRIC implementing an X.509 based provider - Type int32 `protobuf:"varint,1,opt,name=type,proto3" json:"type,omitempty"` - // Config is MSP dependent configuration info - Config []byte `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MSPConfig) Reset() { *m = MSPConfig{} } -func (m *MSPConfig) String() string { return proto.CompactTextString(m) } -func (*MSPConfig) ProtoMessage() {} -func (*MSPConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_config_e749e5bd1d6d997b, []int{0} -} -func (m *MSPConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MSPConfig.Unmarshal(m, b) -} -func (m *MSPConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MSPConfig.Marshal(b, m, deterministic) -} -func (dst *MSPConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_MSPConfig.Merge(dst, src) -} -func (m *MSPConfig) XXX_Size() int { - return xxx_messageInfo_MSPConfig.Size(m) -} -func (m *MSPConfig) XXX_DiscardUnknown() { - xxx_messageInfo_MSPConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_MSPConfig proto.InternalMessageInfo - -func (m *MSPConfig) GetType() int32 { - if m != nil { - return m.Type - } - return 0 -} - -func (m *MSPConfig) GetConfig() []byte { - if m != nil { - return m.Config - } - return nil -} - -// FabricMSPConfig collects all the configuration information for -// a Fabric MSP. -// Here we assume a default certificate validation policy, where -// any certificate signed by any of the listed rootCA certs would -// be considered as valid under this MSP. -// This MSP may or may not come with a signing identity. If it does, -// it can also issue signing identities. If it does not, it can only -// be used to validate and verify certificates. -type FabricMSPConfig struct { - // Name holds the identifier of the MSP; MSP identifier - // is chosen by the application that governs this MSP. - // For example, and assuming the default implementation of MSP, - // that is X.509-based and considers a single Issuer, - // this can refer to the Subject OU field or the Issuer OU field. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // List of root certificates trusted by this MSP - // they are used upon certificate validation (see - // comment for IntermediateCerts below) - RootCerts [][]byte `protobuf:"bytes,2,rep,name=root_certs,json=rootCerts,proto3" json:"root_certs,omitempty"` - // List of intermediate certificates trusted by this MSP; - // they are used upon certificate validation as follows: - // validation attempts to build a path from the certificate - // to be validated (which is at one end of the path) and - // one of the certs in the RootCerts field (which is at - // the other end of the path). If the path is longer than - // 2, certificates in the middle are searched within the - // IntermediateCerts pool - IntermediateCerts [][]byte `protobuf:"bytes,3,rep,name=intermediate_certs,json=intermediateCerts,proto3" json:"intermediate_certs,omitempty"` - // Identity denoting the administrator of this MSP - Admins [][]byte `protobuf:"bytes,4,rep,name=admins,proto3" json:"admins,omitempty"` - // Identity revocation list - RevocationList [][]byte `protobuf:"bytes,5,rep,name=revocation_list,json=revocationList,proto3" json:"revocation_list,omitempty"` - // SigningIdentity holds information on the signing identity - // this peer is to use, and which is to be imported by the - // MSP defined before - SigningIdentity *SigningIdentityInfo `protobuf:"bytes,6,opt,name=signing_identity,json=signingIdentity,proto3" json:"signing_identity,omitempty"` - // OrganizationalUnitIdentifiers holds one or more - // fabric organizational unit identifiers that belong to - // this MSP configuration - OrganizationalUnitIdentifiers []*FabricOUIdentifier `protobuf:"bytes,7,rep,name=organizational_unit_identifiers,json=organizationalUnitIdentifiers,proto3" json:"organizational_unit_identifiers,omitempty"` - // FabricCryptoConfig contains the configuration parameters - // for the cryptographic algorithms used by this MSP - CryptoConfig *FabricCryptoConfig `protobuf:"bytes,8,opt,name=crypto_config,json=cryptoConfig,proto3" json:"crypto_config,omitempty"` - // List of TLS root certificates trusted by this MSP. - // They are returned by GetTLSRootCerts. - TlsRootCerts [][]byte `protobuf:"bytes,9,rep,name=tls_root_certs,json=tlsRootCerts,proto3" json:"tls_root_certs,omitempty"` - // List of TLS intermediate certificates trusted by this MSP; - // They are returned by GetTLSIntermediateCerts. - TlsIntermediateCerts [][]byte `protobuf:"bytes,10,rep,name=tls_intermediate_certs,json=tlsIntermediateCerts,proto3" json:"tls_intermediate_certs,omitempty"` - // fabric_node_ous contains the configuration to distinguish clients from peers from orderers - // based on the OUs. - FabricNodeOus *FabricNodeOUs `protobuf:"bytes,11,opt,name=fabric_node_ous,json=fabricNodeOus,proto3" json:"fabric_node_ous,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FabricMSPConfig) Reset() { *m = FabricMSPConfig{} } -func (m *FabricMSPConfig) String() string { return proto.CompactTextString(m) } -func (*FabricMSPConfig) ProtoMessage() {} -func (*FabricMSPConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_config_e749e5bd1d6d997b, []int{1} -} -func (m *FabricMSPConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FabricMSPConfig.Unmarshal(m, b) -} -func (m *FabricMSPConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FabricMSPConfig.Marshal(b, m, deterministic) -} -func (dst *FabricMSPConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_FabricMSPConfig.Merge(dst, src) -} -func (m *FabricMSPConfig) XXX_Size() int { - return xxx_messageInfo_FabricMSPConfig.Size(m) -} -func (m *FabricMSPConfig) XXX_DiscardUnknown() { - xxx_messageInfo_FabricMSPConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_FabricMSPConfig proto.InternalMessageInfo - -func (m *FabricMSPConfig) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *FabricMSPConfig) GetRootCerts() [][]byte { - if m != nil { - return m.RootCerts - } - return nil -} - -func (m *FabricMSPConfig) GetIntermediateCerts() [][]byte { - if m != nil { - return m.IntermediateCerts - } - return nil -} - -func (m *FabricMSPConfig) GetAdmins() [][]byte { - if m != nil { - return m.Admins - } - return nil -} - -func (m *FabricMSPConfig) GetRevocationList() [][]byte { - if m != nil { - return m.RevocationList - } - return nil -} - -func (m *FabricMSPConfig) GetSigningIdentity() *SigningIdentityInfo { - if m != nil { - return m.SigningIdentity - } - return nil -} - -func (m *FabricMSPConfig) GetOrganizationalUnitIdentifiers() []*FabricOUIdentifier { - if m != nil { - return m.OrganizationalUnitIdentifiers - } - return nil -} - -func (m *FabricMSPConfig) GetCryptoConfig() *FabricCryptoConfig { - if m != nil { - return m.CryptoConfig - } - return nil -} - -func (m *FabricMSPConfig) GetTlsRootCerts() [][]byte { - if m != nil { - return m.TlsRootCerts - } - return nil -} - -func (m *FabricMSPConfig) GetTlsIntermediateCerts() [][]byte { - if m != nil { - return m.TlsIntermediateCerts - } - return nil -} - -func (m *FabricMSPConfig) GetFabricNodeOus() *FabricNodeOUs { - if m != nil { - return m.FabricNodeOus - } - return nil -} - -// FabricCryptoConfig contains configuration parameters -// for the cryptographic algorithms used by the MSP -// this configuration refers to -type FabricCryptoConfig struct { - // SignatureHashFamily is a string representing the hash family to be used - // during sign and verify operations. - // Allowed values are "SHA2" and "SHA3". - SignatureHashFamily string `protobuf:"bytes,1,opt,name=signature_hash_family,json=signatureHashFamily,proto3" json:"signature_hash_family,omitempty"` - // IdentityIdentifierHashFunction is a string representing the hash function - // to be used during the computation of the identity identifier of an MSP identity. - // Allowed values are "SHA256", "SHA384" and "SHA3_256", "SHA3_384". - IdentityIdentifierHashFunction string `protobuf:"bytes,2,opt,name=identity_identifier_hash_function,json=identityIdentifierHashFunction,proto3" json:"identity_identifier_hash_function,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FabricCryptoConfig) Reset() { *m = FabricCryptoConfig{} } -func (m *FabricCryptoConfig) String() string { return proto.CompactTextString(m) } -func (*FabricCryptoConfig) ProtoMessage() {} -func (*FabricCryptoConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_config_e749e5bd1d6d997b, []int{2} -} -func (m *FabricCryptoConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FabricCryptoConfig.Unmarshal(m, b) -} -func (m *FabricCryptoConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FabricCryptoConfig.Marshal(b, m, deterministic) -} -func (dst *FabricCryptoConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_FabricCryptoConfig.Merge(dst, src) -} -func (m *FabricCryptoConfig) XXX_Size() int { - return xxx_messageInfo_FabricCryptoConfig.Size(m) -} -func (m *FabricCryptoConfig) XXX_DiscardUnknown() { - xxx_messageInfo_FabricCryptoConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_FabricCryptoConfig proto.InternalMessageInfo - -func (m *FabricCryptoConfig) GetSignatureHashFamily() string { - if m != nil { - return m.SignatureHashFamily - } - return "" -} - -func (m *FabricCryptoConfig) GetIdentityIdentifierHashFunction() string { - if m != nil { - return m.IdentityIdentifierHashFunction - } - return "" -} - -// IdemixMSPConfig collects all the configuration information for -// an Idemix MSP. -type IdemixMSPConfig struct { - // Name holds the identifier of the MSP - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // ipk represents the (serialized) issuer public key - Ipk []byte `protobuf:"bytes,2,opt,name=ipk,proto3" json:"ipk,omitempty"` - // signer may contain crypto material to configure a default signer - Signer *IdemixMSPSignerConfig `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` - // revocation_pk is the public key used for revocation of credentials - RevocationPk []byte `protobuf:"bytes,4,opt,name=revocation_pk,json=revocationPk,proto3" json:"revocation_pk,omitempty"` - // epoch represents the current epoch (time interval) used for revocation - Epoch int64 `protobuf:"varint,5,opt,name=epoch,proto3" json:"epoch,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *IdemixMSPConfig) Reset() { *m = IdemixMSPConfig{} } -func (m *IdemixMSPConfig) String() string { return proto.CompactTextString(m) } -func (*IdemixMSPConfig) ProtoMessage() {} -func (*IdemixMSPConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_config_e749e5bd1d6d997b, []int{3} -} -func (m *IdemixMSPConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_IdemixMSPConfig.Unmarshal(m, b) -} -func (m *IdemixMSPConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_IdemixMSPConfig.Marshal(b, m, deterministic) -} -func (dst *IdemixMSPConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_IdemixMSPConfig.Merge(dst, src) -} -func (m *IdemixMSPConfig) XXX_Size() int { - return xxx_messageInfo_IdemixMSPConfig.Size(m) -} -func (m *IdemixMSPConfig) XXX_DiscardUnknown() { - xxx_messageInfo_IdemixMSPConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_IdemixMSPConfig proto.InternalMessageInfo - -func (m *IdemixMSPConfig) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *IdemixMSPConfig) GetIpk() []byte { - if m != nil { - return m.Ipk - } - return nil -} - -func (m *IdemixMSPConfig) GetSigner() *IdemixMSPSignerConfig { - if m != nil { - return m.Signer - } - return nil -} - -func (m *IdemixMSPConfig) GetRevocationPk() []byte { - if m != nil { - return m.RevocationPk - } - return nil -} - -func (m *IdemixMSPConfig) GetEpoch() int64 { - if m != nil { - return m.Epoch - } - return 0 -} - -// IdemixMSPSIgnerConfig contains the crypto material to set up an idemix signing identity -type IdemixMSPSignerConfig struct { - // cred represents the serialized idemix credential of the default signer - Cred []byte `protobuf:"bytes,1,opt,name=cred,proto3" json:"cred,omitempty"` - // sk is the secret key of the default signer, corresponding to credential Cred - Sk []byte `protobuf:"bytes,2,opt,name=sk,proto3" json:"sk,omitempty"` - // organizational_unit_identifier defines the organizational unit the default signer is in - OrganizationalUnitIdentifier string `protobuf:"bytes,3,opt,name=organizational_unit_identifier,json=organizationalUnitIdentifier,proto3" json:"organizational_unit_identifier,omitempty"` - // role defines whether the default signer is admin, peer, member or client - Role int32 `protobuf:"varint,4,opt,name=role,proto3" json:"role,omitempty"` - // enrollment_id contains the enrollment id of this signer - EnrollmentId string `protobuf:"bytes,5,opt,name=enrollment_id,json=enrollmentId,proto3" json:"enrollment_id,omitempty"` - // credential_revocation_information contains a serialized CredentialRevocationInformation - CredentialRevocationInformation []byte `protobuf:"bytes,6,opt,name=credential_revocation_information,json=credentialRevocationInformation,proto3" json:"credential_revocation_information,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *IdemixMSPSignerConfig) Reset() { *m = IdemixMSPSignerConfig{} } -func (m *IdemixMSPSignerConfig) String() string { return proto.CompactTextString(m) } -func (*IdemixMSPSignerConfig) ProtoMessage() {} -func (*IdemixMSPSignerConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_config_e749e5bd1d6d997b, []int{4} -} -func (m *IdemixMSPSignerConfig) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_IdemixMSPSignerConfig.Unmarshal(m, b) -} -func (m *IdemixMSPSignerConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_IdemixMSPSignerConfig.Marshal(b, m, deterministic) -} -func (dst *IdemixMSPSignerConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_IdemixMSPSignerConfig.Merge(dst, src) -} -func (m *IdemixMSPSignerConfig) XXX_Size() int { - return xxx_messageInfo_IdemixMSPSignerConfig.Size(m) -} -func (m *IdemixMSPSignerConfig) XXX_DiscardUnknown() { - xxx_messageInfo_IdemixMSPSignerConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_IdemixMSPSignerConfig proto.InternalMessageInfo - -func (m *IdemixMSPSignerConfig) GetCred() []byte { - if m != nil { - return m.Cred - } - return nil -} - -func (m *IdemixMSPSignerConfig) GetSk() []byte { - if m != nil { - return m.Sk - } - return nil -} - -func (m *IdemixMSPSignerConfig) GetOrganizationalUnitIdentifier() string { - if m != nil { - return m.OrganizationalUnitIdentifier - } - return "" -} - -func (m *IdemixMSPSignerConfig) GetRole() int32 { - if m != nil { - return m.Role - } - return 0 -} - -func (m *IdemixMSPSignerConfig) GetEnrollmentId() string { - if m != nil { - return m.EnrollmentId - } - return "" -} - -func (m *IdemixMSPSignerConfig) GetCredentialRevocationInformation() []byte { - if m != nil { - return m.CredentialRevocationInformation - } - return nil -} - -// SigningIdentityInfo represents the configuration information -// related to the signing identity the peer is to use for generating -// endorsements -type SigningIdentityInfo struct { - // PublicSigner carries the public information of the signing - // identity. For an X.509 provider this would be represented by - // an X.509 certificate - PublicSigner []byte `protobuf:"bytes,1,opt,name=public_signer,json=publicSigner,proto3" json:"public_signer,omitempty"` - // PrivateSigner denotes a reference to the private key of the - // peer's signing identity - PrivateSigner *KeyInfo `protobuf:"bytes,2,opt,name=private_signer,json=privateSigner,proto3" json:"private_signer,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SigningIdentityInfo) Reset() { *m = SigningIdentityInfo{} } -func (m *SigningIdentityInfo) String() string { return proto.CompactTextString(m) } -func (*SigningIdentityInfo) ProtoMessage() {} -func (*SigningIdentityInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_config_e749e5bd1d6d997b, []int{5} -} -func (m *SigningIdentityInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SigningIdentityInfo.Unmarshal(m, b) -} -func (m *SigningIdentityInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SigningIdentityInfo.Marshal(b, m, deterministic) -} -func (dst *SigningIdentityInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_SigningIdentityInfo.Merge(dst, src) -} -func (m *SigningIdentityInfo) XXX_Size() int { - return xxx_messageInfo_SigningIdentityInfo.Size(m) -} -func (m *SigningIdentityInfo) XXX_DiscardUnknown() { - xxx_messageInfo_SigningIdentityInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_SigningIdentityInfo proto.InternalMessageInfo - -func (m *SigningIdentityInfo) GetPublicSigner() []byte { - if m != nil { - return m.PublicSigner - } - return nil -} - -func (m *SigningIdentityInfo) GetPrivateSigner() *KeyInfo { - if m != nil { - return m.PrivateSigner - } - return nil -} - -// KeyInfo represents a (secret) key that is either already stored -// in the bccsp/keystore or key material to be imported to the -// bccsp key-store. In later versions it may contain also a -// keystore identifier -type KeyInfo struct { - // Identifier of the key inside the default keystore; this for - // the case of Software BCCSP as well as the HSM BCCSP would be - // the SKI of the key - KeyIdentifier string `protobuf:"bytes,1,opt,name=key_identifier,json=keyIdentifier,proto3" json:"key_identifier,omitempty"` - // KeyMaterial (optional) for the key to be imported; this is - // properly encoded key bytes, prefixed by the type of the key - KeyMaterial []byte `protobuf:"bytes,2,opt,name=key_material,json=keyMaterial,proto3" json:"key_material,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *KeyInfo) Reset() { *m = KeyInfo{} } -func (m *KeyInfo) String() string { return proto.CompactTextString(m) } -func (*KeyInfo) ProtoMessage() {} -func (*KeyInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_config_e749e5bd1d6d997b, []int{6} -} -func (m *KeyInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KeyInfo.Unmarshal(m, b) -} -func (m *KeyInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KeyInfo.Marshal(b, m, deterministic) -} -func (dst *KeyInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_KeyInfo.Merge(dst, src) -} -func (m *KeyInfo) XXX_Size() int { - return xxx_messageInfo_KeyInfo.Size(m) -} -func (m *KeyInfo) XXX_DiscardUnknown() { - xxx_messageInfo_KeyInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_KeyInfo proto.InternalMessageInfo - -func (m *KeyInfo) GetKeyIdentifier() string { - if m != nil { - return m.KeyIdentifier - } - return "" -} - -func (m *KeyInfo) GetKeyMaterial() []byte { - if m != nil { - return m.KeyMaterial - } - return nil -} - -// FabricOUIdentifier represents an organizational unit and -// its related chain of trust identifier. -type FabricOUIdentifier struct { - // Certificate represents the second certificate in a certification chain. - // (Notice that the first certificate in a certification chain is supposed - // to be the certificate of an identity). - // It must correspond to the certificate of root or intermediate CA - // recognized by the MSP this message belongs to. - // Starting from this certificate, a certification chain is computed - // and bound to the OrganizationUnitIdentifier specified - Certificate []byte `protobuf:"bytes,1,opt,name=certificate,proto3" json:"certificate,omitempty"` - // OrganizationUnitIdentifier defines the organizational unit under the - // MSP identified with MSPIdentifier - OrganizationalUnitIdentifier string `protobuf:"bytes,2,opt,name=organizational_unit_identifier,json=organizationalUnitIdentifier,proto3" json:"organizational_unit_identifier,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FabricOUIdentifier) Reset() { *m = FabricOUIdentifier{} } -func (m *FabricOUIdentifier) String() string { return proto.CompactTextString(m) } -func (*FabricOUIdentifier) ProtoMessage() {} -func (*FabricOUIdentifier) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_config_e749e5bd1d6d997b, []int{7} -} -func (m *FabricOUIdentifier) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FabricOUIdentifier.Unmarshal(m, b) -} -func (m *FabricOUIdentifier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FabricOUIdentifier.Marshal(b, m, deterministic) -} -func (dst *FabricOUIdentifier) XXX_Merge(src proto.Message) { - xxx_messageInfo_FabricOUIdentifier.Merge(dst, src) -} -func (m *FabricOUIdentifier) XXX_Size() int { - return xxx_messageInfo_FabricOUIdentifier.Size(m) -} -func (m *FabricOUIdentifier) XXX_DiscardUnknown() { - xxx_messageInfo_FabricOUIdentifier.DiscardUnknown(m) -} - -var xxx_messageInfo_FabricOUIdentifier proto.InternalMessageInfo - -func (m *FabricOUIdentifier) GetCertificate() []byte { - if m != nil { - return m.Certificate - } - return nil -} - -func (m *FabricOUIdentifier) GetOrganizationalUnitIdentifier() string { - if m != nil { - return m.OrganizationalUnitIdentifier - } - return "" -} - -// FabricNodeOUs contains configuration to tell apart clients from peers from orderers -// based on OUs. If NodeOUs recognition is enabled then an msp identity -// that does not contain any of the specified OU will be considered invalid. -type FabricNodeOUs struct { - // If true then an msp identity that does not contain any of the specified OU will be considered invalid. - Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"` - // OU Identifier of the clients - ClientOuIdentifier *FabricOUIdentifier `protobuf:"bytes,2,opt,name=client_ou_identifier,json=clientOuIdentifier,proto3" json:"client_ou_identifier,omitempty"` - // OU Identifier of the peers - PeerOuIdentifier *FabricOUIdentifier `protobuf:"bytes,3,opt,name=peer_ou_identifier,json=peerOuIdentifier,proto3" json:"peer_ou_identifier,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FabricNodeOUs) Reset() { *m = FabricNodeOUs{} } -func (m *FabricNodeOUs) String() string { return proto.CompactTextString(m) } -func (*FabricNodeOUs) ProtoMessage() {} -func (*FabricNodeOUs) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_config_e749e5bd1d6d997b, []int{8} -} -func (m *FabricNodeOUs) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FabricNodeOUs.Unmarshal(m, b) -} -func (m *FabricNodeOUs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FabricNodeOUs.Marshal(b, m, deterministic) -} -func (dst *FabricNodeOUs) XXX_Merge(src proto.Message) { - xxx_messageInfo_FabricNodeOUs.Merge(dst, src) -} -func (m *FabricNodeOUs) XXX_Size() int { - return xxx_messageInfo_FabricNodeOUs.Size(m) -} -func (m *FabricNodeOUs) XXX_DiscardUnknown() { - xxx_messageInfo_FabricNodeOUs.DiscardUnknown(m) -} - -var xxx_messageInfo_FabricNodeOUs proto.InternalMessageInfo - -func (m *FabricNodeOUs) GetEnable() bool { - if m != nil { - return m.Enable - } - return false -} - -func (m *FabricNodeOUs) GetClientOuIdentifier() *FabricOUIdentifier { - if m != nil { - return m.ClientOuIdentifier - } - return nil -} - -func (m *FabricNodeOUs) GetPeerOuIdentifier() *FabricOUIdentifier { - if m != nil { - return m.PeerOuIdentifier - } - return nil -} - -func init() { - proto.RegisterType((*MSPConfig)(nil), "msp.MSPConfig") - proto.RegisterType((*FabricMSPConfig)(nil), "msp.FabricMSPConfig") - proto.RegisterType((*FabricCryptoConfig)(nil), "msp.FabricCryptoConfig") - proto.RegisterType((*IdemixMSPConfig)(nil), "msp.IdemixMSPConfig") - proto.RegisterType((*IdemixMSPSignerConfig)(nil), "msp.IdemixMSPSignerConfig") - proto.RegisterType((*SigningIdentityInfo)(nil), "msp.SigningIdentityInfo") - proto.RegisterType((*KeyInfo)(nil), "msp.KeyInfo") - proto.RegisterType((*FabricOUIdentifier)(nil), "msp.FabricOUIdentifier") - proto.RegisterType((*FabricNodeOUs)(nil), "msp.FabricNodeOUs") -} - -func init() { proto.RegisterFile("msp/msp_config.proto", fileDescriptor_msp_config_e749e5bd1d6d997b) } - -var fileDescriptor_msp_config_e749e5bd1d6d997b = []byte{ - // 847 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x5f, 0x6f, 0xe3, 0x44, - 0x10, 0x57, 0x92, 0x26, 0x77, 0x99, 0x38, 0x49, 0xd9, 0xeb, 0x15, 0x0b, 0x71, 0x77, 0xa9, 0x01, - 0x91, 0x17, 0x52, 0xa9, 0x87, 0x84, 0x84, 0x78, 0xba, 0xc2, 0x09, 0x03, 0xa5, 0xd5, 0x56, 0x7d, - 0xe1, 0xc5, 0xda, 0xd8, 0x9b, 0x64, 0x65, 0x7b, 0xd7, 0xda, 0x5d, 0x9f, 0x08, 0xe2, 0x99, 0x2f, - 0xc0, 0x77, 0xe0, 0x99, 0x57, 0xbe, 0x1d, 0xda, 0x3f, 0x8d, 0x9d, 0x6b, 0x15, 0x78, 0x9b, 0x9d, - 0xf9, 0xcd, 0xcf, 0xb3, 0xbf, 0x99, 0x59, 0xc3, 0x49, 0xa9, 0xaa, 0xf3, 0x52, 0x55, 0x49, 0x2a, - 0xf8, 0x8a, 0xad, 0x17, 0x95, 0x14, 0x5a, 0xa0, 0x5e, 0xa9, 0xaa, 0xe8, 0x2b, 0x18, 0x5e, 0xdd, - 0xde, 0x5c, 0x5a, 0x3f, 0x42, 0x70, 0xa4, 0xb7, 0x15, 0x0d, 0x3b, 0xb3, 0xce, 0xbc, 0x8f, 0xad, - 0x8d, 0x4e, 0x61, 0xe0, 0xb2, 0xc2, 0xee, 0xac, 0x33, 0x0f, 0xb0, 0x3f, 0x45, 0x7f, 0x1f, 0xc1, - 0xf4, 0x2d, 0x59, 0x4a, 0x96, 0xee, 0xe5, 0x73, 0x52, 0xba, 0xfc, 0x21, 0xb6, 0x36, 0x7a, 0x01, - 0x20, 0x85, 0xd0, 0x49, 0x4a, 0xa5, 0x56, 0x61, 0x77, 0xd6, 0x9b, 0x07, 0x78, 0x68, 0x3c, 0x97, - 0xc6, 0x81, 0xbe, 0x00, 0xc4, 0xb8, 0xa6, 0xb2, 0xa4, 0x19, 0x23, 0x9a, 0x7a, 0x58, 0xcf, 0xc2, - 0x3e, 0x68, 0x47, 0x1c, 0xfc, 0x14, 0x06, 0x24, 0x2b, 0x19, 0x57, 0xe1, 0x91, 0x85, 0xf8, 0x13, - 0xfa, 0x1c, 0xa6, 0x92, 0xbe, 0x13, 0x29, 0xd1, 0x4c, 0xf0, 0xa4, 0x60, 0x4a, 0x87, 0x7d, 0x0b, - 0x98, 0x34, 0xee, 0x9f, 0x98, 0xd2, 0xe8, 0x12, 0x8e, 0x15, 0x5b, 0x73, 0xc6, 0xd7, 0x09, 0xcb, - 0x28, 0xd7, 0x4c, 0x6f, 0xc3, 0xc1, 0xac, 0x33, 0x1f, 0x5d, 0x84, 0x8b, 0x52, 0x55, 0x8b, 0x5b, - 0x17, 0x8c, 0x7d, 0x2c, 0xe6, 0x2b, 0x81, 0xa7, 0x6a, 0xdf, 0x89, 0x12, 0x78, 0x25, 0xe4, 0x9a, - 0x70, 0xf6, 0x9b, 0x25, 0x26, 0x45, 0x52, 0x73, 0xa6, 0x3d, 0xe1, 0x8a, 0x51, 0xa9, 0xc2, 0x27, - 0xb3, 0xde, 0x7c, 0x74, 0xf1, 0xa1, 0xe5, 0x74, 0x32, 0x5d, 0xdf, 0xc5, 0xbb, 0x38, 0x7e, 0xb1, - 0x9f, 0x7f, 0xc7, 0x99, 0x6e, 0xa2, 0x0a, 0x7d, 0x03, 0xe3, 0x54, 0x6e, 0x2b, 0x2d, 0x7c, 0xc7, - 0xc2, 0xa7, 0xb6, 0xc4, 0x36, 0xdd, 0xa5, 0x8d, 0x3b, 0xe1, 0x71, 0x90, 0xb6, 0x4e, 0xe8, 0x53, - 0x98, 0xe8, 0x42, 0x25, 0x2d, 0xd9, 0x87, 0x56, 0x8b, 0x40, 0x17, 0x0a, 0xef, 0x94, 0xff, 0x12, - 0x4e, 0x0d, 0xea, 0x11, 0xf5, 0xc1, 0xa2, 0x4f, 0x74, 0xa1, 0xe2, 0x07, 0x0d, 0xf8, 0x1a, 0xa6, - 0x2b, 0xfb, 0xfd, 0x84, 0x8b, 0x8c, 0x26, 0xa2, 0x56, 0xe1, 0xc8, 0xd6, 0x86, 0x5a, 0xb5, 0xfd, - 0x2c, 0x32, 0x7a, 0x7d, 0xa7, 0xf0, 0x78, 0xd5, 0x1c, 0x6b, 0x15, 0xfd, 0xd9, 0x01, 0xf4, 0xb0, - 0x78, 0x74, 0x01, 0xcf, 0x8d, 0xc0, 0x44, 0xd7, 0x92, 0x26, 0x1b, 0xa2, 0x36, 0xc9, 0x8a, 0x94, - 0xac, 0xd8, 0xfa, 0x31, 0x7a, 0xb6, 0x0b, 0x7e, 0x4f, 0xd4, 0xe6, 0xad, 0x0d, 0xa1, 0x18, 0xce, - 0xee, 0xdb, 0xd7, 0x92, 0xdd, 0x67, 0xd7, 0x3c, 0x35, 0xb2, 0xda, 0x81, 0x1d, 0xe2, 0x97, 0xf7, - 0xc0, 0x46, 0x60, 0x4b, 0xe4, 0x51, 0xd1, 0x5f, 0x1d, 0x98, 0xc6, 0x19, 0x2d, 0xd9, 0xaf, 0x87, - 0x07, 0xf9, 0x18, 0x7a, 0xac, 0xca, 0xfd, 0x16, 0x18, 0x13, 0x5d, 0xc0, 0xc0, 0xd4, 0x46, 0x65, - 0xd8, 0xb3, 0x12, 0x7c, 0x64, 0x25, 0xd8, 0x71, 0xdd, 0xda, 0x98, 0xef, 0x90, 0x47, 0xa2, 0x4f, - 0x60, 0xdc, 0x1a, 0xd4, 0x2a, 0x0f, 0x8f, 0x2c, 0x5f, 0xd0, 0x38, 0x6f, 0x72, 0x74, 0x02, 0x7d, - 0x5a, 0x89, 0x74, 0x13, 0xf6, 0x67, 0x9d, 0x79, 0x0f, 0xbb, 0x43, 0xf4, 0x47, 0x17, 0x9e, 0x3f, - 0x4a, 0x6e, 0xca, 0x4d, 0x25, 0xcd, 0x6c, 0xb9, 0x01, 0xb6, 0x36, 0x9a, 0x40, 0x57, 0xdd, 0x57, - 0xdb, 0x55, 0x39, 0xfa, 0x16, 0x5e, 0x1e, 0x9e, 0x59, 0x7b, 0x89, 0x21, 0xfe, 0xf8, 0xd0, 0x64, - 0x9a, 0x2f, 0x49, 0x51, 0x50, 0x5b, 0x75, 0x1f, 0x5b, 0xdb, 0x5c, 0x89, 0x72, 0x29, 0x8a, 0xa2, - 0xa4, 0xdc, 0x10, 0xda, 0xaa, 0x87, 0x38, 0x68, 0x9c, 0x71, 0x86, 0x7e, 0x80, 0x33, 0x53, 0x96, - 0x21, 0x22, 0x45, 0xd2, 0x92, 0x80, 0xf1, 0x95, 0x90, 0xa5, 0xb5, 0xed, 0x22, 0x06, 0xf8, 0x55, - 0x03, 0xc4, 0x3b, 0x5c, 0xdc, 0xc0, 0x22, 0x01, 0xcf, 0x1e, 0x59, 0x53, 0x53, 0x47, 0x55, 0x2f, - 0x0b, 0x96, 0x26, 0xbe, 0x2b, 0x4e, 0x8e, 0xc0, 0x39, 0x9d, 0x60, 0xe8, 0x35, 0x4c, 0x2a, 0xc9, - 0xde, 0x99, 0x61, 0xf7, 0xa8, 0xae, 0xed, 0x5d, 0x60, 0x7b, 0xf7, 0x23, 0x75, 0x1b, 0x3f, 0xf6, - 0x18, 0x97, 0x14, 0xdd, 0xc2, 0x13, 0x1f, 0x41, 0x9f, 0xc1, 0x24, 0xa7, 0xed, 0x99, 0xf3, 0x33, - 0x32, 0xce, 0x69, 0x6b, 0xc0, 0xd0, 0x19, 0x04, 0x06, 0x56, 0x12, 0x4d, 0x25, 0x23, 0x85, 0xef, - 0xc3, 0x28, 0xa7, 0xdb, 0x2b, 0xef, 0x8a, 0x7e, 0xbf, 0x5f, 0x86, 0xf6, 0xc3, 0x80, 0x66, 0x30, - 0x32, 0x4b, 0xc8, 0x56, 0x2c, 0x25, 0x9a, 0xfa, 0x2b, 0xb4, 0x5d, 0xff, 0xa3, 0x91, 0xdd, 0xff, - 0x6e, 0x64, 0xf4, 0x4f, 0x07, 0xc6, 0x7b, 0xcb, 0x6a, 0x9e, 0x56, 0xca, 0xc9, 0xb2, 0x70, 0x1f, - 0x7d, 0x8a, 0xfd, 0x09, 0xc5, 0x70, 0x92, 0x16, 0xcc, 0xb4, 0x56, 0xd4, 0xef, 0x7f, 0xe5, 0xc0, - 0x0b, 0x87, 0x5c, 0xd2, 0x75, 0xdd, 0xba, 0xdc, 0x77, 0x80, 0x2a, 0x4a, 0xe5, 0x7b, 0x44, 0xbd, - 0xc3, 0x44, 0xc7, 0x26, 0xa5, 0x4d, 0xf3, 0x26, 0x81, 0x33, 0x21, 0xd7, 0x8b, 0xcd, 0xb6, 0xa2, - 0xb2, 0xa0, 0xd9, 0x9a, 0xca, 0x85, 0x7b, 0x68, 0xdc, 0x8f, 0x4d, 0x19, 0xa6, 0x37, 0xc7, 0x57, - 0xaa, 0x72, 0xeb, 0x71, 0x43, 0xd2, 0x9c, 0xac, 0xe9, 0x2f, 0xf3, 0x35, 0xd3, 0x9b, 0x7a, 0xb9, - 0x48, 0x45, 0x79, 0xde, 0xca, 0x3d, 0x77, 0xb9, 0xe7, 0x2e, 0xd7, 0xfc, 0x26, 0x97, 0x03, 0x6b, - 0xbf, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0x54, 0x67, 0x46, 0xdb, 0x38, 0x07, 0x00, 0x00, -} diff --git a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_config.proto b/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_config.proto deleted file mode 100644 index 542f06d8..00000000 --- a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_config.proto +++ /dev/null @@ -1,208 +0,0 @@ -/* -Copyright IBM Corp. All Rights Reserved. - -SPDX-License-Identifier: Apache-2.0 -*/ - -syntax = "proto3"; - -option go_package = "github.com/hyperledger/fabric/protos/msp"; -option java_package = "org.hyperledger.fabric.protos.msp"; -option java_outer_classname = "MspConfigPackage"; - -package msp; - -// MSPConfig collects all the configuration information for -// an MSP. The Config field should be unmarshalled in a way -// that depends on the Type -message MSPConfig { - // Type holds the type of the MSP; the default one would - // be of type FABRIC implementing an X.509 based provider - int32 type = 1; - - // Config is MSP dependent configuration info - bytes config = 2; -} - -// FabricMSPConfig collects all the configuration information for -// a Fabric MSP. -// Here we assume a default certificate validation policy, where -// any certificate signed by any of the listed rootCA certs would -// be considered as valid under this MSP. -// This MSP may or may not come with a signing identity. If it does, -// it can also issue signing identities. If it does not, it can only -// be used to validate and verify certificates. -message FabricMSPConfig { - // Name holds the identifier of the MSP; MSP identifier - // is chosen by the application that governs this MSP. - // For example, and assuming the default implementation of MSP, - // that is X.509-based and considers a single Issuer, - // this can refer to the Subject OU field or the Issuer OU field. - string name = 1; - - // List of root certificates trusted by this MSP - // they are used upon certificate validation (see - // comment for IntermediateCerts below) - repeated bytes root_certs = 2; - - // List of intermediate certificates trusted by this MSP; - // they are used upon certificate validation as follows: - // validation attempts to build a path from the certificate - // to be validated (which is at one end of the path) and - // one of the certs in the RootCerts field (which is at - // the other end of the path). If the path is longer than - // 2, certificates in the middle are searched within the - // IntermediateCerts pool - repeated bytes intermediate_certs = 3; - - // Identity denoting the administrator of this MSP - repeated bytes admins = 4; - - // Identity revocation list - repeated bytes revocation_list = 5; - - // SigningIdentity holds information on the signing identity - // this peer is to use, and which is to be imported by the - // MSP defined before - SigningIdentityInfo signing_identity = 6; - - // OrganizationalUnitIdentifiers holds one or more - // fabric organizational unit identifiers that belong to - // this MSP configuration - repeated FabricOUIdentifier organizational_unit_identifiers = 7; - - // FabricCryptoConfig contains the configuration parameters - // for the cryptographic algorithms used by this MSP - FabricCryptoConfig crypto_config = 8; - - // List of TLS root certificates trusted by this MSP. - // They are returned by GetTLSRootCerts. - repeated bytes tls_root_certs = 9; - - // List of TLS intermediate certificates trusted by this MSP; - // They are returned by GetTLSIntermediateCerts. - repeated bytes tls_intermediate_certs = 10; - - // fabric_node_ous contains the configuration to distinguish clients from peers from orderers - // based on the OUs. - FabricNodeOUs fabric_node_ous = 11; -} - -// FabricCryptoConfig contains configuration parameters -// for the cryptographic algorithms used by the MSP -// this configuration refers to -message FabricCryptoConfig { - - // SignatureHashFamily is a string representing the hash family to be used - // during sign and verify operations. - // Allowed values are "SHA2" and "SHA3". - string signature_hash_family = 1; - - // IdentityIdentifierHashFunction is a string representing the hash function - // to be used during the computation of the identity identifier of an MSP identity. - // Allowed values are "SHA256", "SHA384" and "SHA3_256", "SHA3_384". - string identity_identifier_hash_function = 2; - -} - -// IdemixMSPConfig collects all the configuration information for -// an Idemix MSP. -message IdemixMSPConfig { - // Name holds the identifier of the MSP - string name = 1; - - // ipk represents the (serialized) issuer public key - bytes ipk = 2; - - // signer may contain crypto material to configure a default signer - IdemixMSPSignerConfig signer = 3; - - // revocation_pk is the public key used for revocation of credentials - bytes revocation_pk = 4; - - // epoch represents the current epoch (time interval) used for revocation - int64 epoch = 5; -} - -// IdemixMSPSIgnerConfig contains the crypto material to set up an idemix signing identity -message IdemixMSPSignerConfig { - // cred represents the serialized idemix credential of the default signer - bytes cred = 1; - - // sk is the secret key of the default signer, corresponding to credential Cred - bytes sk = 2; - - // organizational_unit_identifier defines the organizational unit the default signer is in - string organizational_unit_identifier = 3; - - // role defines whether the default signer is admin, peer, member or client - int32 role = 4; - - // enrollment_id contains the enrollment id of this signer - string enrollment_id = 5; - - // credential_revocation_information contains a serialized CredentialRevocationInformation - bytes credential_revocation_information = 6; -} - -// SigningIdentityInfo represents the configuration information -// related to the signing identity the peer is to use for generating -// endorsements -message SigningIdentityInfo { - // PublicSigner carries the public information of the signing - // identity. For an X.509 provider this would be represented by - // an X.509 certificate - bytes public_signer = 1; - - // PrivateSigner denotes a reference to the private key of the - // peer's signing identity - KeyInfo private_signer = 2; -} - -// KeyInfo represents a (secret) key that is either already stored -// in the bccsp/keystore or key material to be imported to the -// bccsp key-store. In later versions it may contain also a -// keystore identifier -message KeyInfo { - // Identifier of the key inside the default keystore; this for - // the case of Software BCCSP as well as the HSM BCCSP would be - // the SKI of the key - string key_identifier = 1; - - // KeyMaterial (optional) for the key to be imported; this is - // properly encoded key bytes, prefixed by the type of the key - bytes key_material = 2; -} - -// FabricOUIdentifier represents an organizational unit and -// its related chain of trust identifier. -message FabricOUIdentifier { - - // Certificate represents the second certificate in a certification chain. - // (Notice that the first certificate in a certification chain is supposed - // to be the certificate of an identity). - // It must correspond to the certificate of root or intermediate CA - // recognized by the MSP this message belongs to. - // Starting from this certificate, a certification chain is computed - // and bound to the OrganizationUnitIdentifier specified - bytes certificate = 1; - - // OrganizationUnitIdentifier defines the organizational unit under the - // MSP identified with MSPIdentifier - string organizational_unit_identifier = 2; -} - -// FabricNodeOUs contains configuration to tell apart clients from peers from orderers -// based on OUs. If NodeOUs recognition is enabled then an msp identity -// that does not contain any of the specified OU will be considered invalid. -message FabricNodeOUs { - // If true then an msp identity that does not contain any of the specified OU will be considered invalid. - bool enable = 1; - - // OU Identifier of the clients - FabricOUIdentifier client_ou_identifier = 2; - - // OU Identifier of the peers - FabricOUIdentifier peer_ou_identifier = 3; - -} \ No newline at end of file diff --git a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_principal.go b/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_principal.go deleted file mode 100644 index 339dc629..00000000 --- a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_principal.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright IBM Corp. 2017 All Rights Reserved. - -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. -*/ - -package msp - -import ( - "fmt" - - "github.com/golang/protobuf/proto" -) - -func (mp *MSPPrincipal) VariablyOpaqueFields() []string { - return []string{"principal"} -} - -func (mp *MSPPrincipal) VariablyOpaqueFieldProto(name string) (proto.Message, error) { - if name != mp.VariablyOpaqueFields()[0] { - return nil, fmt.Errorf("not a marshaled field: %s", name) - } - switch mp.PrincipalClassification { - case MSPPrincipal_ROLE: - return &MSPRole{}, nil - case MSPPrincipal_ORGANIZATION_UNIT: - return &OrganizationUnit{}, nil - case MSPPrincipal_IDENTITY: - return nil, fmt.Errorf("unable to decode MSP type IDENTITY until the protos are fixed to include the IDENTITY proto in protos/msp") - default: - return nil, fmt.Errorf("unable to decode MSP type: %v", mp.PrincipalClassification) - } -} diff --git a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_principal.pb.go b/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_principal.pb.go deleted file mode 100644 index 9200e97f..00000000 --- a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_principal.pb.go +++ /dev/null @@ -1,437 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: msp/msp_principal.proto - -package msp // import "github.com/hyperledger/fabric/protos/msp" - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type MSPPrincipal_Classification int32 - -const ( - MSPPrincipal_ROLE MSPPrincipal_Classification = 0 - // one of a member of MSP network, and the one of an - // administrator of an MSP network - MSPPrincipal_ORGANIZATION_UNIT MSPPrincipal_Classification = 1 - // groupping of entities, per MSP affiliation - // E.g., this can well be represented by an MSP's - // Organization unit - MSPPrincipal_IDENTITY MSPPrincipal_Classification = 2 - // identity - MSPPrincipal_ANONYMITY MSPPrincipal_Classification = 3 - // an identity to be anonymous or nominal. - MSPPrincipal_COMBINED MSPPrincipal_Classification = 4 -) - -var MSPPrincipal_Classification_name = map[int32]string{ - 0: "ROLE", - 1: "ORGANIZATION_UNIT", - 2: "IDENTITY", - 3: "ANONYMITY", - 4: "COMBINED", -} -var MSPPrincipal_Classification_value = map[string]int32{ - "ROLE": 0, - "ORGANIZATION_UNIT": 1, - "IDENTITY": 2, - "ANONYMITY": 3, - "COMBINED": 4, -} - -func (x MSPPrincipal_Classification) String() string { - return proto.EnumName(MSPPrincipal_Classification_name, int32(x)) -} -func (MSPPrincipal_Classification) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_msp_principal_9016cf1a8a7156cd, []int{0, 0} -} - -type MSPRole_MSPRoleType int32 - -const ( - MSPRole_MEMBER MSPRole_MSPRoleType = 0 - MSPRole_ADMIN MSPRole_MSPRoleType = 1 - MSPRole_CLIENT MSPRole_MSPRoleType = 2 - MSPRole_PEER MSPRole_MSPRoleType = 3 -) - -var MSPRole_MSPRoleType_name = map[int32]string{ - 0: "MEMBER", - 1: "ADMIN", - 2: "CLIENT", - 3: "PEER", -} -var MSPRole_MSPRoleType_value = map[string]int32{ - "MEMBER": 0, - "ADMIN": 1, - "CLIENT": 2, - "PEER": 3, -} - -func (x MSPRole_MSPRoleType) String() string { - return proto.EnumName(MSPRole_MSPRoleType_name, int32(x)) -} -func (MSPRole_MSPRoleType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_msp_principal_9016cf1a8a7156cd, []int{2, 0} -} - -type MSPIdentityAnonymity_MSPIdentityAnonymityType int32 - -const ( - MSPIdentityAnonymity_NOMINAL MSPIdentityAnonymity_MSPIdentityAnonymityType = 0 - MSPIdentityAnonymity_ANONYMOUS MSPIdentityAnonymity_MSPIdentityAnonymityType = 1 -) - -var MSPIdentityAnonymity_MSPIdentityAnonymityType_name = map[int32]string{ - 0: "NOMINAL", - 1: "ANONYMOUS", -} -var MSPIdentityAnonymity_MSPIdentityAnonymityType_value = map[string]int32{ - "NOMINAL": 0, - "ANONYMOUS": 1, -} - -func (x MSPIdentityAnonymity_MSPIdentityAnonymityType) String() string { - return proto.EnumName(MSPIdentityAnonymity_MSPIdentityAnonymityType_name, int32(x)) -} -func (MSPIdentityAnonymity_MSPIdentityAnonymityType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_msp_principal_9016cf1a8a7156cd, []int{3, 0} -} - -// MSPPrincipal aims to represent an MSP-centric set of identities. -// In particular, this structure allows for definition of -// - a group of identities that are member of the same MSP -// - a group of identities that are member of the same organization unit -// in the same MSP -// - a group of identities that are administering a specific MSP -// - a specific identity -// Expressing these groups is done given two fields of the fields below -// - Classification, that defines the type of classification of identities -// in an MSP this principal would be defined on; Classification can take -// three values: -// (i) ByMSPRole: that represents a classification of identities within -// MSP based on one of the two pre-defined MSP rules, "member" and "admin" -// (ii) ByOrganizationUnit: that represents a classification of identities -// within MSP based on the organization unit an identity belongs to -// (iii)ByIdentity that denotes that MSPPrincipal is mapped to a single -// identity/certificate; this would mean that the Principal bytes -// message -type MSPPrincipal struct { - // Classification describes the way that one should process - // Principal. An Classification value of "ByOrganizationUnit" reflects - // that "Principal" contains the name of an organization this MSP - // handles. A Classification value "ByIdentity" means that - // "Principal" contains a specific identity. Default value - // denotes that Principal contains one of the groups by - // default supported by all MSPs ("admin" or "member"). - PrincipalClassification MSPPrincipal_Classification `protobuf:"varint,1,opt,name=principal_classification,json=principalClassification,proto3,enum=common.MSPPrincipal_Classification" json:"principal_classification,omitempty"` - // Principal completes the policy principal definition. For the default - // principal types, Principal can be either "Admin" or "Member". - // For the ByOrganizationUnit/ByIdentity values of Classification, - // PolicyPrincipal acquires its value from an organization unit or - // identity, respectively. - // For the Combined Classification type, the Principal is a marshalled - // CombinedPrincipal. - Principal []byte `protobuf:"bytes,2,opt,name=principal,proto3" json:"principal,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MSPPrincipal) Reset() { *m = MSPPrincipal{} } -func (m *MSPPrincipal) String() string { return proto.CompactTextString(m) } -func (*MSPPrincipal) ProtoMessage() {} -func (*MSPPrincipal) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_principal_9016cf1a8a7156cd, []int{0} -} -func (m *MSPPrincipal) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MSPPrincipal.Unmarshal(m, b) -} -func (m *MSPPrincipal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MSPPrincipal.Marshal(b, m, deterministic) -} -func (dst *MSPPrincipal) XXX_Merge(src proto.Message) { - xxx_messageInfo_MSPPrincipal.Merge(dst, src) -} -func (m *MSPPrincipal) XXX_Size() int { - return xxx_messageInfo_MSPPrincipal.Size(m) -} -func (m *MSPPrincipal) XXX_DiscardUnknown() { - xxx_messageInfo_MSPPrincipal.DiscardUnknown(m) -} - -var xxx_messageInfo_MSPPrincipal proto.InternalMessageInfo - -func (m *MSPPrincipal) GetPrincipalClassification() MSPPrincipal_Classification { - if m != nil { - return m.PrincipalClassification - } - return MSPPrincipal_ROLE -} - -func (m *MSPPrincipal) GetPrincipal() []byte { - if m != nil { - return m.Principal - } - return nil -} - -// OrganizationUnit governs the organization of the Principal -// field of a policy principal when a specific organization unity members -// are to be defined within a policy principal. -type OrganizationUnit struct { - // MSPIdentifier represents the identifier of the MSP this organization unit - // refers to - MspIdentifier string `protobuf:"bytes,1,opt,name=msp_identifier,json=mspIdentifier,proto3" json:"msp_identifier,omitempty"` - // OrganizationUnitIdentifier defines the organizational unit under the - // MSP identified with MSPIdentifier - OrganizationalUnitIdentifier string `protobuf:"bytes,2,opt,name=organizational_unit_identifier,json=organizationalUnitIdentifier,proto3" json:"organizational_unit_identifier,omitempty"` - // CertifiersIdentifier is the hash of certificates chain of trust - // related to this organizational unit - CertifiersIdentifier []byte `protobuf:"bytes,3,opt,name=certifiers_identifier,json=certifiersIdentifier,proto3" json:"certifiers_identifier,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OrganizationUnit) Reset() { *m = OrganizationUnit{} } -func (m *OrganizationUnit) String() string { return proto.CompactTextString(m) } -func (*OrganizationUnit) ProtoMessage() {} -func (*OrganizationUnit) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_principal_9016cf1a8a7156cd, []int{1} -} -func (m *OrganizationUnit) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OrganizationUnit.Unmarshal(m, b) -} -func (m *OrganizationUnit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OrganizationUnit.Marshal(b, m, deterministic) -} -func (dst *OrganizationUnit) XXX_Merge(src proto.Message) { - xxx_messageInfo_OrganizationUnit.Merge(dst, src) -} -func (m *OrganizationUnit) XXX_Size() int { - return xxx_messageInfo_OrganizationUnit.Size(m) -} -func (m *OrganizationUnit) XXX_DiscardUnknown() { - xxx_messageInfo_OrganizationUnit.DiscardUnknown(m) -} - -var xxx_messageInfo_OrganizationUnit proto.InternalMessageInfo - -func (m *OrganizationUnit) GetMspIdentifier() string { - if m != nil { - return m.MspIdentifier - } - return "" -} - -func (m *OrganizationUnit) GetOrganizationalUnitIdentifier() string { - if m != nil { - return m.OrganizationalUnitIdentifier - } - return "" -} - -func (m *OrganizationUnit) GetCertifiersIdentifier() []byte { - if m != nil { - return m.CertifiersIdentifier - } - return nil -} - -// MSPRole governs the organization of the Principal -// field of an MSPPrincipal when it aims to define one of the -// two dedicated roles within an MSP: Admin and Members. -type MSPRole struct { - // MSPIdentifier represents the identifier of the MSP this principal - // refers to - MspIdentifier string `protobuf:"bytes,1,opt,name=msp_identifier,json=mspIdentifier,proto3" json:"msp_identifier,omitempty"` - // MSPRoleType defines which of the available, pre-defined MSP-roles - // an identiy should posess inside the MSP with identifier MSPidentifier - Role MSPRole_MSPRoleType `protobuf:"varint,2,opt,name=role,proto3,enum=common.MSPRole_MSPRoleType" json:"role,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MSPRole) Reset() { *m = MSPRole{} } -func (m *MSPRole) String() string { return proto.CompactTextString(m) } -func (*MSPRole) ProtoMessage() {} -func (*MSPRole) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_principal_9016cf1a8a7156cd, []int{2} -} -func (m *MSPRole) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MSPRole.Unmarshal(m, b) -} -func (m *MSPRole) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MSPRole.Marshal(b, m, deterministic) -} -func (dst *MSPRole) XXX_Merge(src proto.Message) { - xxx_messageInfo_MSPRole.Merge(dst, src) -} -func (m *MSPRole) XXX_Size() int { - return xxx_messageInfo_MSPRole.Size(m) -} -func (m *MSPRole) XXX_DiscardUnknown() { - xxx_messageInfo_MSPRole.DiscardUnknown(m) -} - -var xxx_messageInfo_MSPRole proto.InternalMessageInfo - -func (m *MSPRole) GetMspIdentifier() string { - if m != nil { - return m.MspIdentifier - } - return "" -} - -func (m *MSPRole) GetRole() MSPRole_MSPRoleType { - if m != nil { - return m.Role - } - return MSPRole_MEMBER -} - -// MSPIdentityAnonymity can be used to enforce an identity to be anonymous or nominal. -type MSPIdentityAnonymity struct { - AnonymityType MSPIdentityAnonymity_MSPIdentityAnonymityType `protobuf:"varint,1,opt,name=anonymity_type,json=anonymityType,proto3,enum=common.MSPIdentityAnonymity_MSPIdentityAnonymityType" json:"anonymity_type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MSPIdentityAnonymity) Reset() { *m = MSPIdentityAnonymity{} } -func (m *MSPIdentityAnonymity) String() string { return proto.CompactTextString(m) } -func (*MSPIdentityAnonymity) ProtoMessage() {} -func (*MSPIdentityAnonymity) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_principal_9016cf1a8a7156cd, []int{3} -} -func (m *MSPIdentityAnonymity) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MSPIdentityAnonymity.Unmarshal(m, b) -} -func (m *MSPIdentityAnonymity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MSPIdentityAnonymity.Marshal(b, m, deterministic) -} -func (dst *MSPIdentityAnonymity) XXX_Merge(src proto.Message) { - xxx_messageInfo_MSPIdentityAnonymity.Merge(dst, src) -} -func (m *MSPIdentityAnonymity) XXX_Size() int { - return xxx_messageInfo_MSPIdentityAnonymity.Size(m) -} -func (m *MSPIdentityAnonymity) XXX_DiscardUnknown() { - xxx_messageInfo_MSPIdentityAnonymity.DiscardUnknown(m) -} - -var xxx_messageInfo_MSPIdentityAnonymity proto.InternalMessageInfo - -func (m *MSPIdentityAnonymity) GetAnonymityType() MSPIdentityAnonymity_MSPIdentityAnonymityType { - if m != nil { - return m.AnonymityType - } - return MSPIdentityAnonymity_NOMINAL -} - -// CombinedPrincipal governs the organization of the Principal -// field of a policy principal when principal_classification has -// indicated that a combined form of principals is required -type CombinedPrincipal struct { - // Principals refer to combined principals - Principals []*MSPPrincipal `protobuf:"bytes,1,rep,name=principals,proto3" json:"principals,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CombinedPrincipal) Reset() { *m = CombinedPrincipal{} } -func (m *CombinedPrincipal) String() string { return proto.CompactTextString(m) } -func (*CombinedPrincipal) ProtoMessage() {} -func (*CombinedPrincipal) Descriptor() ([]byte, []int) { - return fileDescriptor_msp_principal_9016cf1a8a7156cd, []int{4} -} -func (m *CombinedPrincipal) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CombinedPrincipal.Unmarshal(m, b) -} -func (m *CombinedPrincipal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CombinedPrincipal.Marshal(b, m, deterministic) -} -func (dst *CombinedPrincipal) XXX_Merge(src proto.Message) { - xxx_messageInfo_CombinedPrincipal.Merge(dst, src) -} -func (m *CombinedPrincipal) XXX_Size() int { - return xxx_messageInfo_CombinedPrincipal.Size(m) -} -func (m *CombinedPrincipal) XXX_DiscardUnknown() { - xxx_messageInfo_CombinedPrincipal.DiscardUnknown(m) -} - -var xxx_messageInfo_CombinedPrincipal proto.InternalMessageInfo - -func (m *CombinedPrincipal) GetPrincipals() []*MSPPrincipal { - if m != nil { - return m.Principals - } - return nil -} - -func init() { - proto.RegisterType((*MSPPrincipal)(nil), "common.MSPPrincipal") - proto.RegisterType((*OrganizationUnit)(nil), "common.OrganizationUnit") - proto.RegisterType((*MSPRole)(nil), "common.MSPRole") - proto.RegisterType((*MSPIdentityAnonymity)(nil), "common.MSPIdentityAnonymity") - proto.RegisterType((*CombinedPrincipal)(nil), "common.CombinedPrincipal") - proto.RegisterEnum("common.MSPPrincipal_Classification", MSPPrincipal_Classification_name, MSPPrincipal_Classification_value) - proto.RegisterEnum("common.MSPRole_MSPRoleType", MSPRole_MSPRoleType_name, MSPRole_MSPRoleType_value) - proto.RegisterEnum("common.MSPIdentityAnonymity_MSPIdentityAnonymityType", MSPIdentityAnonymity_MSPIdentityAnonymityType_name, MSPIdentityAnonymity_MSPIdentityAnonymityType_value) -} - -func init() { - proto.RegisterFile("msp/msp_principal.proto", fileDescriptor_msp_principal_9016cf1a8a7156cd) -} - -var fileDescriptor_msp_principal_9016cf1a8a7156cd = []byte{ - // 519 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xdf, 0x6a, 0xdb, 0x30, - 0x14, 0xc6, 0xeb, 0xa4, 0x6b, 0x9b, 0x93, 0x3f, 0xa8, 0x22, 0xa5, 0x81, 0x95, 0x11, 0xbc, 0x0d, - 0x72, 0xe5, 0x40, 0xba, 0xed, 0x62, 0x77, 0x4e, 0x62, 0x86, 0x20, 0x96, 0x8d, 0xe3, 0x5c, 0xb4, - 0x94, 0x05, 0xc7, 0x51, 0x52, 0x81, 0x6d, 0x19, 0xdb, 0xbd, 0xf0, 0xde, 0x65, 0x6f, 0xb0, 0xcb, - 0x3d, 0xd5, 0x9e, 0x62, 0xd8, 0x6e, 0x12, 0x65, 0xeb, 0x60, 0x57, 0xf6, 0x39, 0xe7, 0xf7, 0x1d, - 0x1d, 0x49, 0x9f, 0xe0, 0x3a, 0x4c, 0xe3, 0x61, 0x98, 0xc6, 0xcb, 0x38, 0xe1, 0x91, 0xcf, 0x63, - 0x2f, 0xd0, 0xe2, 0x44, 0x64, 0x02, 0x9f, 0xf9, 0x22, 0x0c, 0x45, 0xa4, 0xfe, 0x52, 0xa0, 0x65, - 0xce, 0x6d, 0x7b, 0x57, 0xc6, 0x5f, 0xa1, 0xb7, 0x67, 0x97, 0x7e, 0xe0, 0xa5, 0x29, 0xdf, 0x70, - 0xdf, 0xcb, 0xb8, 0x88, 0x7a, 0x4a, 0x5f, 0x19, 0x74, 0x46, 0x6f, 0xb5, 0x4a, 0xab, 0xc9, 0x3a, - 0x6d, 0x72, 0x84, 0x3a, 0xd7, 0xfb, 0x26, 0xc7, 0x05, 0x7c, 0x03, 0x8d, 0x7d, 0xa9, 0x57, 0xeb, - 0x2b, 0x83, 0x96, 0x73, 0x48, 0xa8, 0x0f, 0xd0, 0xf9, 0x83, 0xbf, 0x80, 0x53, 0xc7, 0x9a, 0x19, - 0xe8, 0x04, 0x5f, 0xc1, 0xa5, 0xe5, 0x7c, 0xd1, 0x29, 0xb9, 0xd7, 0x5d, 0x62, 0xd1, 0xe5, 0x82, - 0x12, 0x17, 0x29, 0xb8, 0x05, 0x17, 0x64, 0x6a, 0x50, 0x97, 0xb8, 0x77, 0xa8, 0x86, 0xdb, 0xd0, - 0xd0, 0xa9, 0x45, 0xef, 0xcc, 0x22, 0xac, 0x17, 0xc5, 0x89, 0x65, 0x8e, 0x09, 0x35, 0xa6, 0xe8, - 0x54, 0xfd, 0xa9, 0x00, 0xb2, 0x92, 0xad, 0x17, 0xf1, 0x6f, 0x65, 0xf3, 0x45, 0xc4, 0x33, 0xfc, - 0x1e, 0x3a, 0xc5, 0x01, 0xf1, 0x35, 0x8b, 0x32, 0xbe, 0xe1, 0x2c, 0x29, 0xb7, 0xd9, 0x70, 0xda, - 0x61, 0x1a, 0x93, 0x7d, 0x12, 0x4f, 0xe1, 0x8d, 0x90, 0xa4, 0x5e, 0xb0, 0x7c, 0x8a, 0x78, 0x26, - 0xcb, 0x6a, 0xa5, 0xec, 0xe6, 0x98, 0x2a, 0x96, 0x90, 0xba, 0xdc, 0xc2, 0x95, 0xcf, 0x92, 0x2a, - 0x48, 0x65, 0x71, 0xbd, 0x3c, 0x89, 0xee, 0xa1, 0x78, 0x10, 0xa9, 0xdf, 0x15, 0x38, 0x37, 0xe7, - 0xb6, 0x23, 0x02, 0xf6, 0xbf, 0xd3, 0x0e, 0xe1, 0x34, 0x11, 0x01, 0x2b, 0x67, 0xea, 0x8c, 0x5e, - 0x4b, 0x37, 0x56, 0x74, 0xd9, 0x7d, 0xdd, 0x3c, 0x66, 0x4e, 0x09, 0xaa, 0x9f, 0xa1, 0x29, 0x25, - 0x31, 0xc0, 0x99, 0x69, 0x98, 0x63, 0xc3, 0x41, 0x27, 0xb8, 0x01, 0xaf, 0xf4, 0xa9, 0x49, 0x28, - 0x52, 0x8a, 0xf4, 0x64, 0x46, 0x0c, 0xea, 0xa2, 0x5a, 0x71, 0x31, 0xb6, 0x61, 0x38, 0xa8, 0xae, - 0xfe, 0x50, 0xa0, 0x6b, 0xce, 0xed, 0x6a, 0xf9, 0x2c, 0xd7, 0x23, 0x11, 0xe5, 0x21, 0xcf, 0x72, - 0xfc, 0x00, 0x1d, 0x6f, 0x17, 0x2c, 0xb3, 0x3c, 0x66, 0xcf, 0x0e, 0xfa, 0x28, 0xcd, 0xf3, 0x97, - 0xea, 0xc5, 0x64, 0x39, 0x69, 0xdb, 0x93, 0x43, 0xf5, 0x13, 0xf4, 0xfe, 0x85, 0xe2, 0x26, 0x9c, - 0x53, 0xcb, 0x24, 0x54, 0x9f, 0xa1, 0x93, 0x83, 0x27, 0xac, 0xc5, 0x1c, 0x29, 0x2a, 0x81, 0xcb, - 0x89, 0x08, 0x57, 0x3c, 0x62, 0xeb, 0x83, 0xed, 0x3f, 0x00, 0xec, 0x5d, 0x98, 0xf6, 0x94, 0x7e, - 0x7d, 0xd0, 0x1c, 0x75, 0x5f, 0x32, 0xba, 0x23, 0x71, 0x63, 0x1b, 0xde, 0x89, 0x64, 0xab, 0x3d, - 0xe6, 0x31, 0x4b, 0x02, 0xb6, 0xde, 0xb2, 0x44, 0xdb, 0x78, 0xab, 0x84, 0xfb, 0xd5, 0x2b, 0x4b, - 0x9f, 0x1b, 0xdc, 0x0f, 0xb6, 0x3c, 0x7b, 0x7c, 0x5a, 0x15, 0xe1, 0x50, 0x82, 0x87, 0x15, 0x3c, - 0xac, 0xe0, 0xe2, 0x9d, 0xae, 0xce, 0xca, 0xff, 0xdb, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x40, - 0x36, 0xd2, 0xf9, 0xb9, 0x03, 0x00, 0x00, -} diff --git a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_principal.proto b/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_principal.proto deleted file mode 100644 index 972f0fe4..00000000 --- a/chaincode/abac/go/vendor/github.com/hyperledger/fabric/protos/msp/msp_principal.proto +++ /dev/null @@ -1,153 +0,0 @@ -/* -Copyright IBM Corp. 2016 All Rights Reserved. - -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. -*/ - - -syntax = "proto3"; - -option go_package = "github.com/hyperledger/fabric/protos/msp"; -option java_package = "org.hyperledger.fabric.protos.common"; - -package common; - - -// msp_principal.proto contains proto messages defining the generalized -// MSP notion of identity called an MSPPrincipal. It is used as part of -// the chain configuration, in particular as the identity parameters to -// the configuration.proto file. This does not represent the MSP -// configuration for a chain, but is understood by MSPs - -// MSPPrincipal aims to represent an MSP-centric set of identities. -// In particular, this structure allows for definition of -// - a group of identities that are member of the same MSP -// - a group of identities that are member of the same organization unit -// in the same MSP -// - a group of identities that are administering a specific MSP -// - a specific identity -// Expressing these groups is done given two fields of the fields below -// - Classification, that defines the type of classification of identities -// in an MSP this principal would be defined on; Classification can take -// three values: -// (i) ByMSPRole: that represents a classification of identities within -// MSP based on one of the two pre-defined MSP rules, "member" and "admin" -// (ii) ByOrganizationUnit: that represents a classification of identities -// within MSP based on the organization unit an identity belongs to -// (iii)ByIdentity that denotes that MSPPrincipal is mapped to a single -// identity/certificate; this would mean that the Principal bytes -// message -message MSPPrincipal { - - enum Classification { - ROLE = 0; // Represents the one of the dedicated MSP roles, the - // one of a member of MSP network, and the one of an - // administrator of an MSP network - ORGANIZATION_UNIT = 1; // Denotes a finer grained (affiliation-based) - // groupping of entities, per MSP affiliation - // E.g., this can well be represented by an MSP's - // Organization unit - IDENTITY = 2; // Denotes a principal that consists of a single - // identity - ANONYMITY = 3; // Denotes a principal that can be used to enforce - // an identity to be anonymous or nominal. - COMBINED = 4; // Denotes a combined principal - } - - // Classification describes the way that one should process - // Principal. An Classification value of "ByOrganizationUnit" reflects - // that "Principal" contains the name of an organization this MSP - // handles. A Classification value "ByIdentity" means that - // "Principal" contains a specific identity. Default value - // denotes that Principal contains one of the groups by - // default supported by all MSPs ("admin" or "member"). - Classification principal_classification = 1; - - // Principal completes the policy principal definition. For the default - // principal types, Principal can be either "Admin" or "Member". - // For the ByOrganizationUnit/ByIdentity values of Classification, - // PolicyPrincipal acquires its value from an organization unit or - // identity, respectively. - // For the Combined Classification type, the Principal is a marshalled - // CombinedPrincipal. - bytes principal = 2; -} - - -// OrganizationUnit governs the organization of the Principal -// field of a policy principal when a specific organization unity members -// are to be defined within a policy principal. -message OrganizationUnit { - - // MSPIdentifier represents the identifier of the MSP this organization unit - // refers to - string msp_identifier = 1; - - // OrganizationUnitIdentifier defines the organizational unit under the - // MSP identified with MSPIdentifier - string organizational_unit_identifier = 2; - - // CertifiersIdentifier is the hash of certificates chain of trust - // related to this organizational unit - bytes certifiers_identifier = 3; -} - -// MSPRole governs the organization of the Principal -// field of an MSPPrincipal when it aims to define one of the -// two dedicated roles within an MSP: Admin and Members. -message MSPRole { - - // MSPIdentifier represents the identifier of the MSP this principal - // refers to - string msp_identifier = 1; - - enum MSPRoleType { - MEMBER = 0; // Represents an MSP Member - ADMIN = 1; // Represents an MSP Admin - CLIENT = 2; // Represents an MSP Client - PEER = 3; // Represents an MSP Peer - } - - // MSPRoleType defines which of the available, pre-defined MSP-roles - // an identiy should posess inside the MSP with identifier MSPidentifier - MSPRoleType role = 2; - -} - -// MSPIdentityAnonymity can be used to enforce an identity to be anonymous or nominal. -message MSPIdentityAnonymity { - - enum MSPIdentityAnonymityType { - NOMINAL = 0; // Represents a nominal MSP Identity - ANONYMOUS = 1; // Represents an anonymous MSP Identity - } - - MSPIdentityAnonymityType anonymity_type = 1; - -} - -// CombinedPrincipal governs the organization of the Principal -// field of a policy principal when principal_classification has -// indicated that a combined form of principals is required -message CombinedPrincipal { - - // Principals refer to combined principals - repeated MSPPrincipal principals = 1; -} - -// TODO: Bring msp.SerializedIdentity from fabric/msp/identities.proto here. Reason below. -// SerializedIdentity represents an serialized version of an identity; -// this consists of an MSP-identifier this identity would correspond to -// and the bytes of the actual identity. A serialized form of -// SerializedIdentity would govern "Principal" field of a PolicyPrincipal -// of classification "ByIdentity". diff --git a/chaincode/abac/go/vendor/github.com/pkg/errors/LICENSE b/chaincode/abac/go/vendor/github.com/pkg/errors/LICENSE deleted file mode 100644 index 835ba3e7..00000000 --- a/chaincode/abac/go/vendor/github.com/pkg/errors/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2015, Dave Cheney -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/chaincode/abac/go/vendor/github.com/pkg/errors/README.md b/chaincode/abac/go/vendor/github.com/pkg/errors/README.md deleted file mode 100644 index 6483ba2a..00000000 --- a/chaincode/abac/go/vendor/github.com/pkg/errors/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) [![Sourcegraph](https://sourcegraph.com/github.com/pkg/errors/-/badge.svg)](https://sourcegraph.com/github.com/pkg/errors?badge) - -Package errors provides simple error handling primitives. - -`go get github.com/pkg/errors` - -The traditional error handling idiom in Go is roughly akin to -```go -if err != nil { - return err -} -``` -which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error. - -## Adding context to an error - -The errors.Wrap function returns a new error that adds context to the original error. For example -```go -_, err := ioutil.ReadAll(r) -if err != nil { - return errors.Wrap(err, "read failed") -} -``` -## Retrieving the cause of an error - -Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`. -```go -type causer interface { - Cause() error -} -``` -`errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example: -```go -switch err := errors.Cause(err).(type) { -case *MyError: - // handle specifically -default: - // unknown error -} -``` - -[Read the package documentation for more information](https://godoc.org/github.com/pkg/errors). - -## Contributing - -We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high. - -Before proposing a change, please discuss your change by raising an issue. - -## License - -BSD-2-Clause diff --git a/chaincode/abac/go/vendor/github.com/pkg/errors/appveyor.yml b/chaincode/abac/go/vendor/github.com/pkg/errors/appveyor.yml deleted file mode 100644 index a932eade..00000000 --- a/chaincode/abac/go/vendor/github.com/pkg/errors/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -version: build-{build}.{branch} - -clone_folder: C:\gopath\src\github.com\pkg\errors -shallow_clone: true # for startup speed - -environment: - GOPATH: C:\gopath - -platform: - - x64 - -# http://www.appveyor.com/docs/installed-software -install: - # some helpful output for debugging builds - - go version - - go env - # pre-installed MinGW at C:\MinGW is 32bit only - # but MSYS2 at C:\msys64 has mingw64 - - set PATH=C:\msys64\mingw64\bin;%PATH% - - gcc --version - - g++ --version - -build_script: - - go install -v ./... - -test_script: - - set PATH=C:\gopath\bin;%PATH% - - go test -v ./... - -#artifacts: -# - path: '%GOPATH%\bin\*.exe' -deploy: off diff --git a/chaincode/abac/go/vendor/github.com/pkg/errors/errors.go b/chaincode/abac/go/vendor/github.com/pkg/errors/errors.go deleted file mode 100644 index 1963d86b..00000000 --- a/chaincode/abac/go/vendor/github.com/pkg/errors/errors.go +++ /dev/null @@ -1,282 +0,0 @@ -// Package errors provides simple error handling primitives. -// -// The traditional error handling idiom in Go is roughly akin to -// -// if err != nil { -// return err -// } -// -// which when applied recursively up the call stack results in error reports -// without context or debugging information. The errors package allows -// programmers to add context to the failure path in their code in a way -// that does not destroy the original value of the error. -// -// Adding context to an error -// -// The errors.Wrap function returns a new error that adds context to the -// original error by recording a stack trace at the point Wrap is called, -// together with the supplied message. For example -// -// _, err := ioutil.ReadAll(r) -// if err != nil { -// return errors.Wrap(err, "read failed") -// } -// -// If additional control is required, the errors.WithStack and -// errors.WithMessage functions destructure errors.Wrap into its component -// operations: annotating an error with a stack trace and with a message, -// respectively. -// -// Retrieving the cause of an error -// -// Using errors.Wrap constructs a stack of errors, adding context to the -// preceding error. Depending on the nature of the error it may be necessary -// to reverse the operation of errors.Wrap to retrieve the original error -// for inspection. Any error value which implements this interface -// -// type causer interface { -// Cause() error -// } -// -// can be inspected by errors.Cause. errors.Cause will recursively retrieve -// the topmost error that does not implement causer, which is assumed to be -// the original cause. For example: -// -// switch err := errors.Cause(err).(type) { -// case *MyError: -// // handle specifically -// default: -// // unknown error -// } -// -// Although the causer interface is not exported by this package, it is -// considered a part of its stable public interface. -// -// Formatted printing of errors -// -// All error values returned from this package implement fmt.Formatter and can -// be formatted by the fmt package. The following verbs are supported: -// -// %s print the error. If the error has a Cause it will be -// printed recursively. -// %v see %s -// %+v extended format. Each Frame of the error's StackTrace will -// be printed in detail. -// -// Retrieving the stack trace of an error or wrapper -// -// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are -// invoked. This information can be retrieved with the following interface: -// -// type stackTracer interface { -// StackTrace() errors.StackTrace -// } -// -// The returned errors.StackTrace type is defined as -// -// type StackTrace []Frame -// -// The Frame type represents a call site in the stack trace. Frame supports -// the fmt.Formatter interface that can be used for printing information about -// the stack trace of this error. For example: -// -// if err, ok := err.(stackTracer); ok { -// for _, f := range err.StackTrace() { -// fmt.Printf("%+s:%d", f) -// } -// } -// -// Although the stackTracer interface is not exported by this package, it is -// considered a part of its stable public interface. -// -// See the documentation for Frame.Format for more details. -package errors - -import ( - "fmt" - "io" -) - -// New returns an error with the supplied message. -// New also records the stack trace at the point it was called. -func New(message string) error { - return &fundamental{ - msg: message, - stack: callers(), - } -} - -// Errorf formats according to a format specifier and returns the string -// as a value that satisfies error. -// Errorf also records the stack trace at the point it was called. -func Errorf(format string, args ...interface{}) error { - return &fundamental{ - msg: fmt.Sprintf(format, args...), - stack: callers(), - } -} - -// fundamental is an error that has a message and a stack, but no caller. -type fundamental struct { - msg string - *stack -} - -func (f *fundamental) Error() string { return f.msg } - -func (f *fundamental) Format(s fmt.State, verb rune) { - switch verb { - case 'v': - if s.Flag('+') { - io.WriteString(s, f.msg) - f.stack.Format(s, verb) - return - } - fallthrough - case 's': - io.WriteString(s, f.msg) - case 'q': - fmt.Fprintf(s, "%q", f.msg) - } -} - -// WithStack annotates err with a stack trace at the point WithStack was called. -// If err is nil, WithStack returns nil. -func WithStack(err error) error { - if err == nil { - return nil - } - return &withStack{ - err, - callers(), - } -} - -type withStack struct { - error - *stack -} - -func (w *withStack) Cause() error { return w.error } - -func (w *withStack) Format(s fmt.State, verb rune) { - switch verb { - case 'v': - if s.Flag('+') { - fmt.Fprintf(s, "%+v", w.Cause()) - w.stack.Format(s, verb) - return - } - fallthrough - case 's': - io.WriteString(s, w.Error()) - case 'q': - fmt.Fprintf(s, "%q", w.Error()) - } -} - -// Wrap returns an error annotating err with a stack trace -// at the point Wrap is called, and the supplied message. -// If err is nil, Wrap returns nil. -func Wrap(err error, message string) error { - if err == nil { - return nil - } - err = &withMessage{ - cause: err, - msg: message, - } - return &withStack{ - err, - callers(), - } -} - -// Wrapf returns an error annotating err with a stack trace -// at the point Wrapf is called, and the format specifier. -// If err is nil, Wrapf returns nil. -func Wrapf(err error, format string, args ...interface{}) error { - if err == nil { - return nil - } - err = &withMessage{ - cause: err, - msg: fmt.Sprintf(format, args...), - } - return &withStack{ - err, - callers(), - } -} - -// WithMessage annotates err with a new message. -// If err is nil, WithMessage returns nil. -func WithMessage(err error, message string) error { - if err == nil { - return nil - } - return &withMessage{ - cause: err, - msg: message, - } -} - -// WithMessagef annotates err with the format specifier. -// If err is nil, WithMessagef returns nil. -func WithMessagef(err error, format string, args ...interface{}) error { - if err == nil { - return nil - } - return &withMessage{ - cause: err, - msg: fmt.Sprintf(format, args...), - } -} - -type withMessage struct { - cause error - msg string -} - -func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() } -func (w *withMessage) Cause() error { return w.cause } - -func (w *withMessage) Format(s fmt.State, verb rune) { - switch verb { - case 'v': - if s.Flag('+') { - fmt.Fprintf(s, "%+v\n", w.Cause()) - io.WriteString(s, w.msg) - return - } - fallthrough - case 's', 'q': - io.WriteString(s, w.Error()) - } -} - -// Cause returns the underlying cause of the error, if possible. -// An error value has a cause if it implements the following -// interface: -// -// type causer interface { -// Cause() error -// } -// -// If the error does not implement Cause, the original error will -// be returned. If the error is nil, nil will be returned without further -// investigation. -func Cause(err error) error { - type causer interface { - Cause() error - } - - for err != nil { - cause, ok := err.(causer) - if !ok { - break - } - err = cause.Cause() - } - return err -} diff --git a/chaincode/abac/go/vendor/github.com/pkg/errors/stack.go b/chaincode/abac/go/vendor/github.com/pkg/errors/stack.go deleted file mode 100644 index 2874a048..00000000 --- a/chaincode/abac/go/vendor/github.com/pkg/errors/stack.go +++ /dev/null @@ -1,147 +0,0 @@ -package errors - -import ( - "fmt" - "io" - "path" - "runtime" - "strings" -) - -// Frame represents a program counter inside a stack frame. -type Frame uintptr - -// pc returns the program counter for this frame; -// multiple frames may have the same PC value. -func (f Frame) pc() uintptr { return uintptr(f) - 1 } - -// file returns the full path to the file that contains the -// function for this Frame's pc. -func (f Frame) file() string { - fn := runtime.FuncForPC(f.pc()) - if fn == nil { - return "unknown" - } - file, _ := fn.FileLine(f.pc()) - return file -} - -// line returns the line number of source code of the -// function for this Frame's pc. -func (f Frame) line() int { - fn := runtime.FuncForPC(f.pc()) - if fn == nil { - return 0 - } - _, line := fn.FileLine(f.pc()) - return line -} - -// Format formats the frame according to the fmt.Formatter interface. -// -// %s source file -// %d source line -// %n function name -// %v equivalent to %s:%d -// -// Format accepts flags that alter the printing of some verbs, as follows: -// -// %+s function name and path of source file relative to the compile time -// GOPATH separated by \n\t (\n\t) -// %+v equivalent to %+s:%d -func (f Frame) Format(s fmt.State, verb rune) { - switch verb { - case 's': - switch { - case s.Flag('+'): - pc := f.pc() - fn := runtime.FuncForPC(pc) - if fn == nil { - io.WriteString(s, "unknown") - } else { - file, _ := fn.FileLine(pc) - fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file) - } - default: - io.WriteString(s, path.Base(f.file())) - } - case 'd': - fmt.Fprintf(s, "%d", f.line()) - case 'n': - name := runtime.FuncForPC(f.pc()).Name() - io.WriteString(s, funcname(name)) - case 'v': - f.Format(s, 's') - io.WriteString(s, ":") - f.Format(s, 'd') - } -} - -// StackTrace is stack of Frames from innermost (newest) to outermost (oldest). -type StackTrace []Frame - -// Format formats the stack of Frames according to the fmt.Formatter interface. -// -// %s lists source files for each Frame in the stack -// %v lists the source file and line number for each Frame in the stack -// -// Format accepts flags that alter the printing of some verbs, as follows: -// -// %+v Prints filename, function, and line number for each Frame in the stack. -func (st StackTrace) Format(s fmt.State, verb rune) { - switch verb { - case 'v': - switch { - case s.Flag('+'): - for _, f := range st { - fmt.Fprintf(s, "\n%+v", f) - } - case s.Flag('#'): - fmt.Fprintf(s, "%#v", []Frame(st)) - default: - fmt.Fprintf(s, "%v", []Frame(st)) - } - case 's': - fmt.Fprintf(s, "%s", []Frame(st)) - } -} - -// stack represents a stack of program counters. -type stack []uintptr - -func (s *stack) Format(st fmt.State, verb rune) { - switch verb { - case 'v': - switch { - case st.Flag('+'): - for _, pc := range *s { - f := Frame(pc) - fmt.Fprintf(st, "\n%+v", f) - } - } - } -} - -func (s *stack) StackTrace() StackTrace { - f := make([]Frame, len(*s)) - for i := 0; i < len(f); i++ { - f[i] = Frame((*s)[i]) - } - return f -} - -func callers() *stack { - const depth = 32 - var pcs [depth]uintptr - n := runtime.Callers(3, pcs[:]) - var st stack = pcs[0:n] - return &st -} - -// funcname removes the path prefix component of a function's name reported by func.Name(). -func funcname(name string) string { - i := strings.LastIndex(name, "/") - name = name[i+1:] - i = strings.Index(name, ".") - return name[i+1:] -} diff --git a/chaincode/abac/go/vendor/vendor.json b/chaincode/abac/go/vendor/vendor.json deleted file mode 100644 index 9794848f..00000000 --- a/chaincode/abac/go/vendor/vendor.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "comment": "", - "ignore": "test", - "package": [ - { - "checksumSHA1": "GaJLoEuMGnP5ofXvuweAI4wx06U=", - "path": "github.com/golang/protobuf/proto", - "revision": "1918e1ff6ffd2be7bed0553df8650672c3bfe80d", - "revisionTime": "2018-10-30T15:47:21Z" - }, - { - "checksumSHA1": "XGpUl1X+7ly1ski4Pc+N9ozfVv8=", - "path": "github.com/hyperledger/fabric/core/chaincode/shim/ext/attrmgr", - "revision": "60f968db8e6e2ebcf439391610e22250993d0a85", - "revisionTime": "2018-09-12T02:19:31Z" - }, - { - "checksumSHA1": "vFuT7942CfsCcH9IG3zHmQ4d/oI=", - "path": "github.com/hyperledger/fabric/core/chaincode/shim/ext/cid", - "revision": "60f968db8e6e2ebcf439391610e22250993d0a85", - "revisionTime": "2018-09-12T02:19:31Z" - }, - { - "checksumSHA1": "ZzWCzHsWRI/LAxhZYUMqVcIAsZQ=", - "path": "github.com/hyperledger/fabric/protos/msp", - "revision": "60f968db8e6e2ebcf439391610e22250993d0a85", - "revisionTime": "2018-09-12T02:19:31Z" - }, - { - "checksumSHA1": "DTy0iJ2w5C+FDsN9EnzfhNmvS+o=", - "path": "github.com/pkg/errors", - "revision": "059132a15dd08d6704c67711dae0cf35ab991756", - "revisionTime": "2018-10-23T23:59:46Z" - } - ], - "rootPath": "github.com/hyperledger/fabric-samples/chaincode/abac/go" -} diff --git a/chaincode/chaincode_example02/go/chaincode_example02.go b/chaincode/abstore/go/abstore.go similarity index 78% rename from chaincode/chaincode_example02/go/chaincode_example02.go rename to chaincode/abstore/go/abstore.go index 53438066..55f13820 100644 --- a/chaincode/chaincode_example02/go/chaincode_example02.go +++ b/chaincode/abstore/go/abstore.go @@ -16,26 +16,20 @@ limitations under the License. package main -//WARNING - this chaincode's ID is hard-coded in chaincode_example04 to illustrate one way of -//calling chaincode from a chaincode. If this example is modified, chaincode_example04.go has -//to be modified as well with the new ID of chaincode_example02. -//chaincode_example05 show's how chaincode ID can be passed in as a parameter instead of -//hard-coding. - import ( "fmt" "strconv" - "github.com/hyperledger/fabric/core/chaincode/shim" - pb "github.com/hyperledger/fabric/protos/peer" + "github.com/hyperledger/fabric-chaincode-go/shim" + pb "github.com/hyperledger/fabric-protos-go/peer" ) -// SimpleChaincode example simple Chaincode implementation -type SimpleChaincode struct { +// ABstore Chaincode implementation +type ABstore struct { } -func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response { - fmt.Println("ex02 Init") +func (t *ABstore) Init(stub shim.ChaincodeStubInterface) pb.Response { + fmt.Println("ABstore Init") _, args := stub.GetFunctionAndParameters() var A, B string // Entities var Aval, Bval int // Asset holdings @@ -72,8 +66,8 @@ func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response { return shim.Success(nil) } -func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response { - fmt.Println("ex02 Invoke") +func (t *ABstore) Invoke(stub shim.ChaincodeStubInterface) pb.Response { + fmt.Println("ABstore Invoke") function, args := stub.GetFunctionAndParameters() if function == "invoke" { // Make payment of X units from A to B @@ -90,7 +84,7 @@ func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response { } // Transaction makes payment of X units from A to B -func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response { +func (t *ABstore) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response { var A, B string // Entities var Aval, Bval int // Asset holdings var X int // Transaction value @@ -147,7 +141,7 @@ func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string } // Deletes an entity from state -func (t *SimpleChaincode) delete(stub shim.ChaincodeStubInterface, args []string) pb.Response { +func (t *ABstore) delete(stub shim.ChaincodeStubInterface, args []string) pb.Response { if len(args) != 1 { return shim.Error("Incorrect number of arguments. Expecting 1") } @@ -164,7 +158,7 @@ func (t *SimpleChaincode) delete(stub shim.ChaincodeStubInterface, args []string } // query callback representing the query of a chaincode -func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response { +func (t *ABstore) query(stub shim.ChaincodeStubInterface, args []string) pb.Response { var A string // Entities var err error @@ -192,8 +186,8 @@ func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) } func main() { - err := shim.Start(new(SimpleChaincode)) + err := shim.Start(new(ABstore)) if err != nil { - fmt.Printf("Error starting Simple chaincode: %s", err) + fmt.Printf("Error starting ABstore chaincode: %s", err) } } diff --git a/chaincode/abstore/go/go.mod b/chaincode/abstore/go/go.mod new file mode 100644 index 00000000..781dc72b --- /dev/null +++ b/chaincode/abstore/go/go.mod @@ -0,0 +1,12 @@ +module github.com/hyperledger/fabric-samples/chaincode/abstore/go + +go 1.12 + +require ( + github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 + github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 + golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect + golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect + golang.org/x/text v0.3.2 // indirect + google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect +) diff --git a/chaincode/abstore/go/go.sum b/chaincode/abstore/go/go.sum new file mode 100644 index 00000000..bf875512 --- /dev/null +++ b/chaincode/abstore/go/go.sum @@ -0,0 +1,81 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 h1:VEm3tPRTCzq3J/1XpVERh1PbOSnshUVwx2G5s3cLiTw= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85/go.mod h1:HZK6PKLWrvdD/t0oSLiyaRaUM6fZ7qjJuOlb0zrn0mo= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 h1:WzttYAPO5xkQ87ZrxzEhvDZknfarSNu1PZt3NPMTE3Y= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/chaincode/chaincode_example02/java/.gitignore b/chaincode/abstore/java/.gitignore similarity index 100% rename from chaincode/chaincode_example02/java/.gitignore rename to chaincode/abstore/java/.gitignore diff --git a/chaincode/chaincode_example02/java/build.gradle b/chaincode/abstore/java/build.gradle similarity index 52% rename from chaincode/chaincode_example02/java/build.gradle rename to chaincode/abstore/java/build.gradle index 5221272c..02483c75 100644 --- a/chaincode/chaincode_example02/java/build.gradle +++ b/chaincode/abstore/java/build.gradle @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ plugins { - id 'com.github.johnrengelman.shadow' version '2.0.3' + id 'com.github.johnrengelman.shadow' version '5.1.0' id 'java' } @@ -16,11 +16,16 @@ sourceCompatibility = 1.8 repositories { mavenLocal() mavenCentral() + maven { + url "https://hyperledger.jfrog.io/hyperledger/fabric-maven" + } + maven { + url 'https://jitpack.io' + } } dependencies { - compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '1.+' - testCompile group: 'junit', name: 'junit', version: '4.12' + implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.+' } shadowJar { @@ -29,6 +34,6 @@ shadowJar { classifier = null manifest { - attributes 'Main-Class': 'org.hyperledger.fabric.example.SimpleChaincode' + attributes 'Main-Class': 'org.hyperledger.fabric_samples.ABstore' } } diff --git a/chaincode/abstore/java/gradle/wrapper/gradle-wrapper.jar b/chaincode/abstore/java/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..5c2d1cf0 Binary files /dev/null and b/chaincode/abstore/java/gradle/wrapper/gradle-wrapper.jar differ diff --git a/chaincode/abstore/java/gradle/wrapper/gradle-wrapper.properties b/chaincode/abstore/java/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..7c4388a9 --- /dev/null +++ b/chaincode/abstore/java/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/chaincode/abstore/java/gradlew b/chaincode/abstore/java/gradlew new file mode 100755 index 00000000..83f2acfd --- /dev/null +++ b/chaincode/abstore/java/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/chaincode/abstore/java/gradlew.bat b/chaincode/abstore/java/gradlew.bat new file mode 100644 index 00000000..24467a14 --- /dev/null +++ b/chaincode/abstore/java/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/chaincode/chaincode_example02/java/settings.gradle b/chaincode/abstore/java/settings.gradle similarity index 65% rename from chaincode/chaincode_example02/java/settings.gradle rename to chaincode/abstore/java/settings.gradle index 9ce14a66..80cbe436 100644 --- a/chaincode/chaincode_example02/java/settings.gradle +++ b/chaincode/abstore/java/settings.gradle @@ -3,5 +3,5 @@ * * SPDX-License-Identifier: Apache-2.0 */ -rootProject.name = 'fabric-chaincode-example-gradle' +rootProject.name = 'abstore' diff --git a/chaincode/chaincode_example02/java/src/main/java/org/hyperledger/fabric/example/SimpleChaincode.java b/chaincode/abstore/java/src/main/java/org/hyperledger/fabric-samples/ABstore.java similarity index 90% rename from chaincode/chaincode_example02/java/src/main/java/org/hyperledger/fabric/example/SimpleChaincode.java rename to chaincode/abstore/java/src/main/java/org/hyperledger/fabric-samples/ABstore.java index dd93a4e0..634895de 100644 --- a/chaincode/chaincode_example02/java/src/main/java/org/hyperledger/fabric/example/SimpleChaincode.java +++ b/chaincode/abstore/java/src/main/java/org/hyperledger/fabric-samples/ABstore.java @@ -3,12 +3,11 @@ Copyright IBM Corp., DTCC All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.fabric.example; +package org.hyperledger.fabric_samples; import java.util.List; import com.google.protobuf.ByteString; -import io.netty.handler.ssl.OpenSsl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hyperledger.fabric.shim.ChaincodeBase; @@ -16,18 +15,14 @@ import org.hyperledger.fabric.shim.ChaincodeStub; import static java.nio.charset.StandardCharsets.UTF_8; -public class SimpleChaincode extends ChaincodeBase { +public class ABstore extends ChaincodeBase { - private static Log _logger = LogFactory.getLog(SimpleChaincode.class); + private static Log _logger = LogFactory.getLog(ABstore.class); @Override public Response init(ChaincodeStub stub) { try { _logger.info("Init java simple chaincode"); - String func = stub.getFunction(); - if (!func.equals("init")) { - return newErrorResponse("function other than init is not supported"); - } List args = stub.getParameters(); if (args.size() != 4) { newErrorResponse("Incorrect number of arguments. Expecting 4"); @@ -135,8 +130,7 @@ public class SimpleChaincode extends ChaincodeBase { } public static void main(String[] args) { - System.out.println("OpenSSL avaliable: " + OpenSsl.isAvailable()); - new SimpleChaincode().start(args); + new ABstore().start(args); } } diff --git a/chaincode/abstore/javascript/.gitignore b/chaincode/abstore/javascript/.gitignore new file mode 100644 index 00000000..a00ca941 --- /dev/null +++ b/chaincode/abstore/javascript/.gitignore @@ -0,0 +1,77 @@ +# +# SPDX-License-Identifier: Apache-2.0 +# + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless diff --git a/chaincode/chaincode_example02/node/chaincode_example02.js b/chaincode/abstore/javascript/abstore.js similarity index 96% rename from chaincode/chaincode_example02/node/chaincode_example02.js rename to chaincode/abstore/javascript/abstore.js index 545092af..adcfdd9c 100644 --- a/chaincode/chaincode_example02/node/chaincode_example02.js +++ b/chaincode/abstore/javascript/abstore.js @@ -7,11 +7,11 @@ const shim = require('fabric-shim'); const util = require('util'); -var Chaincode = class { +var ABstore = class { // Initialize the chaincode async Init(stub) { - console.info('========= example02 Init ========='); + console.info('========= ABstore Init ========='); let ret = stub.getFunctionAndParameters(); console.info(ret); let args = ret.params; @@ -135,4 +135,4 @@ var Chaincode = class { } }; -shim.start(new Chaincode()); +shim.start(new ABstore()); diff --git a/chaincode/abstore/javascript/package.json b/chaincode/abstore/javascript/package.json new file mode 100644 index 00000000..c0e32b78 --- /dev/null +++ b/chaincode/abstore/javascript/package.json @@ -0,0 +1,21 @@ +{ + "name": "abstore", + "version": "1.0.0", + "description": "ABstore chaincode implemented in node.js", + "engines": { + "node": ">=8.4.0", + "npm": ">=5.3.0" + }, + "scripts": { + "start": "node abstore.js" + }, + "engine-strict": true, + "license": "Apache-2.0", + "dependencies": { +<<<<<<< HEAD:chaincode/fabcar/javascript-low-level/package.json + "fabric-shim": "~1.4.0" +======= + "fabric-shim": "^2.0.0" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:chaincode/abstore/javascript/package.json + } +} diff --git a/chaincode/fabcar/go/fabcar.go b/chaincode/fabcar/go/fabcar.go index 01792bf4..1d1346be 100644 --- a/chaincode/fabcar/go/fabcar.go +++ b/chaincode/fabcar/go/fabcar.go @@ -17,32 +17,22 @@ * under the License. */ -/* - * The sample smart contract for documentation topic: - * Writing Your First Blockchain Application - */ - package main -/* Imports - * 4 utility libraries for formatting, handling bytes, reading and writing JSON, and string manipulation - * 2 specific Hyperledger Fabric specific libraries for Smart Contracts - */ import ( - "bytes" "encoding/json" "fmt" "strconv" - "github.com/hyperledger/fabric/core/chaincode/shim" - sc "github.com/hyperledger/fabric/protos/peer" + "github.com/hyperledger/fabric-contract-api-go/contractapi" ) -// Define the Smart Contract structure +// SmartContract provides functions for managing a car type SmartContract struct { + contractapi.Contract } -// Define the car structure, with 4 properties. Structure tags are used by encoding/json library +// Car describes basic details of what makes up a car type Car struct { Make string `json:"make"` Model string `json:"model"` @@ -50,49 +40,14 @@ type Car struct { Owner string `json:"owner"` } -/* - * The Init method is called when the Smart Contract "fabcar" is instantiated by the blockchain network - * Best practice is to have any Ledger initialization in separate function -- see initLedger() - */ -func (s *SmartContract) Init(APIstub shim.ChaincodeStubInterface) sc.Response { - return shim.Success(nil) +// QueryResult structure used for handling result of query +type QueryResult struct { + Key string `json:"Key"` + Record *Car } -/* - * The Invoke method is called as a result of an application request to run the Smart Contract "fabcar" - * The calling application program has also specified the particular smart contract function to be called, with arguments - */ -func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response { - - // Retrieve the requested Smart Contract function and arguments - function, args := APIstub.GetFunctionAndParameters() - // Route to the appropriate handler function to interact with the ledger appropriately - if function == "queryCar" { - return s.queryCar(APIstub, args) - } else if function == "initLedger" { - return s.initLedger(APIstub) - } else if function == "createCar" { - return s.createCar(APIstub, args) - } else if function == "queryAllCars" { - return s.queryAllCars(APIstub) - } else if function == "changeCarOwner" { - return s.changeCarOwner(APIstub, args) - } - - return shim.Error("Invalid Smart Contract function name.") -} - -func (s *SmartContract) queryCar(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { - - if len(args) != 1 { - return shim.Error("Incorrect number of arguments. Expecting 1") - } - - carAsBytes, _ := APIstub.GetState(args[0]) - return shim.Success(carAsBytes) -} - -func (s *SmartContract) initLedger(APIstub shim.ChaincodeStubInterface) sc.Response { +// InitLedger adds a base set of cars to the ledger +func (s *SmartContract) InitLedger(ctx contractapi.TransactionContextInterface) error { cars := []Car{ Car{Make: "Toyota", Model: "Prius", Colour: "blue", Owner: "Tomoko"}, Car{Make: "Ford", Model: "Mustang", Colour: "red", Owner: "Brad"}, @@ -106,99 +61,106 @@ func (s *SmartContract) initLedger(APIstub shim.ChaincodeStubInterface) sc.Respo Car{Make: "Holden", Model: "Barina", Colour: "brown", Owner: "Shotaro"}, } - i := 0 - for i < len(cars) { - fmt.Println("i is ", i) - carAsBytes, _ := json.Marshal(cars[i]) - APIstub.PutState("CAR"+strconv.Itoa(i), carAsBytes) - fmt.Println("Added", cars[i]) - i = i + 1 + for i, car := range cars { + carAsBytes, _ := json.Marshal(car) + err := ctx.GetStub().PutState("CAR"+strconv.Itoa(i), carAsBytes) + + if err != nil { + return fmt.Errorf("Failed to put to world state. %s", err.Error()) + } } - return shim.Success(nil) + return nil } -func (s *SmartContract) createCar(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { - - if len(args) != 5 { - return shim.Error("Incorrect number of arguments. Expecting 5") +// CreateCar adds a new car to the world state with given details +func (s *SmartContract) CreateCar(ctx contractapi.TransactionContextInterface, carNumber string, make string, model string, colour string, owner string) error { + car := Car{ + Make: make, + Model: model, + Colour: colour, + Owner: owner, } - var car = Car{Make: args[1], Model: args[2], Colour: args[3], Owner: args[4]} - carAsBytes, _ := json.Marshal(car) - APIstub.PutState(args[0], carAsBytes) - return shim.Success(nil) + return ctx.GetStub().PutState(carNumber, carAsBytes) } -func (s *SmartContract) queryAllCars(APIstub shim.ChaincodeStubInterface) sc.Response { +// QueryCar returns the car stored in the world state with given id +func (s *SmartContract) QueryCar(ctx contractapi.TransactionContextInterface, carNumber string) (*Car, error) { + carAsBytes, err := ctx.GetStub().GetState(carNumber) - startKey := "CAR0" - endKey := "CAR999" - - resultsIterator, err := APIstub.GetStateByRange(startKey, endKey) if err != nil { - return shim.Error(err.Error()) + return nil, fmt.Errorf("Failed to read from world state. %s", err.Error()) + } + + if carAsBytes == nil { + return nil, fmt.Errorf("%s does not exist", carNumber) + } + + car := new(Car) + _ = json.Unmarshal(carAsBytes, car) + + return car, nil +} + +// QueryAllCars returns all cars found in world state +func (s *SmartContract) QueryAllCars(ctx contractapi.TransactionContextInterface) ([]QueryResult, error) { + startKey := "CAR0" + endKey := "CAR99" + + resultsIterator, err := ctx.GetStub().GetStateByRange(startKey, endKey) + + if err != nil { + return nil, err } defer resultsIterator.Close() - // buffer is a JSON array containing QueryResults - var buffer bytes.Buffer - buffer.WriteString("[") + results := []QueryResult{} - bArrayMemberAlreadyWritten := false for resultsIterator.HasNext() { queryResponse, err := resultsIterator.Next() + if err != nil { - return shim.Error(err.Error()) + return nil, err } - // Add a comma before array members, suppress it for the first array member - if bArrayMemberAlreadyWritten == true { - buffer.WriteString(",") - } - buffer.WriteString("{\"Key\":") - buffer.WriteString("\"") - buffer.WriteString(queryResponse.Key) - buffer.WriteString("\"") - buffer.WriteString(", \"Record\":") - // Record is a JSON object, so we write as-is - buffer.WriteString(string(queryResponse.Value)) - buffer.WriteString("}") - bArrayMemberAlreadyWritten = true - } - buffer.WriteString("]") + car := new(Car) + _ = json.Unmarshal(queryResponse.Value, car) - fmt.Printf("- queryAllCars:\n%s\n", buffer.String()) - - return shim.Success(buffer.Bytes()) -} - -func (s *SmartContract) changeCarOwner(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { - - if len(args) != 2 { - return shim.Error("Incorrect number of arguments. Expecting 2") + queryResult := QueryResult{Key: queryResponse.Key, Record: car} + results = append(results, queryResult) } - carAsBytes, _ := APIstub.GetState(args[0]) - car := Car{} - - json.Unmarshal(carAsBytes, &car) - car.Owner = args[1] - - carAsBytes, _ = json.Marshal(car) - APIstub.PutState(args[0], carAsBytes) - - return shim.Success(nil) + return results, nil +} + +// ChangeCarOwner updates the owner field of car with given id in world state +func (s *SmartContract) ChangeCarOwner(ctx contractapi.TransactionContextInterface, carNumber string, newOwner string) error { + car, err := s.QueryCar(ctx, carNumber) + + if err != nil { + return err + } + + car.Owner = newOwner + + carAsBytes, _ := json.Marshal(car) + + return ctx.GetStub().PutState(carNumber, carAsBytes) } -// The main function is only relevant in unit test mode. Only included here for completeness. func main() { - // Create a new Smart Contract - err := shim.Start(new(SmartContract)) + chaincode, err := contractapi.NewChaincode(new(SmartContract)) + if err != nil { - fmt.Printf("Error creating new Smart Contract: %s", err) + fmt.Printf("Error create fabcar chaincode: %s", err.Error()) + return + } + + if err := chaincode.Start(); err != nil { + fmt.Printf("Error starting fabcar chaincode: %s", err.Error()) } } diff --git a/chaincode/fabcar/go/go.mod b/chaincode/fabcar/go/go.mod new file mode 100644 index 00000000..7a75ea18 --- /dev/null +++ b/chaincode/fabcar/go/go.mod @@ -0,0 +1,5 @@ +module github.com/hyperledger/fabric-samples/chaincode/fabcar/go + +go 1.13 + +require github.com/hyperledger/fabric-contract-api-go v1.0.0 diff --git a/chaincode/fabcar/go/go.sum b/chaincode/fabcar/go/go.sum new file mode 100644 index 00000000..9503dddd --- /dev/null +++ b/chaincode/fabcar/go/go.sum @@ -0,0 +1,141 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/DATA-DOG/godog v0.7.13/go.mod h1:z2OZ6a3X0/YAKVqLfVzYBwFt3j6uSt3Xrqa7XTtcQE0= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.2 h1:o20suLFB4Ri0tuzpWtyHlh7E7HnkqTNLq6aR6WVNS1w= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/spec v0.19.4 h1:ixzUSnHTd6hCemgtAJgluaTSGYpLNpJY4mA2DIkdOAo= +github.com/go-openapi/spec v0.19.4/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= +github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4= +github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= +github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg= +github.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk= +github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20191108205148-17c4b2760b56 h1:BUCrT0VEO4ryJ7DAEGccqnEJcdHydx7wIJQ0ZGFEjJM= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20191108205148-17c4b2760b56/go.mod h1:HZK6PKLWrvdD/t0oSLiyaRaUM6fZ7qjJuOlb0zrn0mo= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20200128192331-2d899240a7ed/go.mod h1:N7H3sA7Tx4k/YzFq7U0EPdqJtqvM4Kild0JoCc7C0Dc= +github.com/hyperledger/fabric-contract-api-go v0.0.0-20191118113407-4c6ff12b4f96 h1:1PaDE2QfQB/5ZnvlrYZNH62xMtKE/9cjwIzy9fjpJmg= +github.com/hyperledger/fabric-contract-api-go v0.0.0-20191118113407-4c6ff12b4f96/go.mod h1:SdJkyS7/oJltu5Ap//5sCEdNlvj+ZzD3TwnJOt3zf4c= +github.com/hyperledger/fabric-contract-api-go v1.0.0 h1:ma1nQX1S/a3zDkfkTb0QXQHNGgJUmEfqHA9/CWmz8Y0= +github.com/hyperledger/fabric-contract-api-go v1.0.0/go.mod h1:PHF7I0hYI0cZF2j7cdyNHaY5FJD3Q49qnnNgsmxEPbM= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-protos-go v0.0.0-20190919234611-2a87503ac7c9/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-protos-go v0.0.0-20191114160927-6bee4929a99f h1:t6+iLphkbJrM8i6YB0T/XxvoTlo50FglEf2hMJHxuOo= +github.com/hyperledger/fabric-protos-go v0.0.0-20191114160927-6bee4929a99f/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-protos-go v0.0.0-20200124220212-e9cfc186ba7b/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542 h1:6ZQFf1D2YYDDI7eSwW8adlkkavTB9sw5I24FVtEvNUQ= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/chaincode/fabcar/java/build.gradle b/chaincode/fabcar/java/build.gradle index 6531834c..8bd04a8e 100644 --- a/chaincode/fabcar/java/build.gradle +++ b/chaincode/fabcar/java/build.gradle @@ -4,8 +4,12 @@ plugins { id 'checkstyle' +<<<<<<< HEAD id 'com.github.johnrengelman.shadow' version '2.0.4' id 'java-library' +======= + id 'java-library-distribution' +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 id 'jacoco' } @@ -13,8 +17,14 @@ group 'org.hyperledger.fabric.samples' version '1.0-SNAPSHOT' dependencies { +<<<<<<< HEAD implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:1.4+' implementation 'com.owlike:genson:1.5' +======= + compileOnly 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.+' + implementation 'com.owlike:genson:1.5' + testImplementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.+' +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' testImplementation 'org.assertj:assertj-core:3.11.1' testImplementation 'org.mockito:mockito-core:2.+' @@ -25,8 +35,13 @@ repositories { url "https://hyperledger.jfrog.io/hyperledger/fabric-maven" } jcenter() +<<<<<<< HEAD maven { url 'https://jitpack.io' +======= + maven { + url 'https://jitpack.io' +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 } } @@ -43,6 +58,7 @@ checkstyleTest { source ='src/test/java' } +<<<<<<< HEAD shadowJar { baseName = 'chaincode' version = null @@ -52,6 +68,8 @@ shadowJar { } } +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 jacocoTestCoverageVerification { afterEvaluate { classDirectories = files(classDirectories.files.collect { @@ -67,7 +85,11 @@ jacocoTestCoverageVerification { } } } +<<<<<<< HEAD +======= + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 finalizedBy jacocoTestReport } diff --git a/chaincode/fabcar/java/config/checkstyle/checkstyle.xml b/chaincode/fabcar/java/config/checkstyle/checkstyle.xml index 94317559..71d84ec9 100644 --- a/chaincode/fabcar/java/config/checkstyle/checkstyle.xml +++ b/chaincode/fabcar/java/config/checkstyle/checkstyle.xml @@ -28,9 +28,15 @@ --> +<<<<<<< HEAD +======= + + + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 diff --git a/chaincode/fabcar/java/gradle/wrapper/gradle-wrapper.properties b/chaincode/fabcar/java/gradle/wrapper/gradle-wrapper.properties index e0b3fb8d..5b0e9d9d 100644 --- a/chaincode/fabcar/java/gradle/wrapper/gradle-wrapper.properties +++ b/chaincode/fabcar/java/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +<<<<<<< HEAD distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip +======= +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/chaincode/fabcar/java/gradlew b/chaincode/fabcar/java/gradlew index cccdd3d5..55599feb 100755 --- a/chaincode/fabcar/java/gradlew +++ b/chaincode/fabcar/java/gradlew @@ -1,5 +1,24 @@ #!/usr/bin/env sh +<<<<<<< HEAD +======= +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +47,11 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +<<<<<<< HEAD DEFAULT_JVM_OPTS="" +======= +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +132,13 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi +<<<<<<< HEAD # For Cygwin, switch paths to Windows format before running java if $cygwin ; then +======= +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` diff --git a/chaincode/fabcar/java/gradlew.bat b/chaincode/fabcar/java/gradlew.bat index e95643d6..fc3b3b9d 100644 --- a/chaincode/fabcar/java/gradlew.bat +++ b/chaincode/fabcar/java/gradlew.bat @@ -1,3 +1,22 @@ +<<<<<<< HEAD +======= +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +33,11 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +<<<<<<< HEAD set DEFAULT_JVM_OPTS= +======= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/chaincode/fabcar/java/settings.gradle b/chaincode/fabcar/java/settings.gradle index 4d04f71e..6e536280 100644 --- a/chaincode/fabcar/java/settings.gradle +++ b/chaincode/fabcar/java/settings.gradle @@ -2,4 +2,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +<<<<<<< HEAD rootProject.name = 'java-chaincode-bootstrap' +======= +rootProject.name = 'fabcar' +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 diff --git a/chaincode/fabcar/javascript-low-level/fabcar.js b/chaincode/fabcar/javascript-low-level/fabcar.js deleted file mode 100644 index c8473c37..00000000 --- a/chaincode/fabcar/javascript-low-level/fabcar.js +++ /dev/null @@ -1,193 +0,0 @@ -/* -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -*/ - -'use strict'; -const shim = require('fabric-shim'); -const util = require('util'); - -let Chaincode = class { - - // The Init method is called when the Smart Contract 'fabcar' is instantiated by the blockchain network - // Best practice is to have any Ledger initialization in separate function -- see initLedger() - async Init(stub) { - console.info('=========== Instantiated fabcar chaincode ==========='); - return shim.success(); - } - - // The Invoke method is called as a result of an application request to run the Smart Contract - // 'fabcar'. The calling application program has also specified the particular smart contract - // function to be called, with arguments - async Invoke(stub) { - let ret = stub.getFunctionAndParameters(); - console.info(ret); - - let method = this[ret.fcn]; - if (!method) { - console.error('no function of name:' + ret.fcn + ' found'); - throw new Error('Received unknown function ' + ret.fcn + ' invocation'); - } - try { - let payload = await method(stub, ret.params); - return shim.success(payload); - } catch (err) { - console.log(err); - return shim.error(err); - } - } - - async queryCar(stub, args) { - if (args.length != 1) { - throw new Error('Incorrect number of arguments. Expecting CarNumber ex: CAR01'); - } - let carNumber = args[0]; - - let carAsBytes = await stub.getState(carNumber); //get the car from chaincode state - if (!carAsBytes || carAsBytes.toString().length <= 0) { - throw new Error(carNumber + ' does not exist: '); - } - console.log(carAsBytes.toString()); - return carAsBytes; - } - - async initLedger(stub, args) { - console.info('============= START : Initialize Ledger ==========='); - let cars = []; - cars.push({ - make: 'Toyota', - model: 'Prius', - color: 'blue', - owner: 'Tomoko' - }); - cars.push({ - make: 'Ford', - model: 'Mustang', - color: 'red', - owner: 'Brad' - }); - cars.push({ - make: 'Hyundai', - model: 'Tucson', - color: 'green', - owner: 'Jin Soo' - }); - cars.push({ - make: 'Volkswagen', - model: 'Passat', - color: 'yellow', - owner: 'Max' - }); - cars.push({ - make: 'Tesla', - model: 'S', - color: 'black', - owner: 'Adriana' - }); - cars.push({ - make: 'Peugeot', - model: '205', - color: 'purple', - owner: 'Michel' - }); - cars.push({ - make: 'Chery', - model: 'S22L', - color: 'white', - owner: 'Aarav' - }); - cars.push({ - make: 'Fiat', - model: 'Punto', - color: 'violet', - owner: 'Pari' - }); - cars.push({ - make: 'Tata', - model: 'Nano', - color: 'indigo', - owner: 'Valeria' - }); - cars.push({ - make: 'Holden', - model: 'Barina', - color: 'brown', - owner: 'Shotaro' - }); - - for (let i = 0; i < cars.length; i++) { - cars[i].docType = 'car'; - await stub.putState('CAR' + i, Buffer.from(JSON.stringify(cars[i]))); - console.info('Added <--> ', cars[i]); - } - console.info('============= END : Initialize Ledger ==========='); - } - - async createCar(stub, args) { - console.info('============= START : Create Car ==========='); - if (args.length != 5) { - throw new Error('Incorrect number of arguments. Expecting 5'); - } - - var car = { - docType: 'car', - make: args[1], - model: args[2], - color: args[3], - owner: args[4] - }; - - await stub.putState(args[0], Buffer.from(JSON.stringify(car))); - console.info('============= END : Create Car ==========='); - } - - async queryAllCars(stub, args) { - - let startKey = 'CAR0'; - let endKey = 'CAR999'; - - let iterator = await stub.getStateByRange(startKey, endKey); - - let allResults = []; - while (true) { - let res = await iterator.next(); - - if (res.value && res.value.value.toString()) { - let jsonRes = {}; - console.log(res.value.value.toString('utf8')); - - jsonRes.Key = res.value.key; - try { - jsonRes.Record = JSON.parse(res.value.value.toString('utf8')); - } catch (err) { - console.log(err); - jsonRes.Record = res.value.value.toString('utf8'); - } - allResults.push(jsonRes); - } - if (res.done) { - console.log('end of data'); - await iterator.close(); - console.info(allResults); - return Buffer.from(JSON.stringify(allResults)); - } - } - } - - async changeCarOwner(stub, args) { - console.info('============= START : changeCarOwner ==========='); - if (args.length != 2) { - throw new Error('Incorrect number of arguments. Expecting 2'); - } - - let carAsBytes = await stub.getState(args[0]); - let car = JSON.parse(carAsBytes); - car.owner = args[1]; - - await stub.putState(args[0], Buffer.from(JSON.stringify(car))); - console.info('============= END : changeCarOwner ==========='); - } -}; - -shim.start(new Chaincode()); diff --git a/chaincode/fabcar/javascript-low-level/package.json b/chaincode/fabcar/javascript-low-level/package.json deleted file mode 100644 index 9ab05de6..00000000 --- a/chaincode/fabcar/javascript-low-level/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "fabcar", - "version": "1.0.0", - "description": "fabcar chaincode implemented in node.js", - "engines": { - "node": ">=8.4.0", - "npm": ">=5.3.0" - }, - "scripts": { - "start": "node fabcar.js" - }, - "engine-strict": true, - "license": "Apache-2.0", - "dependencies": { - "fabric-shim": "~1.4.0" - } -} diff --git a/chaincode/fabcar/javascript/lib/fabcar.js b/chaincode/fabcar/javascript/lib/fabcar.js index 53f2faef..ed6b520d 100644 --- a/chaincode/fabcar/javascript/lib/fabcar.js +++ b/chaincode/fabcar/javascript/lib/fabcar.js @@ -108,33 +108,20 @@ class FabCar extends Contract { async queryAllCars(ctx) { const startKey = 'CAR0'; const endKey = 'CAR999'; - - const iterator = await ctx.stub.getStateByRange(startKey, endKey); - const allResults = []; - while (true) { - const res = await iterator.next(); - - if (res.value && res.value.value.toString()) { - console.log(res.value.value.toString('utf8')); - - const Key = res.value.key; - let Record; - try { - Record = JSON.parse(res.value.value.toString('utf8')); - } catch (err) { - console.log(err); - Record = res.value.value.toString('utf8'); - } - allResults.push({ Key, Record }); - } - if (res.done) { - console.log('end of data'); - await iterator.close(); - console.info(allResults); - return JSON.stringify(allResults); + for await (const {key, value} of ctx.stub.getStateByRange(startKey, endKey)) { + const strValue = Buffer.from(value).toString('utf8'); + let record; + try { + record = JSON.parse(strValue); + } catch (err) { + console.log(err); + record = strValue; } + allResults.push({ Key: key, Record: record }); } + console.info(allResults); + return JSON.stringify(allResults); } async changeCarOwner(ctx, carNumber, newOwner) { diff --git a/chaincode/fabcar/javascript/package.json b/chaincode/fabcar/javascript/package.json index abe74558..9700e8a8 100644 --- a/chaincode/fabcar/javascript/package.json +++ b/chaincode/fabcar/javascript/package.json @@ -17,14 +17,19 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { +<<<<<<< HEAD "fabric-contract-api": "~1.4.0", "fabric-shim": "~1.4.0" +======= + "fabric-contract-api": "^2.0.0", + "fabric-shim": "^2.0.0" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 }, "devDependencies": { "chai": "^4.1.2", "eslint": "^4.19.1", "mocha": "^5.2.0", - "nyc": "^12.0.2", + "nyc": "^14.1.1", "sinon": "^6.0.0", "sinon-chai": "^3.2.0" }, diff --git a/chaincode/fabcar/typescript/package.json b/chaincode/fabcar/typescript/package.json index ba2d5753..3a788721 100644 --- a/chaincode/fabcar/typescript/package.json +++ b/chaincode/fabcar/typescript/package.json @@ -21,8 +21,13 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { +<<<<<<< HEAD "fabric-contract-api": "~1.4.0", "fabric-shim": "~1.4.0" +======= + "fabric-contract-api": "^2.0.0", + "fabric-shim": "^2.0.0" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 }, "devDependencies": { "@types/chai": "^4.1.7", @@ -32,7 +37,7 @@ "@types/sinon-chai": "^3.2.1", "chai": "^4.2.0", "mocha": "^5.2.0", - "nyc": "^13.1.0", + "nyc": "^14.1.1", "sinon": "^7.1.1", "sinon-chai": "^3.3.0", "ts-node": "^7.0.1", diff --git a/chaincode/fabcar/typescript/src/fabcar.ts b/chaincode/fabcar/typescript/src/fabcar.ts index de72b039..2f45f9ef 100644 --- a/chaincode/fabcar/typescript/src/fabcar.ts +++ b/chaincode/fabcar/typescript/src/fabcar.ts @@ -107,33 +107,20 @@ export class FabCar extends Contract { public async queryAllCars(ctx: Context): Promise { const startKey = 'CAR0'; const endKey = 'CAR999'; - - const iterator = await ctx.stub.getStateByRange(startKey, endKey); - const allResults = []; - while (true) { - const res = await iterator.next(); - - if (res.value && res.value.value.toString()) { - console.log(res.value.value.toString('utf8')); - - const Key = res.value.key; - let Record; - try { - Record = JSON.parse(res.value.value.toString('utf8')); - } catch (err) { - console.log(err); - Record = res.value.value.toString('utf8'); - } - allResults.push({ Key, Record }); - } - if (res.done) { - console.log('end of data'); - await iterator.close(); - console.info(allResults); - return JSON.stringify(allResults); + for await (const {key, value} of ctx.stub.getStateByRange(startKey, endKey)) { + const strValue = Buffer.from(value).toString('utf8'); + let record; + try { + record = JSON.parse(strValue); + } catch (err) { + console.log(err); + record = strValue; } + allResults.push({ Key: key, Record: record }); } + console.info(allResults); + return JSON.stringify(allResults); } public async changeCarOwner(ctx: Context, carNumber: string, newOwner: string) { diff --git a/chaincode/marbles02/go/go.mod b/chaincode/marbles02/go/go.mod new file mode 100644 index 00000000..d61ab3ec --- /dev/null +++ b/chaincode/marbles02/go/go.mod @@ -0,0 +1,12 @@ +module github.com/hyperledger/fabric-samples/chaincode/marbles02/go + +go 1.12 + +require ( + github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 + github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 + golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect + golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect + golang.org/x/text v0.3.2 // indirect + google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect +) diff --git a/chaincode/marbles02/go/go.sum b/chaincode/marbles02/go/go.sum new file mode 100644 index 00000000..66ba37b6 --- /dev/null +++ b/chaincode/marbles02/go/go.sum @@ -0,0 +1,85 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 h1:VEm3tPRTCzq3J/1XpVERh1PbOSnshUVwx2G5s3cLiTw= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85/go.mod h1:HZK6PKLWrvdD/t0oSLiyaRaUM6fZ7qjJuOlb0zrn0mo= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 h1:WzttYAPO5xkQ87ZrxzEhvDZknfarSNu1PZt3NPMTE3Y= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/chaincode/marbles02/go/marbles_chaincode.go b/chaincode/marbles02/go/marbles_chaincode.go index 2ed3efd6..d47fe924 100644 --- a/chaincode/marbles02/go/marbles_chaincode.go +++ b/chaincode/marbles02/go/marbles_chaincode.go @@ -87,8 +87,8 @@ import ( "strings" "time" - "github.com/hyperledger/fabric/core/chaincode/shim" - pb "github.com/hyperledger/fabric/protos/peer" + "github.com/hyperledger/fabric-chaincode-go/shim" + pb "github.com/hyperledger/fabric-protos-go/peer" ) // SimpleChaincode example simple Chaincode implementation diff --git a/chaincode/marbles02/javascript/.gitignore b/chaincode/marbles02/javascript/.gitignore new file mode 100644 index 00000000..a00ca941 --- /dev/null +++ b/chaincode/marbles02/javascript/.gitignore @@ -0,0 +1,77 @@ +# +# SPDX-License-Identifier: Apache-2.0 +# + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless diff --git a/chaincode/marbles02/node/META-INF/statedb/couchdb/indexes/indexOwner.json b/chaincode/marbles02/javascript/META-INF/statedb/couchdb/indexes/indexOwner.json similarity index 100% rename from chaincode/marbles02/node/META-INF/statedb/couchdb/indexes/indexOwner.json rename to chaincode/marbles02/javascript/META-INF/statedb/couchdb/indexes/indexOwner.json diff --git a/chaincode/marbles02/node/marbles_chaincode.js b/chaincode/marbles02/javascript/marbles_chaincode.js similarity index 100% rename from chaincode/marbles02/node/marbles_chaincode.js rename to chaincode/marbles02/javascript/marbles_chaincode.js diff --git a/chaincode/marbles02/node/package.json b/chaincode/marbles02/javascript/package.json similarity index 52% rename from chaincode/marbles02/node/package.json rename to chaincode/marbles02/javascript/package.json index 8be2caf3..3c3d4453 100644 --- a/chaincode/marbles02/node/package.json +++ b/chaincode/marbles02/javascript/package.json @@ -6,10 +6,16 @@ "node": ">=8.4.0", "npm": ">=5.3.0" }, - "scripts": { "start" : "node marbles_chaincode.js" }, + "scripts": { + "start": "node marbles_chaincode.js" + }, "engine-strict": true, "license": "Apache-2.0", "dependencies": { +<<<<<<< HEAD:chaincode/marbles02/node/package.json "fabric-shim": "~1.4.0" +======= + "fabric-shim": "^2.0.0" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:chaincode/marbles02/javascript/package.json } } diff --git a/chaincode/marbles02_private/go/go.mod b/chaincode/marbles02_private/go/go.mod new file mode 100644 index 00000000..f9eff013 --- /dev/null +++ b/chaincode/marbles02_private/go/go.mod @@ -0,0 +1,12 @@ +module github.com/hyperledger/fabric-samples/chaincode/marbles02_private/go + +go 1.12 + +require ( + github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 + github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 + golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect + golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect + golang.org/x/text v0.3.2 // indirect + google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect +) diff --git a/chaincode/marbles02_private/go/go.sum b/chaincode/marbles02_private/go/go.sum new file mode 100644 index 00000000..66ba37b6 --- /dev/null +++ b/chaincode/marbles02_private/go/go.sum @@ -0,0 +1,85 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 h1:VEm3tPRTCzq3J/1XpVERh1PbOSnshUVwx2G5s3cLiTw= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85/go.mod h1:HZK6PKLWrvdD/t0oSLiyaRaUM6fZ7qjJuOlb0zrn0mo= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 h1:WzttYAPO5xkQ87ZrxzEhvDZknfarSNu1PZt3NPMTE3Y= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/chaincode/marbles02_private/go/marbles_chaincode_private.go b/chaincode/marbles02_private/go/marbles_chaincode_private.go index b5bafb8d..cd52295c 100644 --- a/chaincode/marbles02_private/go/marbles_chaincode_private.go +++ b/chaincode/marbles02_private/go/marbles_chaincode_private.go @@ -96,8 +96,8 @@ import ( "fmt" "strings" - "github.com/hyperledger/fabric/core/chaincode/shim" - pb "github.com/hyperledger/fabric/protos/peer" + "github.com/hyperledger/fabric-chaincode-go/shim" + pb "github.com/hyperledger/fabric-protos-go/peer" ) // SimpleChaincode example simple Chaincode implementation @@ -199,18 +199,19 @@ func (t *SimpleChaincode) initMarble(stub shim.ChaincodeStubInterface, args []st return shim.Error("Error getting transient: " + err.Error()) } - if _, ok := transMap["marble"]; !ok { + marbleJsonBytes, ok := transMap["marble"] + if !ok { return shim.Error("marble must be a key in the transient map") } - if len(transMap["marble"]) == 0 { + if len(marbleJsonBytes) == 0 { return shim.Error("marble value in the transient map must be a non-empty JSON string") } var marbleInput marbleTransientInput - err = json.Unmarshal(transMap["marble"], &marbleInput) + err = json.Unmarshal(marbleJsonBytes, &marbleInput) if err != nil { - return shim.Error("Failed to decode JSON of: " + string(transMap["marble"])) + return shim.Error("Failed to decode JSON of: " + string(marbleJsonBytes)) } if len(marbleInput.Name) == 0 { @@ -275,8 +276,8 @@ func (t *SimpleChaincode) initMarble(stub shim.ChaincodeStubInterface, args []st // ==== Index the marble to enable color-based range queries, e.g. return all blue marbles ==== // An 'index' is a normal key/value entry in state. // The key is a composite key, with the elements that you want to range query on listed first. - // In our case, the composite key is based on indexName~color~name. - // This will enable very efficient state range queries based on composite keys matching indexName~color~* + // In our case, the composite key is based on indexName=color~name. + // This will enable very efficient state range queries based on composite keys matching indexName=color~* indexName := "color~name" colorNameIndexKey, err := stub.CreateCompositeKey(indexName, []string{marble.Color, marble.Name}) if err != nil { @@ -306,7 +307,7 @@ func (t *SimpleChaincode) readMarble(stub shim.ChaincodeStubInterface, args []st name = args[0] valAsbytes, err := stub.GetPrivateData("collectionMarbles", name) //get the marble from chaincode state if err != nil { - jsonResp = "{\"Error\":\"Failed to get state for " + name + "\"}" + jsonResp = "{\"Error\":\"Failed to get state for " + name + ": " + err.Error() + "\"}" return shim.Error(jsonResp) } else if valAsbytes == nil { jsonResp = "{\"Error\":\"Marble does not exist: " + name + "\"}" @@ -359,18 +360,19 @@ func (t *SimpleChaincode) delete(stub shim.ChaincodeStubInterface, args []string return shim.Error("Error getting transient: " + err.Error()) } - if _, ok := transMap["marble_delete"]; !ok { + marbleDeleteJsonBytes, ok := transMap["marble_delete"] + if !ok { return shim.Error("marble_delete must be a key in the transient map") } - if len(transMap["marble_delete"]) == 0 { + if len(marbleDeleteJsonBytes) == 0 { return shim.Error("marble_delete value in the transient map must be a non-empty JSON string") } var marbleDeleteInput marbleDeleteTransientInput - err = json.Unmarshal(transMap["marble_delete"], &marbleDeleteInput) + err = json.Unmarshal(marbleDeleteJsonBytes, &marbleDeleteInput) if err != nil { - return shim.Error("Failed to decode JSON of: " + string(transMap["marble_delete"])) + return shim.Error("Failed to decode JSON of: " + string(marbleDeleteJsonBytes)) } if len(marbleDeleteInput.Name) == 0 { @@ -438,18 +440,19 @@ func (t *SimpleChaincode) transferMarble(stub shim.ChaincodeStubInterface, args return shim.Error("Error getting transient: " + err.Error()) } - if _, ok := transMap["marble_owner"]; !ok { + marbleOwnerJsonBytes, ok := transMap["marble_owner"] + if !ok { return shim.Error("marble_owner must be a key in the transient map") } - if len(transMap["marble_owner"]) == 0 { + if len(marbleOwnerJsonBytes) == 0 { return shim.Error("marble_owner value in the transient map must be a non-empty JSON string") } var marbleTransferInput marbleTransferTransientInput - err = json.Unmarshal(transMap["marble_owner"], &marbleTransferInput) + err = json.Unmarshal(marbleOwnerJsonBytes, &marbleTransferInput) if err != nil { - return shim.Error("Failed to decode JSON of: " + string(transMap["marble_owner"])) + return shim.Error("Failed to decode JSON of: " + string(marbleOwnerJsonBytes)) } if len(marbleTransferInput.Name) == 0 { @@ -520,18 +523,16 @@ func (t *SimpleChaincode) getMarblesByRange(stub shim.ChaincodeStubInterface, ar return shim.Error(err.Error()) } // Add a comma before array members, suppress it for the first array member - if bArrayMemberAlreadyWritten == true { + if bArrayMemberAlreadyWritten { buffer.WriteString(",") } - buffer.WriteString("{\"Key\":") - buffer.WriteString("\"") - buffer.WriteString(queryResponse.Key) - buffer.WriteString("\"") - buffer.WriteString(", \"Record\":") - // Record is a JSON object, so we write as-is - buffer.WriteString(string(queryResponse.Value)) - buffer.WriteString("}") + buffer.WriteString( + fmt.Sprintf( + `{"Key":"%s", "Record":%s}`, + queryResponse.Key, queryResponse.Value, + ), + ) bArrayMemberAlreadyWritten = true } buffer.WriteString("]") diff --git a/chaincode/sacc/go.mod b/chaincode/sacc/go.mod new file mode 100644 index 00000000..f9deb8a7 --- /dev/null +++ b/chaincode/sacc/go.mod @@ -0,0 +1,12 @@ +module github.com/hyperledger/fabric-samples/chaincode/sacc + +go 1.12 + +require ( + github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 + github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 + golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect + golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect + golang.org/x/text v0.3.2 // indirect + google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect +) diff --git a/chaincode/sacc/go.sum b/chaincode/sacc/go.sum new file mode 100644 index 00000000..da5b5719 --- /dev/null +++ b/chaincode/sacc/go.sum @@ -0,0 +1,82 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 h1:VEm3tPRTCzq3J/1XpVERh1PbOSnshUVwx2G5s3cLiTw= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85/go.mod h1:HZK6PKLWrvdD/t0oSLiyaRaUM6fZ7qjJuOlb0zrn0mo= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 h1:WzttYAPO5xkQ87ZrxzEhvDZknfarSNu1PZt3NPMTE3Y= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/chaincode/sacc/sacc.go b/chaincode/sacc/sacc.go index 4bfb165b..5fffe974 100644 --- a/chaincode/sacc/sacc.go +++ b/chaincode/sacc/sacc.go @@ -9,8 +9,8 @@ package main import ( "fmt" - "github.com/hyperledger/fabric/core/chaincode/shim" - "github.com/hyperledger/fabric/protos/peer" + "github.com/hyperledger/fabric-chaincode-go/shim" + "github.com/hyperledger/fabric-protos-go/peer" ) // SimpleAsset implements a simple chaincode to manage an asset diff --git a/chaincode/sacc/sacc_test.go b/chaincode/sacc/sacc_test.go new file mode 100644 index 00000000..7ab39c9a --- /dev/null +++ b/chaincode/sacc/sacc_test.go @@ -0,0 +1,174 @@ +/* +Copyright Hitachi America Ltd. All Rights Reserved. + +SPDX-License-Identifier: Apache-2.0 +*/ + +package main + +import ( + "fmt" + "testing" + + "github.com/hyperledger/fabric-chaincode-go/shim" + "github.com/hyperledger/fabric-chaincode-go/shimtest" +) + +func checkInit(t *testing.T, stub *shimtest.MockStub, args [][]byte) { + res := stub.MockInit("1", args) + if res.Status != shim.OK { + fmt.Println("Init failed", string(res.Message)) + t.FailNow() + } +} + +func checkState(t *testing.T, stub *shimtest.MockStub, name string, value string) { + bytes := stub.State[name] + if bytes == nil { + fmt.Println("State", name, "failed to get value") + t.FailNow() + } + if string(bytes) != value { + fmt.Println("State value", name, "was not", value, "as expected") + t.FailNow() + } +} + +func checkQuery(t *testing.T, stub *shimtest.MockStub, name string, value string) { + res := stub.MockInvoke("1", [][]byte{[]byte("query"), []byte(name)}) + if res.Status != shim.OK { + fmt.Println("Query", name, "failed", string(res.Message)) + t.FailNow() + } + if res.Payload == nil { + fmt.Println("Query", name, "failed to get value") + t.FailNow() + } + if string(res.Payload) != value { + fmt.Println("Query value", name, "was not", value, "as expected") + t.FailNow() + } +} + +func checkInvoke(t *testing.T, stub *shimtest.MockStub, args [][]byte) { + res := stub.MockInvoke("1", args) + if res.Status != shim.OK { + fmt.Println("Invoke", args, "failed", string(res.Message)) + t.FailNow() + } +} + +func TestSacc_Init(t *testing.T) { + cc := new(SimpleAsset) + stub := shimtest.NewMockStub("sacc", cc) + + // Init a=10 + checkInit(t, stub, [][]byte{[]byte("a"), []byte("10")}) + + checkState(t, stub, "a", "10") +} + +func TestSacc_Query(t *testing.T) { + cc := new(SimpleAsset) + stub := shimtest.NewMockStub("sacc", cc) + + // Init a=10 + checkInit(t, stub, [][]byte{[]byte("a"), []byte("10")}) + + // Query a + checkQuery(t, stub, "a", "10") +} + +func TestSacc_Invoke(t *testing.T) { + cc := new(SimpleAsset) + stub := shimtest.NewMockStub("sacc", cc) + + // Init a=10 + checkInit(t, stub, [][]byte{[]byte("a"), []byte("10")}) + + // Invoke: Set a=20 + checkInvoke(t, stub, [][]byte{[]byte("set"), []byte("a"), []byte("20")}) + + // Query a + checkQuery(t, stub, "a", "20") +} + +func TestSacc_InitWithIncorrectArguments(t *testing.T) { + cc := new(SimpleAsset) + stub := shimtest.NewMockStub("sacc", cc) + + // Init with incorrect arguments + res := stub.MockInit("1", [][]byte{[]byte("a"), []byte("10"), []byte("10")}) + + if res.Status != shim.ERROR { + fmt.Println("Invalid Init accepted") + t.FailNow() + } + + if res.Message != "Incorrect arguments. Expecting a key and a value" { + fmt.Println("Unexpected Error message:", string(res.Message)) + t.FailNow() + } +} + +func TestSacc_QueryWithIncorrectArguments(t *testing.T) { + cc := new(SimpleAsset) + stub := shimtest.NewMockStub("sacc", cc) + + // Init a=10 + checkInit(t, stub, [][]byte{[]byte("a"), []byte("10")}) + + // Query with incorrect arguments + res := stub.MockInvoke("1", [][]byte{[]byte("query"), []byte("a"), []byte("b")}) + + if res.Status != shim.ERROR { + fmt.Println("Invalid query accepted") + t.FailNow() + } + + if res.Message != "Incorrect arguments. Expecting a key" { + fmt.Println("Unexpected Error message:", string(res.Message)) + t.FailNow() + } +} + +func TestSacc_QueryForAssetNotFound(t *testing.T) { + cc := new(SimpleAsset) + stub := shimtest.NewMockStub("sacc", cc) + + // Init a=10 + checkInit(t, stub, [][]byte{[]byte("a"), []byte("10")}) + + // Query for b (as a asset not found) + res := stub.MockInvoke("1", [][]byte{[]byte("query"), []byte("b")}) + + if res.Status != shim.ERROR { + fmt.Println("Invalid query accepted") + t.FailNow() + } + + if res.Message != "Asset not found: b" { + fmt.Println("Unexpected Error message:", string(res.Message)) + t.FailNow() + } +} + +func TestSacc_InvokeWithIncorrectArguments(t *testing.T) { + cc := new(SimpleAsset) + stub := shimtest.NewMockStub("sacc", cc) + + // Init a=10 + checkInit(t, stub, [][]byte{[]byte("a"), []byte("10")}) + + // Invoke with incorrect arguments + res := stub.MockInvoke("1", [][]byte{[]byte("set"), []byte("a")}) + if res.Status != shim.ERROR { + fmt.Println("Invalid Invoke accepted") + t.FailNow() + } + + if res.Message != "Incorrect arguments. Expecting a key and a value" { + fmt.Println("Unexpected Error message:", string(res.Message)) + t.FailNow() + } +} diff --git a/ci.properties b/ci.properties new file mode 100644 index 00000000..a3b65aae --- /dev/null +++ b/ci.properties @@ -0,0 +1,21 @@ +# Set "nexus" if you would like to pull images from nexus3 +# Set "build" if you would like build fabric, fabric-ca on latest commits +IMAGE_SORUCE=nexus +# set only "javaenv" image if you set IMAGE_SOURCE to "build" +# Pull below list of images from nexus3 if IMAGE_SOURCE is set to "nexus" or "build" +FAB_IMAGES_LIST=ca peer orderer ccenv tools baseos nodeenv javaenv +# Set fabric if you would like pull only fabric binaries +FAB_BINARY_REPO=fabric fabric-ca +# Pull below list of images from Hyperledger DockerHub +FAB_THIRDPARTY_IMAGES_LIST=couchdb +# Pull latest binaries of latest commit of release-1.4 from nexus snapshots +# Applicable only when set IMAGE_SOURCE to "nexus" +FAB_BINARY_VER=latest +# Set base version from fabric branch +FAB_BASE_VERSION=2.0.0 +# Set base image version from fabric branch +FAB_BASEIMAGE_VERSION=0.4.15 +# Set related rocketChat channel name. Default: jenkins-robot +CHANNEL_NAME=jenkins-robot +# Set compaitable go version +GO_VER=1.12.5 diff --git a/ci/azure-pipelines.yml b/ci/azure-pipelines.yml index def2c1bc..ac302534 100644 --- a/ci/azure-pipelines.yml +++ b/ci/azure-pipelines.yml @@ -7,7 +7,11 @@ trigger: - release-1.4 variables: +<<<<<<< HEAD NODE_VER: '10.x' +======= + NODE_VER: '12.x' +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 jobs: - job: fabcar_go @@ -21,6 +25,20 @@ jobs: - template: install-fabric.yml - template: fabcar-go.yml +<<<<<<< HEAD +======= + - job: test_network + displayName: Start the test network + pool: + vmImage: ubuntu-18.04 + dependsOn: [] + timeoutInMinutes: 60 + steps: + - template: install-deps.yml + - template: install-fabric.yml + - template: testnetwork.yml + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 - job: fabcar_java displayName: FabCar (Java) pool: @@ -53,3 +71,39 @@ jobs: - template: install-deps.yml - template: install-fabric.yml - template: fabcar-typescript.yml +<<<<<<< HEAD +======= + + - job: commercialpaper_javascript + displayName: CommercialPaper (JavaScript) + pool: + vmImage: ubuntu-18.04 + dependsOn: [] + timeoutInMinutes: 60 + steps: + - template: install-deps.yml + - template: install-fabric.yml + - template: commercialpaper-javascript.yml + + - job: commercialpaper_java + displayName: CommercialPaper (Java) + pool: + vmImage: ubuntu-18.04 + dependsOn: [] + timeoutInMinutes: 60 + steps: + - template: install-deps.yml + - template: install-fabric.yml + - template: commercialpaper-java.yml + + - job: commercialpaper_go + displayName: CommercialPaper (Go) + pool: + vmImage: ubuntu-18.04 + dependsOn: [] + timeoutInMinutes: 60 + steps: + - template: install-deps.yml + - template: install-fabric.yml + - template: commercialpaper-go.yml +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 diff --git a/ci/commercialpaper-go.yml b/ci/commercialpaper-go.yml new file mode 100644 index 00000000..0396051d --- /dev/null +++ b/ci/commercialpaper-go.yml @@ -0,0 +1,109 @@ +# +# SPDX-License-Identifier: Apache-2.0 +# + +steps: + - script: go test ./... + workingDirectory: commercial-paper/organization/magnetocorp/contract-go + displayName: Go unit test magnetocorp + - script: go test ./... + workingDirectory: commercial-paper/organization/digibank/contract-go + displayName: Go unit test digibank + + - script: | + go mod vendor + workingDirectory: commercial-paper/organization/magnetocorp/contract-go + - script: | + go mod vendor + workingDirectory: commercial-paper/organization/digibank/contract-go + + - script: | + echo $PATH + ls -l /usr/local/bin/peer + sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-latest.tar.gz -C .. + ./network.sh down + ./network.sh up createChannel -s couchdb -i 2.0.0 + + # Copy the connection profiles so they are in the correct organizations. + cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/" + cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/" + workingDirectory: test-network + displayName: Start Fabric + env: + FABRIC_CFG_PATH: /usr/local/config + - script: | + source <(./magnetocorp.sh) + peer lifecycle chaincode package cp.tar.gz --lang java --path ./contract-java --label cp_0 + peer lifecycle chaincode install cp.tar.gz + + export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id') + echo $PACKAGE_ID + + peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel \ + --name papercontract \ + -v 0 \ + --package-id $PACKAGE_ID \ + --sequence 1 \ + --tls \ + --cafile $ORDERER_CA + + peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1 + workingDirectory: commercial-paper/organization/magnetocorp + displayName: Setup Commercial Paper contract + env: + FABRIC_CFG_PATH: /usr/local/config + - script: | + source <(./digibank.sh) + peer lifecycle chaincode package cp.tar.gz --lang java --path ./contract-java --label cp_0 + peer lifecycle chaincode install cp.tar.gz + + export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id') + echo $PACKAGE_ID + + peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel \ + --name papercontract \ + -v 0 \ + --package-id $PACKAGE_ID \ + --sequence 1 \ + --tls \ + --cafile $ORDERER_CA + + peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1 + + peer lifecycle chaincode commit -o localhost:7050 \ + --peerAddresses localhost:7051 --tlsRootCertFiles ${PEER0_ORG1_CA} \ + --peerAddresses localhost:9051 --tlsRootCertFiles ${PEER0_ORG2_CA} \ + --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel --name papercontract -v 0 \ + --sequence 1 \ + --tls --cafile $ORDERER_CA --waitForEvent + + workingDirectory: commercial-paper/organization/digibank + displayName: Setup Commercial Paper contract + env: + FABRIC_CFG_PATH: /usr/local/config + + + + - script: retry -- npm install + workingDirectory: commercial-paper/organization/magnetocorp/application + displayName: Install Magnetocorp application + - script: | + set -ex + node addToWallet.js + node issue.js + workingDirectory: commercial-paper/organization/magnetocorp/application + displayName: Magnetocorp issue paper + + - script: retry -- npm install + workingDirectory: commercial-paper/organization/digibank/application + displayName: Install Digibank application + - script: | + set -ex + node addToWallet.js + node buy.js + node redeem.js + workingDirectory: commercial-paper/organization/digibank/application + displayName: Digibank issue paper \ No newline at end of file diff --git a/ci/commercialpaper-java.yml b/ci/commercialpaper-java.yml new file mode 100644 index 00000000..8143aeae --- /dev/null +++ b/ci/commercialpaper-java.yml @@ -0,0 +1,103 @@ +# +# SPDX-License-Identifier: Apache-2.0 +# + +steps: + - script: | + ./gradlew build + workingDirectory: commercial-paper/organization/digibank/contract-java + displayName: Build Java Contract + - script: | + ./gradlew build + workingDirectory: commercial-paper/organization/magnetocorp/contract-java + displayName: Build Java Contract + + - script: | + echo $PATH + ls -l /usr/local/bin/peer + sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-latest.tar.gz -C .. + ./network.sh down + ./network.sh up createChannel -s couchdb -i 2.0.0 + + # Copy the connection profiles so they are in the correct organizations. + cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/" + cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/" + workingDirectory: test-network + displayName: Start Fabric + env: + FABRIC_CFG_PATH: /usr/local/config + - script: | + source <(./magnetocorp.sh) + peer lifecycle chaincode package cp.tar.gz --lang java --path ./contract-java --label cp_0 + peer lifecycle chaincode install cp.tar.gz + + export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id') + echo $PACKAGE_ID + + peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel \ + --name papercontract \ + -v 0 \ + --package-id $PACKAGE_ID \ + --sequence 1 \ + --tls \ + --cafile $ORDERER_CA + + peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1 + workingDirectory: commercial-paper/organization/magnetocorp + displayName: Setup Commercial Paper contract + env: + FABRIC_CFG_PATH: /usr/local/config + - script: | + source <(./digibank.sh) + peer lifecycle chaincode package cp.tar.gz --lang java --path ./contract-java --label cp_0 + peer lifecycle chaincode install cp.tar.gz + + export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id') + echo $PACKAGE_ID + + peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel \ + --name papercontract \ + -v 0 \ + --package-id $PACKAGE_ID \ + --sequence 1 \ + --tls \ + --cafile $ORDERER_CA + + peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1 + + peer lifecycle chaincode commit -o localhost:7050 \ + --peerAddresses localhost:7051 --tlsRootCertFiles ${PEER0_ORG1_CA} \ + --peerAddresses localhost:9051 --tlsRootCertFiles ${PEER0_ORG2_CA} \ + --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel --name papercontract -v 0 \ + --sequence 1 \ + --tls --cafile $ORDERER_CA --waitForEvent + + workingDirectory: commercial-paper/organization/digibank + displayName: Setup Commercial Paper contract + env: + FABRIC_CFG_PATH: /usr/local/config + + + - script: retry -- npm install + workingDirectory: commercial-paper/organization/magnetocorp/application + displayName: Install Magnetocorp application + - script: | + set -ex + node addToWallet.js + node issue.js + workingDirectory: commercial-paper/organization/magnetocorp/application + displayName: Magnetocorp issue paper + + - script: retry -- npm install + workingDirectory: commercial-paper/organization/digibank/application + displayName: Install Digibank application + - script: | + set -ex + node addToWallet.js + node buy.js + node redeem.js + workingDirectory: commercial-paper/organization/digibank/application + displayName: Digibank issue paper \ No newline at end of file diff --git a/ci/commercialpaper-javascript.yml b/ci/commercialpaper-javascript.yml new file mode 100644 index 00000000..790beaef --- /dev/null +++ b/ci/commercialpaper-javascript.yml @@ -0,0 +1,92 @@ +# +# SPDX-License-Identifier: Apache-2.0 +# + +steps: + - script: | + echo $PATH + ls -l /usr/local/bin/peer + sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-latest.tar.gz -C .. + ./network.sh down + ./network.sh up createChannel -s couchdb -i 2.0.0 + + # Copy the connection profiles so they are in the correct organizations. + cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/" + cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/" + workingDirectory: test-network + displayName: Start Fabric + env: + FABRIC_CFG_PATH: /usr/local/config + - script: | + source <(./magnetocorp.sh) + peer lifecycle chaincode package cp.tar.gz --lang node --path ./contract --label cp_0 + peer lifecycle chaincode install cp.tar.gz + + export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id') + echo $PACKAGE_ID + + peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel \ + --name papercontract \ + -v 0 \ + --package-id $PACKAGE_ID \ + --sequence 1 \ + --tls \ + --cafile $ORDERER_CA + + peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1 + workingDirectory: commercial-paper/organization/magnetocorp + displayName: Setup Commercial Paper contract + env: + FABRIC_CFG_PATH: /usr/local/config + - script: | + source <(./digibank.sh) + peer lifecycle chaincode package cp.tar.gz --lang node --path ./contract --label cp_0 + peer lifecycle chaincode install cp.tar.gz + + export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id') + echo $PACKAGE_ID + + peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel \ + --name papercontract \ + -v 0 \ + --package-id $PACKAGE_ID \ + --sequence 1 \ + --tls \ + --cafile $ORDERER_CA + + peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1 + + peer lifecycle chaincode commit -o localhost:7050 \ + --peerAddresses localhost:7051 --tlsRootCertFiles ${PEER0_ORG1_CA} \ + --peerAddresses localhost:9051 --tlsRootCertFiles ${PEER0_ORG2_CA} \ + --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel --name papercontract -v 0 \ + --sequence 1 \ + --tls --cafile $ORDERER_CA --waitForEvent + + workingDirectory: commercial-paper/organization/digibank + displayName: Setup Commercial Paper contract + env: + FABRIC_CFG_PATH: /usr/local/config + - script: retry -- npm install + workingDirectory: commercial-paper/organization/magnetocorp/application + displayName: Install Magnetocorp application + - script: | + set -ex + node addToWallet.js + node issue.js + workingDirectory: commercial-paper/organization/magnetocorp/application + displayName: Magnetocorp issue paper + + - script: retry -- npm install + workingDirectory: commercial-paper/organization/digibank/application + displayName: Install Digibank application + - script: | + set -ex + node addToWallet.js + node buy.js + node redeem.js + workingDirectory: commercial-paper/organization/digibank/application + displayName: Digibank issue paper \ No newline at end of file diff --git a/ci/fabcar-javascript.yml b/ci/fabcar-javascript.yml index 3f910747..7edde6e9 100644 --- a/ci/fabcar-javascript.yml +++ b/ci/fabcar-javascript.yml @@ -6,7 +6,13 @@ steps: - script: bash startFabric.sh javascript workingDirectory: fabcar displayName: Start Fabric +<<<<<<< HEAD - script: retry -- npm install +======= + - script: | + retry -- npm install + npm ls +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 workingDirectory: fabcar/javascript displayName: Install FabCar application dependencies - script: | diff --git a/ci/getDockerImages.sh b/ci/getDockerImages.sh new file mode 100755 index 00000000..6fcb91a4 --- /dev/null +++ b/ci/getDockerImages.sh @@ -0,0 +1,41 @@ +#!/bin/bash -e +set -o pipefail + +echo "======== PULL DOCKER IMAGES ========" +########################################################## +REPO_URL=hyperledger-fabric.jfrog.io +ORG_NAME="fabric" + +VERSION=2.0.0 +ARCH="amd64" +: ${STABLE_VERSION:=$VERSION-stable} +STABLE_TAG=$ARCH-$STABLE_VERSION +MASTER_TAG=$ARCH-stable + +echo "---------> STABLE_VERSION:" $STABLE_VERSION + +dockerTag() { + for IMAGES in baseos peer orderer ca tools orderer ccenv javaenv nodeenv; do + echo "Images: $IMAGES" + echo + docker pull $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG + if [ $? != 0 ]; then + echo "FAILED: Docker Pull Failed on $IMAGES" + exit 1 + fi + docker tag $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG hyperledger/$ORG_NAME-$IMAGES + docker tag $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG hyperledger/$ORG_NAME-$IMAGES:latest + docker tag $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG hyperledger/$ORG_NAME-$IMAGES:$ARCH-$VERSION-stable + docker tag $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG hyperledger/$ORG_NAME-$IMAGES:$ARCH-stable + docker tag $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG hyperledger/$ORG_NAME-$IMAGES:$VERSION + + echo "Deleting docker images: $IMAGES" + docker rmi -f $REPO_URL/$ORG_NAME-$IMAGES:$STABLE_TAG + done +} + +dockerTag + +echo +docker images +echo \ No newline at end of file diff --git a/ci/install-fabric.yml b/ci/install-fabric.yml index 6f8db50e..3f344ca9 100644 --- a/ci/install-fabric.yml +++ b/ci/install-fabric.yml @@ -5,6 +5,7 @@ steps: - script: | set -eo pipefail +<<<<<<< HEAD wget -q -P /tmp https://hyperledger.jfrog.io/hyperledger/fabric-binaries/hyperledger-fabric-linux-amd64-1.4.5-stable.tar.gz sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-1.4.5-stable.tar.gz -C /usr/local displayName: Download Fabric CLI @@ -26,4 +27,15 @@ steps: docker pull hyperledger/fabric-couchdb:0.4.15 docker tag hyperledger/fabric-couchdb:0.4.15 hyperledger/fabric-couchdb:latest +======= + wget -q -P /tmp https://hyperledger.jfrog.io/hyperledger/fabric-binaries/hyperledger-fabric-linux-amd64-latest.tar.gz + sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-latest.tar.gz -C /usr/local + displayName: Download Fabric CLI + - script: | + set -eo pipefail + wget -q -P /tmp https://hyperledger.jfrog.io/hyperledger/fabric-binaries/hyperledger-fabric-ca-linux-amd64-latest.tar.gz + sudo tar xzvf /tmp/hyperledger-fabric-ca-linux-amd64-latest.tar.gz -C /usr/local + displayName: Download Fabric CA CLI + - script: bash ci/getDockerImages.sh +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 displayName: Pull Fabric Docker images diff --git a/ci/testnetwork.yml b/ci/testnetwork.yml new file mode 100644 index 00000000..9cf27392 --- /dev/null +++ b/ci/testnetwork.yml @@ -0,0 +1,15 @@ +# +# SPDX-License-Identifier: Apache-2.0 +# + +steps: + - script: | + sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-latest.tar.gz -C .. + ./network.sh down + ./network.sh up createChannel -s couchdb -i 2.0.0 + ./network.sh deployCC -l javascript + + workingDirectory: test-network + displayName: Start up test network + env: + FABRIC_CFG_PATH: /usr/local/config diff --git a/commercial-paper/.gitignore b/commercial-paper/.gitignore new file mode 100644 index 00000000..65971ce8 --- /dev/null +++ b/commercial-paper/.gitignore @@ -0,0 +1,4 @@ +cp.tar.gz +**/.gradle +**/gateway/connection-org1.yaml +**/gateway/connection-org2.yaml diff --git a/commercial-paper/README.md b/commercial-paper/README.md new file mode 100644 index 00000000..2bf1f920 --- /dev/null +++ b/commercial-paper/README.md @@ -0,0 +1,281 @@ +# Commercial Paper Tutorial + +This folder contains the code for an introductory tutorial to Smart Contract development. It is based around the scenario of Commercial Paper. +The full tutorial, including full scenario details and line by line code walk-through is in the [Hyperledger Fabric Commercial Paper Tutorial](https://hyperledger-fabric.readthedocs.io/en/latest/tutorial/commercial_paper.html). + +## Scenario + +In this tutorial two organizations, MagnetoCorp and DigiBank, trade commercial paper with each other using 'PaperNet', a Hyperledger Fabric blockchain network. + +Once you’ve set up a basic network, you’ll act as Isabella, an employee of MagnetoCorp, who will issue a commercial paper on its behalf. You’ll then switch hats to take the role of Balaji, an employee of DigiBank, who will buy this commercial paper, hold it for a period of time, and then redeem it with MagnetoCorp for a small profit. + +![](https://hyperledger-fabric.readthedocs.io/en/latest/_images/commercial_paper.diagram.1.png) + +## Quick Start + +You are strongly advised to read the full tutorial to get information about the code and the scenario. Below are the quick start instructions for running the tutorial, but without extensive details of what is happening. + +This `README.md` file is in the `commercial-paper` directory, the source code for client applications and the contracts is in the `organization` directory. + +### Steps + +1) Start the Hyperledger Fabric infrastructure + + The 'test-network' will be used - this has two organizations 'org1' and 'org2' DigiBank will be org1, and MagnetoCorp will be org2. + +2) Install and Instantiate the Contracts + +3) Run client applications in the roles of MagnetoCorp and DigiBank to trade the commercial paper + + - Issue the Paper as Magnetocorp (org2) + - Buy the paper as DigiBank (org1) + - Redeem the paper as DigiBank (org1) + +## Setup + +You will need a machine with the following + +- Docker and docker-compose installed +- Node.js v12 if you want to run JavaScript client applications +- Java v8 if you want to run Java client applications +- Maven to build the Java applications + +You will need to install the peer cli binaries and this fabric-samples repository available. For more information +[Install the Samples, Binaries and Docker Images](https://hyperledger-fabric.readthedocs.io/en/latest/install.html) in the Hyperledger Fabric documentation. + +It is advised to have 3 console windows open; one to monitor the infrastructure and one each for MagnetoCorp and DigiBank. Once you've cloned the fabric-samples - change to the commercial-paper directory in each window. + +``` +cd fabric-samples/commercial-paper +``` + +## Running the Infrastructure + +In one console window, run the `./network-starter.sh` script; this will start the basic infrastructure. + +You can re-use this console window if you wish, but it is recommended to run a docker container monitoring script. This will let you view what Fabric is doing and help diagnose any failures. + +```bash +./organization/magnetocorp/configuration/cli/monitordocker.sh net_test +``` + +### Setup the Organizations' environments + +The contract code is available as either JavaScript, Java or Go. You can use either one, and the choice of contract language does not affect the choice of client language. With the v2.0 Fabric chaincode lifecycle, this requires operations for both MagentoCorp and Digibank admin. Open two windows in the fabric-samples/commercial paper directory, one for each organization. + +In your 'MagnetoCorp' window run the following commands, to show the shell environment variables needed to act as that organization. + +``` +cd fabric-samples/commercial-paper/magentocorp +./magnetocorp.sh +``` + +You can either copy and paste thee directly into the terminal, or invoke directly in you own command shell. For example if you are using bash or zsh on Linux you can use this command. + +``` +source <(./magnetocorp.sh) +``` + +Similarly in your 'DigiBank' window run the following command + +``` +cd fabric-samples/commercial-paper/digibank +./digibank.sh +``` + +### Deploy the smart contract to the channel + +You need to perform similar operations for both organizations. For different contract langauges the steps are very similar. The steps for JavaScript are shown first, with the details of different languages afterwards. + + +**For a JavaScript Contract** + +Running in MagnetoCorp: + +``` +# MAGENTOCORP + +peer lifecycle chaincode package cp.tar.gz --lang node --path ./contract --label cp_0 +peer lifecycle chaincode install cp.tar.gz + +export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id') +echo $PACKAGE_ID + +peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel \ + --name papercontract \ + -v 0 \ + --package-id $PACKAGE_ID \ + --sequence 1 \ + --tls \ + --cafile $ORDERER_CA + +peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1 +``` + +Running in Digibank + +``` + +# DIGIBANK + +peer lifecycle chaincode package cp.tar.gz --lang node --path ./contract --label cp_0 +peer lifecycle chaincode install cp.tar.gz + +export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id') +echo $PACKAGE_ID + +peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel \ + --name papercontract \ + -v 0 \ + --package-id $PACKAGE_ID \ + --sequence 1 \ + --tls \ + --cafile $ORDERER_CA + +peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1 + +``` + +Once both organizations have installed, and approved the chaincode, it can be committed. + +``` +# MAGNETOCORP + +peer lifecycle chaincode commit -o localhost:7050 \ + --peerAddresses localhost:7051 --tlsRootCertFiles ${PEER0_ORG1_CA} \ + --peerAddresses localhost:9051 --tlsRootCertFiles ${PEER0_ORG2_CA} \ + --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel --name papercontract -v 0 \ + --sequence 1 \ + --tls --cafile $ORDERER_CA --waitForEvent + +``` + +To test try sending some simple transactions. + +``` + +peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com \ + --peerAddresses localhost:7051 --tlsRootCertFiles ${PEER0_ORG1_CA} \ + --peerAddresses localhost:9051 --tlsRootCertFiles ${PEER0_ORG2_CA} \ + --channelID mychannel --name papercontract \ + -c '{"Args":["org.papernet.commercialpaper:instantiate"]}' ${PEER_ADDRESS_ORG1} ${PEER_ADDRESS_ORG2} \ + --tls --cafile $ORDERER_CA --waitForEvent + +peer chaincode query -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com \ + --channelID mychannel \ + --name papercontract \ + -c '{"Args":["org.hyperledger.fabric:GetMetadata"]}' \ + --peerAddresses localhost:9051 --tlsRootCertFiles ${PEER0_ORG2_CA} \ + --tls --cafile $ORDERER_CA | jq -C | more +``` + +**For a Java Contract:** + +Before the `peer lifecycle chaincode package` command, you will need to change into each organization's `contract-java` directory and issues + +``` +./gradlew build +``` + +Then when you package the contract, use this variation of the command to specify language +``` +peer lifecycle chaincode package cp.tar.gz --lang java --path /opt/gopath/src/github.com/contract-java --label cp_0 +``` + +After this point the steps are exactly the same as for JavaScript + +**For a Go Contract:** + + +Before the `peer lifecycle chaincode package` command, you will need to change into each organization's `contract-go` directory and issues + +``` +go mod vendor +``` + +Then when you package the contract, use this variation of the command to specify language +``` +peer lifecycle chaincode package cp.tar.gz --lang golang --path ./contract-go --label cp_0 +``` + +After this point the steps are exactly the same as for JavaScript + + +## Client Applications + +Note for Java applications you will need to compile the Java Code using maven. Use this command in each application-java directory + +``` +mvn clean package +``` + +Note for JavaScript applications you will need to install the dependencies first. Use this command in each application directory + +``` +npm install +``` +> Note that there is NO dependency between the language of any one client application and any contract. Mix and match as you wish! + +The docker containers don't contain the node or Java runtimes; so it is best to exit the docker containers - but keep the windows open and run the applications locally. + +### Issue the paper + +This is running as *MagnetoCorp* These commands are to be run in the +`commercial-paper/organization/magnetocorp/application` directory or the `commercial-paper/organization/magnetocorp/application-java` + +*Add the Identity to be used* + +``` +node addToWallet.js +# or +java -cp target/commercial-paper-0.0.1-SNAPSHOT.jar org.magnetocorp.AddToWallet +``` + +*Issue the Commercial Paper* + +``` +node issue.js +# or +java -cp target/commercial-paper-0.0.1-SNAPSHOT.jar org.magnetocorp.Issue +``` + +### Buy and Redeem the paper + +This is running as *Digibank*; + +You can now run the applications to buy and redeem the paper. Change to either the +`commercial-paper/organization/digibank/application` directory or `commercial-paper/organization/digibank/application-java` + +*Add the Identity to be used* + +``` +node addToWallet.js +# or +java -cp target/commercial-paper-0.0.1-SNAPSHOT.jar org.digibank.AddToWallet +``` + +*Buy the paper* + +``` +node buy.js +# or +java -cp target/commercial-paper-0.0.1-SNAPSHOT.jar org.digibank.Buy +``` + +*Redeem* + +``` +node redeem.js +# or +java -cp target/commercial-paper-0.0.1-SNAPSHOT.jar org.digibank.Redeem +``` + +## Clean up +When you are finished using the Fabric test network and the commercial paper smart contract and applications, you can use the following command to clean up the network: + +``` +./network-clean.sh +``` \ No newline at end of file diff --git a/commercial-paper/network-clean.sh b/commercial-paper/network-clean.sh new file mode 100755 index 00000000..5fe6c087 --- /dev/null +++ b/commercial-paper/network-clean.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# SPDX-License-Identifier: Apache-2.0 + +function _exit(){ + printf "Exiting:%s\n" "$1" + exit -1 +} + +# Exit on first error, print all commands. +set -ev +set -o pipefail + +# Where am I? +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +export FABRIC_CFG_PATH="${DIR}/../config" + +cd "${DIR}/../test-network/" + +docker kill cliDigiBank cliMagnetoCorp logspout || true +./network.sh down + +# remove any stopped containers +docker rm $(docker ps -aq) + diff --git a/commercial-paper/network-starter.sh b/commercial-paper/network-starter.sh new file mode 100755 index 00000000..d3571645 --- /dev/null +++ b/commercial-paper/network-starter.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# SPDX-License-Identifier: Apache-2.0 + +function _exit(){ + printf "Exiting:%s\n" "$1" + exit -1 +} + +# Exit on first error, print all commands. +set -ev +set -o pipefail + +# Where am I? +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +export FABRIC_CFG_PATH="${DIR}/../config" + +cd "${DIR}/../test-network/" + +docker kill cliDigiBank cliMagnetoCorp logspout || true +./network.sh down +./network.sh up createChannel -s couchdb -i 2.0.0 + +# Copy the connection profiles so they are in the correct organizations. +cp "${DIR}/../test-network/organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "${DIR}/organization/digibank/gateway/" +cp "${DIR}/../test-network/organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "${DIR}/organization/magnetocorp/gateway/" + +echo Suggest that you monitor the docker containers by running +echo "./organization/magnetocorp/configuration/cli/monitordocker.sh net_test" diff --git a/commercial-paper/organization/digibank/application/buy.js b/commercial-paper/organization/digibank/application/buy.js new file mode 100644 index 00000000..7908f158 --- /dev/null +++ b/commercial-paper/organization/digibank/application/buy.js @@ -0,0 +1,103 @@ +/* +SPDX-License-Identifier: Apache-2.0 +*/ + +/* + * This application has 6 basic steps: + * 1. Select an identity from a wallet + * 2. Connect to network gateway + * 3. Access PaperNet network + * 4. Construct request to issue commercial paper + * 5. Submit transaction + * 6. Process response + */ + +'use strict'; + +// Bring key classes into scope, most importantly Fabric SDK network class +const fs = require('fs'); +const yaml = require('js-yaml'); +const { Wallets, Gateway } = require('fabric-network'); +const CommercialPaper = require('../../magnetocorp/contract/lib/paper.js'); + + +// Main program function +async function main () { + + // A wallet stores a collection of identities for use + const wallet = await Wallets.newFileSystemWallet('../identity/user/balaji/wallet'); + + + // A gateway defines the peers used to access Fabric networks + const gateway = new Gateway(); + + // Main try/catch block + try { + + // Specify userName for network access + const userName = 'balaji'; + + // Load connection profile; will be used to locate a gateway + let connectionProfile = yaml.safeLoad(fs.readFileSync('../gateway/connection-org1.yaml', 'utf8')); + + // Set connection options; identity and wallet + let connectionOptions = { + identity: userName, + wallet: wallet, + discovery: { enabled: true, asLocalhost: true } + + }; + + // Connect to gateway using application specified parameters + console.log('Connect to Fabric gateway.'); + + await gateway.connect(connectionProfile, connectionOptions); + + // Access PaperNet network + console.log('Use network channel: mychannel.'); + + const network = await gateway.getNetwork('mychannel'); + + // Get addressability to commercial paper contract + console.log('Use org.papernet.commercialpaper smart contract.'); + + const contract = await network.getContract('papercontract', 'org.papernet.commercialpaper'); + + // buy commercial paper + console.log('Submit commercial paper buy transaction.'); + + const buyResponse = await contract.submitTransaction('buy', 'MagnetoCorp', '00001', 'MagnetoCorp', 'DigiBank', '4900000', '2020-05-31'); + + // process response + console.log('Process buy transaction response.'); + + let paper = CommercialPaper.fromBuffer(buyResponse); + + console.log(`${paper.issuer} commercial paper : ${paper.paperNumber} successfully purchased by ${paper.owner}`); + console.log('Transaction complete.'); + + } catch (error) { + + console.log(`Error processing transaction. ${error}`); + console.log(error.stack); + + } finally { + + // Disconnect from the gateway + console.log('Disconnect from Fabric gateway.'); + gateway.disconnect(); + + } +} +main().then(() => { + + console.log('Buy program complete.'); + +}).catch((e) => { + + console.log('Buy program exception.'); + console.log(e); + console.log(e.stack); + process.exit(-1); + +}); \ No newline at end of file diff --git a/commercial-paper/organization/digibank/application/redeem.js b/commercial-paper/organization/digibank/application/redeem.js new file mode 100644 index 00000000..98e46af3 --- /dev/null +++ b/commercial-paper/organization/digibank/application/redeem.js @@ -0,0 +1,103 @@ +/* +SPDX-License-Identifier: Apache-2.0 +*/ + +/* + * This application has 6 basic steps: + * 1. Select an identity from a wallet + * 2. Connect to network gateway + * 3. Access PaperNet network + * 4. Construct request to issue commercial paper + * 5. Submit transaction + * 6. Process response + */ + +'use strict'; + +// Bring key classes into scope, most importantly Fabric SDK network class +const fs = require('fs'); +const yaml = require('js-yaml'); +const { Wallets, Gateway } = require('fabric-network'); +const CommercialPaper = require('../contract/lib/paper.js'); + + +// Main program function +async function main() { + + // A wallet stores a collection of identities for use + const wallet = await Wallets.newFileSystemWallet('../identity/user/balaji/wallet'); + + + // A gateway defines the peers used to access Fabric networks + const gateway = new Gateway(); + + // Main try/catch block + try { + + // Specify userName for network access + // Specify userName for network access + const userName = 'balaji'; + + // Load connection profile; will be used to locate a gateway + let connectionProfile = yaml.safeLoad(fs.readFileSync('../gateway/connection-org1.yaml', 'utf8')); + + // Set connection options; identity and wallet + let connectionOptions = { + identity: userName, + wallet: wallet, + discovery: { enabled:true, asLocalhost: true } + }; + + // Connect to gateway using application specified parameters + console.log('Connect to Fabric gateway.'); + + await gateway.connect(connectionProfile, connectionOptions); + + // Access PaperNet network + console.log('Use network channel: mychannel.'); + + const network = await gateway.getNetwork('mychannel'); + + // Get addressability to commercial paper contract + console.log('Use org.papernet.commercialpaper smart contract.'); + + const contract = await network.getContract('papercontract', 'org.papernet.commercialpaper'); + + // redeem commercial paper + console.log('Submit commercial paper redeem transaction.'); + + const redeemResponse = await contract.submitTransaction('redeem', 'MagnetoCorp', '00001', 'DigiBank', '2020-11-30'); + + // process response + console.log('Process redeem transaction response.'); + + let paper = CommercialPaper.fromBuffer(redeemResponse); + + console.log(`${paper.issuer} commercial paper : ${paper.paperNumber} successfully redeemed with ${paper.owner}`); + console.log('Transaction complete.'); + + } catch (error) { + + console.log(`Error processing transaction. ${error}`); + console.log(error.stack); + + } finally { + + // Disconnect from the gateway + console.log('Disconnect from Fabric gateway.') + gateway.disconnect(); + + } +} +main().then(() => { + + console.log('Redeem program complete.'); + +}).catch((e) => { + + console.log('Redeem program exception.'); + console.log(e); + console.log(e.stack); + process.exit(-1); + +}); \ No newline at end of file diff --git a/commercial-paper/organization/magnetocorp/application/issue.js b/commercial-paper/organization/magnetocorp/application/issue.js new file mode 100644 index 00000000..04db65ea --- /dev/null +++ b/commercial-paper/organization/magnetocorp/application/issue.js @@ -0,0 +1,101 @@ +/* +SPDX-License-Identifier: Apache-2.0 +*/ + +/* + * This application has 6 basic steps: + * 1. Select an identity from a wallet + * 2. Connect to network gateway + * 3. Access PaperNet network + * 4. Construct request to issue commercial paper + * 5. Submit transaction + * 6. Process response + */ + +'use strict'; + +// Bring key classes into scope, most importantly Fabric SDK network class +const fs = require('fs'); +const yaml = require('js-yaml'); +const { Wallets, Gateway } = require('fabric-network'); +const CommercialPaper = require('../contract/lib/paper.js'); + +// Main program function +async function main() { + + // A wallet stores a collection of identities for use + const wallet = await Wallets.newFileSystemWallet('../identity/user/isabella/wallet'); + + // A gateway defines the peers used to access Fabric networks + const gateway = new Gateway(); + + // Main try/catch block + try { + + // Specify userName for network access + // const userName = 'isabella.issuer@magnetocorp.com'; + const userName = 'isabella'; + + // Load connection profile; will be used to locate a gateway + let connectionProfile = yaml.safeLoad(fs.readFileSync('../gateway/connection-org2.yaml', 'utf8')); + + // Set connection options; identity and wallet + let connectionOptions = { + identity: userName, + wallet: wallet, + discovery: { enabled:true, asLocalhost: true } + }; + + // Connect to gateway using application specified parameters + console.log('Connect to Fabric gateway.'); + + await gateway.connect(connectionProfile, connectionOptions); + + // Access PaperNet network + console.log('Use network channel: mychannel.'); + + const network = await gateway.getNetwork('mychannel'); + + // Get addressability to commercial paper contract + console.log('Use org.papernet.commercialpaper smart contract.'); + + const contract = await network.getContract('papercontract'); + + // issue commercial paper + console.log('Submit commercial paper issue transaction.'); + + const issueResponse = await contract.submitTransaction('issue', 'MagnetoCorp', '00001', '2020-05-31', '2020-11-30', '5000000'); + + // process response + console.log('Process issue transaction response.'+issueResponse); + + let paper = CommercialPaper.fromBuffer(issueResponse); + + console.log(`${paper.issuer} commercial paper : ${paper.paperNumber} successfully issued for value ${paper.faceValue}`); + console.log('Transaction complete.'); + + } catch (error) { + + console.log(`Error processing transaction. ${error}`); + console.log(error.stack); + + } finally { + + // Disconnect from the gateway + console.log('Disconnect from Fabric gateway.'); + gateway.disconnect(); + + } +} +main().then(() => { + + console.log('Issue program complete.'); + +}).catch((e) => { + + console.log('Issue program exception.'); + console.log(e); + console.log(e.stack); + process.exit(-1); + +}); \ No newline at end of file diff --git a/docs/fabric-samples-ci.md b/docs/fabric-samples-ci.md new file mode 100644 index 00000000..b285b558 --- /dev/null +++ b/docs/fabric-samples-ci.md @@ -0,0 +1,109 @@ +# Continuous Integration Process + +This document explains the fabric-samples Jenkins pipeline flow and FAQ's on the build +process to help developer to get more familiarize with the process flow. + +We use Jenkins as a CI tool and to manage jobs, we use [JJB](https://docs.openstack.org/infra/jenkins-job-builder). +Please see the pipeline job configuration template here https://ci-docs.readthedocs.io/en/latest/source/pipeline_jobs.html#job-templates. + +## CI Pipeline flow + +- Every Gerrit patchset triggers a verify job with the Gerrit Refspec on the parent commit + of the patchset and runs the below tests from the `Jenkinsfile`. Note: when you are ready + to merge the patchset, it's always a best practice to rebase the patchset on the latest commit. + +All the below tests runs on the Hyperledger infrastructure x86_64 build nodes. All these nodes +uses the packer with pre-configured software packages. This helps us to run the tests in much +faster than installing required packages everytime. + +Below steps shows what each stage does in the Jenkins pipeline verify and merge flow. +Before execute the below tests, it clean the environment (Deletes the left over build artifacts) +and clone the repository with the Gerrit Refspec. + +![](pipeline_flow.png) + +Based on the value provided to **IMAGE_SOURCE** in ci.properties file, Jenkinsfile execute the +steps. If the IMAGE_SOURCE is set to "build", Jenkins clones the latest commits of fabric +and fabric-ca and builds the docker images and binaries. If you specify IMAGE_SOURCE as "nexus", +it always pulls the latest fabric and fabric-ca images published from nightly job which triggers +everyday at 8:00 PM EST. + +Also, it pulls the "javaenv" and "nodeenv" images from the latest published images from nexus3. +NOTE: nodeenv image is available only in master branch. + +Once the artifacts stage is ready, Jenkins executes the below tests + +- byfn & eyfn tests + - on default channel + - Custom channel with couchdb + - on node chaincode + +- fabcar tests + - go + - javascript + - typescript + +Above pipeline flow works the same on both `fabric-samples-verify-x86_64` and `fabric-samples-merge-x86_64` pipeline jobs. + +See below **FAQ's** for more information on the pipeline process. + +## FAQ's + +#### How to re-trigger failed tests? + +You can post comments `reverify` or `reverify-x` on the gerrit patchset to trigger the `fabric-samples-verify-x86_64` +job which triggers the pipeline flow as mentioned above. Also, we provided `remerge` or `remerge-x` +comment phrases to re-trigger the failed merge job. + +#### Where should I see the output of the stages? + +Pipeline supports two views (stages and blueocean). **Staged views** shows on the Jenkins job +main page and it shows each stage in order and the status. For better view, we suggest you +to access BlueOcean plugin. Click on the build number and click on the **Open Blue Ocean** +link that shows the build stages in pipeline view. + +#### How to add more stages to this pipeline flow? + +We use scripted pipeline syntax with groovy and shell scripts. Also, we use global shared +library scripts which are placed in https://github.com/hyperledger/ci-management/tree/master/vars. +Try to leverage these common functions in your code. All you have to do is, understand the pipeline +flow of the tests and conditions, add more stages as mentioned in the existing Jenkinsfile. + +#### How will I get build failure notifications? + +On every merge failure, we send build failure email notifications to the submitter of the +patchset and sends the build details to the Rocket Chat **jenkins-robot** channel. Check the +result here https://chat.hyperledger.org/channel/jenkins-robot + +#### What steps I have to modify when I create a new branch from master? + +As the Jenkinsfile is completely parameterized, you no need to modify anything in the +Jenkinsfile but you may endup modifying **ci.properties** file with the appropriate +Base Versions, Baseimage versions etc... in the new branch. We suggest you to modify this +file immediately after you create a new branch to avoid running tests on older versions. + +#### On what platforms these tests triggers? + +- x86_64 (Run the above mentioned tests on verify and merge jobs) +- s390x (Run the above mentioned tests in daily jobs) + +#### Where can I see the Build Scripts. + +We use global shared library scripts and Jenkinsfile along with the build file. + +Global Shared Library - https://github.com/hyperledger/ci-management/tree/master/vars + +Jenkinsfile - https://github.com/hyperledger/fabric-samples/tree/master/Jenkinsfile + +ci.properties - https://github.com/hyperledger/fabric-samples/tree/master/ci.properties +(ci.properties is the only file you have to modify with the values required for the specific branch.) + +Packer Scripts - https://github.com/hyperledger/ci-management/blob/master/packer/provision/docker.sh +(Packer is a tool for automatically creating VM and container images, configuring them and +post-processing them into standard output formats. We build Hyperledger's CI images via Packer +and attach them to x86_64 build nodes. On s390x, we install manually. See the packages we +install as a pre-requisite in the CI x86 build nodes.) + +#### How to reach out to CI team? + +Post your questions or feedback in https://chat.hyperledger.org/channel/ci-pipeline or https://chat.hyperledger.org/channel/fabric-ci Rocket Chat channels. Also, you can create JIRA tasks or bugs in FABCI project. https://jira.hyperledger.org/projects/FABCI \ No newline at end of file diff --git a/docs/pipeline_flow.png b/docs/pipeline_flow.png new file mode 100644 index 00000000..b1d98011 Binary files /dev/null and b/docs/pipeline_flow.png differ diff --git a/fabcar/javascript/enrollAdmin.js b/fabcar/javascript/enrollAdmin.js index 695d9ea5..c2c1888b 100644 --- a/fabcar/javascript/enrollAdmin.js +++ b/fabcar/javascript/enrollAdmin.js @@ -5,16 +5,22 @@ 'use strict'; const FabricCAServices = require('fabric-ca-client'); -const { FileSystemWallet, X509WalletMixin } = require('fabric-network'); +const { Wallets } = require('fabric-network'); const fs = require('fs'); const path = require('path'); +<<<<<<< HEAD const ccpPath = path.resolve(__dirname, '..', '..', 'first-network', 'connection-org1.json'); const ccpJSON = fs.readFileSync(ccpPath, 'utf8'); const ccp = JSON.parse(ccpJSON); +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 async function main() { try { + // load the network configuration + const ccpPath = path.resolve(__dirname, '..', '..', 'first-network', 'connection-org1.json'); + const ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8')); // Create a new CA client for interacting with the CA. const caInfo = ccp.certificateAuthorities['ca.org1.example.com']; @@ -23,20 +29,32 @@ async function main() { // Create a new file system based wallet for managing identities. const walletPath = path.join(process.cwd(), 'wallet'); - const wallet = new FileSystemWallet(walletPath); + const wallet = await Wallets.newFileSystemWallet(walletPath); console.log(`Wallet path: ${walletPath}`); // Check to see if we've already enrolled the admin user. - const adminExists = await wallet.exists('admin'); - if (adminExists) { + const identity = await wallet.get('admin'); + if (identity) { console.log('An identity for the admin user "admin" already exists in the wallet'); return; } // Enroll the admin user, and import the new identity into the wallet. const enrollment = await ca.enroll({ enrollmentID: 'admin', enrollmentSecret: 'adminpw' }); +<<<<<<< HEAD const identity = X509WalletMixin.createIdentity('Org1MSP', enrollment.certificate, enrollment.key.toBytes()); await wallet.import('admin', identity); +======= + const x509Identity = { + credentials: { + certificate: enrollment.certificate, + privateKey: enrollment.key.toBytes(), + }, + mspId: 'Org1MSP', + type: 'X.509', + }; + await wallet.put('admin', x509Identity); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 console.log('Successfully enrolled admin user "admin" and imported it into the wallet'); } catch (error) { diff --git a/fabcar/javascript/invoke.js b/fabcar/javascript/invoke.js index 013188bb..9decf9fd 100644 --- a/fabcar/javascript/invoke.js +++ b/fabcar/javascript/invoke.js @@ -4,22 +4,32 @@ 'use strict'; +<<<<<<< HEAD const { FileSystemWallet, Gateway } = require('fabric-network'); const path = require('path'); const ccpPath = path.resolve(__dirname, '..', '..', 'first-network', 'connection-org1.json'); +======= +const { Gateway, Wallets } = require('fabric-network'); +const fs = require('fs'); +const path = require('path'); + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 async function main() { try { + // load the network configuration + const ccpPath = path.resolve(__dirname, '..', '..', 'first-network', 'connection-org1.json'); + let ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8')); // Create a new file system based wallet for managing identities. const walletPath = path.join(process.cwd(), 'wallet'); - const wallet = new FileSystemWallet(walletPath); + const wallet = await Wallets.newFileSystemWallet(walletPath); console.log(`Wallet path: ${walletPath}`); // Check to see if we've already enrolled the user. - const userExists = await wallet.exists('user1'); - if (!userExists) { + const identity = await wallet.get('user1'); + if (!identity) { console.log('An identity for the user "user1" does not exist in the wallet'); console.log('Run the registerUser.js application before retrying'); return; @@ -27,7 +37,11 @@ async function main() { // Create a new gateway for connecting to our peer node. const gateway = new Gateway(); +<<<<<<< HEAD await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +======= + await gateway.connect(ccp, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Get the network (channel) our contract is deployed to. const network = await gateway.getNetwork('mychannel'); diff --git a/fabcar/javascript/package-lock.json b/fabcar/javascript/package-lock.json new file mode 100644 index 00000000..ffad88e2 --- /dev/null +++ b/fabcar/javascript/package-lock.json @@ -0,0 +1,3569 @@ +{ + "name": "fabcar", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "dev": true, + "requires": { + "@babel/highlight": "^7.8.3" + } + }, + "@babel/generator": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.4.tgz", + "integrity": "sha512-PwhclGdRpNAf3IxZb0YVuITPZmmrXz9zf6fH8lT4XbrmfQKr6ryBzhv593P5C6poJRciFCL/eHGW2NuGrgEyxA==", + "dev": true, + "requires": { + "@babel/types": "^7.8.3", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + } + }, + "@babel/helper-function-name": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz", + "integrity": "sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.8.3", + "@babel/template": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz", + "integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==", + "dev": true, + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz", + "integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==", + "dev": true, + "requires": { + "@babel/types": "^7.8.3" + } + }, + "@babel/highlight": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz", + "integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.4.tgz", + "integrity": "sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw==", + "dev": true + }, + "@babel/template": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.3.tgz", + "integrity": "sha512-04m87AcQgAFdvuoyiQ2kgELr2tV8B4fP/xJAVUL3Yb3bkNdMedD3d0rlSQr3PegP0cms3eHjl1F7PWlvWbU8FQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/parser": "^7.8.3", + "@babel/types": "^7.8.3" + } + }, + "@babel/traverse": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.8.4.tgz", + "integrity": "sha512-NGLJPZwnVEyBPLI+bl9y9aSnxMhsKz42so7ApAv9D+b4vAFPpY013FTS9LdKxcABoIYFU52HcYga1pPlx454mg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.8.4", + "@babel/helper-function-name": "^7.8.3", + "@babel/helper-split-export-declaration": "^7.8.3", + "@babel/parser": "^7.8.4", + "@babel/types": "^7.8.3", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "@babel/types": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.8.3.tgz", + "integrity": "sha512-jBD+G8+LWpMBBWvVcdr4QysjUE4mU/syrhN17o1u3gx0/WzJB1kwiVZAXRtWbsIPOwW8pF/YJV5+nmetPzepXg==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "@sinonjs/commons": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.0.tgz", + "integrity": "sha512-qbk9AP+cZUsKdW1GJsBpxPKFmCJ0T8swwzVje3qFd+AkQb74Q/tiuzrdfFg8AD2g5HH/XbE/I8Uc1KYHVYWfhg==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/formatio": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.2.tgz", + "integrity": "sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1", + "@sinonjs/samsam": "^3.1.0" + } + }, + "@sinonjs/samsam": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.3.tgz", + "integrity": "sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.3.0", + "array-from": "^2.1.1", + "lodash": "^4.17.15" + } + }, + "@sinonjs/text-encoding": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz", + "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", + "dev": true + }, + "@types/bytebuffer": { + "version": "5.0.40", + "resolved": "https://registry.npmjs.org/@types/bytebuffer/-/bytebuffer-5.0.40.tgz", + "integrity": "sha512-h48dyzZrPMz25K6Q4+NCwWaxwXany2FhQg/ErOcdZS1ZpsaDnDMZg8JYLMTGz7uvXKrcKGJUZJlZObyfgdaN9g==", + "requires": { + "@types/long": "*", + "@types/node": "*" + } + }, + "@types/caseless": { + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.2.tgz", + "integrity": "sha512-6ckxMjBBD8URvjB6J3NcnuAn5Pkl7t3TizAg+xdlzzQGSPSmBcXf8KoIH0ua/i+tio+ZRUHEXp0HEmvaR4kt0w==" + }, + "@types/long": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", + "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" + }, + "@types/node": { + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.0.tgz", + "integrity": "sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ==" + }, + "@types/request": { + "version": "2.48.4", + "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.4.tgz", + "integrity": "sha512-W1t1MTKYR8PxICH+A4HgEIPuAC3sbljoEVfyZbeFJJDbr30guDspJri2XOaM2E+Un7ZjrihaDi7cf6fPa2tbgw==", + "requires": { + "@types/caseless": "*", + "@types/node": "*", + "@types/tough-cookie": "*", + "form-data": "^2.5.0" + }, + "dependencies": { + "form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + } + } + }, + "@types/tough-cookie": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.6.tgz", + "integrity": "sha512-wHNBMnkoEBiRAd3s8KTKwIuO9biFtTf0LehITzBhSco+HQI0xkXZbLOD55SW3Aqw3oUkHstkm5SPv58yaAdFPQ==" + }, + "acorn": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz", + "integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==", + "dev": true + }, + "acorn-jsx": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz", + "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==", + "dev": true + }, + "ajv": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.11.0.tgz", + "integrity": "sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "append-transform": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-1.0.0.tgz", + "integrity": "sha512-P009oYkeHyU742iSZJzZZywj4QRJdnTWffaKuJQLablCZ1uz6/cW4yaRgcDaoQ+uwOxxnt0gRUcwfsNP2ri0gw==", + "dev": true, + "requires": { + "default-require-extensions": "^2.0.0" + } + }, + "archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array-from": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", + "integrity": "sha1-z+nYwmYoudxa7MYqn12PHzUsEZU=", + "dev": true + }, + "ascli": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ascli/-/ascli-1.0.1.tgz", + "integrity": "sha1-vPpZdKYvGOgcq660lzKrSoj5Brw=", + "requires": { + "colour": "~0.7.1", + "optjs": "~3.2.2" + } + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", + "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bl": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", + "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", + "requires": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browser-request": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/browser-request/-/browser-request-0.3.3.tgz", + "integrity": "sha1-ns5bWsqJopkyJC4Yv5M975h2zBc=" + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "buffer-alloc": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", + "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", + "requires": { + "buffer-alloc-unsafe": "^1.1.0", + "buffer-fill": "^1.0.0" + } + }, + "buffer-alloc-unsafe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", + "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" + }, + "buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" + }, + "bytebuffer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/bytebuffer/-/bytebuffer-5.0.1.tgz", + "integrity": "sha1-WC7qSxqHO20CCkjVjfhfC7ps/d0=", + "requires": { + "long": "~3" + }, + "dependencies": { + "long": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", + "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=" + } + } + }, + "caching-transform": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-3.0.2.tgz", + "integrity": "sha512-Mtgcv3lh3U0zRii/6qVgQODdPA4G3zhG+jtbCWj39RXuUFTMzH0vcdMtaJS1jPowd+It2Pqr6y3NJMQqOqCE2w==", + "dev": true, + "requires": { + "hasha": "^3.0.0", + "make-dir": "^2.0.0", + "package-hash": "^3.0.0", + "write-file-atomic": "^2.4.2" + } + }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "chai": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", + "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.0", + "type-detect": "^4.0.5" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "cloudant-follow": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/cloudant-follow/-/cloudant-follow-0.17.0.tgz", + "integrity": "sha512-JQ1xvKAHh8rsnSVBjATLCjz/vQw1sWBGadxr2H69yFMwD7hShUGDwwEefdypaxroUJ/w6t1cSwilp/hRUxEW8w==", + "requires": { + "browser-request": "~0.3.0", + "debug": "^3.0.0", + "request": "^2.83.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "colors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=" + }, + "colour": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/colour/-/colour-0.7.1.tgz", + "integrity": "sha1-nLFpkX7F0SwHNtPoaFdG3xyt93g=" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + } + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cp-file": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/cp-file/-/cp-file-6.2.0.tgz", + "integrity": "sha512-fmvV4caBnofhPe8kOcitBwSn2f39QLjnAnGq3gO9dfd75mUytzKNZB1hde6QHunW2Rt+OwuBOMc3i1tNElbszA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "make-dir": "^2.0.0", + "nested-error-stacks": "^2.0.0", + "pify": "^4.0.1", + "safe-buffer": "^5.0.1" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "cycle": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", + "integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI=" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "default-require-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-2.0.0.tgz", + "integrity": "sha1-9fj7sYp9bVCyH2QfZJ67Uiz+JPc=", + "dev": true, + "requires": { + "strip-bom": "^3.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "elliptic": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", + "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "errs": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/errs/-/errs-0.3.2.tgz", + "integrity": "sha1-eYCZstvTfKK8dJ5TinwTB9C1BJk=" + }, + "es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint": { + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.16.0.tgz", + "integrity": "sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.9.1", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^4.0.3", + "eslint-utils": "^1.3.1", + "eslint-visitor-keys": "^1.0.0", + "espree": "^5.0.1", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob": "^7.1.2", + "globals": "^11.7.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^6.2.2", + "js-yaml": "^3.13.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.11", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.2", + "path-is-inside": "^1.0.2", + "progress": "^2.0.0", + "regexpp": "^2.0.1", + "semver": "^5.5.1", + "strip-ansi": "^4.0.0", + "strip-json-comments": "^2.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "eslint-scope": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", + "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", + "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", + "dev": true + }, + "espree": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-5.0.1.tgz", + "integrity": "sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A==", + "dev": true, + "requires": { + "acorn": "^6.0.7", + "acorn-jsx": "^5.0.0", + "eslint-visitor-keys": "^1.0.0" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + }, + "esquery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "dev": true, + "requires": { + "estraverse": "^4.0.0" + } + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=" + }, + "fabric-ca-client": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/fabric-ca-client/-/fabric-ca-client-2.0.0-beta.2.tgz", + "integrity": "sha512-bA7qA2m8PjZF3LV5Qx8i79zFpOwkFUVYD6WDLB0TP8PGnrv66Tr5gWOP0E/HI35Es9hPiBvl7F8h9v63omLvZw==", + "requires": { + "@types/bytebuffer": "^5.0.34", + "fabric-common": "^2.0.0-beta.2", + "fs-extra": "^6.0.1", + "jsrsasign": "^7.2.2", + "url": "^0.11.0", + "util": "^0.10.3" + } + }, + "fabric-client": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/fabric-client/-/fabric-client-2.0.0-beta.2.tgz", + "integrity": "sha512-sif1iAMfzBk4cg3yrcxoZso6vXYh0NR3pPHU9rYTIlFtozyu4IMZrF54b6gqpEQk34IkBHja1a8dLxxkcmWSDQ==", + "requires": { + "@types/bytebuffer": "^5.0.34", + "callsite": "^1.0.0", + "fabric-ca-client": "^2.0.0-beta.2", + "fabric-common": "^2.0.0-beta.2", + "fabric-protos": "^2.0.0-beta.2", + "fs-extra": "^6.0.1", + "ignore-walk": "^3.0.0", + "js-yaml": "^3.13.0", + "jsrsasign": "^7.2.2", + "klaw": "^2.0.0", + "long": "^4.0.0", + "promise-settle": "^0.3.0", + "tar-stream": "1.6.1", + "url": "^0.11.0", + "yn": "^3.1.0" + } + }, + "fabric-common": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/fabric-common/-/fabric-common-2.0.0-beta.2.tgz", + "integrity": "sha512-RYCB5wghlKJe/7n0XJXRbndHac99+RVrYCluXHWjmqNuz5TnPV8IVQrHY/2B0UV0iXFYs0ZlQ6/gCKg3anHokQ==", + "requires": { + "elliptic": "^6.2.3", + "js-sha3": "^0.7.0", + "nano": "^6.4.4", + "nconf": "^0.10.0", + "pkcs11js": "^1.0.6", + "sjcl": "1.0.7", + "winston": "^2.2.0", + "yn": "^3.1.0" + } + }, + "fabric-network": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/fabric-network/-/fabric-network-2.0.0-beta.2.tgz", + "integrity": "sha512-SjH/35BaM84c8c5+G3p5khiky5/hDklBQD0MKbKiycYa7IMD0MGO5oatp6RLnvZhI9yowgvzBcdC7tIPmiM76Q==", + "requires": { + "fabric-ca-client": "^2.0.0-beta.2", + "fabric-client": "^2.0.0-beta.2", + "fabric-common": "^2.0.0-beta.2", + "fs-extra": "^8.1.0", + "nano": "^8.1.0" + }, + "dependencies": { + "cloudant-follow": { + "version": "0.18.2", + "resolved": "https://registry.npmjs.org/cloudant-follow/-/cloudant-follow-0.18.2.tgz", + "integrity": "sha512-qu/AmKxDqJds+UmT77+0NbM7Yab2K3w0qSeJRzsq5dRWJTEJdWeb+XpG4OpKuTE9RKOa/Awn2gR3TTnvNr3TeA==", + "requires": { + "browser-request": "~0.3.0", + "debug": "^4.0.1", + "request": "^2.88.0" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "nano": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/nano/-/nano-8.1.0.tgz", + "integrity": "sha512-suMHW9XtTP8doR4FnId5+6ZfbAvDIZOAVp3qe7zTHXp7BvT/Cf4G9xBjXAthrIzoa+fkcionEr9xo8cZtvqMmg==", + "requires": { + "@types/request": "^2.47.1", + "cloudant-follow": "^0.18.1", + "debug": "^4.1.1", + "errs": "^0.3.2", + "request": "^2.88.0" + } + } + } + }, + "fabric-protos": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/fabric-protos/-/fabric-protos-2.0.0-beta.2.tgz", + "integrity": "sha512-fxl4ECLKAutaVMnMp78lZhzR5WYADORPN70M5MmaC+/Psse0r94w7a0i/QDG/7kItQiINtlUneEvy1NujQ/lLQ==", + "requires": { + "grpc": "1.23.3", + "protobufjs": "^5.0.3" + } + }, + "fast-deep-equal": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "dev": true, + "requires": { + "flat-cache": "^2.0.1" + } + }, + "find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "dev": true, + "requires": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + } + }, + "flatted": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", + "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", + "dev": true + }, + "foreground-child": { + "version": "1.5.6", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-1.5.6.tgz", + "integrity": "sha1-T9ca0t/elnibmApcCilZN8svXOk=", + "dev": true, + "requires": { + "cross-spawn": "^4", + "signal-exit": "^3.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", + "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + } + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, + "fs-extra": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz", + "integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "grpc": { + "version": "1.23.3", + "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.23.3.tgz", + "integrity": "sha512-7vdzxPw9s5UYch4aUn4hyM5tMaouaxUUkwkgJlwbR4AXMxiYZJOv19N2ps2eKiuUbJovo5fnGF9hg/X91gWYjw==", + "requires": { + "@types/bytebuffer": "^5.0.40", + "lodash.camelcase": "^4.3.0", + "lodash.clone": "^4.5.0", + "nan": "^2.13.2", + "node-pre-gyp": "^0.13.0", + "protobufjs": "^5.0.3" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "bundled": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.1.2", + "bundled": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "debug": { + "version": "3.2.6", + "bundled": true, + "requires": { + "ms": "^2.1.1" + } + }, + "deep-extend": { + "version": "0.6.0", + "bundled": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true + }, + "fs-minipass": { + "version": "1.2.6", + "bundled": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.4", + "bundled": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true + }, + "iconv-lite": { + "version": "0.4.24", + "bundled": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "bundled": true + }, + "ini": { + "version": "1.3.5", + "bundled": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "bundled": true + }, + "minipass": { + "version": "2.3.5", + "bundled": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.2.1", + "bundled": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "bundled": true + } + } + }, + "ms": { + "version": "2.1.2", + "bundled": true + }, + "needle": { + "version": "2.4.0", + "bundled": true, + "requires": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.13.0", + "bundled": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.6", + "bundled": true + }, + "npm-packlist": { + "version": "1.4.4", + "bundled": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true + }, + "process-nextick-args": { + "version": "2.0.1", + "bundled": true + }, + "rc": { + "version": "1.2.8", + "bundled": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.7.1", + "bundled": true, + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true + }, + "sax": { + "version": "1.2.4", + "bundled": true + }, + "semver": { + "version": "5.7.1", + "bundled": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true + }, + "tar": { + "version": "4.4.10", + "bundled": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.3.5", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true + }, + "wide-align": { + "version": "1.1.3", + "bundled": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + }, + "yallist": { + "version": "3.0.3", + "bundled": true + } + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hasha": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-3.0.0.tgz", + "integrity": "sha1-UqMvq4Vp1BymmmH/GiFPjrfIvTk=", + "dev": true, + "requires": { + "is-stream": "^1.0.1" + } + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "hosted-git-info": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz", + "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==", + "dev": true + }, + "html-escaper": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.0.tgz", + "integrity": "sha512-a4u9BeERWGu/S8JiWEAQcdrg9v4QArtP9keViQjGMdff20fBdd8waotXaNmODqBe6uZ3Nafi7K/ho4gCQHV3Ig==", + "dev": true + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "ignore-walk": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", + "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", + "requires": { + "minimatch": "^3.0.4" + } + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + }, + "inquirer": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", + "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", + "dev": true, + "requires": { + "ansi-escapes": "^3.2.0", + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^2.0.0", + "lodash": "^4.17.12", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.4.0", + "string-width": "^2.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + } + } + } + } + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "istanbul-lib-coverage": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", + "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", + "dev": true + }, + "istanbul-lib-hook": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-2.0.7.tgz", + "integrity": "sha512-vrRztU9VRRFDyC+aklfLoeXyNdTfga2EI3udDGn4cZ6fpSXpHLV9X6CHvfoMCPtggg8zvDDmC4b9xfu0z6/llA==", + "dev": true, + "requires": { + "append-transform": "^1.0.0" + } + }, + "istanbul-lib-instrument": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz", + "integrity": "sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA==", + "dev": true, + "requires": { + "@babel/generator": "^7.4.0", + "@babel/parser": "^7.4.3", + "@babel/template": "^7.4.0", + "@babel/traverse": "^7.4.3", + "@babel/types": "^7.4.0", + "istanbul-lib-coverage": "^2.0.5", + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "istanbul-lib-report": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz", + "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "supports-color": "^6.1.0" + }, + "dependencies": { + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz", + "integrity": "sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "rimraf": "^2.6.3", + "source-map": "^0.6.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "istanbul-reports": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.7.tgz", + "integrity": "sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0" + } + }, + "js-sha3": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.7.0.tgz", + "integrity": "sha512-Wpks3yBDm0UcL5qlVhwW9Jr9n9i4FfeWBFOOXP5puDS/SiudJGhw7DPyBqn3487qD4F0lsC0q3zxink37f7zeA==" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jsrsasign": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-7.2.2.tgz", + "integrity": "sha1-rlIwy1V0RRu5eanMaXQoxg9ZjSA=" + }, + "just-extend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.0.2.tgz", + "integrity": "sha512-FrLwOgm+iXrPV+5zDU6Jqu4gCRXbWEQg2O3SKONsWE4w7AXFRkryS53bpWdaL9cNol+AmR3AEYz6kn+o0fCPnw==", + "dev": true + }, + "klaw": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-2.1.1.tgz", + "integrity": "sha1-QrdolHARacyRD9DRnOZ3tfs3ivE=", + "requires": { + "graceful-fs": "^4.1.9" + } + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "requires": { + "invert-kv": "^1.0.0" + } + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=" + }, + "lodash.clone": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clone/-/lodash.clone-4.5.0.tgz", + "integrity": "sha1-GVhwRQ9aExkkeN9Lw9I9LeoZB7Y=" + }, + "lodash.flattendeep": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", + "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", + "dev": true + }, + "lodash.isempty": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.isempty/-/lodash.isempty-4.4.0.tgz", + "integrity": "sha1-b4bL7di+TsmHvpqvM8loTbGzHn4=" + }, + "lolex": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz", + "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==", + "dev": true + }, + "long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + } + }, + "merge-source-map": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.1.0.tgz", + "integrity": "sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==", + "dev": true, + "requires": { + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "mime-db": { + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==" + }, + "mime-types": { + "version": "2.1.26", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", + "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", + "requires": { + "mime-db": "1.43.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "dev": true, + "requires": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + }, + "nano": { + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/nano/-/nano-6.4.4.tgz", + "integrity": "sha512-7sldMrZI1ZH8QE29PnzohxLfR67WNVzMKLa7EMl3x9Hr+0G+YpOUCq50qZ9G66APrjcb0Of2BTOZLNBCutZGag==", + "requires": { + "cloudant-follow": "~0.17.0", + "debug": "^2.2.0", + "errs": "^0.3.2", + "lodash.isempty": "^4.4.0", + "request": "^2.85.0" + } + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "nconf": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/nconf/-/nconf-0.10.0.tgz", + "integrity": "sha512-fKiXMQrpP7CYWJQzKkPPx9hPgmq+YLDyxcG9N8RpiE9FoCkCbzD0NyW0YhE3xn3Aupe7nnDeIx4PFzYehpHT9Q==", + "requires": { + "async": "^1.4.0", + "ini": "^1.3.0", + "secure-keys": "^1.0.0", + "yargs": "^3.19.0" + } + }, + "nested-error-stacks": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz", + "integrity": "sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug==", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "nise": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", + "integrity": "sha512-Ymbac/94xeIrMf59REBPOv0thr+CJVFMhrlAkW/gjCIE58BGQdCj0x7KRCb3yz+Ga2Rz3E9XXSvUyyxqqhjQAQ==", + "dev": true, + "requires": { + "@sinonjs/formatio": "^3.2.1", + "@sinonjs/text-encoding": "^0.7.1", + "just-extend": "^4.0.2", + "lolex": "^5.0.1", + "path-to-regexp": "^1.7.0" + }, + "dependencies": { + "lolex": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", + "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0" + } + } + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "nyc": { + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-14.1.1.tgz", + "integrity": "sha512-OI0vm6ZGUnoGZv/tLdZ2esSVzDwUC88SNs+6JoSOMVxA+gKMB8Tk7jBwgemLx4O40lhhvZCVw1C+OYLOBOPXWw==", + "dev": true, + "requires": { + "archy": "^1.0.0", + "caching-transform": "^3.0.2", + "convert-source-map": "^1.6.0", + "cp-file": "^6.2.0", + "find-cache-dir": "^2.1.0", + "find-up": "^3.0.0", + "foreground-child": "^1.5.6", + "glob": "^7.1.3", + "istanbul-lib-coverage": "^2.0.5", + "istanbul-lib-hook": "^2.0.7", + "istanbul-lib-instrument": "^3.3.0", + "istanbul-lib-report": "^2.0.8", + "istanbul-lib-source-maps": "^3.0.6", + "istanbul-reports": "^2.2.4", + "js-yaml": "^3.13.1", + "make-dir": "^2.1.0", + "merge-source-map": "^1.1.0", + "resolve-from": "^4.0.0", + "rimraf": "^2.6.3", + "signal-exit": "^3.0.2", + "spawn-wrap": "^1.4.2", + "test-exclude": "^5.2.3", + "uuid": "^3.3.2", + "yargs": "^13.2.2", + "yargs-parser": "^13.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yargs": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", + "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.1" + } + } + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + } + }, + "optjs": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/optjs/-/optjs-3.2.2.tgz", + "integrity": "sha1-aabOicRCpEQDFBrS+bNwvVu29O4=" + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "requires": { + "lcid": "^1.0.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-limit": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", + "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "package-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-3.0.0.tgz", + "integrity": "sha512-lOtmukMDVvtkL84rJHI7dpTYq+0rli8N2wlnqUcBuDWCfVhRUfOmnR9SsoHFMLpACvEV60dX7rd0rFaYDZI+FA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.15", + "hasha": "^3.0.0", + "lodash.flattendeep": "^4.4.0", + "release-zalgo": "^1.0.0" + } + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-to-regexp": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", + "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "dev": true, + "requires": { + "isarray": "0.0.1" + } + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "pkcs11js": { + "version": "1.0.19", + "resolved": "https://registry.npmjs.org/pkcs11js/-/pkcs11js-1.0.19.tgz", + "integrity": "sha512-BThNeWreqDXbMAZOTtG8PodY4WAS0HNHsXtsVbDBX4L4C58AvxIIXjjZrsBadXUagbjTllmZwsZHkebVUTpwcA==", + "optional": true, + "requires": { + "nan": "^2.14.0" + } + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "promise-settle": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/promise-settle/-/promise-settle-0.3.0.tgz", + "integrity": "sha1-tO/VcqHrdM95T4KM00naQKCOTpY=" + }, + "protobufjs": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-5.0.3.tgz", + "integrity": "sha512-55Kcx1MhPZX0zTbVosMQEO5R6/rikNXd9b6RQK4KSPcrSIIwoXTtebIczUrXlwaSrbz4x8XUVThGPob1n8I4QA==", + "requires": { + "ascli": "~1", + "bytebuffer": "~5", + "glob": "^7.0.5", + "yargs": "^3.10.0" + } + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "psl": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", + "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==" + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", + "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", + "dev": true, + "requires": { + "find-up": "^3.0.0", + "read-pkg": "^3.0.0" + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", + "dev": true + }, + "release-zalgo": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", + "integrity": "sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA=", + "dev": true, + "requires": { + "es6-error": "^4.0.1" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "resolve": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz", + "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "secure-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/secure-keys/-/secure-keys-1.0.0.tgz", + "integrity": "sha1-8MgtmKOxOah3aogIBQuCRDEIf8o=" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "sinon": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.5.0.tgz", + "integrity": "sha512-AoD0oJWerp0/rY9czP/D6hDTTUYGpObhZjMpd7Cl/A6+j0xBE+ayL/ldfggkBXUs0IkvIiM1ljM8+WkOc5k78Q==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.4.0", + "@sinonjs/formatio": "^3.2.1", + "@sinonjs/samsam": "^3.3.3", + "diff": "^3.5.0", + "lolex": "^4.2.0", + "nise": "^1.5.2", + "supports-color": "^5.5.0" + } + }, + "sinon-chai": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/sinon-chai/-/sinon-chai-3.4.0.tgz", + "integrity": "sha512-BpVxsjEkGi6XPbDXrgWUe7Cb1ZzIfxKUbu/MmH5RoUnS7AXpKo3aIYIyQUg0FMvlUL05aPt7VZuAdaeQhEnWxg==", + "dev": true + }, + "sjcl": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/sjcl/-/sjcl-1.0.7.tgz", + "integrity": "sha1-MrNlpQ3Ju6JriLo8nfjqNCF9n0U=" + }, + "slice-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "astral-regex": "^1.0.0", + "is-fullwidth-code-point": "^2.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + } + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "spawn-wrap": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-1.4.3.tgz", + "integrity": "sha512-IgB8md0QW/+tWqcavuFgKYR/qIRvJkRLPJDFaoXtLLUaVcCDK0+HeFTkmQHj3eprcYhc+gOl0aEA1w7qZlYezw==", + "dev": true, + "requires": { + "foreground-child": "^1.5.6", + "mkdirp": "^0.5.0", + "os-homedir": "^1.0.1", + "rimraf": "^2.6.2", + "signal-exit": "^3.0.2", + "which": "^1.3.0" + } + }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", + "dev": true + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "table": { + "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", + "dev": true, + "requires": { + "ajv": "^6.10.2", + "lodash": "^4.17.14", + "slice-ansi": "^2.1.0", + "string-width": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "tar-stream": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.1.tgz", + "integrity": "sha512-IFLM5wp3QrJODQFPm6/to3LJZrONdBY/otxcvDIQzu217zKye6yVR3hhi9lAjrC2Z+m/j5oDxMPb1qcd8cIvpA==", + "requires": { + "bl": "^1.0.0", + "buffer-alloc": "^1.1.0", + "end-of-stream": "^1.0.0", + "fs-constants": "^1.0.0", + "readable-stream": "^2.3.0", + "to-buffer": "^1.1.0", + "xtend": "^4.0.0" + } + }, + "test-exclude": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", + "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==", + "dev": true, + "requires": { + "glob": "^7.1.3", + "minimatch": "^3.0.4", + "read-pkg-up": "^4.0.0", + "require-main-filename": "^2.0.0" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "to-buffer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", + "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==" + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + } + } + }, + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" + } + } + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "window-size": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", + "integrity": "sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY=" + }, + "winston": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/winston/-/winston-2.4.4.tgz", + "integrity": "sha512-NBo2Pepn4hK4V01UfcWcDlmiVTs7VTB1h7bgnB0rgP146bYhMxX0ypCz3lBOfNxCO4Zuek7yeT+y/zM1OfMw4Q==", + "requires": { + "async": "~1.0.0", + "colors": "1.0.x", + "cycle": "1.0.x", + "eyes": "0.1.x", + "isstream": "0.1.x", + "stack-trace": "0.0.x" + }, + "dependencies": { + "async": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", + "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=" + } + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "dev": true, + "requires": { + "mkdirp": "^0.5.1" + } + }, + "write-file-atomic": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", + "integrity": "sha1-AwiOnr+edWtpdRYR0qXvWRSCyZU=", + "requires": { + "camelcase": "^2.0.1", + "cliui": "^3.0.3", + "decamelize": "^1.1.1", + "os-locale": "^1.4.0", + "string-width": "^1.0.1", + "window-size": "^0.1.4", + "y18n": "^3.2.0" + } + }, + "yargs-parser": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "dependencies": { + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + } + } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" + } + } +} diff --git a/fabcar/javascript/package.json b/fabcar/javascript/package.json index 26f7c750..7d597661 100644 --- a/fabcar/javascript/package.json +++ b/fabcar/javascript/package.json @@ -15,14 +15,19 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { +<<<<<<< HEAD "fabric-ca-client": "~1.4.0", "fabric-network": "~1.4.0" +======= + "fabric-ca-client": "beta", + "fabric-network": "beta" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 }, "devDependencies": { "chai": "^4.2.0", "eslint": "^5.9.0", "mocha": "^5.2.0", - "nyc": "^13.1.0", + "nyc": "^14.1.1", "sinon": "^7.1.1", "sinon-chai": "^3.3.0" }, diff --git a/fabcar/javascript/query.js b/fabcar/javascript/query.js index 40af411f..62572f89 100644 --- a/fabcar/javascript/query.js +++ b/fabcar/javascript/query.js @@ -4,22 +4,33 @@ 'use strict'; +<<<<<<< HEAD const { FileSystemWallet, Gateway } = require('fabric-network'); +======= +const { Gateway, Wallets } = require('fabric-network'); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 const path = require('path'); +const fs = require('fs'); +<<<<<<< HEAD const ccpPath = path.resolve(__dirname, '..', '..', 'first-network', 'connection-org1.json'); +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 async function main() { try { + // load the network configuration + const ccpPath = path.resolve(__dirname, '..', '..', 'first-network', 'connection-org1.json'); + const ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8')); // Create a new file system based wallet for managing identities. const walletPath = path.join(process.cwd(), 'wallet'); - const wallet = new FileSystemWallet(walletPath); + const wallet = await Wallets.newFileSystemWallet(walletPath); console.log(`Wallet path: ${walletPath}`); // Check to see if we've already enrolled the user. - const userExists = await wallet.exists('user1'); - if (!userExists) { + const identity = await wallet.get('user1'); + if (!identity) { console.log('An identity for the user "user1" does not exist in the wallet'); console.log('Run the registerUser.js application before retrying'); return; @@ -27,7 +38,11 @@ async function main() { // Create a new gateway for connecting to our peer node. const gateway = new Gateway(); +<<<<<<< HEAD await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +======= + await gateway.connect(ccp, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Get the network (channel) our contract is deployed to. const network = await gateway.getNetwork('mychannel'); diff --git a/fabcar/javascript/registerUser.js b/fabcar/javascript/registerUser.js index cb786a25..cf525e3a 100644 --- a/fabcar/javascript/registerUser.js +++ b/fabcar/javascript/registerUser.js @@ -4,34 +4,50 @@ 'use strict'; +<<<<<<< HEAD const { FileSystemWallet, Gateway, X509WalletMixin } = require('fabric-network'); const path = require('path'); const ccpPath = path.resolve(__dirname, '..', '..', 'first-network', 'connection-org1.json'); +======= +const { Wallets } = require('fabric-network'); +const FabricCAServices = require('fabric-ca-client'); +const fs = require('fs'); +const path = require('path'); + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 async function main() { try { + // load the network configuration + const ccpPath = path.resolve(__dirname, '..', '..', 'first-network', 'connection-org1.json'); + const ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8')); + + // Create a new CA client for interacting with the CA. + const caURL = ccp.certificateAuthorities['ca.org1.example.com'].url; + const ca = new FabricCAServices(caURL); // Create a new file system based wallet for managing identities. const walletPath = path.join(process.cwd(), 'wallet'); - const wallet = new FileSystemWallet(walletPath); + const wallet = await Wallets.newFileSystemWallet(walletPath); console.log(`Wallet path: ${walletPath}`); // Check to see if we've already enrolled the user. - const userExists = await wallet.exists('user1'); - if (userExists) { + const userIdentity = await wallet.get('user1'); + if (userIdentity) { console.log('An identity for the user "user1" already exists in the wallet'); return; } // Check to see if we've already enrolled the admin user. - const adminExists = await wallet.exists('admin'); - if (!adminExists) { + const adminIdentity = await wallet.get('admin'); + if (!adminIdentity) { console.log('An identity for the admin user "admin" does not exist in the wallet'); console.log('Run the enrollAdmin.js application before retrying'); return; } +<<<<<<< HEAD // Create a new gateway for connecting to our peer node. const gateway = new Gateway(); await gateway.connect(ccpPath, { wallet, identity: 'admin', discovery: { enabled: true, asLocalhost: true } }); @@ -45,6 +61,31 @@ async function main() { const enrollment = await ca.enroll({ enrollmentID: 'user1', enrollmentSecret: secret }); const userIdentity = X509WalletMixin.createIdentity('Org1MSP', enrollment.certificate, enrollment.key.toBytes()); await wallet.import('user1', userIdentity); +======= + // build a user object for authenticating with the CA + const provider = wallet.getProviderRegistry().getProvider(adminIdentity.type); + const adminUser = await provider.getUserContext(adminIdentity, 'admin'); + + // Register the user, enroll the user, and import the new identity into the wallet. + const secret = await ca.register({ + affiliation: 'org1.department1', + enrollmentID: 'user1', + role: 'client' + }, adminUser); + const enrollment = await ca.enroll({ + enrollmentID: 'user1', + enrollmentSecret: secret + }); + const x509Identity = { + credentials: { + certificate: enrollment.certificate, + privateKey: enrollment.key.toBytes(), + }, + mspId: 'Org1MSP', + type: 'X.509', + }; + await wallet.put('user1', x509Identity); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 console.log('Successfully registered and enrolled admin user "user1" and imported it into the wallet'); } catch (error) { diff --git a/fabcar/startFabric.sh b/fabcar/startFabric.sh index 028a0e11..17e0bf8a 100755 --- a/fabcar/startFabric.sh +++ b/fabcar/startFabric.sh @@ -5,7 +5,7 @@ # SPDX-License-Identifier: Apache-2.0 # # Exit on first error -set -e +set -ex # don't rewrite paths for Windows Git Bash users export MSYS_NO_PATHCONV=1 @@ -14,6 +14,7 @@ CC_SRC_LANGUAGE=${1:-"go"} CC_SRC_LANGUAGE=`echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]` if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then CC_RUNTIME_LANGUAGE=golang +<<<<<<< HEAD CC_SRC_PATH=github.com/chaincode/fabcar/go elif [ "$CC_SRC_LANGUAGE" = "java" ]; then CC_RUNTIME_LANGUAGE=java @@ -24,6 +25,28 @@ elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then elif [ "$CC_SRC_LANGUAGE" = "typescript" ]; then CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js CC_SRC_PATH=/opt/gopath/src/github.com/chaincode/fabcar/typescript +======= + CC_SRC_PATH=github.com/hyperledger/fabric-samples/chaincode/fabcar/go + echo Vendoring Go dependencies ... + pushd ../chaincode/fabcar/go + GO111MODULE=on go mod vendor + popd + echo Finished vendoring Go dependencies +elif [ "$CC_SRC_LANGUAGE" = "java" ]; then + CC_RUNTIME_LANGUAGE=java + CC_SRC_PATH=/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/fabcar/java/build/install/fabcar + echo Compiling Java code ... + pushd ../chaincode/fabcar/java + ./gradlew installDist + popd + echo Finished compiling Java code +elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then + CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js + CC_SRC_PATH=/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/fabcar/javascript +elif [ "$CC_SRC_LANGUAGE" = "typescript" ]; then + CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js + CC_SRC_PATH=/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/fabcar/typescript +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 echo Compiling TypeScript code into JavaScript ... pushd ../chaincode/fabcar/typescript npm install @@ -32,7 +55,7 @@ elif [ "$CC_SRC_LANGUAGE" = "typescript" ]; then echo Finished compiling TypeScript code into JavaScript else echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script - echo Supported chaincode languages are: go, javascript, and typescript + echo Supported chaincode languages are: go, java, javascript, and typescript exit 1 fi @@ -41,9 +64,16 @@ fi rm -rf ./hfc-key-store # launch network; create channel and join peer to channel +<<<<<<< HEAD cd ../first-network echo y | ./byfn.sh down echo y | ./byfn.sh up -a -n -s couchdb +======= +pushd ../first-network +echo y | ./byfn.sh down +echo y | ./byfn.sh up -a -n -s couchdb +popd +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 CONFIG_ROOT=/opt/gopath/src/github.com/hyperledger/fabric/peer ORG1_MSPCONFIGPATH=${CONFIG_ROOT}/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp @@ -51,6 +81,7 @@ ORG1_TLS_ROOTCERT_FILE=${CONFIG_ROOT}/crypto/peerOrganizations/org1.example.com/ ORG2_MSPCONFIGPATH=${CONFIG_ROOT}/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp ORG2_TLS_ROOTCERT_FILE=${CONFIG_ROOT}/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt ORDERER_TLS_ROOTCERT_FILE=${CONFIG_ROOT}/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem +<<<<<<< HEAD set -x echo "Installing smart contract on peer0.org1.example.com" @@ -119,6 +150,159 @@ docker exec \ --tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} \ --tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE} set +x +======= + +PEER0_ORG1="docker exec +-e CORE_PEER_LOCALMSPID=Org1MSP +-e CORE_PEER_ADDRESS=peer0.org1.example.com:7051 +-e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} +-e CORE_PEER_TLS_ROOTCERT_FILE=${ORG1_TLS_ROOTCERT_FILE} +cli +peer +--tls=true +--cafile=${ORDERER_TLS_ROOTCERT_FILE} +--orderer=orderer.example.com:7050" + +PEER1_ORG1="docker exec +-e CORE_PEER_LOCALMSPID=Org1MSP +-e CORE_PEER_ADDRESS=peer1.org1.example.com:8051 +-e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} +-e CORE_PEER_TLS_ROOTCERT_FILE=${ORG1_TLS_ROOTCERT_FILE} +cli +peer +--tls=true +--cafile=${ORDERER_TLS_ROOTCERT_FILE} +--orderer=orderer.example.com:7050" + +PEER0_ORG2="docker exec +-e CORE_PEER_LOCALMSPID=Org2MSP +-e CORE_PEER_ADDRESS=peer0.org2.example.com:9051 +-e CORE_PEER_MSPCONFIGPATH=${ORG2_MSPCONFIGPATH} +-e CORE_PEER_TLS_ROOTCERT_FILE=${ORG2_TLS_ROOTCERT_FILE} +cli +peer +--tls=true +--cafile=${ORDERER_TLS_ROOTCERT_FILE} +--orderer=orderer.example.com:7050" + +PEER1_ORG2="docker exec +-e CORE_PEER_LOCALMSPID=Org2MSP +-e CORE_PEER_ADDRESS=peer1.org2.example.com:10051 +-e CORE_PEER_MSPCONFIGPATH=${ORG2_MSPCONFIGPATH} +-e CORE_PEER_TLS_ROOTCERT_FILE=${ORG2_TLS_ROOTCERT_FILE} +cli +peer +--tls=true +--cafile=${ORDERER_TLS_ROOTCERT_FILE} +--orderer=orderer.example.com:7050" + +echo "Packaging smart contract on peer0.org1.example.com" +${PEER0_ORG1} lifecycle chaincode package \ + fabcar.tar.gz \ + --path "$CC_SRC_PATH" \ + --lang "$CC_RUNTIME_LANGUAGE" \ + --label fabcarv1 + +echo "Installing smart contract on peer0.org1.example.com" +${PEER0_ORG1} lifecycle chaincode install \ + fabcar.tar.gz + +echo "Installing smart contract on peer1.org1.example.com" +${PEER1_ORG1} lifecycle chaincode install \ + fabcar.tar.gz + +echo "Determining package ID for smart contract on peer0.org1.example.com" +REGEX='Package ID: (.*), Label: fabcarv1' +if [[ `${PEER0_ORG1} lifecycle chaincode queryinstalled` =~ $REGEX ]]; then + PACKAGE_ID_ORG1=${BASH_REMATCH[1]} +else + echo Could not find package ID for fabcarv1 chaincode on peer0.org1.example.com + exit 1 +fi + +echo "Approving smart contract for org1" +${PEER0_ORG1} lifecycle chaincode approveformyorg \ + --package-id ${PACKAGE_ID_ORG1} \ + --channelID mychannel \ + --name fabcar \ + --version 1.0 \ + --signature-policy "AND('Org1MSP.member','Org2MSP.member')" \ + --sequence 1 \ + --waitForEvent + +echo "Packaging smart contract on peer0.org2.example.com" +${PEER0_ORG2} lifecycle chaincode package \ + fabcar.tar.gz \ + --path "$CC_SRC_PATH" \ + --lang "$CC_RUNTIME_LANGUAGE" \ + --label fabcarv1 + +echo "Installing smart contract on peer0.org2.example.com" +${PEER0_ORG2} lifecycle chaincode install fabcar.tar.gz + +echo "Installing smart contract on peer1.org2.example.com" +${PEER1_ORG2} lifecycle chaincode install fabcar.tar.gz + +echo "Determining package ID for smart contract on peer0.org2.example.com" +REGEX='Package ID: (.*), Label: fabcarv1' +if [[ `${PEER0_ORG2} lifecycle chaincode queryinstalled` =~ $REGEX ]]; then + PACKAGE_ID_ORG2=${BASH_REMATCH[1]} +else + echo Could not find package ID for fabcarv1 chaincode on peer0.org2.example.com + exit 1 +fi + +echo "Approving smart contract for org2" +${PEER0_ORG2} lifecycle chaincode approveformyorg \ + --package-id ${PACKAGE_ID_ORG2} \ + --channelID mychannel \ + --name fabcar \ + --version 1.0 \ + --signature-policy "AND('Org1MSP.member','Org2MSP.member')" \ + --sequence 1 \ + --waitForEvent + +echo "Committing smart contract" +${PEER0_ORG1} lifecycle chaincode commit \ + --channelID mychannel \ + --name fabcar \ + --version 1.0 \ + --signature-policy "AND('Org1MSP.member','Org2MSP.member')" \ + --sequence 1 \ + --waitForEvent \ + --peerAddresses peer0.org1.example.com:7051 \ + --peerAddresses peer0.org2.example.com:9051 \ + --tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} \ + --tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE} + +echo "Submitting initLedger transaction to smart contract on mychannel" +# echo "The transaction is sent to all of the peers so that chaincode is built before receiving the following requests" +${PEER0_ORG1} chaincode invoke \ + -C mychannel \ + -n fabcar \ + -c '{"function":"initLedger","Args":[]}' \ + --waitForEvent \ + --waitForEventTimeout 300s \ + --peerAddresses peer0.org1.example.com:7051 \ + --peerAddresses peer0.org2.example.com:9051 \ + --tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} \ + --tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE} + +# Temporary workaround (see FAB-15897) - cannot invoke across all four peers at the same time, so use a query to build +# the chaincode across the remaining peers. +${PEER1_ORG1} chaincode query \ + -C mychannel \ + -n fabcar \ + -c '{"function":"queryAllCars","Args":[]}' \ + --peerAddresses peer1.org1.example.com:8051 \ + --tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} +${PEER1_ORG2} chaincode query \ + -C mychannel \ + -n fabcar \ + -c '{"function":"queryAllCars","Args":[]}' \ + --peerAddresses peer1.org2.example.com:10051 \ + --tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE} +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 cat <>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 }, "devDependencies": { "@types/chai": "^4.1.7", @@ -29,7 +34,7 @@ "@types/sinon-chai": "^3.2.1", "chai": "^4.2.0", "mocha": "^5.2.0", - "nyc": "^13.1.0", + "nyc": "^14.1.1", "sinon": "^7.1.1", "sinon-chai": "^3.3.0", "ts-node": "^7.0.1", diff --git a/fabcar/typescript/src/enrollAdmin.ts b/fabcar/typescript/src/enrollAdmin.ts index 7325ee2d..a1c1fc18 100644 --- a/fabcar/typescript/src/enrollAdmin.ts +++ b/fabcar/typescript/src/enrollAdmin.ts @@ -3,16 +3,22 @@ */ import * as FabricCAServices from 'fabric-ca-client'; -import { FileSystemWallet, X509WalletMixin } from 'fabric-network'; +import { Wallets, X509Identity } from 'fabric-network'; import * as fs from 'fs'; import * as path from 'path'; +<<<<<<< HEAD const ccpPath = path.resolve(__dirname, '..', '..', '..', 'first-network', 'connection-org1.json'); const ccpJSON = fs.readFileSync(ccpPath, 'utf8'); const ccp = JSON.parse(ccpJSON); +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 async function main() { try { + // load the network configuration + const ccpPath = path.resolve(__dirname, '..', '..', '..', 'first-network', 'connection-org1.json'); + const ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8')); // Create a new CA client for interacting with the CA. const caInfo = ccp.certificateAuthorities['ca.org1.example.com']; @@ -21,20 +27,32 @@ async function main() { // Create a new file system based wallet for managing identities. const walletPath = path.join(process.cwd(), 'wallet'); - const wallet = new FileSystemWallet(walletPath); + const wallet = await Wallets.newFileSystemWallet(walletPath); console.log(`Wallet path: ${walletPath}`); // Check to see if we've already enrolled the admin user. - const adminExists = await wallet.exists('admin'); - if (adminExists) { + const identity = await wallet.get('admin'); + if (identity) { console.log('An identity for the admin user "admin" already exists in the wallet'); return; } // Enroll the admin user, and import the new identity into the wallet. const enrollment = await ca.enroll({ enrollmentID: 'admin', enrollmentSecret: 'adminpw' }); +<<<<<<< HEAD const identity = X509WalletMixin.createIdentity('Org1MSP', enrollment.certificate, enrollment.key.toBytes()); await wallet.import('admin', identity); +======= + const x509Identity: X509Identity = { + credentials: { + certificate: enrollment.certificate, + privateKey: enrollment.key.toBytes(), + }, + mspId: 'Org1MSP', + type: 'X.509', + }; + await wallet.put('admin', x509Identity); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 console.log('Successfully enrolled admin user "admin" and imported it into the wallet'); } catch (error) { diff --git a/fabcar/typescript/src/invoke.ts b/fabcar/typescript/src/invoke.ts index 017d8ee1..2ae6c1de 100644 --- a/fabcar/typescript/src/invoke.ts +++ b/fabcar/typescript/src/invoke.ts @@ -2,22 +2,31 @@ * SPDX-License-Identifier: Apache-2.0 */ +<<<<<<< HEAD import { FileSystemWallet, Gateway } from 'fabric-network'; import * as path from 'path'; const ccpPath = path.resolve(__dirname, '..', '..', '..', 'first-network', 'connection-org1.json'); +======= +import { Gateway, Wallets } from 'fabric-network'; +import * as path from 'path'; +import * as fs from 'fs'; +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 async function main() { try { + // load the network configuration + const ccpPath = path.resolve(__dirname, '..', '..', '..', 'first-network', 'connection-org1.json'); + const ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8')); // Create a new file system based wallet for managing identities. const walletPath = path.join(process.cwd(), 'wallet'); - const wallet = new FileSystemWallet(walletPath); + const wallet = await Wallets.newFileSystemWallet(walletPath); console.log(`Wallet path: ${walletPath}`); // Check to see if we've already enrolled the user. - const userExists = await wallet.exists('user1'); - if (!userExists) { + const identity = await wallet.get('user1'); + if (!identity) { console.log('An identity for the user "user1" does not exist in the wallet'); console.log('Run the registerUser.ts application before retrying'); return; @@ -25,7 +34,11 @@ async function main() { // Create a new gateway for connecting to our peer node. const gateway = new Gateway(); +<<<<<<< HEAD await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +======= + await gateway.connect(ccp, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Get the network (channel) our contract is deployed to. const network = await gateway.getNetwork('mychannel'); diff --git a/fabcar/typescript/src/query.ts b/fabcar/typescript/src/query.ts index 704433ff..885154b5 100644 --- a/fabcar/typescript/src/query.ts +++ b/fabcar/typescript/src/query.ts @@ -2,22 +2,33 @@ * SPDX-License-Identifier: Apache-2.0 */ +<<<<<<< HEAD import { FileSystemWallet, Gateway } from 'fabric-network'; +======= +import { Gateway, Wallets } from 'fabric-network'; +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 import * as path from 'path'; +import * as fs from 'fs'; +<<<<<<< HEAD const ccpPath = path.resolve(__dirname, '..', '..', '..', 'first-network', 'connection-org1.json'); +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 async function main() { try { + // load the network configuration + const ccpPath = path.resolve(__dirname, '..', '..', '..', 'first-network', 'connection-org1.json'); + const ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8')); // Create a new file system based wallet for managing identities. const walletPath = path.join(process.cwd(), 'wallet'); - const wallet = new FileSystemWallet(walletPath); + const wallet = await Wallets.newFileSystemWallet(walletPath); console.log(`Wallet path: ${walletPath}`); // Check to see if we've already enrolled the user. - const userExists = await wallet.exists('user1'); - if (!userExists) { + const identity = await wallet.get('user1'); + if (!identity) { console.log('An identity for the user "user1" does not exist in the wallet'); console.log('Run the registerUser.ts application before retrying'); return; @@ -25,7 +36,11 @@ async function main() { // Create a new gateway for connecting to our peer node. const gateway = new Gateway(); +<<<<<<< HEAD await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +======= + await gateway.connect(ccp, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Get the network (channel) our contract is deployed to. const network = await gateway.getNetwork('mychannel'); diff --git a/fabcar/typescript/src/registerUser.ts b/fabcar/typescript/src/registerUser.ts index 4e9407e4..c742891d 100644 --- a/fabcar/typescript/src/registerUser.ts +++ b/fabcar/typescript/src/registerUser.ts @@ -2,34 +2,49 @@ * SPDX-License-Identifier: Apache-2.0 */ +<<<<<<< HEAD import { FileSystemWallet, Gateway, X509WalletMixin } from 'fabric-network'; import * as path from 'path'; const ccpPath = path.resolve(__dirname, '..', '..', '..', 'first-network', 'connection-org1.json'); +======= +import { Wallets, X509Identity } from 'fabric-network'; +import * as FabricCAServices from 'fabric-ca-client'; +import * as path from 'path'; +import * as fs from 'fs'; +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 async function main() { try { + // load the network configuration + const ccpPath = path.resolve(__dirname, '..', '..', '..', 'first-network', 'connection-org1.json'); + let ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8')); + + // Create a new CA client for interacting with the CA. + const caURL = ccp.certificateAuthorities['ca.org1.example.com'].url; + const ca = new FabricCAServices(caURL); // Create a new file system based wallet for managing identities. const walletPath = path.join(process.cwd(), 'wallet'); - const wallet = new FileSystemWallet(walletPath); + const wallet = await Wallets.newFileSystemWallet(walletPath); console.log(`Wallet path: ${walletPath}`); // Check to see if we've already enrolled the user. - const userExists = await wallet.exists('user1'); - if (userExists) { + const userIdentity = await wallet.get('user1'); + if (userIdentity) { console.log('An identity for the user "user1" already exists in the wallet'); return; } // Check to see if we've already enrolled the admin user. - const adminExists = await wallet.exists('admin'); - if (!adminExists) { + const adminIdentity = await wallet.get('admin'); + if (!adminIdentity) { console.log('An identity for the admin user "admin" does not exist in the wallet'); console.log('Run the enrollAdmin.ts application before retrying'); return; } +<<<<<<< HEAD // Create a new gateway for connecting to our peer node. const gateway = new Gateway(); await gateway.connect(ccpPath, { wallet, identity: 'admin', discovery: { enabled: true, asLocalhost: true } }); @@ -37,12 +52,29 @@ async function main() { // Get the CA client object from the gateway for interacting with the CA. const ca = gateway.getClient().getCertificateAuthority(); const adminIdentity = gateway.getCurrentIdentity(); +======= + // build a user object for authenticating with the CA + const provider = wallet.getProviderRegistry().getProvider(adminIdentity.type); + const adminUser = await provider.getUserContext(adminIdentity, 'admin'); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Register the user, enroll the user, and import the new identity into the wallet. - const secret = await ca.register({ affiliation: 'org1.department1', enrollmentID: 'user1', role: 'client' }, adminIdentity); + const secret = await ca.register({ affiliation: 'org1.department1', enrollmentID: 'user1', role: 'client' }, adminUser); const enrollment = await ca.enroll({ enrollmentID: 'user1', enrollmentSecret: secret }); +<<<<<<< HEAD const userIdentity = X509WalletMixin.createIdentity('Org1MSP', enrollment.certificate, enrollment.key.toBytes()); await wallet.import('user1', userIdentity); +======= + const x509Identity: X509Identity = { + credentials: { + certificate: enrollment.certificate, + privateKey: enrollment.key.toBytes(), + }, + mspId: 'Org1MSP', + type: 'X.509', + }; + await wallet.put('user1', x509Identity); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 console.log('Successfully registered and enrolled admin user "user1" and imported it into the wallet'); } catch (error) { diff --git a/first-network/.gitignore b/first-network/.gitignore index 4888c4c2..5974ddb2 100644 --- a/first-network/.gitignore +++ b/first-network/.gitignore @@ -1,8 +1,12 @@ /channel-artifacts/*.tx /channel-artifacts/*.block /crypto-config/* -/docker-compose-e2e.yaml /ledgers /ledgers-backup /channel-artifacts/*.json -/org3-artifacts/crypto-config/* \ No newline at end of file +<<<<<<< HEAD +/org3-artifacts/crypto-config/* +======= +/org3-artifacts/crypto-config/* +/connection-*.* +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 diff --git a/first-network/base/peer-base.yaml b/first-network/base/peer-base.yaml index 6f6dd3e1..b1141fd3 100644 --- a/first-network/base/peer-base.yaml +++ b/first-network/base/peer-base.yaml @@ -23,6 +23,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt + # Allow more time for chaincode container to build on install. + - CORE_CHAINCODE_EXECUTETIMEOUT=300s working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer command: peer node start @@ -31,8 +33,13 @@ services: environment: - FABRIC_LOGGING_SPEC=INFO - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 +<<<<<<< HEAD - ORDERER_GENERAL_GENESISMETHOD=file - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block +======= + - ORDERER_GENERAL_BOOTSTRAPMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/orderer/orderer.genesis.block +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp # enabled TLS @@ -40,8 +47,11 @@ services: - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] +<<<<<<< HEAD - ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1 - ORDERER_KAFKA_VERBOSE=true +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] diff --git a/first-network/byfn.sh b/first-network/byfn.sh index 57a3447c..ff72881a 100755 --- a/first-network/byfn.sh +++ b/first-network/byfn.sh @@ -9,7 +9,7 @@ # Fabric network. # # The end-to-end verification provisions a sample Fabric network consisting of -# two organizations, each maintaining two peers, and a “solo” ordering service. +# two organizations, each maintaining two peers, and a Raft ordering service. # # This verification makes use of two fundamental tools, which are necessary to # create a functioning transactional network with digital signature validation @@ -45,10 +45,13 @@ function printHelp() { echo " -c - channel name to use (defaults to \"mychannel\")" echo " -t - CLI timeout duration in seconds (defaults to 10)" echo " -d - delay duration in seconds (defaults to 3)" - echo " -f - specify which docker-compose file use (defaults to docker-compose-cli.yaml)" echo " -s - the database backend to use: goleveldb (default) or couchdb" +<<<<<<< HEAD echo " -l - the chaincode language: golang (default) or node" echo " -o - the consensus-type of the ordering service: solo (default), kafka, or etcdraft" +======= + echo " -l - the programming language of the chaincode to deploy: go (default), javascript, or java" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 echo " -i - the tag to be used to launch the network (defaults to \"latest\")" echo " -a - launch certificate authorities (no certificate authorities are launched by default)" echo " -n - do not deploy chaincode (abstore chaincode is deployed by default)" @@ -61,7 +64,7 @@ function printHelp() { echo " byfn.sh generate -c mychannel" echo " byfn.sh up -c mychannel -s couchdb" echo " byfn.sh up -c mychannel -s couchdb -i 1.4.0" - echo " byfn.sh up -l node" + echo " byfn.sh up -l javascript" echo " byfn.sh down -c mychannel" echo " byfn.sh upgrade -c mychannel" echo @@ -113,7 +116,7 @@ function removeUnwantedImages() { } # Versions of fabric known not to work with this release of first-network -BLACKLISTED_VERSIONS="^1\.0\. ^1\.1\.0-preview ^1\.1\.0-alpha" +BLACKLISTED_VERSIONS="^1\." # Do some basic sanity checking to make sure that the appropriate versions of fabric # binaries/images are available. In the future, additional checking for the presence @@ -155,20 +158,26 @@ function networkUp() { # generate artifacts if they don't exist if [ ! -d "crypto-config" ]; then generateCerts - replacePrivateKey generateChannelArtifacts fi +<<<<<<< HEAD COMPOSE_FILES="-f ${COMPOSE_FILE}" +======= + COMPOSE_FILES="-f ${COMPOSE_FILE} -f ${COMPOSE_FILE_RAFT2}" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 if [ "${CERTIFICATE_AUTHORITIES}" == "true" ]; then COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_CA}" export BYFN_CA1_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org1.example.com/ca && ls *_sk) export BYFN_CA2_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org2.example.com/ca && ls *_sk) fi +<<<<<<< HEAD if [ "${CONSENSUS_TYPE}" == "kafka" ]; then COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_KAFKA}" elif [ "${CONSENSUS_TYPE}" == "etcdraft" ]; then COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_RAFT2}" fi +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 if [ "${IF_COUCHDB}" == "couchdb" ]; then COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_COUCH}" fi @@ -179,10 +188,22 @@ function networkUp() { exit 1 fi +<<<<<<< HEAD if [ "$CONSENSUS_TYPE" == "kafka" ]; then sleep 1 echo "Sleeping 10s to allow $CONSENSUS_TYPE cluster to complete booting" sleep 9 +======= + echo "Sleeping 15s to allow Raft cluster to complete booting" + sleep 15 + + if [ "${NO_CHAINCODE}" != "true" ]; then + echo Vendoring Go dependencies ... + pushd ../chaincode/abstore/go + GO111MODULE=on go mod vendor + popd + echo Finished vendoring Go dependencies +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 fi if [ "$CONSENSUS_TYPE" == "etcdraft" ]; then @@ -192,7 +213,11 @@ function networkUp() { fi # now run the end to end script +<<<<<<< HEAD docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE $NO_CHAINCODE +======= + docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE $NO_CHAINCODE +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 if [ $? -ne 0 ]; then echo "ERROR !!!! Test failed" exit 1 @@ -216,17 +241,24 @@ function upgradeNetwork() { mkdir -p $LEDGERS_BACKUP export IMAGE_TAG=$IMAGETAG +<<<<<<< HEAD COMPOSE_FILES="-f ${COMPOSE_FILE}" +======= + COMPOSE_FILES="-f ${COMPOSE_FILE} -f ${COMPOSE_FILE_RAFT2}" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 if [ "${CERTIFICATE_AUTHORITIES}" == "true" ]; then COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_CA}" export BYFN_CA1_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org1.example.com/ca && ls *_sk) export BYFN_CA2_PRIVATE_KEY=$(cd crypto-config/peerOrganizations/org2.example.com/ca && ls *_sk) fi +<<<<<<< HEAD if [ "${CONSENSUS_TYPE}" == "kafka" ]; then COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_KAFKA}" elif [ "${CONSENSUS_TYPE}" == "etcdraft" ]; then COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_RAFT2}" fi +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 if [ "${IF_COUCHDB}" == "couchdb" ]; then COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_COUCH}" fi @@ -261,7 +293,11 @@ function upgradeNetwork() { docker-compose $COMPOSE_FILES up -d --no-deps $PEER done +<<<<<<< HEAD docker exec cli sh -c "SYS_CHANNEL=$CH_NAME && scripts/upgrade_to_v14.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE" +======= + docker exec cli scripts/upgrade_to_v14.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 if [ $? -ne 0 ]; then echo "ERROR !!!! Test failed" exit 1 @@ -274,8 +310,12 @@ function upgradeNetwork() { # Tear down running network function networkDown() { # stop org3 containers also in addition to org1 and org2, in case we were running sample to add org3 +<<<<<<< HEAD # stop kafka and zookeeper containers in case we're running with kafka consensus-type docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_CA -f $COMPOSE_FILE_ORG3 down --volumes --remove-orphans +======= + docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_CA -f $COMPOSE_FILE_ORG3 down --volumes --remove-orphans +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # Don't remove the generated artifacts -- note, the ledgers are always removed if [ "$MODE" != "restart" ]; then @@ -288,41 +328,6 @@ function networkDown() { removeUnwantedImages # remove orderer block and other channel configuration transactions and certs rm -rf channel-artifacts/*.block channel-artifacts/*.tx crypto-config ./org3-artifacts/crypto-config/ channel-artifacts/org3.json - # remove the docker-compose yaml file that was customized to the example - rm -f docker-compose-e2e.yaml - fi -} - -# Using docker-compose-e2e-template.yaml, replace constants with private key file names -# generated by the cryptogen tool and output a docker-compose.yaml specific to this -# configuration -function replacePrivateKey() { - # sed on MacOSX does not support -i flag with a null extension. We will use - # 't' for our back-up's extension and delete it at the end of the function - ARCH=$(uname -s | grep Darwin) - if [ "$ARCH" == "Darwin" ]; then - OPTS="-it" - else - OPTS="-i" - fi - - # Copy the template to the file that will be modified to add the private key - cp docker-compose-e2e-template.yaml docker-compose-e2e.yaml - - # The next steps will replace the template's contents with the - # actual values of the private key file names for the two CAs. - CURRENT_DIR=$PWD - cd crypto-config/peerOrganizations/org1.example.com/ca/ - PRIV_KEY=$(ls *_sk) - cd "$CURRENT_DIR" - sed $OPTS "s/CA1_PRIVATE_KEY/${PRIV_KEY}/g" docker-compose-e2e.yaml - cd crypto-config/peerOrganizations/org2.example.com/ca/ - PRIV_KEY=$(ls *_sk) - cd "$CURRENT_DIR" - sed $OPTS "s/CA2_PRIVATE_KEY/${PRIV_KEY}/g" docker-compose-e2e.yaml - # If MacOSX, remove the temporary backup of the docker-compose file - if [ "$ARCH" == "Darwin" ]; then - rm docker-compose-e2e.yamlt fi } @@ -421,6 +426,7 @@ function generateChannelArtifacts() { echo "##########################################################" # Note: For some unknown reason (at least for now) the block file can't be # named orderer.genesis.block or the orderer will fail to launch! +<<<<<<< HEAD echo "CONSENSUS_TYPE="$CONSENSUS_TYPE set -x if [ "$CONSENSUS_TYPE" == "solo" ]; then @@ -434,8 +440,10 @@ function generateChannelArtifacts() { echo "unrecognized CONSESUS_TYPE='$CONSENSUS_TYPE'. exiting" exit 1 fi +======= + configtxgen -profile SampleMultiNodeEtcdRaft -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 res=$? - set +x if [ $res -ne 0 ]; then echo "Failed to generate orderer genesis block..." exit 1 @@ -482,9 +490,6 @@ function generateChannelArtifacts() { echo } -# Obtain the OS and Architecture string that will be used to select the correct -# native binaries for your platform, e.g., darwin-amd64 or linux-amd64 -OS_ARCH=$(echo "$(uname -s | tr '[:upper:]' '[:lower:]' | sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') # timeout duration - the duration the CLI should wait for a response from # another container before giving up CLI_TIMEOUT=10 @@ -500,19 +505,20 @@ COMPOSE_FILE=docker-compose-cli.yaml COMPOSE_FILE_COUCH=docker-compose-couch.yaml # org3 docker compose file COMPOSE_FILE_ORG3=docker-compose-org3.yaml +<<<<<<< HEAD # kafka and zookeeper compose file COMPOSE_FILE_KAFKA=docker-compose-kafka.yaml +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # two additional etcd/raft orderers COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml # certificate authorities compose file COMPOSE_FILE_CA=docker-compose-ca.yaml # -# use golang as the default language for chaincode -LANGUAGE=golang +# use go as the default language for chaincode +CC_SRC_LANGUAGE=go # default image tag IMAGETAG="latest" -# default consensus type -CONSENSUS_TYPE="solo" # Parse commandline args if [ "$1" = "-m" ]; then # supports old usage, muscle memory is powerful! shift @@ -535,7 +541,11 @@ else exit 1 fi +<<<<<<< HEAD while getopts "h?c:t:d:f:s:l:i:o:anv" opt; do +======= +while getopts "h?c:t:d:s:l:i:anv" opt; do +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 case "$opt" in h | \?) printHelp @@ -550,20 +560,25 @@ while getopts "h?c:t:d:f:s:l:i:o:anv" opt; do d) CLI_DELAY=$OPTARG ;; - f) - COMPOSE_FILE=$OPTARG - ;; s) IF_COUCHDB=$OPTARG ;; l) - LANGUAGE=$OPTARG + CC_SRC_LANGUAGE=$OPTARG ;; i) IMAGETAG=$(go env GOARCH)"-"$OPTARG ;; +<<<<<<< HEAD o) CONSENSUS_TYPE=$OPTARG +======= + a) + CERTIFICATE_AUTHORITIES=true + ;; + n) + NO_CHAINCODE=true +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 ;; a) CERTIFICATE_AUTHORITIES=true @@ -596,7 +611,6 @@ elif [ "${MODE}" == "down" ]; then ## Clear the network networkDown elif [ "${MODE}" == "generate" ]; then ## Generate Artifacts generateCerts - replacePrivateKey generateChannelArtifacts elif [ "${MODE}" == "restart" ]; then ## Restart the network networkDown diff --git a/first-network/configtx.yaml b/first-network/configtx.yaml index a1f6b20b..5fae273b 100644 --- a/first-network/configtx.yaml +++ b/first-network/configtx.yaml @@ -64,6 +64,9 @@ Organizations: Admins: Type: Signature Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.peer')" # leave this flag set to true. AnchorPeers: @@ -96,6 +99,9 @@ Organizations: Admins: Type: Signature Rule: "OR('Org2MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org2MSP.peer')" AnchorPeers: # AnchorPeers defines the location of peers which can be used @@ -128,6 +134,7 @@ Capabilities: # supported by both. # Set the value of the capability to true to require it. Channel: &ChannelCapabilities +<<<<<<< HEAD # V1.4.3 for Channel is a catchall flag for behavior which has been # determined to be desired for all orderers and peers running at the v1.4.3 # level, but which would be incompatible with orderers and peers from @@ -141,11 +148,21 @@ Capabilities: # V1.1 for Channel enables the new non-backwards compatible # features and fixes of fabric v1.1 V1_1: false +======= + # V2_0 capability ensures that orderers and peers behave according + # to v2.0 channel capabilities. Orderers and peers from + # prior releases would behave in an incompatible way, and are therefore + # not able to participate in channels at v2.0 capability. + # Prior to enabling V2.0 channel capabilities, ensure that all + # orderers and peers on a channel are at v2.0.0 or later. + V2_0: true +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # Orderer capabilities apply only to the orderers, and may be safely # used with prior release peers. # Set the value of the capability to true to require it. Orderer: &OrdererCapabilities +<<<<<<< HEAD # V1.4.2 for Orderer is a catchall flag for behavior which has been # determined to be desired for all orderers running at the v1.4.2 # level, but which would be incompatible with orderers from prior releases. @@ -155,11 +172,21 @@ Capabilities: # V1.1 for Orderer enables the new non-backwards compatible # features and fixes of fabric v1.1 V1_1: false +======= + # V2_0 orderer capability ensures that orderers behave according + # to v2.0 orderer capabilities. Orderers from + # prior releases would behave in an incompatible way, and are therefore + # not able to participate in channels at v2.0 orderer capability. + # Prior to enabling V2.0 orderer capabilities, ensure that all + # orderers on channel are at v2.0.0 or later. + V2_0: true +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # Application capabilities apply only to the peer network, and may be safely # used with prior release orderers. # Set the value of the capability to true to require it. Application: &ApplicationCapabilities +<<<<<<< HEAD # V1.4.2 for Application enables the new non-backwards compatible # features and fixes of fabric v1.4.2. V1_4_2: true @@ -174,6 +201,15 @@ Capabilities: # features and fixes of fabric v1.1 (note, this need not be set if # later version capabilities are set). V1_1: false +======= + # V2_0 application capability ensures that peers behave according + # to v2.0 application capabilities. Peers from + # prior releases would behave in an incompatible way, and are therefore + # not able to participate in channels at v2.0 application capability. + # Prior to enabling V2.0 application capabilities, ensure that all + # peers on channel are at v2.0.0 or later. + V2_0: true +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 ################################################################################ # @@ -202,6 +238,12 @@ Application: &ApplicationDefaults Admins: Type: ImplicitMeta Rule: "MAJORITY Admins" + LifecycleEndorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" Capabilities: <<: *ApplicationCapabilities @@ -216,8 +258,12 @@ Application: &ApplicationDefaults Orderer: &OrdererDefaults # Orderer Type: The orderer implementation to start +<<<<<<< HEAD # Available types are "solo","kafka" and "etcdraft" OrdererType: solo +======= + OrdererType: etcdraft +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 Addresses: - orderer.example.com:7050 @@ -240,6 +286,7 @@ Orderer: &OrdererDefaults # max bytes will result in a batch larger than preferred max bytes. PreferredMaxBytes: 512 KB +<<<<<<< HEAD Kafka: # Brokers: A list of Kafka brokers to which the orderer connects # NOTE: Use IP:port notation @@ -275,6 +322,8 @@ Orderer: &OrdererDefaults ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # Organizations is the list of orgs which are defined as participants on # the orderer side of the network Organizations: @@ -340,19 +389,6 @@ Channel: &ChannelDefaults ################################################################################ Profiles: - TwoOrgsOrdererGenesis: - <<: *ChannelDefaults - Orderer: - <<: *OrdererDefaults - Organizations: - - *OrdererOrg - Capabilities: - <<: *OrdererCapabilities - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - - *Org2 TwoOrgsChannel: Consortium: SampleConsortium <<: *ChannelDefaults @@ -364,16 +400,41 @@ Profiles: Capabilities: <<: *ApplicationCapabilities - SampleDevModeKafka: + SampleMultiNodeEtcdRaft: <<: *ChannelDefaults Capabilities: <<: *ChannelCapabilities Orderer: <<: *OrdererDefaults - OrdererType: kafka - Kafka: - Brokers: - - kafka.example.com:9092 + OrdererType: etcdraft + EtcdRaft: + Consenters: + - Host: orderer.example.com + Port: 7050 + ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt + - Host: orderer2.example.com + Port: 8050 + ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt + ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt + - Host: orderer3.example.com + Port: 9050 + ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt + ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt + - Host: orderer4.example.com + Port: 10050 + ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt + ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt + - Host: orderer5.example.com + Port: 11050 + ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt + ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt + Addresses: + - orderer.example.com:7050 + - orderer2.example.com:8050 + - orderer3.example.com:9050 + - orderer4.example.com:10050 + - orderer5.example.com:11050 Organizations: - *OrdererOrg @@ -388,6 +449,7 @@ Profiles: Organizations: - *Org1 - *Org2 +<<<<<<< HEAD SampleMultiNodeEtcdRaft: <<: *ChannelDefaults @@ -438,3 +500,5 @@ Profiles: Organizations: - *Org1 - *Org2 +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 diff --git a/first-network/docker-compose-cli.yaml b/first-network/docker-compose-cli.yaml index a7aa3f4b..2398dc1b 100644 --- a/first-network/docker-compose-cli.yaml +++ b/first-network/docker-compose-cli.yaml @@ -80,7 +80,7 @@ services: command: /bin/bash volumes: - /var/run/:/host/var/run/ - - ./../chaincode/:/opt/gopath/src/github.com/chaincode + - ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/ - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts diff --git a/first-network/docker-compose-couch-org3.yaml b/first-network/docker-compose-couch-org3.yaml index 4e98ad94..d1ab4ebc 100644 --- a/first-network/docker-compose-couch-org3.yaml +++ b/first-network/docker-compose-couch-org3.yaml @@ -11,7 +11,7 @@ networks: services: couchdb4: container_name: couchdb4 - image: hyperledger/fabric-couchdb + image: couchdb:2.3 # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. environment: @@ -38,7 +38,7 @@ services: couchdb5: container_name: couchdb5 - image: hyperledger/fabric-couchdb + image: couchdb:2.3 # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. environment: diff --git a/first-network/docker-compose-couch.yaml b/first-network/docker-compose-couch.yaml index b14c7f5c..d7a2bdc0 100644 --- a/first-network/docker-compose-couch.yaml +++ b/first-network/docker-compose-couch.yaml @@ -11,7 +11,7 @@ networks: services: couchdb0: container_name: couchdb0 - image: hyperledger/fabric-couchdb + image: couchdb:2.3 # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. environment: @@ -38,7 +38,7 @@ services: couchdb1: container_name: couchdb1 - image: hyperledger/fabric-couchdb + image: couchdb:2.3 # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. environment: @@ -65,7 +65,7 @@ services: couchdb2: container_name: couchdb2 - image: hyperledger/fabric-couchdb + image: couchdb:2.3 # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. environment: @@ -92,7 +92,7 @@ services: couchdb3: container_name: couchdb3 - image: hyperledger/fabric-couchdb + image: couchdb:2.3 # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. environment: diff --git a/first-network/docker-compose-etcdraft2.yaml b/first-network/docker-compose-etcdraft2.yaml index 1e525ee2..68f892ef 100644 --- a/first-network/docker-compose-etcdraft2.yaml +++ b/first-network/docker-compose-etcdraft2.yaml @@ -20,6 +20,7 @@ services: extends: file: base/peer-base.yaml service: orderer-base +<<<<<<< HEAD container_name: orderer2.example.com networks: - byfn @@ -30,11 +31,26 @@ services: - orderer2.example.com:/var/hyperledger/production/orderer ports: - 8050:7050 +======= + environment: + - ORDERER_GENERAL_LISTENPORT=8050 + container_name: orderer2.example.com + networks: + - byfn + volumes: + - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block + - ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/msp:/var/hyperledger/orderer/msp + - ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/:/var/hyperledger/orderer/tls + - orderer2.example.com:/var/hyperledger/production/orderer + ports: + - 8050:8050 +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 orderer3.example.com: extends: file: base/peer-base.yaml service: orderer-base +<<<<<<< HEAD container_name: orderer3.example.com networks: - byfn @@ -45,11 +61,26 @@ services: - orderer3.example.com:/var/hyperledger/production/orderer ports: - 9050:7050 +======= + environment: + - ORDERER_GENERAL_LISTENPORT=9050 + container_name: orderer3.example.com + networks: + - byfn + volumes: + - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block + - ./crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/msp:/var/hyperledger/orderer/msp + - ./crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/:/var/hyperledger/orderer/tls + - orderer3.example.com:/var/hyperledger/production/orderer + ports: + - 9050:9050 +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 orderer4.example.com: extends: file: base/peer-base.yaml service: orderer-base +<<<<<<< HEAD container_name: orderer4.example.com networks: - byfn @@ -60,11 +91,26 @@ services: - orderer4.example.com:/var/hyperledger/production/orderer ports: - 10050:7050 +======= + environment: + - ORDERER_GENERAL_LISTENPORT=10050 + container_name: orderer4.example.com + networks: + - byfn + volumes: + - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block + - ./crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/msp:/var/hyperledger/orderer/msp + - ./crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/:/var/hyperledger/orderer/tls + - orderer4.example.com:/var/hyperledger/production/orderer + ports: + - 10050:10050 +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 orderer5.example.com: extends: file: base/peer-base.yaml service: orderer-base +<<<<<<< HEAD container_name: orderer5.example.com networks: - byfn @@ -75,3 +121,17 @@ services: - orderer5.example.com:/var/hyperledger/production/orderer ports: - 11050:7050 +======= + environment: + - ORDERER_GENERAL_LISTENPORT=11050 + container_name: orderer5.example.com + networks: + - byfn + volumes: + - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block + - ./crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/msp:/var/hyperledger/orderer/msp + - ./crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/:/var/hyperledger/orderer/tls + - orderer5.example.com:/var/hyperledger/production/orderer + ports: + - 11050:11050 +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 diff --git a/first-network/docker-compose-kafka.yaml b/first-network/docker-compose-kafka.yaml deleted file mode 100644 index 06deac85..00000000 --- a/first-network/docker-compose-kafka.yaml +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - - -# NOTE: This is not the way a Kafka cluster would normally be deployed in production, as it is not secure -# and is not fault tolerant. This example is a toy deployment that is only meant to exercise the Kafka code path -# of the ordering service. - -version: '2' - -networks: - byfn: - -services: - zookeeper.example.com: - container_name: zookeeper.example.com - image: hyperledger/fabric-zookeeper:$IMAGE_TAG - environment: - ZOOKEEPER_CLIENT_PORT: 32181 - ZOOKEEPER_TICK_TIME: 2000 - networks: - - byfn - - kafka.example.com: - container_name: kafka.example.com - image: hyperledger/fabric-kafka:$IMAGE_TAG - depends_on: - - zookeeper.example.com - environment: - - KAFKA_BROKER_ID=1 - - KAFKA_ZOOKEEPER_CONNECT=zookeeper.example.com:2181 - - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka.example.com:9092 - - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 - - KAFKA_MESSAGE_MAX_BYTES=1048576 # 1 * 1024 * 1024 B - - KAFKA_REPLICA_FETCH_MAX_BYTES=1048576 # 1 * 1024 * 1024 B - - KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE=false - - KAFKA_LOG_RETENTION_MS=-1 - - KAFKA_MIN_INSYNC_REPLICAS=1 - - KAFKA_DEFAULT_REPLICATION_FACTOR=1 - networks: - - byfn diff --git a/first-network/docker-compose-org3.yaml b/first-network/docker-compose-org3.yaml index 2ee41e3c..20aa79cf 100644 --- a/first-network/docker-compose-org3.yaml +++ b/first-network/docker-compose-org3.yaml @@ -85,7 +85,7 @@ services: command: /bin/bash volumes: - /var/run/:/host/var/run/ - - ./../chaincode/:/opt/gopath/src/github.com/chaincode + - ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode - ./org3-artifacts/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ - ./crypto-config/peerOrganizations/org1.example.com:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com - ./crypto-config/peerOrganizations/org2.example.com:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com diff --git a/first-network/eyfn.sh b/first-network/eyfn.sh index ad2c3769..0954d228 100755 --- a/first-network/eyfn.sh +++ b/first-network/eyfn.sh @@ -29,9 +29,8 @@ function printHelp () { echo " -c - channel name to use (defaults to \"mychannel\")" echo " -t - CLI timeout duration in seconds (defaults to 10)" echo " -d - delay duration in seconds (defaults to 3)" - echo " -f - specify which docker-compose file use (defaults to docker-compose-cli.yaml)" echo " -s - the database backend to use: goleveldb (default) or couchdb" - echo " -l - the chaincode language: golang (default) or node" + echo " -l - the programming language of the chaincode to deploy: go (default), javascript, or java" echo " -i - the tag to be used to launch the network (defaults to \"latest\")" echo " -v - verbose mode" echo @@ -40,7 +39,7 @@ function printHelp () { echo echo " eyfn.sh generate -c mychannel" echo " eyfn.sh up -c mychannel -s couchdb" - echo " eyfn.sh up -l node" + echo " eyfn.sh up -l javascript" echo " eyfn.sh down -c mychannel" echo echo "Taking all defaults:" @@ -112,22 +111,13 @@ function networkUp () { echo "###############################################################" echo "############### Have Org3 peers join network ##################" echo "###############################################################" - docker exec Org3cli ./scripts/step2org3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE + docker exec Org3cli ./scripts/step2org3.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Unable to have Org3 peers join network" exit 1 fi - echo - echo "###############################################################" - echo "##### Upgrade chaincode to have Org3 peers on the network #####" - echo "###############################################################" - docker exec cli ./scripts/step3org3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE - if [ $? -ne 0 ]; then - echo "ERROR !!!! Unable to add Org3 peers on network" - exit 1 - fi # finish by running the test - docker exec Org3cli ./scripts/testorg3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE + docker exec Org3cli ./scripts/testorg3.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Unable to run test" exit 1 @@ -136,7 +126,11 @@ function networkUp () { # Tear down running network function networkDown () { +<<<<<<< HEAD docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_KAFKA -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_ORG3 -f $COMPOSE_FILE_COUCH down --volumes --remove-orphans +======= + docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_RAFT2 -f $COMPOSE_FILE_ORG3 -f $COMPOSE_FILE_COUCH down --volumes --remove-orphans +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # Don't remove containers, images, etc if restarting if [ "$MODE" != "restart" ]; then #Cleanup the chaincode containers @@ -145,8 +139,6 @@ function networkDown () { removeUnwantedImages # remove orderer block and other channel configuration transactions and certs rm -rf channel-artifacts/*.block channel-artifacts/*.tx crypto-config ./org3-artifacts/crypto-config/ channel-artifacts/org3.json - # remove the docker-compose yaml file that was customized to the example - rm -f docker-compose-e2e.yaml fi } @@ -157,7 +149,7 @@ function createConfigTx () { echo "###############################################################" echo "####### Generate and submit config tx to add Org3 #############" echo "###############################################################" - docker exec cli scripts/step1org3.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE + docker exec cli scripts/step1org3.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE if [ $? -ne 0 ]; then echo "ERROR !!!! Unable to create config tx" exit 1 @@ -227,9 +219,6 @@ if [ ! -d crypto-config ]; then exit 1 fi -# Obtain the OS and Architecture string that will be used to select the correct -# native binaries for your platform -OS_ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') # timeout duration - the duration the CLI should wait for a response from # another container before giving up CLI_TIMEOUT=10 @@ -245,12 +234,19 @@ COMPOSE_FILE_COUCH=docker-compose-couch.yaml COMPOSE_FILE_ORG3=docker-compose-org3.yaml # COMPOSE_FILE_COUCH_ORG3=docker-compose-couch-org3.yaml +<<<<<<< HEAD # kafka and zookeeper compose file COMPOSE_FILE_KAFKA=docker-compose-kafka.yaml # two additional etcd/raft orderers COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml # use golang as the default language for chaincode LANGUAGE=golang +======= +# two additional etcd/raft orderers +COMPOSE_FILE_RAFT2=docker-compose-etcdraft2.yaml +# use go as the default language for chaincode +CC_SRC_LANGUAGE=go +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # default image tag IMAGETAG="latest" @@ -272,7 +268,7 @@ else printHelp exit 1 fi -while getopts "h?c:t:d:f:s:l:i:v" opt; do +while getopts "h?c:t:d:s:l:i:v" opt; do case "$opt" in h|\?) printHelp @@ -284,11 +280,9 @@ while getopts "h?c:t:d:f:s:l:i:v" opt; do ;; d) CLI_DELAY=$OPTARG ;; - f) COMPOSE_FILE=$OPTARG - ;; s) IF_COUCHDB=$OPTARG ;; - l) LANGUAGE=$OPTARG + l) CC_SRC_LANGUAGE=$OPTARG ;; i) IMAGETAG=$OPTARG ;; diff --git a/first-network/org3-artifacts/configtx.yaml b/first-network/org3-artifacts/configtx.yaml index 26b49ed2..c32532c3 100644 --- a/first-network/org3-artifacts/configtx.yaml +++ b/first-network/org3-artifacts/configtx.yaml @@ -43,3 +43,20 @@ Organizations: # encoded in the genesis block in the Application section context - Host: peer0.org3.example.com Port: 11051 +<<<<<<< HEAD +======= + + Policies: + Readers: + Type: Signature + Rule: "OR('Org3MSP.admin', 'Org3MSP.peer', 'Org3MSP.client')" + Writers: + Type: Signature + Rule: "OR('Org3MSP.admin', 'Org3MSP.client')" + Admins: + Type: Signature + Rule: "OR('Org3MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org3MSP.peer')" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 diff --git a/first-network/scripts/script.sh b/first-network/scripts/script.sh index 04bdea5f..e6f6e245 100755 --- a/first-network/scripts/script.sh +++ b/first-network/scripts/script.sh @@ -11,28 +11,40 @@ echo "Build your first network (BYFN) end-to-end test" echo CHANNEL_NAME="$1" DELAY="$2" -LANGUAGE="$3" +CC_SRC_LANGUAGE="$3" TIMEOUT="$4" VERBOSE="$5" NO_CHAINCODE="$6" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="3"} -: ${LANGUAGE:="golang"} +: ${CC_SRC_LANGUAGE:="go"} : ${TIMEOUT:="10"} : ${VERBOSE:="false"} : ${NO_CHAINCODE:="false"} +<<<<<<< HEAD LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` +======= +CC_SRC_LANGUAGE=`echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]` +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 COUNTER=1 -MAX_RETRY=10 +MAX_RETRY=20 +PACKAGE_ID="" -CC_SRC_PATH="github.com/chaincode/chaincode_example02/go/" -if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/chaincode/chaincode_example02/node/" +if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then + CC_RUNTIME_LANGUAGE=golang + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" +elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then + CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/javascript/" +elif [ "$CC_SRC_LANGUAGE" = "java" ]; then + CC_RUNTIME_LANGUAGE=java + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +else + echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script + echo Supported chaincode languages are: go, javascript, java + exit 1 fi -if [ "$LANGUAGE" = "java" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/chaincode/chaincode_example02/java/" -fi echo "Channel name : "$CHANNEL_NAME @@ -86,15 +98,52 @@ updateAnchorPeers 0 2 if [ "${NO_CHAINCODE}" != "true" ]; then +<<<<<<< HEAD +======= + ## at first we package the chaincode + packageChaincode 1 0 1 + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 ## Install chaincode on peer0.org1 and peer0.org2 echo "Installing chaincode on peer0.org1..." installChaincode 0 1 echo "Install chaincode on peer0.org2..." installChaincode 0 2 +<<<<<<< HEAD # Instantiate chaincode on peer0.org2 echo "Instantiating chaincode on peer0.org2..." instantiateChaincode 0 2 +======= + ## query whether the chaincode is installed + queryInstalled 0 1 + + ## approve the definition for org1 + approveForMyOrg 1 0 1 + + ## check whether the chaincode definition is ready to be committed + ## expect org1 to have approved and org2 not to + checkCommitReadiness 1 0 1 "\"Org1MSP\": true" "\"Org2MSP\": false" + checkCommitReadiness 1 0 2 "\"Org1MSP\": true" "\"Org2MSP\": false" + + ## now approve also for org2 + approveForMyOrg 1 0 2 + + ## check whether the chaincode definition is ready to be committed + ## expect them both to have approved + checkCommitReadiness 1 0 1 "\"Org1MSP\": true" "\"Org2MSP\": true" + checkCommitReadiness 1 0 2 "\"Org1MSP\": true" "\"Org2MSP\": true" + + ## now that we know for sure both orgs have approved, commit the definition + commitChaincodeDefinition 1 0 1 0 2 + + ## query on both orgs to see that the definition committed successfully + queryCommitted 1 0 1 + queryCommitted 1 0 2 + + # invoke init + chaincodeInvoke 1 0 1 0 2 +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # Query chaincode on peer0.org1 echo "Querying chaincode on peer0.org1..." @@ -102,8 +151,17 @@ if [ "${NO_CHAINCODE}" != "true" ]; then # Invoke chaincode on peer0.org1 and peer0.org2 echo "Sending invoke transaction on peer0.org1 peer0.org2..." +<<<<<<< HEAD chaincodeInvoke 0 1 0 2 +======= + chaincodeInvoke 0 0 1 0 2 + + # Query chaincode on peer0.org1 + echo "Querying chaincode on peer0.org1..." + chaincodeQuery 0 1 90 + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 ## Install chaincode on peer1.org2 echo "Installing chaincode on peer1.org2..." installChaincode 1 2 @@ -111,7 +169,11 @@ if [ "${NO_CHAINCODE}" != "true" ]; then # Query on chaincode on peer1.org2, check if the result is 90 echo "Querying chaincode on peer1.org2..." chaincodeQuery 1 2 90 +<<<<<<< HEAD +======= + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 fi echo diff --git a/first-network/scripts/step1org3.sh b/first-network/scripts/step1org3.sh index bff4d6a0..4329860c 100755 --- a/first-network/scripts/step1org3.sh +++ b/first-network/scripts/step1org3.sh @@ -13,21 +13,31 @@ CHANNEL_NAME="$1" DELAY="$2" -LANGUAGE="$3" +CC_SRC_LANGUAGE="$3" TIMEOUT="$4" VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="3"} -: ${LANGUAGE:="golang"} +: ${CC_SRC_LANGUAGE:="go"} : ${TIMEOUT:="10"} : ${VERBOSE:="false"} -LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` +CC_SRC_LANGUAGE=`echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 -CC_SRC_PATH="github.com/chaincode/chaincode_example02/go/" -if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/chaincode/chaincode_example02/node/" +if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then + CC_RUNTIME_LANGUAGE=golang + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" +elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then + CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/javascript/" +elif [ "$CC_SRC_LANGUAGE" = "java" ]; then + CC_RUNTIME_LANGUAGE=java + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +else + echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script + echo Supported chaincode languages are: go, javascript, java + exit 1 fi # import utils @@ -37,9 +47,6 @@ echo echo "========= Creating config transaction to add org3 to network =========== " echo -echo "Installing jq" -apt-get -y update && apt-get -y install jq - # Fetch the config for the channel, writing it to config.json fetchChannelConfig ${CHANNEL_NAME} config.json diff --git a/first-network/scripts/step2org3.sh b/first-network/scripts/step2org3.sh index 75745ef9..fec4dcc4 100755 --- a/first-network/scripts/step2org3.sh +++ b/first-network/scripts/step2org3.sh @@ -16,21 +16,32 @@ echo "========= Getting Org3 on to your first network ========= " echo CHANNEL_NAME="$1" DELAY="$2" -LANGUAGE="$3" +CC_SRC_LANGUAGE="$3" TIMEOUT="$4" VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="3"} -: ${LANGUAGE:="golang"} +: ${CC_SRC_LANGUAGE:="go"} : ${TIMEOUT:="10"} : ${VERBOSE:="false"} -LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` +CC_SRC_LANGUAGE=`echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 +PACKAGE_ID="" -CC_SRC_PATH="github.com/chaincode/chaincode_example02/go/" -if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/chaincode/chaincode_example02/node/" +if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then + CC_RUNTIME_LANGUAGE=golang + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" +elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then + CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/javascript/" +elif [ "$CC_SRC_LANGUAGE" = "java" ]; then + CC_RUNTIME_LANGUAGE=java + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +else + echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script + echo Supported chaincode languages are: go, javascript, java + exit 1 fi # import utils @@ -48,11 +59,28 @@ joinChannelWithRetry 0 3 echo "===================== peer0.org3 joined channel '$CHANNEL_NAME' ===================== " joinChannelWithRetry 1 3 echo "===================== peer1.org3 joined channel '$CHANNEL_NAME' ===================== " -echo "Installing chaincode 2.0 on peer0.org3..." -installChaincode 0 3 2.0 + +## at first we package the chaincode +packageChaincode 1 0 3 + +echo "Installing chaincode on peer0.org3..." +installChaincode 0 3 + +## query whether the chaincode is installed +queryInstalled 0 3 + +## sanity check: expect the chaincode to be already committed +queryCommitted 1 0 3 + +## approve it for our org, so that our peers know what package to invoke +approveForMyOrg 1 0 3 + +# Query on chaincode on peer0.org3, check if the result is 90 +echo "Querying chaincode on peer0.org3..." +chaincodeQuery 0 3 90 echo -echo "========= Org3 is now halfway onto your first network ========= " +echo "========= Finished adding Org3 to your first network! ========= " echo exit 0 diff --git a/first-network/scripts/step3org3.sh b/first-network/scripts/step3org3.sh deleted file mode 100755 index 9588a8b8..00000000 --- a/first-network/scripts/step3org3.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -# This script is designed to be run in the cli container as the third -# step of the EYFN tutorial. It installs the chaincode as version 2.0 -# on peer0.org1 and peer0.org2, and uprage the chaincode on the -# channel to version 2.0, thus completing the addition of org3 to the -# network previously setup in the BYFN tutorial. -# - -echo -echo "========= Finish adding Org3 to your first network ========= " -echo -CHANNEL_NAME="$1" -DELAY="$2" -LANGUAGE="$3" -TIMEOUT="$4" -VERBOSE="$5" -: ${CHANNEL_NAME:="mychannel"} -: ${DELAY:="3"} -: ${LANGUAGE:="golang"} -: ${TIMEOUT:="10"} -: ${VERBOSE:="false"} -LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` -COUNTER=1 -MAX_RETRY=5 - -CC_SRC_PATH="github.com/chaincode/chaincode_example02/go/" -if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/chaincode/chaincode_example02/node/" -fi - -# import utils -. scripts/utils.sh - -echo "===================== Installing chaincode 2.0 on peer0.org1 ===================== " -installChaincode 0 1 2.0 -echo "===================== Installing chaincode 2.0 on peer0.org2 ===================== " -installChaincode 0 2 2.0 - -echo "===================== Upgrading chaincode on peer0.org1 ===================== " -upgradeChaincode 0 1 - -echo -echo "========= Finished adding Org3 to your first network! ========= " -echo - -exit 0 diff --git a/first-network/scripts/testorg3.sh b/first-network/scripts/testorg3.sh index 6d1930cd..04e23114 100755 --- a/first-network/scripts/testorg3.sh +++ b/first-network/scripts/testorg3.sh @@ -22,20 +22,30 @@ echo "Extend your first network (EYFN) test" echo CHANNEL_NAME="$1" DELAY="$2" -LANGUAGE="$3" +CC_SRC_LANGUAGE="$3" TIMEOUT="$4" VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${TIMEOUT:="10"} -: ${LANGUAGE:="golang"} +: ${CC_SRC_LANGUAGE:="go"} : ${VERBOSE:="false"} -LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` +CC_SRC_LANGUAGE=`echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 -CC_SRC_PATH="github.com/chaincode/chaincode_example02/go/" -if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/chaincode/chaincode_example02/node/" +if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then + CC_RUNTIME_LANGUAGE=golang + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" +elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then + CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/javascript/" +elif [ "$CC_SRC_LANGUAGE" = "java" ]; then + CC_RUNTIME_LANGUAGE=java + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +else + echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script + echo Supported chaincode languages are: go, javascript, java + exit 1 fi echo "Channel name : "$CHANNEL_NAME @@ -47,9 +57,9 @@ echo "Channel name : "$CHANNEL_NAME echo "Querying chaincode on peer0.org3..." chaincodeQuery 0 3 90 -# Invoke chaincode on peer0.org1, peer0.org2, and peer0.org3 -echo "Sending invoke transaction on peer0.org1 peer0.org2 peer0.org3..." -chaincodeInvoke 0 1 0 2 0 3 +# Invoke chaincode on peer0.org1 and peer0.org3 +echo "Sending invoke transaction on peer0.org1 peer0.org3..." +chaincodeInvoke 0 0 1 0 3 # Query on chaincode on peer0.org3, peer0.org2, peer0.org1 check if the result is 80 # We query a peer in each organization, to ensure peers from all organizations are in sync diff --git a/first-network/scripts/upgrade_to_v14.sh b/first-network/scripts/upgrade_to_v14.sh index 3b0f7b12..607cc701 100755 --- a/first-network/scripts/upgrade_to_v14.sh +++ b/first-network/scripts/upgrade_to_v14.sh @@ -11,22 +11,32 @@ echo "Upgrade your first network (BYFN) from v1.3.x to v1.4.x end-to-end test" echo CHANNEL_NAME="$1" DELAY="$2" -LANGUAGE="$3" +CC_SRC_LANGUAGE="$3" TIMEOUT="$4" VERBOSE="$5" : ${CHANNEL_NAME:="mychannel"} : ${DELAY:="5"} -: ${LANGUAGE:="golang"} +: ${CC_SRC_LANGUAGE:="go"} : ${TIMEOUT:="10"} : ${VERBOSE:="false"} -LANGUAGE=$(echo "$LANGUAGE" | tr [:upper:] [:lower:]) +CC_SRC_LANGUAGE=$(echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]) COUNTER=1 MAX_RETRY=5 SYS_CHANNEL=$SYS_CHANNEL -CC_SRC_PATH="github.com/chaincode/chaincode_example02/go/" -if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/chaincode/chaincode_example02/node/" +if [ "$CC_SRC_LANGUAGE" = "go" -o "$CC_SRC_LANGUAGE" = "golang" ]; then + CC_RUNTIME_LANGUAGE=golang + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" +elif [ "$CC_SRC_LANGUAGE" = "javascript" ]; then + CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/javascript/" +elif [ "$CC_SRC_LANGUAGE" = "java" ]; then + CC_RUNTIME_LANGUAGE=java + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +else + echo The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script + echo Supported chaincode languages are: go, javascript, java + exit 1 fi echo "System channel name : "$SYS_CHANNEL diff --git a/first-network/scripts/utils.sh b/first-network/scripts/utils.sh index a6c53323..88070118 100755 --- a/first-network/scripts/utils.sh +++ b/first-network/scripts/utils.sh @@ -113,13 +113,29 @@ joinChannelWithRetry() { verifyResult $res "After $MAX_RETRY attempts, peer${PEER}.org${ORG} has failed to join channel '$CHANNEL_NAME' " } +# packageChaincode VERSION PEER ORG +packageChaincode() { + VERSION=$1 + PEER=$2 + ORG=$3 + setGlobals $PEER $ORG + set -x + peer lifecycle chaincode package mycc.tar.gz --path ${CC_SRC_PATH} --lang ${CC_RUNTIME_LANGUAGE} --label mycc_${VERSION} >&log.txt + res=$? + set +x + cat log.txt + verifyResult $res "Chaincode packaging on peer${PEER}.org${ORG} has failed" + echo "===================== Chaincode is packaged on peer${PEER}.org${ORG} ===================== " + echo +} + +# installChaincode PEER ORG installChaincode() { PEER=$1 ORG=$2 setGlobals $PEER $ORG - VERSION=${3:-1.0} set -x - peer chaincode install -n mycc -v ${VERSION} -l ${LANGUAGE} -p ${CC_SRC_PATH} >&log.txt + peer lifecycle chaincode install mycc.tar.gz >&log.txt res=$? set +x cat log.txt @@ -128,45 +144,149 @@ installChaincode() { echo } -instantiateChaincode() { +# queryInstalled PEER ORG +queryInstalled() { PEER=$1 ORG=$2 setGlobals $PEER $ORG - VERSION=${3:-1.0} + set -x + peer lifecycle chaincode queryinstalled >&log.txt + res=$? + set +x + cat log.txt + PACKAGE_ID=`sed -n '/Package/{s/^Package ID: //; s/, Label:.*$//; p;}' log.txt` + verifyResult $res "Query installed on peer${PEER}.org${ORG} has failed" + echo PackageID is ${PACKAGE_ID} + echo "===================== Query installed successful on peer${PEER}.org${ORG} on channel ===================== " + echo +} + +# approveForMyOrg VERSION PEER ORG +approveForMyOrg() { + VERSION=$1 + PEER=$2 + ORG=$3 + setGlobals $PEER $ORG - # while 'peer chaincode' command can get the orderer endpoint from the peer - # (if join was successful), let's supply it directly as we know it using - # the "-o" option if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then set -x - peer chaincode instantiate -o orderer.example.com:7050 -C $CHANNEL_NAME -n mycc -l ${LANGUAGE} -v ${VERSION} -c '{"Args":["init","a","100","b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')" >&log.txt + peer lifecycle chaincode approveformyorg --channelID $CHANNEL_NAME --name mycc --version ${VERSION} --init-required --package-id ${PACKAGE_ID} --sequence ${VERSION} --waitForEvent >&log.txt + set +x + else + set -x + peer lifecycle chaincode approveformyorg --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA --channelID $CHANNEL_NAME --name mycc --version ${VERSION} --init-required --package-id ${PACKAGE_ID} --sequence ${VERSION} --waitForEvent >&log.txt + set +x + fi + cat log.txt + verifyResult $res "Chaincode definition approved on peer${PEER}.org${ORG} on channel '$CHANNEL_NAME' failed" + echo "===================== Chaincode definition approved on peer${PEER}.org${ORG} on channel '$CHANNEL_NAME' ===================== " + echo +} + +# commitChaincodeDefinition VERSION PEER ORG (PEER ORG)... +commitChaincodeDefinition() { + VERSION=$1 + shift + parsePeerConnectionParameters $@ + res=$? + verifyResult $res "Invoke transaction failed on channel '$CHANNEL_NAME' due to uneven number of peer and org parameters " + + # while 'peer chaincode' command can get the orderer endpoint from the + # peer (if join was successful), let's supply it directly as we know + # it using the "-o" option + if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then + set -x + peer lifecycle chaincode commit -o orderer.example.com:7050 --channelID $CHANNEL_NAME --name mycc $PEER_CONN_PARMS --version ${VERSION} --sequence ${VERSION} --init-required >&log.txt res=$? set +x else set -x - peer chaincode instantiate -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -l ${LANGUAGE} -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')" >&log.txt + peer lifecycle chaincode commit -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA --channelID $CHANNEL_NAME --name mycc $PEER_CONN_PARMS --version ${VERSION} --sequence ${VERSION} --init-required >&log.txt res=$? set +x fi cat log.txt - verifyResult $res "Chaincode instantiation on peer${PEER}.org${ORG} on channel '$CHANNEL_NAME' failed" - echo "===================== Chaincode is instantiated on peer${PEER}.org${ORG} on channel '$CHANNEL_NAME' ===================== " + verifyResult $res "Chaincode definition commit failed on peer${PEER}.org${ORG} on channel '$CHANNEL_NAME' failed" + echo "===================== Chaincode definition committed on channel '$CHANNEL_NAME' ===================== " echo } -upgradeChaincode() { - PEER=$1 - ORG=$2 +# checkCommitReadiness VERSION PEER ORG +checkCommitReadiness() { + VERSION=$1 + PEER=$2 + ORG=$3 + shift 3 setGlobals $PEER $ORG + echo "===================== Checking the commit readiness of the chaincode definition on peer${PEER}.org${ORG} on channel '$CHANNEL_NAME'... ===================== " + local rc=1 + local starttime=$(date +%s) - set -x - peer chaincode upgrade -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -v 2.0 -c '{"Args":["init","a","90","b","210"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer','Org3MSP.peer')" - res=$? - set +x - cat log.txt - verifyResult $res "Chaincode upgrade on peer${PEER}.org${ORG} has failed" - echo "===================== Chaincode is upgraded on peer${PEER}.org${ORG} on channel '$CHANNEL_NAME' ===================== " + # continue to poll + # we either get a successful response, or reach TIMEOUT + while + test "$(($(date +%s) - starttime))" -lt "$TIMEOUT" -a $rc -ne 0 + do + sleep $DELAY + echo "Attempting to check the commit readiness of the chaincode definition on peer${PEER}.org${ORG} ...$(($(date +%s) - starttime)) secs" + set -x + peer lifecycle chaincode checkcommitreadiness --channelID $CHANNEL_NAME --name mycc $PEER_CONN_PARMS --version ${VERSION} --sequence ${VERSION} --output json --init-required >&log.txt + res=$? + set +x + test $res -eq 0 || continue + let rc=0 + for var in "$@" + do + grep "$var" log.txt &>/dev/null || let rc=1 + done + done echo + cat log.txt + if test $rc -eq 0; then + echo "===================== Checking the commit readiness of the chaincode definition successful on peer${PEER}.org${ORG} on channel '$CHANNEL_NAME' ===================== " + else + echo "!!!!!!!!!!!!!!! Check commit readiness result on peer${PEER}.org${ORG} is INVALID !!!!!!!!!!!!!!!!" + echo "================== ERROR !!! FAILED to execute End-2-End Scenario ==================" + echo + exit 1 + fi +} + +# queryCommitted VERSION PEER ORG +queryCommitted() { + VERSION=$1 + PEER=$2 + ORG=$3 + setGlobals $PEER $ORG + EXPECTED_RESULT="Version: ${VERSION}, Sequence: ${VERSION}, Endorsement Plugin: escc, Validation Plugin: vscc" + echo "===================== Querying chaincode definition on peer${PEER}.org${ORG} on channel '$CHANNEL_NAME'... ===================== " + local rc=1 + local starttime=$(date +%s) + + # continue to poll + # we either get a successful response, or reach TIMEOUT + while + test "$(($(date +%s) - starttime))" -lt "$TIMEOUT" -a $rc -ne 0 + do + sleep $DELAY + echo "Attempting to Query committed status on peer${PEER}.org${ORG} ...$(($(date +%s) - starttime)) secs" + set -x + peer lifecycle chaincode querycommitted --channelID $CHANNEL_NAME --name mycc >&log.txt + res=$? + set +x + test $res -eq 0 && VALUE=$(cat log.txt | grep -o '^Version: [0-9], Sequence: [0-9], Endorsement Plugin: escc, Validation Plugin: vscc') + test "$VALUE" = "$EXPECTED_RESULT" && let rc=0 + done + echo + cat log.txt + if test $rc -eq 0; then + echo "===================== Query chaincode definition successful on peer${PEER}.org${ORG} on channel '$CHANNEL_NAME' ===================== " + else + echo "!!!!!!!!!!!!!!! Query chaincode definition result on peer${PEER}.org${ORG} is INVALID !!!!!!!!!!!!!!!!" + echo "================== ERROR !!! FAILED to execute End-2-End Scenario ==================" + echo + exit 1 + fi } chaincodeQuery() { @@ -293,24 +413,34 @@ parsePeerConnectionParameters() { PEERS="$(echo -e "$PEERS" | sed -e 's/^[[:space:]]*//')" } -# chaincodeInvoke ... +# chaincodeInvoke IS_INIT PEER ORG (PEER ORG) ... # Accepts as many peer/org pairs as desired and requests endorsement from each chaincodeInvoke() { + IS_INIT=$1 + shift parsePeerConnectionParameters $@ res=$? verifyResult $res "Invoke transaction failed on channel '$CHANNEL_NAME' due to uneven number of peer and org parameters " + if [ "${IS_INIT}" -eq "1" ]; then + CCARGS='{"Args":["Init","a","100","b","100"]}' + INIT_ARG="--isInit" + else + CCARGS='{"Args":["invoke","a","b","10"]}' + INIT_ARG="" + fi + # while 'peer chaincode' command can get the orderer endpoint from the # peer (if join was successful), let's supply it directly as we know # it using the "-o" option if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then set -x - peer chaincode invoke -o orderer.example.com:7050 -C $CHANNEL_NAME -n mycc $PEER_CONN_PARMS -c '{"Args":["invoke","a","b","10"]}' >&log.txt + peer chaincode invoke -o orderer.example.com:7050 -C $CHANNEL_NAME -n mycc $PEER_CONN_PARMS ${INIT_ARG} -c ${CCARGS} >&log.txt res=$? set +x else set -x - peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc $PEER_CONN_PARMS -c '{"Args":["invoke","a","b","10"]}' >&log.txt + peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc $PEER_CONN_PARMS ${INIT_ARG} -c ${CCARGS} >&log.txt res=$? set +x fi diff --git a/high-throughput/README.md b/high-throughput/README.md index a899792f..7eea4f07 100644 --- a/high-throughput/README.md +++ b/high-throughput/README.md @@ -104,31 +104,36 @@ and run some invocations are provided below. * In the `volumes` section of the `cli` container, edit the second line which refers to the chaincode folder to point to the chaincode folder within the `high-throughput` folder, e.g. - `./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go` --> - `./../high-throughput/chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go` + `./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode` --> + `./../high-throughput/chaincode/:/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode` * Again in the `volumes` section, edit the fourth line which refers to the scripts folder so it points to the scripts folder within the `high-throughput` folder, e.g. - `./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/` --> + `./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/` --> `./../high-throughput/scripts/:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/` * Finally, comment out the `docker exec cli scripts/script.sh` command from the `byfn.sh` script by placing a `#` before it so that the standard BYFN end to end script doesn't run, e.g. - `# docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $LANGUAGE $CLI_TIMEOUT $VERBOSE` + `# docker exec cli scripts/script.sh $CHANNEL_NAME $CLI_DELAY $CC_SRC_LANGUAGE $CLI_TIMEOUT $VERBOSE` -3. We can now bring our network up by typing in `./byfn.sh -m up -c mychannel` +3. We can now bring our network up by typing in `./byfn.sh up -c mychannel` 4. Open a new terminal window and enter the CLI container using `docker exec -it cli bash`, all operations on the network will happen within this container from now on. -### Install and instantiate the chaincode +### Vendor the chaincode dependencies +1. Outside of the CLI container, change into the chaincode directory, e.g. `cd ~/fabric-samples/high-throughput/chaincode` +2. Vendor the Go dependencies by running the following command: `GO111MODULE=on go mod vendor` +3. The chaincode directory will now contain a `vendor` directory. + +### Install and define the chaincode 1. Once you're in the CLI container run `cd scripts` to enter the `scripts` folder 2. Set-up the environment variables by running `source setclienv.sh` 3. Set-up your channels and anchor peers by running `./channel-setup.sh` -4. Install your chaincode by running `./install-chaincode.sh 1.0`. The only argument is a number representing the chaincode version, every time - you want to install and upgrade to a new chaincode version simply increment this value by 1 when running the command, e.g. `./install-chaincode.sh 2.0` -5. Instantiate your chaincode by running `./instantiate-chaincode.sh 1.0`. The version argument serves the same purpose as in `./install-chaincode.sh 1.0` - and should match the version of the chaincode you just installed. In the future, when upgrading the chaincode to a newer version, - `./upgrade-chaincode.sh 2.0` should be used instead of `./instantiate-chaincode.sh 1.0`. +4. Package and install your chaincode by running `./install-chaincode.sh 1`. The only argument is a number representing the chaincode version, every time + you want to install and upgrade to a new chaincode version simply increment this value by 1 when running the command, e.g. `./install-chaincode.sh 2` +5. Define your chaincode on the channel by running `./approve-commit-chaincode.sh 1`. The version argument serves the same purpose as in `./install-chaincode.sh 1` + and should match the version of the chaincode you just installed. This script also invokes the chaincode `Init` function to start the chaincode container. + You can also upgrade the chaincode to a newer version by running `./approve-commit-chaincode.sh 2`. 6. Your chaincode is now installed and ready to receive invocations ### Invoke the chaincode @@ -153,13 +158,11 @@ Example: `./delete-invoke.sh myvar` #### Prune Pruning takes all the deltas generated for a variable and combines them all into a single row, deleting all previous rows. This helps cleanup -the ledger when many updates have been performed. There are two types of pruning: `prunefast` and `prunesafe`. Prune fast performs the deletion -and aggregation simultaneously, so if an error happens along the way data integrity is not guaranteed. Prune safe performs the aggregation first, -backs up the results, then performs the deletion. This way, if an error occurs along the way, data integrity is maintained. +the ledger when many updates have been performed. -The format for pruning is: `./[prunesafe|prunefast]-invoke.sh name` where `name` is the name of the variable to prune. +The format for pruning is: `./prune-invoke.sh name` where `name` is the name of the variable to prune. -Example: `./prunefast-invoke.sh myvar` or `./prunesafe-invoke.sh myvar` +Example: `./prune-invoke.sh myvar` ### Test the Network Two scripts are provided to show the advantage of using this system when running many parallel transactions at once: `many-updates.sh` and @@ -172,8 +175,9 @@ row in the ledger 1000 times, with a value incrementing by one each time (i.e. t expectation would be that the final value of the row is 999. However, the final value changes each time this script is run and you'll find errors in the peer and orderer logs. -There is one other script, `get-traditional.sh`, which simply gets the value of a row in the traditional way, with no deltas. +There are two other scripts, `get-traditional.sh`, which simply gets the value of a row in the traditional way, with no deltas, and `del-traditional.sh` will delete an asset in the traditional way. Examples: -`./many-updates.sh testvar 100 +` --> final value from `./get-invoke.sh` should be 100000 +`./many-updates.sh testvar 100 +` --> final value from `./get-invoke.sh testvar` should be 100000 + `./many-updates-traditional.sh testvar` --> final value from `./get-traditional.sh testvar` is undefined diff --git a/high-throughput/chaincode/go.mod b/high-throughput/chaincode/go.mod new file mode 100644 index 00000000..1eceb00b --- /dev/null +++ b/high-throughput/chaincode/go.mod @@ -0,0 +1,12 @@ +module github.com/hyperledger/fabric-samples/high-throughput/chaincode + +go 1.12 + +require ( + github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 + github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 + golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect + golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect + golang.org/x/text v0.3.2 // indirect + google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect +) diff --git a/high-throughput/chaincode/go.sum b/high-throughput/chaincode/go.sum new file mode 100644 index 00000000..748afa1a --- /dev/null +++ b/high-throughput/chaincode/go.sum @@ -0,0 +1,86 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 h1:VEm3tPRTCzq3J/1XpVERh1PbOSnshUVwx2G5s3cLiTw= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85/go.mod h1:HZK6PKLWrvdD/t0oSLiyaRaUM6fZ7qjJuOlb0zrn0mo= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 h1:WzttYAPO5xkQ87ZrxzEhvDZknfarSNu1PZt3NPMTE3Y= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542 h1:6ZQFf1D2YYDDI7eSwW8adlkkavTB9sw5I24FVtEvNUQ= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/high-throughput/chaincode/high-throughput.go b/high-throughput/chaincode/high-throughput.go index 252c9805..cee451a7 100644 --- a/high-throughput/chaincode/high-throughput.go +++ b/high-throughput/chaincode/high-throughput.go @@ -29,8 +29,8 @@ import ( "fmt" "strconv" - "github.com/hyperledger/fabric/core/chaincode/shim" - sc "github.com/hyperledger/fabric/protos/peer" + "github.com/hyperledger/fabric-chaincode-go/shim" + pb "github.com/hyperledger/fabric-protos-go/peer" ) //SmartContract is the data structure which represents this contract and on which various contract lifecycle functions are attached @@ -44,7 +44,7 @@ const ( ) // Init is called when the smart contract is instantiated -func (s *SmartContract) Init(APIstub shim.ChaincodeStubInterface) sc.Response { +func (s *SmartContract) Init(APIstub shim.ChaincodeStubInterface) pb.Response { return shim.Success(nil) } @@ -52,10 +52,9 @@ func (s *SmartContract) Init(APIstub shim.ChaincodeStubInterface) sc.Response { // Current supported invocations are: // - update, adds a delta to an aggregate variable in the ledger, all variables are assumed to start at 0 // - get, retrieves the aggregate value of a variable in the ledger -// - pruneFast, deletes all rows associated with the variable and replaces them with a single row containing the aggregate value -// - pruneSafe, same as pruneFast except it pre-computed the value and backs it up before performing any destructive operations +// - prune, deletes all rows associated with the variable and replaces them with a single row containing the aggregate value // - delete, removes all rows associated with the variable -func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response { +func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) pb.Response { // Retrieve the requested Smart Contract function and arguments function, args := APIstub.GetFunctionAndParameters() @@ -64,16 +63,16 @@ func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response return s.update(APIstub, args) } else if function == "get" { return s.get(APIstub, args) - } else if function == "prunefast" { - return s.pruneFast(APIstub, args) - } else if function == "prunesafe" { - return s.pruneSafe(APIstub, args) + } else if function == "prune" { + return s.prune(APIstub, args) } else if function == "delete" { return s.delete(APIstub, args) } else if function == "putstandard" { return s.putStandard(APIstub, args) } else if function == "getstandard" { return s.getStandard(APIstub, args) + } else if function == "delstandard" { + return s.delStandard(APIstub, args) } return shim.Error("Invalid Smart Contract function name.") @@ -92,7 +91,7 @@ func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response * * @return A response structure indicating success or failure with a message */ -func (s *SmartContract) update(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { +func (s *SmartContract) update(APIstub shim.ChaincodeStubInterface, args []string) pb.Response { // Check we have a valid number of args if len(args) != 3 { return shim.Error("Incorrect number of arguments, expecting 3") @@ -141,7 +140,7 @@ func (s *SmartContract) update(APIstub shim.ChaincodeStubInterface, args []strin * * @return A response structure indicating success or failure with a message */ -func (s *SmartContract) get(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { +func (s *SmartContract) get(APIstub shim.ChaincodeStubInterface, args []string) pb.Response { // Check we have a valid number of args if len(args) != 1 { return shim.Error("Incorrect number of arguments, expecting 1") @@ -202,17 +201,15 @@ func (s *SmartContract) get(APIstub shim.ChaincodeStubInterface, args []string) /** * Prunes a variable by deleting all of its delta rows while computing the final value. Once all rows * have been processed and deleted, a single new row is added which defines a delta containing the final - * computed value of the variable. This function is NOT safe as any failures or errors during pruning - * will result in an undefined final value for the variable and loss of data. Use pruneSafe if data - * integrity is important. The args array contains the following argument: + * computed value of the variable. The args array contains the following argument: * - args[0] -> The name of the variable to prune * * @param APIstub The chaincode shim - * @param args The args array for the pruneFast invocation + * @param args The args array for the prune invocation * * @return A response structure indicating success or failure with a message */ -func (s *SmartContract) pruneFast(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { +func (s *SmartContract) prune(APIstub shim.ChaincodeStubInterface, args []string) pb.Response { // Check we have a valid number of ars if len(args) != 1 { return shim.Error("Incorrect number of arguments, expecting 1") @@ -276,88 +273,13 @@ func (s *SmartContract) pruneFast(APIstub shim.ChaincodeStubInterface, args []st } } - // Update the ledger with the final value and return + // Update the ledger with the final value updateResp := s.update(APIstub, []string{name, strconv.FormatFloat(finalVal, 'f', -1, 64), "+"}) - if updateResp.Status == OK { - return shim.Success([]byte(fmt.Sprintf("Successfully pruned variable %s, final value is %f, %d rows pruned", args[0], finalVal, i))) - } - - return shim.Error(fmt.Sprintf("Failed to prune variable: all rows deleted but could not update value to %f, variable no longer exists in ledger", finalVal)) -} - -/** - * This function performs the same function as pruneFast except it provides data backups in case the - * prune fails. The final aggregate value is computed before any deletion occurs and is backed up - * to a new row. This back-up row is deleted only after the new aggregate delta has been successfully - * written to the ledger. The args array contains the following argument: - * args[0] -> The name of the variable to prune - * - * @param APIstub The chaincode shim - * @param args The arguments array for the pruneSafe invocation - * - * @result A response structure indicating success or failure with a message - */ -func (s *SmartContract) pruneSafe(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { - // Verify there are a correct number of arguments - if len(args) != 1 { - return shim.Error("Incorrect number of arguments, expecting 1 (the name of the variable to prune)") - } - - // Get the var name - name := args[0] - - // Get the var's value and process it - getResp := s.get(APIstub, args) - if getResp.Status == ERROR { - return shim.Error(fmt.Sprintf("Could not retrieve the value of %s before pruning, pruning aborted: %s", name, getResp.Message)) - } - - valueStr := string(getResp.Payload) - val, convErr := strconv.ParseFloat(valueStr, 64) - if convErr != nil { - return shim.Error(fmt.Sprintf("Could not convert the value of %s to a number before pruning, pruning aborted: %s", name, convErr.Error())) - } - - // Store the var's value temporarily - backupPutErr := APIstub.PutState(fmt.Sprintf("%s_PRUNE_BACKUP", name), []byte(valueStr)) - if backupPutErr != nil { - return shim.Error(fmt.Sprintf("Could not backup the value of %s before pruning, pruning aborted: %s", name, backupPutErr.Error())) - } - - // Get all deltas for the variable - deltaResultsIterator, deltaErr := APIstub.GetStateByPartialCompositeKey("varName~op~value~txID", []string{name}) - if deltaErr != nil { - return shim.Error(fmt.Sprintf("Could not retrieve value for %s: %s", name, deltaErr.Error())) - } - defer deltaResultsIterator.Close() - - // Delete each row - var i int - for i = 0; deltaResultsIterator.HasNext(); i++ { - responseRange, nextErr := deltaResultsIterator.Next() - if nextErr != nil { - return shim.Error(fmt.Sprintf("Could not retrieve next row for pruning: %s", nextErr.Error())) - } - - deltaRowDelErr := APIstub.DelState(responseRange.Key) - if deltaRowDelErr != nil { - return shim.Error(fmt.Sprintf("Could not delete delta row: %s", deltaRowDelErr.Error())) - } - } - - // Insert new row for the final value - updateResp := s.update(APIstub, []string{name, valueStr, "+"}) if updateResp.Status == ERROR { - return shim.Error(fmt.Sprintf("Could not insert the final value of the variable after pruning, variable backup is stored in %s_PRUNE_BACKUP: %s", name, updateResp.Message)) + return shim.Error(fmt.Sprintf("Could not update the final value of the variable after pruning: %s", updateResp.Message)) } - // Delete the backup value - delErr := APIstub.DelState(fmt.Sprintf("%s_PRUNE_BACKUP", name)) - if delErr != nil { - return shim.Error(fmt.Sprintf("Could not delete backup value %s_PRUNE_BACKUP, this does not affect the ledger but should be removed manually", name)) - } - - return shim.Success([]byte(fmt.Sprintf("Successfully pruned variable %s, final value is %f, %d rows pruned", name, val, i))) + return shim.Success([]byte(fmt.Sprintf("Successfully pruned variable %s, final value is %f, %d rows pruned", args[0], finalVal, i))) } /** @@ -370,7 +292,7 @@ func (s *SmartContract) pruneSafe(APIstub shim.ChaincodeStubInterface, args []st * * @return A response structure indicating success or failure with a message */ -func (s *SmartContract) delete(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { +func (s *SmartContract) delete(APIstub shim.ChaincodeStubInterface, args []string) pb.Response { // Check there are a correct number of arguments if len(args) != 1 { return shim.Error("Incorrect number of arguments, expecting 1") @@ -434,13 +356,13 @@ func main() { /** * All functions below this are for testing traditional editing of a single row */ -func (s *SmartContract) putStandard(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { +func (s *SmartContract) putStandard(APIstub shim.ChaincodeStubInterface, args []string) pb.Response { name := args[0] valStr := args[1] _, getErr := APIstub.GetState(name) if getErr != nil { - return shim.Error(fmt.Sprintf("Failed to retrieve the statr of %s: %s", name, getErr.Error())) + return shim.Error(fmt.Sprintf("Failed to retrieve the state of %s: %s", name, getErr.Error())) } putErr := APIstub.PutState(name, []byte(valStr)) @@ -451,7 +373,7 @@ func (s *SmartContract) putStandard(APIstub shim.ChaincodeStubInterface, args [] return shim.Success(nil) } -func (s *SmartContract) getStandard(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { +func (s *SmartContract) getStandard(APIstub shim.ChaincodeStubInterface, args []string) pb.Response { name := args[0] val, getErr := APIstub.GetState(name) @@ -461,3 +383,14 @@ func (s *SmartContract) getStandard(APIstub shim.ChaincodeStubInterface, args [] return shim.Success(val) } + +func (s *SmartContract) delStandard(APIstub shim.ChaincodeStubInterface, args []string) pb.Response { + name := args[0] + + getErr := APIstub.DelState(name) + if getErr != nil { + return shim.Error(fmt.Sprintf("Failed to delete state: %s", getErr.Error())) + } + + return shim.Success(nil) +} diff --git a/high-throughput/scripts/approve-commit-chaincode.sh b/high-throughput/scripts/approve-commit-chaincode.sh new file mode 100755 index 00000000..08123582 --- /dev/null +++ b/high-throughput/scripts/approve-commit-chaincode.sh @@ -0,0 +1,43 @@ +# +# Copyright IBM Corp All Rights Reserved +# +# SPDX-License-Identifier: Apache-2.0 +# + + +echo "========== Query chaincode package ID ==========" +export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp +export CORE_PEER_ADDRESS=peer0.org1.example.com:7051 +export CORE_PEER_LOCALMSPID="Org1MSP" +export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt +peer lifecycle chaincode queryinstalled >&log.txt +export PACKAGE_ID=`sed -n '/Package/{s/^Package ID: //; s/, Label:.*$//; p;}' log.txt` + +echo "========== Approve definition for Org1 ==========" +export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp +export CORE_PEER_ADDRESS=peer0.org1.example.com:7051 +export CORE_PEER_LOCALMSPID="Org1MSP" +export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt +peer lifecycle chaincode install ${CC_NAME}.tar.gz + +peer lifecycle chaincode approveformyorg -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID $CHANNEL_NAME --signature-policy "OR('Org1MSP.peer', 'Org2MSP.peer')" --name $CC_NAME --version $1 --init-required --package-id ${PACKAGE_ID} --sequence $1 + +echo "========== Approve definition for Org2 ==========" +export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp +export CORE_PEER_ADDRESS=peer0.org2.example.com:9051 +export CORE_PEER_LOCALMSPID="Org2MSP" +export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt +peer lifecycle chaincode approveformyorg -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID $CHANNEL_NAME --signature-policy "OR('Org1MSP.peer', 'Org2MSP.peer')" --name $CC_NAME --version $1 --init-required --package-id ${PACKAGE_ID} --sequence $1 + +. query-status.sh + +queryStatus $1 0 1 "\"Org1MSP\": true" "\"Org2MSP\": true" +queryStatus $1 0 2 "\"Org1MSP\": true" "\"Org2MSP\": true" + + +echo "========== Commit the definition the $CHANNEL_NAME ==========" +peer lifecycle chaincode commit -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID $CHANNEL_NAME --signature-policy "OR('Org1MSP.peer', 'Org2MSP.peer')" --name $CC_NAME --version $1 --init-required --sequence $1 --waitForEvent --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt + + +echo "========== Invoke the Init function ==========" +peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n $CC_NAME --isInit -c '{"Args":["Init"]}' diff --git a/high-throughput/scripts/channel-setup.sh b/high-throughput/scripts/channel-setup.sh index 116b86a4..376f4685 100755 --- a/high-throughput/scripts/channel-setup.sh +++ b/high-throughput/scripts/channel-setup.sh @@ -43,4 +43,3 @@ export CORE_PEER_ADDRESS=peer1.org2.example.com:10051 export CORE_PEER_LOCALMSPID="Org2MSP" export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt peer channel join -b ${CHANNEL_NAME}.block - diff --git a/high-throughput/scripts/check-commit-readiness.sh b/high-throughput/scripts/check-commit-readiness.sh new file mode 100755 index 00000000..d65f5709 --- /dev/null +++ b/high-throughput/scripts/check-commit-readiness.sh @@ -0,0 +1,76 @@ +# +# Copyright IBM Corp All Rights Reserved +# +# SPDX-License-Identifier: Apache-2.0 +# + +setGlobals() { + PEER=$1 + ORG=$2 + if [ $ORG -eq 1 ]; then + CORE_PEER_LOCALMSPID="Org1MSP" + CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp + if [ $PEER -eq 0 ]; then + CORE_PEER_ADDRESS=peer0.org1.example.com:7051 + else + CORE_PEER_ADDRESS=peer1.org1.example.com:8051 + fi + elif [ $ORG -eq 2 ]; then + CORE_PEER_LOCALMSPID="Org2MSP" + CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt + CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp + if [ $PEER -eq 0 ]; then + CORE_PEER_ADDRESS=peer0.org2.example.com:9051 + else + CORE_PEER_ADDRESS=peer1.org2.example.com:10051 + fi + + else + echo "================== ERROR !!! ORG Unknown ==================" + fi + + if [ "$VERBOSE" == "true" ]; then + env | grep CORE + fi +} + +checkCommitReadiness() { + VERSION=$1 + PEER=$2 + ORG=$3 + shift 3 + setGlobals $PEER $ORG + echo "===================== Simulating the commit of the chaincode definition on peer${PEER}.org${ORG} ===================== " + local rc=1 + local starttime=$(date +%s) + + # continue to poll + # we either get a successful response, or reach TIMEOUT + while + test "$(($(date +%s) - starttime))" -lt "$TIMEOUT" -a $rc -ne 0 + do + sleep $DELAY + echo "Attempting to check the commit readiness of the chaincode definition on peer${PEER}.org${ORG} ...$(($(date +%s) - starttime)) secs" + set -x + peer lifecycle chaincode checkcommitreadiness --channelID $CHANNEL_NAME --name $CC_NAME --signature-policy "OR('Org1MSP.peer', 'Org2MSP.peer')" --version ${VERSION} --init-required --sequence ${VERSION} >&log.txt + res=$? + set +x + test $res -eq 0 || continue + let rc=0 + for var in "$@" + do + grep "$var" log.txt &>/dev/null || let rc=1 + done + done + echo + cat log.txt + if test $rc -eq 0; then + echo "===================== Checking the commit readiness of the chaincode definition successful on peer${PEER}.org${ORG} ===================== " + else + echo "!!!!!!!!!!!!!!! Check commit readiness result on peer${PEER}.org${ORG} is INVALID !!!!!!!!!!!!!!!!" + echo "================== ERROR !!! FAILED to execute End-2-End Scenario ==================" + echo + exit 1 + fi +} diff --git a/high-throughput/scripts/del-traditional.sh b/high-throughput/scripts/del-traditional.sh new file mode 100644 index 00000000..954fab8a --- /dev/null +++ b/high-throughput/scripts/del-traditional.sh @@ -0,0 +1,7 @@ +# +# Copyright IBM Corp All Rights Reserved +# +# SPDX-License-Identifier: Apache-2.0 +# + +peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n $CC_NAME -c '{"Args":["delstandard","'$1'"]}' \ No newline at end of file diff --git a/high-throughput/scripts/install-chaincode.sh b/high-throughput/scripts/install-chaincode.sh index 705682f1..15f344d0 100755 --- a/high-throughput/scripts/install-chaincode.sh +++ b/high-throughput/scripts/install-chaincode.sh @@ -4,30 +4,37 @@ # SPDX-License-Identifier: Apache-2.0 # +echo "========== Package a chaincode on peer0.org1 ==========" +export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp +export CORE_PEER_ADDRESS=peer0.org1.example.com:7051 +export CORE_PEER_LOCALMSPID="Org1MSP" +export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt +peer lifecycle chaincode package ${CC_NAME}.tar.gz --path github.com/hyperledger/fabric-samples/chaincode/ --lang golang --label ${CC_NAME}_$1 + echo "========== Installing chaincode on peer0.org1 ==========" export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp export CORE_PEER_ADDRESS=peer0.org1.example.com:7051 export CORE_PEER_LOCALMSPID="Org1MSP" export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt -peer chaincode install -n $CC_NAME -v $1 -p github.com/hyperledger/fabric/examples/chaincode/go +peer lifecycle chaincode install ${CC_NAME}.tar.gz echo "========== Installing chaincode on peer1.org1 ==========" export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp export CORE_PEER_ADDRESS=peer1.org1.example.com:8051 export CORE_PEER_LOCALMSPID="Org1MSP" export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt -peer chaincode install -n $CC_NAME -v $1 -p github.com/hyperledger/fabric/examples/chaincode/go +peer lifecycle chaincode install ${CC_NAME}.tar.gz echo "========== Installing chaincode on peer0.org2 ==========" export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp export CORE_PEER_ADDRESS=peer0.org2.example.com:9051 export CORE_PEER_LOCALMSPID="Org2MSP" export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -peer chaincode install -n $CC_NAME -v $1 -p github.com/hyperledger/fabric/examples/chaincode/go +peer lifecycle chaincode install ${CC_NAME}.tar.gz echo "========== Installing chaincode on peer1.org2 ==========" export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp export CORE_PEER_ADDRESS=peer1.org2.example.com:10051 export CORE_PEER_LOCALMSPID="Org2MSP" export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt -peer chaincode install -n $CC_NAME -v $1 -p github.com/hyperledger/fabric/examples/chaincode/go +peer lifecycle chaincode install ${CC_NAME}.tar.gz diff --git a/high-throughput/scripts/instantiate-chaincode.sh b/high-throughput/scripts/instantiate-chaincode.sh deleted file mode 100755 index 25fe046c..00000000 --- a/high-throughput/scripts/instantiate-chaincode.sh +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright IBM Corp All Rights Reserved -# -# SPDX-License-Identifier: Apache-2.0 -# - -echo "========== Instantiating chaincode v$1 ==========" -peer chaincode instantiate -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n $CC_NAME -c '{"Args": []}' -v $1 -P "OR ('Org1MSP.member','Org2MSP.member')" - diff --git a/high-throughput/scripts/prunesafe-invoke.sh b/high-throughput/scripts/prune-invoke.sh similarity index 85% rename from high-throughput/scripts/prunesafe-invoke.sh rename to high-throughput/scripts/prune-invoke.sh index e42019e8..388f4364 100755 --- a/high-throughput/scripts/prunesafe-invoke.sh +++ b/high-throughput/scripts/prune-invoke.sh @@ -4,5 +4,5 @@ # SPDX-License-Identifier: Apache-2.0 # -peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n $CC_NAME -c '{"Args":["prunesafe","'$1'"]}' +peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n $CC_NAME -c '{"Args":["prune","'$1'"]}' diff --git a/high-throughput/scripts/prunefast-invoke.sh b/high-throughput/scripts/prunefast-invoke.sh deleted file mode 100755 index bd7b168c..00000000 --- a/high-throughput/scripts/prunefast-invoke.sh +++ /dev/null @@ -1,8 +0,0 @@ -# -# Copyright IBM Corp All Rights Reserved -# -# SPDX-License-Identifier: Apache-2.0 -# - -peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n $CC_NAME -c '{"Args":["prunefast","'$1'"]}' - diff --git a/high-throughput/scripts/setclienv.sh b/high-throughput/scripts/setclienv.sh index 8e953500..6193f753 100644 --- a/high-throughput/scripts/setclienv.sh +++ b/high-throughput/scripts/setclienv.sh @@ -6,3 +6,5 @@ export CHANNEL_NAME=mychannel export CC_NAME=bigdatacc +export TIMEOUT=10 +export DELAY=3 diff --git a/high-throughput/scripts/update-invoke.sh b/high-throughput/scripts/update-invoke.sh index d49b2ccc..14ec2dbe 100755 --- a/high-throughput/scripts/update-invoke.sh +++ b/high-throughput/scripts/update-invoke.sh @@ -3,6 +3,4 @@ # # SPDX-License-Identifier: Apache-2.0 # - peer chaincode invoke -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n $CC_NAME -c '{"Args":["update","'$1'","'$2'","'$3'"]}' - diff --git a/high-throughput/scripts/upgrade-chaincode.sh b/high-throughput/scripts/upgrade-chaincode.sh deleted file mode 100755 index add1b8c7..00000000 --- a/high-throughput/scripts/upgrade-chaincode.sh +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright IBM Corp All Rights Reserved -# -# SPDX-License-Identifier: Apache-2.0 -# - -echo "========== Upgrade chaincode to version $1 ==========" -peer chaincode upgrade -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n $CC_NAME -c '{"Args": []}' -v $1 -P "OR ('Org1MSP.member','Org2MSP.member')" - diff --git a/interest_rate_swaps/README.md b/interest_rate_swaps/README.md index 3455d8d0..7e47bf06 100644 --- a/interest_rate_swaps/README.md +++ b/interest_rate_swaps/README.md @@ -118,8 +118,11 @@ The following prerequisites are needed to run this sample: line parameter of the script. * A local installation of `configtxgen` and `cryptogen` in the `PATH` environment, or included in `fabric-samples/bin` directory. +<<<<<<< HEAD * Vendoring the chaincode. In the `chaincode` directory, run `govendor init` and `govendor add +external` to vendor the shim from your local copy of fabric. +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 ### Bringing up the network @@ -138,10 +141,15 @@ commands in the following section. ### Transactions -The chaincode is instantiated as follows: +The chaincode is initialized as follows: ``` +<<<<<<< HEAD peer chaincode instantiate -o irs-orderer:7050 -C irs -n irscc -l golang -v 0 -c '{"Args":["init","auditor","1000000","rrprovider","myrr"]}' -P "AND(OR('partya.peer','partyb.peer','partyc.peer'), 'auditor.peer')" +======= +peer chaincode invoke -o irs-orderer:7050 --isInit -C irs --waitForEvent -n irscc --peerAddresses irs-rrprovider:7051 --peerAddresses irs-partya:7051 --peerAddresses irs-partyb:7051 --peerAddresses irs-partyc:7051 --peerAddresses irs-auditor:7051 -c '{"Args":["init","auditor","1000000","rrprovider","myrr"]}' +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 ``` + This sets an auditing threshold of 1M, above which the `auditor` organization needs to be involved. It also specifies the `myrr` reference rate provided by the `rrprovider` organization. diff --git a/interest_rate_swaps/chaincode/chaincode.go b/interest_rate_swaps/chaincode/chaincode.go index 6cca88fd..ad5e3b82 100644 --- a/interest_rate_swaps/chaincode/chaincode.go +++ b/interest_rate_swaps/chaincode/chaincode.go @@ -12,9 +12,9 @@ import ( "strconv" "time" - "github.com/hyperledger/fabric/core/chaincode/shim" - "github.com/hyperledger/fabric/core/chaincode/shim/ext/statebased" - pb "github.com/hyperledger/fabric/protos/peer" + "github.com/hyperledger/fabric-chaincode-go/pkg/statebased" + "github.com/hyperledger/fabric-chaincode-go/shim" + pb "github.com/hyperledger/fabric-protos-go/peer" ) /* InterestRateSwap represents an interest rate swap on the ledger diff --git a/interest_rate_swaps/chaincode/go.mod b/interest_rate_swaps/chaincode/go.mod new file mode 100644 index 00000000..9a1ce33e --- /dev/null +++ b/interest_rate_swaps/chaincode/go.mod @@ -0,0 +1,12 @@ +module github.com/hyperledger/fabric-samples/interest_rate_swaps/chaincode + +go 1.12 + +require ( + github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 + github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 + golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect + golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect + golang.org/x/text v0.3.2 // indirect + google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect +) diff --git a/interest_rate_swaps/chaincode/go.sum b/interest_rate_swaps/chaincode/go.sum new file mode 100644 index 00000000..21d2908d --- /dev/null +++ b/interest_rate_swaps/chaincode/go.sum @@ -0,0 +1,82 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 h1:VEm3tPRTCzq3J/1XpVERh1PbOSnshUVwx2G5s3cLiTw= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85/go.mod h1:HZK6PKLWrvdD/t0oSLiyaRaUM6fZ7qjJuOlb0zrn0mo= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022 h1:WzttYAPO5xkQ87ZrxzEhvDZknfarSNu1PZt3NPMTE3Y= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542 h1:6ZQFf1D2YYDDI7eSwW8adlkkavTB9sw5I24FVtEvNUQ= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b h1:lohp5blsw53GBXtLyLNaTXPXS9pJ1tiTw61ZHUoE9Qw= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/interest_rate_swaps/network/.gitignore b/interest_rate_swaps/network/.gitignore new file mode 100644 index 00000000..81500649 --- /dev/null +++ b/interest_rate_swaps/network/.gitignore @@ -0,0 +1,2 @@ +channel-artifacts/ +crypto-config/ diff --git a/interest_rate_swaps/network/configtx.yaml b/interest_rate_swaps/network/configtx.yaml index 569939e5..2063e7e3 100644 --- a/interest_rate_swaps/network/configtx.yaml +++ b/interest_rate_swaps/network/configtx.yaml @@ -64,6 +64,12 @@ Organizations: Admins: Type: Signature Rule: OR('partya.admin') +<<<<<<< HEAD +======= + Endorsement: + Type: Signature + Rule: "OR('partya.peer')" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # leave this flag set to true. AnchorPeers: @@ -96,6 +102,12 @@ Organizations: Admins: Type: Signature Rule: OR('partyb.admin') +<<<<<<< HEAD +======= + Endorsement: + Type: Signature + Rule: "OR('partyb.peer')" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # leave this flag set to true. AnchorPeers: @@ -128,6 +140,12 @@ Organizations: Admins: Type: Signature Rule: "OR('partyc.admin')" +<<<<<<< HEAD +======= + Endorsement: + Type: Signature + Rule: "OR('partyc.peer')" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # leave this flag set to true. AnchorPeers: @@ -161,6 +179,12 @@ Organizations: Admins: Type: Signature Rule: OR('auditor.admin') +<<<<<<< HEAD +======= + Endorsement: + Type: Signature + Rule: "OR('auditor.peer')" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # leave this flag set to true. AnchorPeers: @@ -193,6 +217,12 @@ Organizations: Admins: Type: Signature Rule: "OR('rrprovider.admin')" +<<<<<<< HEAD +======= + Endorsement: + Type: Signature + Rule: "OR('rrprovider.peer')" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # leave this flag set to true. AnchorPeers: @@ -227,6 +257,7 @@ Capabilities: # supported by both. # Set the value of the capability to true to require it. Channel: &ChannelCapabilities +<<<<<<< HEAD # V1.4.3 for Channel is a catchall flag for behavior which has been # determined to be desired for all orderers and peers running at the v1.4.3 # level, but which would be incompatible with orderers and peers from @@ -240,11 +271,21 @@ Capabilities: # V1.1 for Channel enables the new non-backwards compatible # features and fixes of fabric v1.1 V1_1: false +======= + # V2_0 capability ensures that orderers and peers behave according + # to v2.0 channel capabilities. Orderers and peers from + # prior releases would behave in an incompatible way, and are therefore + # not able to participate in channels at v2.0 capability. + # Prior to enabling V2.0 channel capabilities, ensure that all + # orderers and peers on a channel are at v2.0.0 or later. + V2_0: true +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # Orderer capabilities apply only to the orderers, and may be safely # used with prior release peers. # Set the value of the capability to true to require it. Orderer: &OrdererCapabilities +<<<<<<< HEAD # V1.4.2 for Orderer is a catchall flag for behavior which has been # determined to be desired for all orderers running at the v1.4.2 # level, but which would be incompatible with orderers from prior releases. @@ -254,11 +295,21 @@ Capabilities: # V1.1 for Orderer enables the new non-backwards compatible # features and fixes of fabric v1.1 V1_1: false +======= + # V2_0 orderer capability ensures that orderers behave according + # to v2.0 orderer capabilities. Orderers from + # prior releases would behave in an incompatible way, and are therefore + # not able to participate in channels at v2.0 orderer capability. + # Prior to enabling V2.0 orderer capabilities, ensure that all + # orderers on channel are at v2.0.0 or later. + V2_0: true +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # Application capabilities apply only to the peer network, and may be safely # used with prior release orderers. # Set the value of the capability to true to require it. Application: &ApplicationCapabilities +<<<<<<< HEAD # V1.4.2 for Application enables the new non-backwards compatible # features and fixes of fabric v1.4.2. V1_4_2: true @@ -273,6 +324,15 @@ Capabilities: # features and fixes of fabric v1.1 (note, this need not be set if # later version capabilities are set). V1_1: false +======= + # V2_0 application capability ensures that peers behave according + # to v2.0 application capabilities. Peers from + # prior releases would behave in an incompatible way, and are therefore + # not able to participate in channels at v2.0 application capability. + # Prior to enabling V2.0 application capabilities, ensure that all + # peers on channel are at v2.0.0 or later. + V2_0: true +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 ################################################################################ # @@ -301,6 +361,15 @@ Application: &ApplicationDefaults Admins: Type: ImplicitMeta Rule: "MAJORITY Admins" +<<<<<<< HEAD +======= + LifecycleEndorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 Capabilities: <<: *ApplicationCapabilities @@ -393,6 +462,7 @@ Channel: &ChannelDefaults Admins: Type: ImplicitMeta Rule: "MAJORITY Admins" +<<<<<<< HEAD # Capabilities describes the channel level capabilities, see the # dedicated Capabilities section elsewhere in this file for a full @@ -400,6 +470,15 @@ Channel: &ChannelDefaults Capabilities: <<: *ChannelCapabilities +======= + + # Capabilities describes the channel level capabilities, see the + # dedicated Capabilities section elsewhere in this file for a full + # description + Capabilities: + <<: *ChannelCapabilities + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 ################################################################################ # # Profile diff --git a/interest_rate_swaps/network/docker-compose.yaml b/interest_rate_swaps/network/docker-compose.yaml index 44fabf96..371ef048 100644 --- a/interest_rate_swaps/network/docker-compose.yaml +++ b/interest_rate_swaps/network/docker-compose.yaml @@ -35,8 +35,8 @@ services: environment: - FABRIC_LOGGING_SPEC=INFO - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block + - ORDERER_GENERAL_BOOTSTRAPMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/orderer/orderer.genesis.block - ORDERER_GENERAL_LOCALMSPID=orderer - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - ORDERER_GENERAL_TLS_ENABLED=false diff --git a/interest_rate_swaps/network/network.sh b/interest_rate_swaps/network/network.sh index 076b7f34..b87c52db 100755 --- a/interest_rate_swaps/network/network.sh +++ b/interest_rate_swaps/network/network.sh @@ -113,6 +113,11 @@ function networkUp() { echo "ERROR !!!! Unable to start network" exit 1 fi + echo Vendoring Go dependencies ... + pushd ../chaincode + GO111MODULE=on go mod vendor + popd + echo Finished vendoring Go dependencies # now run the end to end script docker exec cli scripts/script.sh if [ $? -ne 0 ]; then diff --git a/interest_rate_swaps/network/scripts/check-commit-readiness.sh b/interest_rate_swaps/network/scripts/check-commit-readiness.sh new file mode 100644 index 00000000..55300d84 --- /dev/null +++ b/interest_rate_swaps/network/scripts/check-commit-readiness.sh @@ -0,0 +1,38 @@ +# +# Copyright IBM Corp All Rights Reserved +# +# SPDX-License-Identifier: Apache-2.0 +# +checkCommitReadiness() { + echo "===================== Check the commit readiness of the chaincode definition for ${CORE_PEER_LOCALMSPID} ===================== " + local rc=1 + local starttime=$(date +%s) + + # continue to poll + # we either get a successful response, or reach TIMEOUT + while + test "$(($(date +%s) - starttime))" -lt "$TIMEOUT" -a $rc -ne 0 + do + echo "Attempting to check the commit readiness of the chaincode definition for ${CORE_PEER_LOCALMSPID} ...$(($(date +%s) - starttime)) secs" + set -x + peer lifecycle chaincode checkcommitreadiness -o irs-orderer:7050 --channelID irs --signature-policy "AND(OR('partya.peer','partyb.peer','partyc.peer'), 'auditor.peer')" --name irscc --version 1 --init-required --sequence 1 >&log.txt + res=$? + set +x + test $res -eq 0 || continue + let rc=0 + for var in "$@" + do + grep "$var" log.txt &>/dev/null || let rc=1 + done + done + echo + cat log.txt + if test $rc -eq 0; then + echo "===================== Checking the commit readiness of the chaincode definition successful for ${CORE_PEER_LOCALMSPID} ===================== " + else + echo "!!!!!!!!!!!!!!! Check commit readiness result for ${CORE_PEER_LOCALMSPID} is INVALID !!!!!!!!!!!!!!!!" + echo "================== ERROR !!! FAILED to execute End-2-End Scenario ==================" + echo + exit 1 + fi +} diff --git a/interest_rate_swaps/network/scripts/script.sh b/interest_rate_swaps/network/scripts/script.sh index fffc93c8..40d55bb0 100755 --- a/interest_rate_swaps/network/scripts/script.sh +++ b/interest_rate_swaps/network/scripts/script.sh @@ -29,6 +29,15 @@ joinChannel () { done } +packageChaincode() { + CORE_PEER_LOCALMSPID=partya + CORE_PEER_ADDRESS=irs-partya:7051 + CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/partya.example.com/users/Admin@partya.example.com/msp + echo "===================== Creating chaincode package ===================== " + peer lifecycle chaincode package irscc.tar.gz --path ${CC_SRC_PATH} --lang golang --label irscc_1 + echo "===================== Chaincode packaged ===================== " +} + installChaincode() { for org in partya partyb partyc auditor rrprovider do @@ -36,18 +45,66 @@ installChaincode() { CORE_PEER_ADDRESS=irs-$org:7051 CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/$org.example.com/users/Admin@$org.example.com/msp echo "===================== Org $org installing chaincode ===================== " - peer chaincode install -n irscc -v 0 -l golang -p ${CC_SRC_PATH} + peer lifecycle chaincode install irscc.tar.gz echo "===================== Org $org chaincode installed ===================== " done } -instantiateChaincode() { +queryPackage() { + CORE_PEER_LOCALMSPID=partya + CORE_PEER_ADDRESS=irs-partya:7051 + CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/partya.example.com/users/Admin@partya.example.com/msp + echo "===================== Query chaincode package ID ===================== " + peer lifecycle chaincode queryinstalled >&log.txt + export PACKAGE_ID=`sed -n '/Package/{s/^Package ID: //; s/, Label:.*$//; p;}' log.txt` + echo "packgeID=$PACKAGE_ID" + echo "===================== Query successfull ===================== " +} + +approveChaincode() { + for org in partya partyb partyc auditor rrprovider + do + CORE_PEER_LOCALMSPID=$org + CORE_PEER_ADDRESS=irs-$org:7051 + CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/$org.example.com/users/Admin@$org.example.com/msp + echo "===================== Approving chaincode definition for $org ===================== " + peer lifecycle chaincode approveformyorg -o irs-orderer:7050 --channelID irs --signature-policy "AND(OR('partya.peer','partyb.peer','partyc.peer'), 'auditor.peer')" --name irscc --version 1 --init-required --sequence 1 --package-id ${PACKAGE_ID} --waitForEvent + echo "===================== Chaincode definition approved ===================== " + done +} + +checkCommitReadiness() { + for org in partya partyb partyc auditor rrprovider + do + export CORE_PEER_LOCALMSPID=$org + export CORE_PEER_ADDRESS=irs-$org:7051 + export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/$org.example.com/users/Admin@$org.example.com/msp + checkCommitReadiness "\"partya\": true" "\"partyb\": true" "\"partyc\": true" "\"auditor\": true" "\"rrprovider\": true" + done +} + +commitChaincode() { CORE_PEER_LOCALMSPID=partya CORE_PEER_ADDRESS=irs-partya:7051 CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/partya.example.com/users/Admin@partya.example.com/msp + echo "===================== Commiting chaincode definition to channel ===================== " + peer lifecycle chaincode commit -o irs-orderer:7050 --channelID irs --signature-policy "AND(OR('partya.peer','partyb.peer','partyc.peer'), 'auditor.peer')" --name irscc --version 1 --init-required --sequence 1 --peerAddresses irs-partya:7051 --peerAddresses irs-partyb:7051 --peerAddresses irs-partyc:7051 --peerAddresses irs-auditor:7051 --peerAddresses irs-rrprovider:7051 --waitForEvent + echo "===================== Chaincode definition committed ===================== " +} + +initChaincode() { + CORE_PEER_LOCALMSPID=partya + CORE_PEER_ADDRESS=irs-partya:7051 + CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/partya.example.com/users/Admin@partya.example.com/msp +<<<<<<< HEAD echo "===================== Instantiating chaincode ===================== " peer chaincode instantiate -o irs-orderer:7050 -C irs -n irscc -l golang -v 0 -c '{"Args":["init","auditor","1000000","rrprovider","myrr"]}' -P "AND(OR('partya.peer','partyb.peer','partyc.peer'), 'auditor.peer')" echo "===================== Chaincode instantiated ===================== " +======= + echo "===================== Initializing chaincode ===================== " + peer chaincode invoke -o irs-orderer:7050 --isInit -C irs --waitForEvent -n irscc --peerAddresses irs-rrprovider:7051 --peerAddresses irs-partya:7051 --peerAddresses irs-partyb:7051 --peerAddresses irs-partyc:7051 --peerAddresses irs-auditor:7051 -c '{"Args":["init","auditor","1000000","rrprovider","myrr"]}' + echo "===================== Chaincode initialized ===================== " +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 } setReferenceRate() { @@ -95,13 +152,35 @@ createChannel echo "Having all peers join the channel..." joinChannel -## Install chaincode on all peers -echo "Installing chaincode..." +## Package the chaincode +echo "packaging chaincode..." +packageChaincode + +## Query chaincode packageID +echo "Querying packageID..." installChaincode -# Instantiate chaincode -echo "Instantiating chaincode..." -instantiateChaincode +## Install chaincode on all peers +echo "Installing chaincode..." +queryPackage + +# Approve chaincode definition +echo "Approving chaincode..." +approveChaincode + +. scripts/check-commit-readiness.sh + +# Check the commit readiness of the chaincode definition +echo "Checking the commit readiness of the chaincode definition..." +checkCommitReadiness + +# Commit chaincode definition +echo "Committing chaincode definition..." +commitChaincode + +# Init chaincode +echo "Initialize chaincode..." +initChaincode echo "Setting myrr reference rate" sleep 3 diff --git a/library-tracker/organization/bullard-sanford/application-java/pom.xml b/library-tracker/organization/bullard-sanford/application-java/pom.xml index 5cab62e8..f3963d3f 100644 --- a/library-tracker/organization/bullard-sanford/application-java/pom.xml +++ b/library-tracker/organization/bullard-sanford/application-java/pom.xml @@ -14,7 +14,7 @@ UTF-8 - 1.4.2 + [2.0.0,2.1) @@ -63,7 +63,7 @@ hyperledger - Hyperledger Artifactory + Hyperledger Nexus https://hyperledger.jfrog.io/hyperledger/fabric-maven @@ -77,7 +77,7 @@ org.hyperledger.fabric-gateway-java fabric-gateway-java - 1.4.0-SNAPSHOT + 2.0.0-SNAPSHOT @@ -96,4 +96,4 @@ - \ No newline at end of file + diff --git a/library-tracker/organization/bullard-sanford/application-java/src/org/papernet/ledgerapi/State.java b/library-tracker/organization/bullard-sanford/application-java/src/org/papernet/ledgerapi/State.java index 18158193..a32abc02 100644 --- a/library-tracker/organization/bullard-sanford/application-java/src/org/papernet/ledgerapi/State.java +++ b/library-tracker/organization/bullard-sanford/application-java/src/org/papernet/ledgerapi/State.java @@ -53,7 +53,7 @@ public class State { } public static String[] splitKey(String key) { - System.out.println("Splittin gkey " + key + " " + java.util.Arrays.asList(key.split(":"))); + System.out.println("splitting key " + key + " " + java.util.Arrays.asList(key.split(":"))); return key.split(":"); } diff --git a/library-tracker/organization/bullard-sanford/application/addToWallet.js b/library-tracker/organization/bullard-sanford/application/addToWallet.js index b2b4415f..0829a3da 100644 --- a/library-tracker/organization/bullard-sanford/application/addToWallet.js +++ b/library-tracker/organization/bullard-sanford/application/addToWallet.js @@ -6,29 +6,37 @@ // Bring key classes into scope, most importantly Fabric SDK network class const fs = require('fs'); -const { FileSystemWallet, X509WalletMixin } = require('fabric-network'); +const { Wallets } = require('fabric-network'); const path = require('path'); -const fixtures = path.resolve(__dirname, '../../../../basic-network'); - -// A wallet stores a collection of identities -const wallet = new FileSystemWallet('../identity/user/balaji/wallet'); +const fixtures = path.resolve(__dirname, '../../../../test-network'); async function main() { // Main try/catch block try { + // A wallet stores a collection of identities + const wallet = await Wallets.newFileSystemWallet('../identity/user/balaji/wallet'); + // Identity to credentials to be stored in the wallet - const credPath = path.join(fixtures, '/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com'); - const cert = fs.readFileSync(path.join(credPath, '/msp/signcerts/Admin@org1.example.com-cert.pem')).toString(); - const key = fs.readFileSync(path.join(credPath, '/msp/keystore/cd96d5260ad4757551ed4a5a991e62130f8008a0bf996e4e4b84cd097a747fec_sk')).toString(); + const credPath = path.join(fixtures, '/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com'); + const certificate = fs.readFileSync(path.join(credPath, '/msp/signcerts/Admin@org1.example.com-cert.pem')).toString(); + const privateKey = fs.readFileSync(path.join(credPath, '/msp/keystore/priv_sk')).toString(); // Load credentials into wallet - const identityLabel = 'Admin@org1.example.com'; - const identity = X509WalletMixin.createIdentity('Org1MSP', cert, key); + const identityLabel = 'balaji'; + + const identity = { + credentials: { + certificate, + privateKey + }, + mspId: 'Org1MSP', + type: 'X.509' + } - await wallet.import(identityLabel, identity); + await wallet.put(identityLabel, identity); } catch (error) { console.log(`Error adding to wallet. ${error}`); diff --git a/library-tracker/organization/bullard-sanford/application/package.json b/library-tracker/organization/bullard-sanford/application/package.json index 3655349d..c055092e 100644 --- a/library-tracker/organization/bullard-sanford/application/package.json +++ b/library-tracker/organization/bullard-sanford/application/package.json @@ -9,10 +9,15 @@ }, "keywords": [], "author": "", - "license": "ISC", + "license": "Apache-2.0", "dependencies": { +<<<<<<< HEAD:library-tracker/organization/bullard-sanford/application/package.json "fabric-network": "~1.4.0", "fabric-client": "~1.4.0", +======= + "fabric-network": "beta", + "fabric-client": "beta", +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:commercial-paper/organization/digibank/application/package.json "js-yaml": "^3.12.0" }, "devDependencies": { diff --git a/library-tracker/organization/bullard-sanford/configuration/cli/docker-compose.yml b/library-tracker/organization/bullard-sanford/configuration/cli/docker-compose.yml index 434b2a96..d7c90928 100644 --- a/library-tracker/organization/bullard-sanford/configuration/cli/docker-compose.yml +++ b/library-tracker/organization/bullard-sanford/configuration/cli/docker-compose.yml @@ -8,12 +8,12 @@ version: '2' networks: basic: external: - name: net_basic + name: net_test services: cliDigiBank: container_name: cliDigiBank - image: hyperledger/fabric-tools + image: hyperledger/fabric-tools:2.0.0-beta tty: true environment: - GOPATH=/opt/gopath @@ -24,15 +24,15 @@ services: - CORE_PEER_LOCALMSPID=Org1MSP - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp - CORE_CHAINCODE_KEEPALIVE=10 + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + - ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer command: /bin/bash volumes: - /var/run/:/host/var/run/ - ./../../../../organization/digibank:/opt/gopath/src/github.com/ - - ./../../../../../basic-network/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ + - ./../../../../../test-network/organizations:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ networks: - basic - #depends_on: - # - orderer.example.com - # - peer0.org1.example.com - # - couchdb + diff --git a/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/paper.go b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/paper.go new file mode 100644 index 00000000..94b072c2 --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/paper.go @@ -0,0 +1,139 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "encoding/json" + "fmt" + + ledgerapi "github.com/hyperledger/fabric-samples/commercial-paper/organization/digibank/contract-go/ledger-api" +) + +// State enum for commercial paper state property +type State uint + +const ( + // ISSUED state for when a paper has been issued + ISSUED State = iota + 1 + // TRADING state for when a paper is trading + TRADING + // REDEEMED state for when a paper has been redeemed + REDEEMED +) + +func (state State) String() string { + names := []string{"ISSUED", "TRADING", "REDEEMED"} + + if state < ISSUED || state > REDEEMED { + return "UNKNOWN" + } + + return names[state-1] +} + +// CreateCommercialPaperKey creates a key for commercial papers +func CreateCommercialPaperKey(issuer string, paperNumber string) string { + return ledgerapi.MakeKey(issuer, paperNumber) +} + +// Used for managing the fact status is private but want it in world state +type commercialPaperAlias CommercialPaper +type jsonCommercialPaper struct { + *commercialPaperAlias + State State `json:"currentState"` + Class string `json:"class"` + Key string `json:"key"` +} + +// CommercialPaper defines a commercial paper +type CommercialPaper struct { + PaperNumber string `json:"paperNumber"` + Issuer string `json:"issuer"` + IssueDateTime string `json:"issueDateTime"` + FaceValue int `json:"faceValue"` + MaturityDateTime string `json:"maturityDateTime"` + Owner string `json:"owner"` + state State `metadata:"currentState"` + class string `metadata:"class"` + key string `metadata:"key"` +} + +// UnmarshalJSON special handler for managing JSON marshalling +func (cp *CommercialPaper) UnmarshalJSON(data []byte) error { + jcp := jsonCommercialPaper{commercialPaperAlias: (*commercialPaperAlias)(cp)} + + err := json.Unmarshal(data, &jcp) + + if err != nil { + return err + } + + cp.state = jcp.State + + return nil +} + +// MarshalJSON special handler for managing JSON marshalling +func (cp CommercialPaper) MarshalJSON() ([]byte, error) { + jcp := jsonCommercialPaper{commercialPaperAlias: (*commercialPaperAlias)(&cp), State: cp.state, Class: "org.papernet.commercialpaper", Key: ledgerapi.MakeKey(cp.Issuer, cp.PaperNumber)} + + return json.Marshal(&jcp) +} + +// GetState returns the state +func (cp *CommercialPaper) GetState() State { + return cp.state +} + +// SetIssued returns the state to issued +func (cp *CommercialPaper) SetIssued() { + cp.state = ISSUED +} + +// SetTrading sets the state to trading +func (cp *CommercialPaper) SetTrading() { + cp.state = TRADING +} + +// SetRedeemed sets the state to redeemed +func (cp *CommercialPaper) SetRedeemed() { + cp.state = REDEEMED +} + +// IsIssued returns true if state is issued +func (cp *CommercialPaper) IsIssued() bool { + return cp.state == ISSUED +} + +// IsTrading returns true if state is trading +func (cp *CommercialPaper) IsTrading() bool { + return cp.state == TRADING +} + +// IsRedeemed returns true if state is redeemed +func (cp *CommercialPaper) IsRedeemed() bool { + return cp.state == REDEEMED +} + +// GetSplitKey returns values which should be used to form key +func (cp *CommercialPaper) GetSplitKey() []string { + return []string{cp.Issuer, cp.PaperNumber} +} + +// Serialize formats the commercial paper as JSON bytes +func (cp *CommercialPaper) Serialize() ([]byte, error) { + return json.Marshal(cp) +} + +// Deserialize formats the commercial paper from JSON bytes +func Deserialize(bytes []byte, cp *CommercialPaper) error { + err := json.Unmarshal(bytes, cp) + + if err != nil { + return fmt.Errorf("Error deserializing commercial paper. %s", err.Error()) + } + + return nil +} diff --git a/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/paper_test.go b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/paper_test.go new file mode 100644 index 00000000..6af65ef7 --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/paper_test.go @@ -0,0 +1,125 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "testing" + + ledgerapi "github.com/hyperledger/fabric-samples/commercial-paper/organization/digibank/contract-go/ledger-api" + "github.com/stretchr/testify/assert" +) + +func TestString(t *testing.T) { + assert.Equal(t, "ISSUED", ISSUED.String(), "should return string for issued") + assert.Equal(t, "TRADING", TRADING.String(), "should return string for issued") + assert.Equal(t, "REDEEMED", REDEEMED.String(), "should return string for issued") + assert.Equal(t, "UNKNOWN", State(REDEEMED+1).String(), "should return unknown when not one of constants") +} + +func TestCreateCommercialPaperKey(t *testing.T) { + assert.Equal(t, ledgerapi.MakeKey("someissuer", "somepaper"), CreateCommercialPaperKey("someissuer", "somepaper"), "should return key comprised of passed values") +} + +func TestGetState(t *testing.T) { + cp := new(CommercialPaper) + cp.state = ISSUED + + assert.Equal(t, ISSUED, cp.GetState(), "should return set state") +} + +func TestSetIssued(t *testing.T) { + cp := new(CommercialPaper) + cp.SetIssued() + assert.Equal(t, ISSUED, cp.state, "should set state to trading") +} + +func TestSetTrading(t *testing.T) { + cp := new(CommercialPaper) + cp.SetTrading() + assert.Equal(t, TRADING, cp.state, "should set state to trading") +} + +func TestSetRedeemed(t *testing.T) { + cp := new(CommercialPaper) + cp.SetRedeemed() + assert.Equal(t, REDEEMED, cp.state, "should set state to trading") +} + +func TestIsIssued(t *testing.T) { + cp := new(CommercialPaper) + + cp.SetIssued() + assert.True(t, cp.IsIssued(), "should be true when status set to issued") + + cp.SetTrading() + assert.False(t, cp.IsIssued(), "should be false when status not set to issued") +} + +func TestIsTrading(t *testing.T) { + cp := new(CommercialPaper) + + cp.SetTrading() + assert.True(t, cp.IsTrading(), "should be true when status set to trading") + + cp.SetRedeemed() + assert.False(t, cp.IsTrading(), "should be false when status not set to trading") +} + +func TestIsRedeemed(t *testing.T) { + cp := new(CommercialPaper) + + cp.SetRedeemed() + assert.True(t, cp.IsRedeemed(), "should be true when status set to redeemed") + + cp.SetIssued() + assert.False(t, cp.IsRedeemed(), "should be false when status not set to redeemed") +} + +func TestGetSplitKey(t *testing.T) { + cp := new(CommercialPaper) + cp.PaperNumber = "somepaper" + cp.Issuer = "someissuer" + + assert.Equal(t, []string{"someissuer", "somepaper"}, cp.GetSplitKey(), "should return issuer and paper number as split key") +} + +func TestSerialize(t *testing.T) { + cp := new(CommercialPaper) + cp.PaperNumber = "somepaper" + cp.Issuer = "someissuer" + cp.IssueDateTime = "sometime" + cp.FaceValue = 1000 + cp.MaturityDateTime = "somelatertime" + cp.Owner = "someowner" + cp.state = TRADING + + bytes, err := cp.Serialize() + assert.Nil(t, err, "should not error on serialize") + assert.Equal(t, `{"paperNumber":"somepaper","issuer":"someissuer","issueDateTime":"sometime","faceValue":1000,"maturityDateTime":"somelatertime","owner":"someowner","currentState":2,"class":"org.papernet.commercialpaper","key":"someissuer:somepaper"}`, string(bytes), "should return JSON formatted value") +} + +func TestDeserialize(t *testing.T) { + var cp *CommercialPaper + var err error + + goodJSON := `{"paperNumber":"somepaper","issuer":"someissuer","issueDateTime":"sometime","faceValue":1000,"maturityDateTime":"somelatertime","owner":"someowner","currentState":2,"class":"org.papernet.commercialpaper","key":"someissuer:somepaper"}` + expectedCp := new(CommercialPaper) + expectedCp.PaperNumber = "somepaper" + expectedCp.Issuer = "someissuer" + expectedCp.IssueDateTime = "sometime" + expectedCp.FaceValue = 1000 + expectedCp.MaturityDateTime = "somelatertime" + expectedCp.Owner = "someowner" + expectedCp.state = TRADING + cp = new(CommercialPaper) + err = Deserialize([]byte(goodJSON), cp) + assert.Nil(t, err, "should not return error for deserialize") + assert.Equal(t, expectedCp, cp, "should create expected commercial paper") + + badJSON := `{"paperNumber":"somepaper","issuer":"someissuer","issueDateTime":"sometime","faceValue":"NaN","maturityDateTime":"somelatertime","owner":"someowner","currentState":2,"class":"org.papernet.commercialpaper","key":"someissuer:somepaper"}` + cp = new(CommercialPaper) + err = Deserialize([]byte(badJSON), cp) + assert.EqualError(t, err, "Error deserializing commercial paper. json: cannot unmarshal string into Go struct field jsonCommercialPaper.faceValue of type int", "should return error for bad data") +} diff --git a/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/papercontext.go b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/papercontext.go new file mode 100644 index 00000000..c346cf3b --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/papercontext.go @@ -0,0 +1,35 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "github.com/hyperledger/fabric-contract-api-go/contractapi" +) + +// TransactionContextInterface an interface to +// describe the minimum required functions for +// a transaction context in the commercial +// paper +type TransactionContextInterface interface { + contractapi.TransactionContextInterface + GetPaperList() ListInterface +} + +// TransactionContext implementation of +// TransactionContextInterface for use with +// commercial paper contract +type TransactionContext struct { + contractapi.TransactionContext + paperList *list +} + +// GetPaperList return paper list +func (tc *TransactionContext) GetPaperList() ListInterface { + if tc.paperList == nil { + tc.paperList = newList(tc) + } + + return tc.paperList +} diff --git a/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/papercontext_test.go b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/papercontext_test.go new file mode 100644 index 00000000..81317aac --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/papercontext_test.go @@ -0,0 +1,31 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "testing" + + ledgerapi "github.com/hyperledger/fabric-samples/commercial-paper/organization/digibank/contract-go/ledger-api" + "github.com/stretchr/testify/assert" +) + +func TestGetPaperList(t *testing.T) { + var tc *TransactionContext + var expectedPaperList *list + + tc = new(TransactionContext) + expectedPaperList = newList(tc) + actualList := tc.GetPaperList().(*list) + assert.Equal(t, expectedPaperList.stateList.(*ledgerapi.StateList).Name, actualList.stateList.(*ledgerapi.StateList).Name, "should configure paper list when one not already configured") + + tc = new(TransactionContext) + expectedPaperList = new(list) + expectedStateList := new(ledgerapi.StateList) + expectedStateList.Ctx = tc + expectedStateList.Name = "existing paper list" + expectedPaperList.stateList = expectedStateList + tc.paperList = expectedPaperList + assert.Equal(t, expectedPaperList, tc.GetPaperList(), "should return set paper list when already set") +} diff --git a/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/papercontract.go b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/papercontract.go new file mode 100644 index 00000000..4e8cee20 --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/papercontract.go @@ -0,0 +1,96 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "fmt" + + "github.com/hyperledger/fabric-contract-api-go/contractapi" +) + +// Contract chaincode that defines +// the business logic for managing commercial +// paper +type Contract struct { + contractapi.Contract +} + +// Instantiate does nothing +func (c *Contract) Instantiate() { + fmt.Println("Instantiated") +} + +// Issue creates a new commercial paper and stores it in the world state +func (c *Contract) Issue(ctx TransactionContextInterface, issuer string, paperNumber string, issueDateTime string, maturityDateTime string, faceValue int) (*CommercialPaper, error) { + paper := CommercialPaper{PaperNumber: paperNumber, Issuer: issuer, IssueDateTime: issueDateTime, FaceValue: faceValue, MaturityDateTime: maturityDateTime, Owner: issuer} + paper.SetIssued() + + err := ctx.GetPaperList().AddPaper(&paper) + + if err != nil { + return nil, err + } + + return &paper, nil +} + +// Buy updates a commercial paper to be in trading status and sets the new owner +func (c *Contract) Buy(ctx TransactionContextInterface, issuer string, paperNumber string, currentOwner string, newOwner string, price int, purchaseDateTime string) (*CommercialPaper, error) { + paper, err := ctx.GetPaperList().GetPaper(issuer, paperNumber) + + if err != nil { + return nil, err + } + + if paper.Owner != currentOwner { + return nil, fmt.Errorf("Paper %s:%s is not owned by %s", issuer, paperNumber, currentOwner) + } + + if paper.IsIssued() { + paper.SetTrading() + } + + if !paper.IsTrading() { + return nil, fmt.Errorf("Paper %s:%s is not trading. Current state = %s", issuer, paperNumber, paper.GetState()) + } + + paper.Owner = newOwner + + err = ctx.GetPaperList().UpdatePaper(paper) + + if err != nil { + return nil, err + } + + return paper, nil +} + +// Redeem updates a commercial paper status to be redeemed +func (c *Contract) Redeem(ctx TransactionContextInterface, issuer string, paperNumber string, redeemingOwner string, redeenDateTime string) (*CommercialPaper, error) { + paper, err := ctx.GetPaperList().GetPaper(issuer, paperNumber) + + if err != nil { + return nil, err + } + + if paper.Owner != redeemingOwner { + return nil, fmt.Errorf("Paper %s:%s is not owned by %s", issuer, paperNumber, redeemingOwner) + } + + if paper.IsRedeemed() { + return nil, fmt.Errorf("Paper %s:%s is already redeemed", issuer, paperNumber) + } + + paper.Owner = paper.Issuer + paper.SetRedeemed() + + err = ctx.GetPaperList().UpdatePaper(paper) + + if err != nil { + return nil, err + } + + return paper, nil +} diff --git a/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/papercontract_test.go b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/papercontract_test.go new file mode 100644 index 00000000..25c429b3 --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/papercontract_test.go @@ -0,0 +1,185 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "errors" + "testing" + + "github.com/hyperledger/fabric-contract-api-go/contractapi" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +// ######### +// HELPERS +// ######### +type MockPaperList struct { + mock.Mock +} + +func (mpl *MockPaperList) AddPaper(paper *CommercialPaper) error { + args := mpl.Called(paper) + + return args.Error(0) +} + +func (mpl *MockPaperList) GetPaper(issuer string, papernumber string) (*CommercialPaper, error) { + args := mpl.Called(issuer, papernumber) + + return args.Get(0).(*CommercialPaper), args.Error(1) +} + +func (mpl *MockPaperList) UpdatePaper(paper *CommercialPaper) error { + args := mpl.Called(paper) + + return args.Error(0) +} + +type MockTransactionContext struct { + contractapi.TransactionContext + paperList *MockPaperList +} + +func (mtc *MockTransactionContext) GetPaperList() ListInterface { + return mtc.paperList +} + +func resetPaper(paper *CommercialPaper) { + paper.Owner = "someowner" + paper.SetTrading() +} + +// ######### +// TESTS +// ######### + +func TestIssue(t *testing.T) { + var paper *CommercialPaper + var err error + + mpl := new(MockPaperList) + ctx := new(MockTransactionContext) + ctx.paperList = mpl + + contract := new(Contract) + + var sentPaper *CommercialPaper + + mpl.On("AddPaper", mock.MatchedBy(func(paper *CommercialPaper) bool { sentPaper = paper; return paper.Issuer == "someissuer" })).Return(nil) + mpl.On("AddPaper", mock.MatchedBy(func(paper *CommercialPaper) bool { sentPaper = paper; return paper.Issuer == "someotherissuer" })).Return(errors.New("AddPaper error")) + + expectedPaper := CommercialPaper{PaperNumber: "somepaper", Issuer: "someissuer", IssueDateTime: "someissuedate", FaceValue: 1000, MaturityDateTime: "somematuritydate", Owner: "someissuer", state: 1} + paper, err = contract.Issue(ctx, "someissuer", "somepaper", "someissuedate", "somematuritydate", 1000) + assert.Nil(t, err, "should not error when add paper does not error") + assert.Equal(t, sentPaper, paper, "should send the same paper as it returns to add paper") + assert.Equal(t, expectedPaper, *paper, "should correctly configure paper") + + paper, err = contract.Issue(ctx, "someotherissuer", "somepaper", "someissuedate", "somematuritydate", 1000) + assert.EqualError(t, err, "AddPaper error", "should return error when add paper fails") + assert.Nil(t, paper, "should not return paper when fails") +} + +func TestBuy(t *testing.T) { + var paper *CommercialPaper + var err error + + mpl := new(MockPaperList) + ctx := new(MockTransactionContext) + ctx.paperList = mpl + + contract := new(Contract) + + wsPaper := new(CommercialPaper) + resetPaper(wsPaper) + + var sentPaper *CommercialPaper + var emptyPaper *CommercialPaper + shouldError := false + + mpl.On("GetPaper", "someissuer", "somepaper").Return(wsPaper, nil) + mpl.On("GetPaper", "someotherissuer", "someotherpaper").Return(emptyPaper, errors.New("GetPaper error")) + mpl.On("UpdatePaper", mock.MatchedBy(func(paper *CommercialPaper) bool { return shouldError })).Return(errors.New("UpdatePaper error")) + mpl.On("UpdatePaper", mock.MatchedBy(func(paper *CommercialPaper) bool { sentPaper = paper; return !shouldError })).Return(nil) + + paper, err = contract.Buy(ctx, "someotherissuer", "someotherpaper", "someowner", "someotherowner", 100, "2019-12-10:10:00") + assert.EqualError(t, err, "GetPaper error", "should return error when GetPaper errors") + assert.Nil(t, paper, "should return nil for paper when GetPaper errors") + + paper, err = contract.Buy(ctx, "someissuer", "somepaper", "someotherowner", "someowner", 100, "2019-12-10:10:00") + assert.EqualError(t, err, "Paper someissuer:somepaper is not owned by someotherowner", "should error when sent owner not correct") + assert.Nil(t, paper, "should not return paper for bad owner error") + + resetPaper(wsPaper) + wsPaper.SetRedeemed() + paper, err = contract.Buy(ctx, "someissuer", "somepaper", "someowner", "someotherowner", 100, "2019-12-10:10:00") + assert.EqualError(t, err, "Paper someissuer:somepaper is not trading. Current state = REDEEMED") + assert.Nil(t, paper, "should not return paper for bad state error") + + resetPaper(wsPaper) + shouldError = true + paper, err = contract.Buy(ctx, "someissuer", "somepaper", "someowner", "someotherowner", 100, "2019-12-10:10:00") + assert.EqualError(t, err, "UpdatePaper error", "should error when update paper fails") + assert.Nil(t, paper, "should not return paper for bad state error") + shouldError = false + + resetPaper(wsPaper) + wsPaper.SetIssued() + paper, err = contract.Buy(ctx, "someissuer", "somepaper", "someowner", "someotherowner", 100, "2019-12-10:10:00") + assert.Nil(t, err, "should not error when good paper and owner") + assert.Equal(t, "someotherowner", paper.Owner, "should update the owner of the paper") + assert.True(t, paper.IsTrading(), "should mark issued paper as trading") + assert.Equal(t, sentPaper, paper, "should update same paper as it returns in the world state") +} + +func TestRedeem(t *testing.T) { + var paper *CommercialPaper + var err error + + mpl := new(MockPaperList) + ctx := new(MockTransactionContext) + ctx.paperList = mpl + + contract := new(Contract) + + var sentPaper *CommercialPaper + wsPaper := new(CommercialPaper) + resetPaper(wsPaper) + + var emptyPaper *CommercialPaper + shouldError := false + + mpl.On("GetPaper", "someissuer", "somepaper").Return(wsPaper, nil) + mpl.On("GetPaper", "someotherissuer", "someotherpaper").Return(emptyPaper, errors.New("GetPaper error")) + mpl.On("UpdatePaper", mock.MatchedBy(func(paper *CommercialPaper) bool { return shouldError })).Return(errors.New("UpdatePaper error")) + mpl.On("UpdatePaper", mock.MatchedBy(func(paper *CommercialPaper) bool { sentPaper = paper; return !shouldError })).Return(nil) + + paper, err = contract.Redeem(ctx, "someotherissuer", "someotherpaper", "someowner", "2021-12-10:10:00") + assert.EqualError(t, err, "GetPaper error", "should error when GetPaper errors") + assert.Nil(t, paper, "should not return paper when GetPaper errors") + + paper, err = contract.Redeem(ctx, "someissuer", "somepaper", "someotherowner", "2021-12-10:10:00") + assert.EqualError(t, err, "Paper someissuer:somepaper is not owned by someotherowner", "should error when paper owned by someone else") + assert.Nil(t, paper, "should not return paper when errors as owned by someone else") + + resetPaper(wsPaper) + wsPaper.SetRedeemed() + paper, err = contract.Redeem(ctx, "someissuer", "somepaper", "someowner", "2021-12-10:10:00") + assert.EqualError(t, err, "Paper someissuer:somepaper is already redeemed", "should error when paper already redeemed") + assert.Nil(t, paper, "should not return paper when errors as already redeemed") + + shouldError = true + resetPaper(wsPaper) + paper, err = contract.Redeem(ctx, "someissuer", "somepaper", "someowner", "2021-12-10:10:00") + assert.EqualError(t, err, "UpdatePaper error", "should error when update paper errors") + assert.Nil(t, paper, "should not return paper when UpdatePaper errors") + shouldError = false + + resetPaper(wsPaper) + paper, err = contract.Redeem(ctx, "someissuer", "somepaper", "someowner", "2021-12-10:10:00") + assert.Nil(t, err, "should not error on good redeem") + assert.True(t, paper.IsRedeemed(), "should return redeemed paper") + assert.Equal(t, sentPaper, paper, "should update same paper as it returns in the world state") +} diff --git a/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/paperlist.go b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/paperlist.go new file mode 100644 index 00000000..c3bdf810 --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/paperlist.go @@ -0,0 +1,55 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ledgerapi "github.com/hyperledger/fabric-samples/commercial-paper/organization/digibank/contract-go/ledger-api" + +// ListInterface defines functionality needed +// to interact with the world state on behalf +// of a commercial paper +type ListInterface interface { + AddPaper(*CommercialPaper) error + GetPaper(string, string) (*CommercialPaper, error) + UpdatePaper(*CommercialPaper) error +} + +type list struct { + stateList ledgerapi.StateListInterface +} + +func (cpl *list) AddPaper(paper *CommercialPaper) error { + return cpl.stateList.AddState(paper) +} + +func (cpl *list) GetPaper(issuer string, paperNumber string) (*CommercialPaper, error) { + cp := new(CommercialPaper) + + err := cpl.stateList.GetState(CreateCommercialPaperKey(issuer, paperNumber), cp) + + if err != nil { + return nil, err + } + + return cp, nil +} + +func (cpl *list) UpdatePaper(paper *CommercialPaper) error { + return cpl.stateList.UpdateState(paper) +} + +// NewList create a new list from context +func newList(ctx TransactionContextInterface) *list { + stateList := new(ledgerapi.StateList) + stateList.Ctx = ctx + stateList.Name = "org.papernet.commercialpaperlist" + stateList.Deserialize = func(bytes []byte, state ledgerapi.StateInterface) error { + return Deserialize(bytes, state.(*CommercialPaper)) + } + + list := new(list) + list.stateList = stateList + + return list +} diff --git a/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/paperlist_test.go b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/paperlist_test.go new file mode 100644 index 00000000..33a2c30b --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/commercial-paper/paperlist_test.go @@ -0,0 +1,103 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "errors" + "testing" + + ledgerapi "github.com/hyperledger/fabric-samples/commercial-paper/organization/digibank/contract-go/ledger-api" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +// ######### +// HELPERS +// ######### + +type MockStateList struct { + mock.Mock +} + +func (msl *MockStateList) AddState(state ledgerapi.StateInterface) error { + args := msl.Called(state) + + return args.Error(0) +} + +func (msl *MockStateList) GetState(key string, state ledgerapi.StateInterface) error { + args := msl.Called(key, state) + + state.(*CommercialPaper).PaperNumber = "somepaper" + + return args.Error(0) +} + +func (msl *MockStateList) UpdateState(state ledgerapi.StateInterface) error { + args := msl.Called(state) + + return args.Error(0) +} + +// ######### +// TESTS +// ######### + +func TestAddPaper(t *testing.T) { + paper := new(CommercialPaper) + + list := new(list) + msl := new(MockStateList) + msl.On("AddState", paper).Return(errors.New("Called add state correctly")) + list.stateList = msl + + err := list.AddPaper(paper) + assert.EqualError(t, err, "Called add state correctly", "should call state list add state with paper") +} + +func TestGetPaper(t *testing.T) { + var cp *CommercialPaper + var err error + + list := new(list) + msl := new(MockStateList) + msl.On("GetState", CreateCommercialPaperKey("someissuer", "somepaper"), mock.MatchedBy(func(state ledgerapi.StateInterface) bool { _, ok := state.(*CommercialPaper); return ok })).Return(nil) + msl.On("GetState", CreateCommercialPaperKey("someotherissuer", "someotherpaper"), mock.MatchedBy(func(state ledgerapi.StateInterface) bool { _, ok := state.(*CommercialPaper); return ok })).Return(errors.New("GetState error")) + list.stateList = msl + + cp, err = list.GetPaper("someissuer", "somepaper") + assert.Nil(t, err, "should not error when get state on state list does not error") + assert.Equal(t, cp.PaperNumber, "somepaper", "should use state list GetState to fill commercial paper") + + cp, err = list.GetPaper("someotherissuer", "someotherpaper") + assert.EqualError(t, err, "GetState error", "should return error when state list get state errors") + assert.Nil(t, cp, "should not return commercial paper on error") +} + +func TestUpdatePaper(t *testing.T) { + paper := new(CommercialPaper) + + list := new(list) + msl := new(MockStateList) + msl.On("UpdateState", paper).Return(errors.New("Called update state correctly")) + list.stateList = msl + + err := list.UpdatePaper(paper) + assert.EqualError(t, err, "Called update state correctly", "should call state list update state with paper") +} + +func TestNewStateList(t *testing.T) { + ctx := new(TransactionContext) + list := newList(ctx) + stateList, ok := list.stateList.(*ledgerapi.StateList) + + assert.True(t, ok, "should make statelist of type ledgerapi.StateList") + assert.Equal(t, ctx, stateList.Ctx, "should set the context to passed context") + assert.Equal(t, "org.papernet.commercialpaperlist", stateList.Name, "should set the name for the list") + + expectedErr := Deserialize([]byte("bad json"), new(CommercialPaper)) + err := stateList.Deserialize([]byte("bad json"), new(CommercialPaper)) + assert.EqualError(t, err, expectedErr.Error(), "should call Deserialize when stateList.Deserialize called") +} diff --git a/library-tracker/organization/bullard-sanford/contract-go/go.mod b/library-tracker/organization/bullard-sanford/contract-go/go.mod new file mode 100644 index 00000000..436712dc --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/go.mod @@ -0,0 +1,13 @@ +module github.com/hyperledger/fabric-samples/commercial-paper/organization/digibank/contract-go + +go 1.13 + +require ( + github.com/go-openapi/jsonreference v0.19.3 // indirect + github.com/hyperledger/fabric-contract-api-go v1.0.0 + github.com/mailru/easyjson v0.7.0 // indirect + github.com/stretchr/testify v1.4.0 + golang.org/x/net v0.0.0-20191028085509-fe3aa8a45271 // indirect + google.golang.org/genproto v0.0.0-20191028173616-919d9bdd9fe6 // indirect + google.golang.org/grpc v1.24.0 // indirect +) diff --git a/library-tracker/organization/bullard-sanford/contract-go/go.sum b/library-tracker/organization/bullard-sanford/contract-go/go.sum new file mode 100644 index 00000000..786c656e --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/go.sum @@ -0,0 +1,255 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/DATA-DOG/godog v0.7.13/go.mod h1:z2OZ6a3X0/YAKVqLfVzYBwFt3j6uSt3Xrqa7XTtcQE0= +github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/awjh-ibm/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 h1:I27he/2AiTiQ7b9HNG69Yti+8Z5uRu9LyYI+zHK+3v0= +github.com/awjh-ibm/fabric-chaincode-go v0.0.0-20191101104715-ed6605dbcf4a h1:Og6B6TGwSJ+TANq/nVFldoq2vdFpq6eaz6uJdn4u6mc= +github.com/awjh-ibm/fabric-chaincode-go v0.0.0-20191101104715-ed6605dbcf4a/go.mod h1:EPsP9u9T1bG0HG3fxmh/88ijXC1ivmFpZImQe/XbJ34= +github.com/awjh-ibm/fabric-chaincode-go v0.0.0-20191101150549-e9d05b39373d h1:Wjv4Jb5Ir0ZhauaHFnKqLXrM5dywA0dryw4iOKfOTkk= +github.com/awjh-ibm/fabric-chaincode-go v0.0.0-20191101150549-e9d05b39373d/go.mod h1:EPsP9u9T1bG0HG3fxmh/88ijXC1ivmFpZImQe/XbJ34= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= +github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= +github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= +github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= +github.com/go-openapi/analysis v0.19.4/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= +github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= +github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= +github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= +github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= +github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= +github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= +github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= +github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= +github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= +github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= +github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= +github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= +github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/spec v0.19.4 h1:ixzUSnHTd6hCemgtAJgluaTSGYpLNpJY4mA2DIkdOAo= +github.com/go-openapi/spec v0.19.4/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= +github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= +github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= +github.com/go-openapi/strfmt v0.19.2/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= +github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= +github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= +github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= +github.com/go-openapi/validate v0.19.4/go.mod h1:BkJ0ZmXui7yB0bJXWSXgLPNTmbLVeX/3D1xn/N9mMUM= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/envy v1.7.1 h1:OQl5ys5MBea7OGCdvPbBJWRgnhC/fGona6QKfvFeau8= +github.com/gobuffalo/envy v1.7.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w= +github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= +github.com/gobuffalo/logger v1.0.1/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= +github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4= +github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= +github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg= +github.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk= +github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw= +github.com/gobuffalo/packr/v2 v2.7.1/go.mod h1:qYEvAazPaVxy7Y7KR0W8qYEE+RymX74kETFqjFoFlOc= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gucumber/gucumber v0.0.0-20180127021336-7d5c79e832a2/go.mod h1:YbdHRK9ViqwGMS0rtRY+1I6faHvVyyurKPIPwifihxI= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20191108205148-17c4b2760b56 h1:BUCrT0VEO4ryJ7DAEGccqnEJcdHydx7wIJQ0ZGFEjJM= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20191108205148-17c4b2760b56/go.mod h1:HZK6PKLWrvdD/t0oSLiyaRaUM6fZ7qjJuOlb0zrn0mo= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20200128192331-2d899240a7ed/go.mod h1:N7H3sA7Tx4k/YzFq7U0EPdqJtqvM4Kild0JoCc7C0Dc= +github.com/hyperledger/fabric-contract-api-go v0.0.0-20191118113407-4c6ff12b4f96 h1:1PaDE2QfQB/5ZnvlrYZNH62xMtKE/9cjwIzy9fjpJmg= +github.com/hyperledger/fabric-contract-api-go v0.0.0-20191118113407-4c6ff12b4f96/go.mod h1:SdJkyS7/oJltu5Ap//5sCEdNlvj+ZzD3TwnJOt3zf4c= +github.com/hyperledger/fabric-contract-api-go v1.0.0 h1:ma1nQX1S/a3zDkfkTb0QXQHNGgJUmEfqHA9/CWmz8Y0= +github.com/hyperledger/fabric-contract-api-go v1.0.0/go.mod h1:PHF7I0hYI0cZF2j7cdyNHaY5FJD3Q49qnnNgsmxEPbM= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-protos-go v0.0.0-20190919234611-2a87503ac7c9/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-protos-go v0.0.0-20191101064633-9949a658b7e5 h1:2GAVnTeca8eaet9Ked2Usqy7GstZd6JkmsFHiyJI5hY= +github.com/hyperledger/fabric-protos-go v0.0.0-20191101064633-9949a658b7e5/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-protos-go v0.0.0-20191114160927-6bee4929a99f h1:t6+iLphkbJrM8i6YB0T/XxvoTlo50FglEf2hMJHxuOo= +github.com/hyperledger/fabric-protos-go v0.0.0-20191114160927-6bee4929a99f/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-protos-go v0.0.0-20200124220212-e9cfc186ba7b/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-samples v1.4.4 h1:6CdBpR8M4ajOnXUK4e8cO82/lXQKfAX2L5oTJtzWjLk= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/karrick/godirwalk v1.13.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.0 h1:aizVhC/NAAcKWb+5QsU1iNOZb4Yws5UO2I+aIprQITM= +github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.4.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.5.0 h1:Usqs0/lDK/NqTkvrmKSwA/3XkZAs7ZAW/eLeQ2MVBTw= +github.com/rogpeppe/go-internal v1.5.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191028085509-fe3aa8a45271 h1:N66aaryRB3Ax92gH0v3hp1QYZ3zWWCCUR/j8Ifh45Ss= +golang.org/x/net v0.0.0-20191028085509-fe3aa8a45271/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542 h1:6ZQFf1D2YYDDI7eSwW8adlkkavTB9sw5I24FVtEvNUQ= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191029155521-f43be2a4598c h1:S/FtSvpNLtFBgjTqcKsRpsa6aVsI6iztaz1bQd9BJwE= +golang.org/x/sys v0.0.0-20191029155521-f43be2a4598c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191004055002-72853e10c5a3/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191024074452-7defa796fec0/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20191028173616-919d9bdd9fe6 h1:UXl+Zk3jqqcbEVV7ace5lrt4YdA4tXiz3f/KbmD29Vo= +google.golang.org/genproto v0.0.0-20191028173616-919d9bdd9fe6/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s= +google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/library-tracker/organization/bullard-sanford/contract-go/ledger-api/state.go b/library-tracker/organization/bullard-sanford/contract-go/ledger-api/state.go new file mode 100644 index 00000000..6d8c3f86 --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/ledger-api/state.go @@ -0,0 +1,27 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package ledgerapi + +import ( + "strings" +) + +// SplitKey splits a key on colon +func SplitKey(key string) []string { + return strings.Split(key, ":") +} + +// MakeKey joins key parts using colon +func MakeKey(keyParts ...string) string { + return strings.Join(keyParts, ":") +} + +// StateInterface interface states must implement +// for use in a list +type StateInterface interface { + // GetSplitKey return components that combine to form the key + GetSplitKey() []string + Serialize() ([]byte, error) +} diff --git a/library-tracker/organization/bullard-sanford/contract-go/ledger-api/statelist.go b/library-tracker/organization/bullard-sanford/contract-go/ledger-api/statelist.go new file mode 100644 index 00000000..492efb34 --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/ledger-api/statelist.go @@ -0,0 +1,61 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package ledgerapi + +import ( + "fmt" + + "github.com/hyperledger/fabric-contract-api-go/contractapi" +) + +// StateListInterface functions that a state list +// should have +type StateListInterface interface { + AddState(StateInterface) error + GetState(string, StateInterface) error + UpdateState(StateInterface) error +} + +// StateList useful for managing putting data in and out +// of the ledger. Implementation of StateListInterface +type StateList struct { + Ctx contractapi.TransactionContextInterface + Name string + Deserialize func([]byte, StateInterface) error +} + +// AddState puts state into world state +func (sl *StateList) AddState(state StateInterface) error { + key, _ := sl.Ctx.GetStub().CreateCompositeKey(sl.Name, state.GetSplitKey()) + data, err := state.Serialize() + + if err != nil { + return err + } + + return sl.Ctx.GetStub().PutState(key, data) +} + +// GetState returns state from world state. Unmarshalls the JSON +// into passed state. Key is the split key value used in Add/Update +// joined using a colon +func (sl *StateList) GetState(key string, state StateInterface) error { + ledgerKey, _ := sl.Ctx.GetStub().CreateCompositeKey(sl.Name, SplitKey(key)) + data, err := sl.Ctx.GetStub().GetState(ledgerKey) + + if err != nil { + return err + } else if data == nil { + return fmt.Errorf("No state found for %s", key) + } + + return sl.Deserialize(data, state) +} + +// UpdateState puts state into world state. Same as AddState but +// separate as semantically different +func (sl *StateList) UpdateState(state StateInterface) error { + return sl.AddState(state) +} diff --git a/library-tracker/organization/bullard-sanford/contract-go/main.go b/library-tracker/organization/bullard-sanford/contract-go/main.go new file mode 100644 index 00000000..002c4f96 --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-go/main.go @@ -0,0 +1,35 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package main + +import ( + "fmt" + + "github.com/hyperledger/fabric-contract-api-go/contractapi" + "github.com/hyperledger/fabric-samples/commercial-paper/organization/digibank/contract-go/commercial-paper" +) + +func main() { + + contract := new(commercialpaper.Contract) + contract.TransactionContextHandler = new(commercialpaper.TransactionContext) + contract.Name = "org.papernet.commercialpaper" + contract.Info.Version = "0.0.1" + + chaincode, err := contractapi.NewChaincode(contract) + + if err != nil { + panic(fmt.Sprintf("Error creating chaincode. %s", err.Error())) + } + + chaincode.Info.Title = "CommercialPaperChaincode" + chaincode.Info.Version = "0.0.1" + + err = chaincode.Start() + + if err != nil { + panic(fmt.Sprintf("Error starting chaincode. %s", err.Error())) + } +} diff --git a/library-tracker/organization/bullard-sanford/contract-java/.gitignore b/library-tracker/organization/bullard-sanford/contract-java/.gitignore index 73d55ace..ae1478ca 100644 --- a/library-tracker/organization/bullard-sanford/contract-java/.gitignore +++ b/library-tracker/organization/bullard-sanford/contract-java/.gitignore @@ -1,5 +1,10 @@ -.gradle/ -build/ -bin/ -.classpath -.settings/ \ No newline at end of file +# +# SPDX-License-Identifier: Apache-2.0 +# + +/.classpath +/.gradle/ +/.project +/.settings/ +/bin/ +/build/ diff --git a/library-tracker/organization/bullard-sanford/contract-java/build.gradle b/library-tracker/organization/bullard-sanford/contract-java/build.gradle index 04626aec..2f04c43e 100644 --- a/library-tracker/organization/bullard-sanford/contract-java/build.gradle +++ b/library-tracker/organization/bullard-sanford/contract-java/build.gradle @@ -1,6 +1,5 @@ plugins { - id 'com.github.johnrengelman.shadow' version '2.0.3' - id 'java' + id 'java-library-distribution' } version '0.0.1' @@ -8,11 +7,10 @@ version '0.0.1' sourceCompatibility = 1.8 repositories { - mavenLocal() mavenCentral() - maven { - url 'https://jitpack.io' + maven { + url 'https://jitpack.io' } maven { url "https://hyperledger.jfrog.io/hyperledger/fabric-maven" @@ -21,23 +19,13 @@ repositories { } dependencies { - compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '1.4.2' + compileOnly group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '1.4.2' compile group: 'org.json', name: 'json', version: '20180813' testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' testImplementation 'org.assertj:assertj-core:3.11.1' testImplementation 'org.mockito:mockito-core:2.+' } -shadowJar { - baseName = 'chaincode' - version = null - classifier = null - - manifest { - attributes 'Main-Class': 'org.hyperledger.fabric.contract.ContractRouter' - } -} - test { useJUnitPlatform() testLogging { @@ -45,7 +33,6 @@ test { } } - tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters" -} +} \ No newline at end of file diff --git a/library-tracker/organization/bullard-sanford/contract-java/gradle/wrapper/gradle-wrapper.jar b/library-tracker/organization/bullard-sanford/contract-java/gradle/wrapper/gradle-wrapper.jar index f6b961fd..5c2d1cf0 100644 Binary files a/library-tracker/organization/bullard-sanford/contract-java/gradle/wrapper/gradle-wrapper.jar and b/library-tracker/organization/bullard-sanford/contract-java/gradle/wrapper/gradle-wrapper.jar differ diff --git a/library-tracker/organization/bullard-sanford/contract-java/gradle/wrapper/gradle-wrapper.properties b/library-tracker/organization/bullard-sanford/contract-java/gradle/wrapper/gradle-wrapper.properties index bf3de218..7c4388a9 100644 --- a/library-tracker/organization/bullard-sanford/contract-java/gradle/wrapper/gradle-wrapper.properties +++ b/library-tracker/organization/bullard-sanford/contract-java/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/library-tracker/organization/bullard-sanford/contract-java/gradlew b/library-tracker/organization/bullard-sanford/contract-java/gradlew old mode 100644 new mode 100755 index cccdd3d5..83f2acfd --- a/library-tracker/organization/bullard-sanford/contract-java/gradlew +++ b/library-tracker/organization/bullard-sanford/contract-java/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` diff --git a/library-tracker/organization/bullard-sanford/contract-java/gradlew.bat b/library-tracker/organization/bullard-sanford/contract-java/gradlew.bat index f9553162..9618d8d9 100644 --- a/library-tracker/organization/bullard-sanford/contract-java/gradlew.bat +++ b/library-tracker/organization/bullard-sanford/contract-java/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/library-tracker/organization/bullard-sanford/contract-java/settings.gradle b/library-tracker/organization/bullard-sanford/contract-java/settings.gradle index 343bba0d..0c5f0723 100644 --- a/library-tracker/organization/bullard-sanford/contract-java/settings.gradle +++ b/library-tracker/organization/bullard-sanford/contract-java/settings.gradle @@ -1,2 +1,2 @@ -rootProject.name = 'java-contractcontract' +rootProject.name = 'papercontract' diff --git a/library-tracker/organization/bullard-sanford/contract-java/shadow-build.gradle b/library-tracker/organization/bullard-sanford/contract-java/shadow-build.gradle new file mode 100644 index 00000000..f683babb --- /dev/null +++ b/library-tracker/organization/bullard-sanford/contract-java/shadow-build.gradle @@ -0,0 +1,50 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ +plugins { + id 'com.github.johnrengelman.shadow' version '5.1.0' + id 'java' +} + + +version '0.0.1' + +sourceCompatibility = 1.8 + +repositories { + mavenLocal() + mavenCentral() + maven { + url 'https://jitpack.io' + } +} + +dependencies { + implementation group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.0.+' + implementation group: 'org.json', name: 'json', version: '20180813' + testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' + testImplementation 'org.assertj:assertj-core:3.11.1' + testImplementation 'org.mockito:mockito-core:2.+' +} + +test { + useJUnitPlatform() + testLogging { + events "passed", "skipped", "failed" + } +} + +shadowJar { + baseName = 'chaincode' + version = null + classifier = null + + manifest { + attributes 'Main-Class': 'org.hyperledger.fabric.contract.ContractRouter' + } +} + + +tasks.withType(JavaCompile) { + options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters" +} diff --git a/library-tracker/organization/bullard-sanford/contract-java/src/main/java/org/example/CommercialPaper.java b/library-tracker/organization/bullard-sanford/contract-java/src/main/java/org/example/CommercialPaper.java index cb38eb2c..13d16b66 100644 --- a/library-tracker/organization/bullard-sanford/contract-java/src/main/java/org/example/CommercialPaper.java +++ b/library-tracker/organization/bullard-sanford/contract-java/src/main/java/org/example/CommercialPaper.java @@ -1,5 +1,5 @@ /* - * SPDX-License-Identifier: + * SPDX-License-Identifier: Apache-2.0 */ package org.example; diff --git a/library-tracker/organization/bullard-sanford/contract-java/src/main/java/org/example/ledgerapi/State.java b/library-tracker/organization/bullard-sanford/contract-java/src/main/java/org/example/ledgerapi/State.java index 5e0a15b6..46d35c38 100644 --- a/library-tracker/organization/bullard-sanford/contract-java/src/main/java/org/example/ledgerapi/State.java +++ b/library-tracker/organization/bullard-sanford/contract-java/src/main/java/org/example/ledgerapi/State.java @@ -53,7 +53,7 @@ public class State { } public static String[] splitKey(String key) { - System.out.println("Splittin gkey " + key + " " + java.util.Arrays.asList(key.split(":"))); + System.out.println("splitting key " + key + " " + java.util.Arrays.asList(key.split(":"))); return key.split(":"); } diff --git a/library-tracker/organization/bullard-sanford/contract/ledger-api/statelist.js b/library-tracker/organization/bullard-sanford/contract/ledger-api/statelist.js index 17604334..42f4e42b 100644 --- a/library-tracker/organization/bullard-sanford/contract/ledger-api/statelist.js +++ b/library-tracker/organization/bullard-sanford/contract/ledger-api/statelist.js @@ -42,7 +42,11 @@ class StateList { async getState(key) { let ledgerKey = this.ctx.stub.createCompositeKey(this.name, State.splitKey(key)); let data = await this.ctx.stub.getState(ledgerKey); +<<<<<<< HEAD:library-tracker/organization/bullard-sanford/contract/ledger-api/statelist.js if (data){ +======= + if (data && data.toString('utf8')) { +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:commercial-paper/organization/digibank/contract/ledger-api/statelist.js let state = State.deserialize(data, this.supportedClasses); return state; } else { diff --git a/library-tracker/organization/bullard-sanford/contract/package.json b/library-tracker/organization/bullard-sanford/contract/package.json index e523a73f..c385e118 100644 --- a/library-tracker/organization/bullard-sanford/contract/package.json +++ b/library-tracker/organization/bullard-sanford/contract/package.json @@ -18,8 +18,13 @@ "author": "hyperledger", "license": "Apache-2.0", "dependencies": { +<<<<<<< HEAD:library-tracker/organization/bullard-sanford/contract/package.json "fabric-contract-api": "~1.4.0", "fabric-shim": "~1.4.0" +======= + "fabric-contract-api": "^2.0.0", + "fabric-shim": "^2.0.0" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:commercial-paper/organization/magnetocorp/contract/package.json }, "devDependencies": { "chai": "^4.1.2", diff --git a/library-tracker/organization/bullard-sanford/digibank.sh b/library-tracker/organization/bullard-sanford/digibank.sh new file mode 100755 index 00000000..3aad75d2 --- /dev/null +++ b/library-tracker/organization/bullard-sanford/digibank.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# SPDX-License-Identifier: Apache-2.0 +# +shopt -s extglob + +function _exit(){ + printf "Exiting:%s\n" "$1" + exit -1 +} + +: ${CHANNEL_NAME:="mychannel"} +: ${DELAY:="3"} +: ${MAX_RETRY:="5"} +: ${VERBOSE:="false"} + +# Where am I? +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Locate the test network +cd "${DIR}/../../../test-network" +env | sort > /tmp/env.orig + +OVERRIDE_ORG="1" +. ./scripts/envVar.sh + +parsePeerConnectionParameters 1 2 + +export PEER_PARMS="${PEER_CONN_PARMS##*( )}" + +# set the fabric config path +export FABRIC_CFG_PATH="${DIR}/../../../config" +export PATH="${DIR}/../../../bin:${PWD}:$PATH" + +env | sort | comm -1 -3 /tmp/env.orig - | sed -E 's/(.*)=(.*)/export \1="\2"/' + +rm /tmp/env.orig + +cd ${DIR} \ No newline at end of file diff --git a/library-tracker/organization/bullard-sanford/gateway/.gitkeep b/library-tracker/organization/bullard-sanford/gateway/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/library-tracker/organization/cannavino/application-java/.settings/org.eclipse.core.resources.prefs b/library-tracker/organization/cannavino/application-java/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..7a531392 --- /dev/null +++ b/library-tracker/organization/cannavino/application-java/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 +encoding/src=UTF-8 diff --git a/library-tracker/organization/cannavino/application-java/src/org/magnetocorp/AddToWallet.java b/library-tracker/organization/cannavino/application-java/src/org/magnetocorp/AddToWallet.java new file mode 100644 index 00000000..4470021e --- /dev/null +++ b/library-tracker/organization/cannavino/application-java/src/org/magnetocorp/AddToWallet.java @@ -0,0 +1,44 @@ +/* +SPDX-License-Identifier: Apache-2.0 +*/ + +package org.magnetocorp; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import org.hyperledger.fabric.gateway.GatewayException; +import org.hyperledger.fabric.gateway.Wallet; +import org.hyperledger.fabric.gateway.Wallet.Identity; + +public class AddToWallet { + + public static void main(String[] args) { + try { + // A wallet stores a collection of identities + Path walletPath = Paths.get("..", "identity", "user", "isabella", "wallet"); + Wallet wallet = Wallet.createFileSystemWallet(walletPath); + + // Location of credentials to be stored in the wallet + Path credentialPath = Paths.get("..", "..",".." ,".." ,"basic-network", "crypto-config", + "peerOrganizations", "org1.example.com", "users", "User1@org1.example.com", "msp"); + Path certificatePem = credentialPath.resolve(Paths.get("signcerts", + "User1@org1.example.com-cert.pem")); + Path privateKey = credentialPath.resolve(Paths.get("keystore", + "c75bd6911aca808941c3557ee7c97e90f3952e379497dc55eb903f31b50abc83_sk")); + + // Load credentials into wallet + String identityLabel = "User1@org1.example.com"; + Identity identity = Identity.createIdentity("Org1MSP", Files.newBufferedReader(certificatePem), Files.newBufferedReader(privateKey)); + + wallet.put(identityLabel, identity); + + } catch (IOException e) { + System.err.println("Error adding to wallet"); + e.printStackTrace(); + } + } + +} diff --git a/library-tracker/organization/cannavino/application-java/src/org/magnetocorp/Issue.java b/library-tracker/organization/cannavino/application-java/src/org/magnetocorp/Issue.java new file mode 100644 index 00000000..352d65d9 --- /dev/null +++ b/library-tracker/organization/cannavino/application-java/src/org/magnetocorp/Issue.java @@ -0,0 +1,73 @@ +/* +SPDX-License-Identifier: Apache-2.0 +*/ + +package org.magnetocorp; + +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Map; +import java.util.concurrent.TimeoutException; + +import org.hyperledger.fabric.gateway.Contract; +import org.hyperledger.fabric.gateway.Gateway; +import org.hyperledger.fabric.gateway.GatewayException; +import org.hyperledger.fabric.gateway.Network; +import org.hyperledger.fabric.gateway.Wallet; +import org.papernet.CommercialPaper; + +public class Issue { + + private static final String ENVKEY="CONTRACT_NAME"; + + public static void main(String[] args) { + + String contractName="papercontract"; + // get the name of the contract, in case it is overridden + Map envvar = System.getenv(); + if (envvar.containsKey(ENVKEY)){ + contractName=envvar.get(ENVKEY); + } + + Gateway.Builder builder = Gateway.createBuilder(); + + try { + // A wallet stores a collection of identities + Path walletPath = Paths.get("..", "identity", "user", "isabella", "wallet"); + Wallet wallet = Wallet.createFileSystemWallet(walletPath); + + String userName = "User1@org1.example.com"; + + Path connectionProfile = Paths.get("..", "gateway", "networkConnection.yaml"); + + // Set connection options on the gateway builder + builder.identity(wallet, userName).networkConfig(connectionProfile).discovery(false); + + // Connect to gateway using application specified parameters + try(Gateway gateway = builder.connect()) { + + // Access PaperNet network + System.out.println("Use network channel: mychannel."); + Network network = gateway.getNetwork("mychannel"); + + // Get addressability to commercial paper contract + System.out.println("Use org.papernet.commercialpaper smart contract."); + Contract contract = network.getContract(contractName, "org.papernet.commercialpaper"); + + // Issue commercial paper + System.out.println("Submit commercial paper issue transaction."); + byte[] response = contract.submitTransaction("issue", "MagnetoCorp", "00001", "2020-05-31", "2020-11-30", "5000000"); + + // Process response + System.out.println("Process issue transaction response."); + CommercialPaper paper = CommercialPaper.deserialize(response); + System.out.println(paper); + } + } catch (GatewayException | IOException | TimeoutException | InterruptedException e) { + e.printStackTrace(); + System.exit(-1); + } + } + +} diff --git a/library-tracker/organization/cannavino/application-java/src/org/papernet/CommercialPaper.java b/library-tracker/organization/cannavino/application-java/src/org/papernet/CommercialPaper.java index dbb4e3f1..e909b494 100644 --- a/library-tracker/organization/cannavino/application-java/src/org/papernet/CommercialPaper.java +++ b/library-tracker/organization/cannavino/application-java/src/org/papernet/CommercialPaper.java @@ -1,19 +1,20 @@ /* - * SPDX-License-Identifier: + * SPDX-License-Identifier: Apache-2.0 */ package org.papernet; import static java.nio.charset.StandardCharsets.UTF_8; -import org.papernet.ledgerapi.State; import org.hyperledger.fabric.contract.annotation.DataType; import org.hyperledger.fabric.contract.annotation.Property; import org.json.JSONObject; import org.json.JSONPropertyIgnore; +import org.papernet.ledgerapi.State; @DataType() public class CommercialPaper extends State { + // Enumerate commercial paper state values public final static String ISSUED = "ISSUED"; public final static String TRADING = "TRADING"; @@ -161,8 +162,8 @@ public class CommercialPaper extends State { String maturityDateTime = json.getString("maturityDateTime"); String owner = json.getString("owner"); int faceValue = json.getInt("faceValue"); - String state = json.getString("state"); - return createInstance(issuer, paperNumber, issueDateTime, maturityDateTime, faceValue,owner,state); + String state = json.getString("state"); + return createInstance(issuer, paperNumber, issueDateTime, maturityDateTime, faceValue, owner, state); } public static byte[] serialize(CommercialPaper paper) { @@ -175,7 +176,8 @@ public class CommercialPaper extends State { public static CommercialPaper createInstance(String issuer, String paperNumber, String issueDateTime, String maturityDateTime, int faceValue, String owner, String state) { return new CommercialPaper().setIssuer(issuer).setPaperNumber(paperNumber).setMaturityDateTime(maturityDateTime) - .setFaceValue(faceValue).setKey().setIssueDateTime(issueDateTime).setOwner(owner).setState(state); + .setFaceValue(faceValue).setKey().setIssueDateTime(issueDateTime).setOwner(issuer).setState(state); } + } diff --git a/library-tracker/organization/cannavino/application-java/src/org/papernet/ledgerapi/State.java b/library-tracker/organization/cannavino/application-java/src/org/papernet/ledgerapi/State.java index 18158193..a32abc02 100644 --- a/library-tracker/organization/cannavino/application-java/src/org/papernet/ledgerapi/State.java +++ b/library-tracker/organization/cannavino/application-java/src/org/papernet/ledgerapi/State.java @@ -53,7 +53,7 @@ public class State { } public static String[] splitKey(String key) { - System.out.println("Splittin gkey " + key + " " + java.util.Arrays.asList(key.split(":"))); + System.out.println("splitting key " + key + " " + java.util.Arrays.asList(key.split(":"))); return key.split(":"); } diff --git a/library-tracker/organization/cannavino/application/addToWallet.js b/library-tracker/organization/cannavino/application/addToWallet.js index b2b4415f..72b163bc 100644 --- a/library-tracker/organization/cannavino/application/addToWallet.js +++ b/library-tracker/organization/cannavino/application/addToWallet.js @@ -6,20 +6,27 @@ // Bring key classes into scope, most importantly Fabric SDK network class const fs = require('fs'); -const { FileSystemWallet, X509WalletMixin } = require('fabric-network'); +const { Wallets } = require('fabric-network'); const path = require('path'); +<<<<<<< HEAD:library-tracker/organization/cannavino/application/addToWallet.js const fixtures = path.resolve(__dirname, '../../../../basic-network'); // A wallet stores a collection of identities const wallet = new FileSystemWallet('../identity/user/balaji/wallet'); +======= +const fixtures = path.resolve(__dirname, '../../../../test-network'); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:commercial-paper/organization/magnetocorp/application/addToWallet.js async function main() { // Main try/catch block try { + // A wallet stores a collection of identities + const wallet = await Wallets.newFileSystemWallet('../identity/user/isabella/wallet'); // Identity to credentials to be stored in the wallet +<<<<<<< HEAD:library-tracker/organization/cannavino/application/addToWallet.js const credPath = path.join(fixtures, '/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com'); const cert = fs.readFileSync(path.join(credPath, '/msp/signcerts/Admin@org1.example.com-cert.pem')).toString(); const key = fs.readFileSync(path.join(credPath, '/msp/keystore/cd96d5260ad4757551ed4a5a991e62130f8008a0bf996e4e4b84cd097a747fec_sk')).toString(); @@ -29,6 +36,26 @@ async function main() { const identity = X509WalletMixin.createIdentity('Org1MSP', cert, key); await wallet.import(identityLabel, identity); +======= + const credPath = path.join(fixtures, '/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com'); + const certificate = fs.readFileSync(path.join(credPath, '/msp/signcerts/User1@org2.example.com-cert.pem')).toString(); + const privateKey = fs.readFileSync(path.join(credPath, '/msp/keystore/priv_sk')).toString(); + + // Load credentials into wallet + const identityLabel = 'isabella'; + + const identity = { + credentials: { + certificate, + privateKey + }, + mspId: 'Org2MSP', + type: 'X.509' + } + + + await wallet.put(identityLabel,identity); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:commercial-paper/organization/magnetocorp/application/addToWallet.js } catch (error) { console.log(`Error adding to wallet. ${error}`); diff --git a/library-tracker/organization/cannavino/application/package.json b/library-tracker/organization/cannavino/application/package.json index 3655349d..796b565d 100644 --- a/library-tracker/organization/cannavino/application/package.json +++ b/library-tracker/organization/cannavino/application/package.json @@ -9,10 +9,15 @@ }, "keywords": [], "author": "", - "license": "ISC", + "license": "Apache-2.0", "dependencies": { +<<<<<<< HEAD:library-tracker/organization/cannavino/application/package.json "fabric-network": "~1.4.0", "fabric-client": "~1.4.0", +======= + "fabric-network": "beta", + "fabric-client": "beta", +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:commercial-paper/organization/magnetocorp/application/package.json "js-yaml": "^3.12.0" }, "devDependencies": { diff --git a/library-tracker/organization/cannavino/configuration/cli/docker-compose.yml b/library-tracker/organization/cannavino/configuration/cli/docker-compose.yml index 434b2a96..de72d6c2 100644 --- a/library-tracker/organization/cannavino/configuration/cli/docker-compose.yml +++ b/library-tracker/organization/cannavino/configuration/cli/docker-compose.yml @@ -8,31 +8,41 @@ version: '2' networks: basic: external: - name: net_basic + name: net_test services: +<<<<<<< HEAD:library-tracker/organization/cannavino/configuration/cli/docker-compose.yml cliDigiBank: container_name: cliDigiBank image: hyperledger/fabric-tools +======= + cliMagnetoCorp: + container_name: cliMagnetoCorp + image: hyperledger/fabric-tools:2.0.0-beta +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:commercial-paper/organization/magnetocorp/configuration/cli/docker-compose.yml tty: true environment: - GOPATH=/opt/gopath - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - FABRIC_LOGGING_SPEC=info - CORE_PEER_ID=cli - - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org2.example.com:9051 + - CORE_PEER_LOCALMSPID=Org2MSP + - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp - CORE_CHAINCODE_KEEPALIVE=10 + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt + - ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer command: /bin/bash volumes: - /var/run/:/host/var/run/ +<<<<<<< HEAD:library-tracker/organization/cannavino/configuration/cli/docker-compose.yml - ./../../../../organization/digibank:/opt/gopath/src/github.com/ - ./../../../../../basic-network/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ +======= + - ./../../../../organization/magnetocorp:/opt/gopath/src/github.com/ + - ./../../../../../test-network/organizations:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:commercial-paper/organization/magnetocorp/configuration/cli/docker-compose.yml networks: - basic - #depends_on: - # - orderer.example.com - # - peer0.org1.example.com - # - couchdb diff --git a/library-tracker/organization/cannavino/configuration/cli/monitordocker.sh b/library-tracker/organization/cannavino/configuration/cli/monitordocker.sh index 2cf82fbd..cd388b28 100644 --- a/library-tracker/organization/cannavino/configuration/cli/monitordocker.sh +++ b/library-tracker/organization/cannavino/configuration/cli/monitordocker.sh @@ -6,7 +6,7 @@ # More information at https://github.com/gliderlabs/logspout/tree/master/httpstream if [ -z "$1" ]; then - DOCKER_NETWORK=basicnetwork_basic + DOCKER_NETWORK=net_test else DOCKER_NETWORK="$1" fi diff --git a/library-tracker/organization/cannavino/contract-go/commercial-paper/paper.go b/library-tracker/organization/cannavino/contract-go/commercial-paper/paper.go new file mode 100644 index 00000000..7eecdf45 --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/commercial-paper/paper.go @@ -0,0 +1,139 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "encoding/json" + "fmt" + + ledgerapi "github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp/contract-go/ledger-api" +) + +// State enum for commercial paper state property +type State uint + +const ( + // ISSUED state for when a paper has been issued + ISSUED State = iota + 1 + // TRADING state for when a paper is trading + TRADING + // REDEEMED state for when a paper has been redeemed + REDEEMED +) + +func (state State) String() string { + names := []string{"ISSUED", "TRADING", "REDEEMED"} + + if state < ISSUED || state > REDEEMED { + return "UNKNOWN" + } + + return names[state-1] +} + +// CreateCommercialPaperKey creates a key for commercial papers +func CreateCommercialPaperKey(issuer string, paperNumber string) string { + return ledgerapi.MakeKey(issuer, paperNumber) +} + +// Used for managing the fact status is private but want it in world state +type commercialPaperAlias CommercialPaper +type jsonCommercialPaper struct { + *commercialPaperAlias + State State `json:"currentState"` + Class string `json:"class"` + Key string `json:"key"` +} + +// CommercialPaper defines a commercial paper +type CommercialPaper struct { + PaperNumber string `json:"paperNumber"` + Issuer string `json:"issuer"` + IssueDateTime string `json:"issueDateTime"` + FaceValue int `json:"faceValue"` + MaturityDateTime string `json:"maturityDateTime"` + Owner string `json:"owner"` + state State `metadata:"currentState"` + class string `metadata:"class"` + key string `metadata:"key"` +} + +// UnmarshalJSON special handler for managing JSON marshalling +func (cp *CommercialPaper) UnmarshalJSON(data []byte) error { + jcp := jsonCommercialPaper{commercialPaperAlias: (*commercialPaperAlias)(cp)} + + err := json.Unmarshal(data, &jcp) + + if err != nil { + return err + } + + cp.state = jcp.State + + return nil +} + +// MarshalJSON special handler for managing JSON marshalling +func (cp CommercialPaper) MarshalJSON() ([]byte, error) { + jcp := jsonCommercialPaper{commercialPaperAlias: (*commercialPaperAlias)(&cp), State: cp.state, Class: "org.papernet.commercialpaper", Key: ledgerapi.MakeKey(cp.Issuer, cp.PaperNumber)} + + return json.Marshal(&jcp) +} + +// GetState returns the state +func (cp *CommercialPaper) GetState() State { + return cp.state +} + +// SetIssued returns the state to issued +func (cp *CommercialPaper) SetIssued() { + cp.state = ISSUED +} + +// SetTrading sets the state to trading +func (cp *CommercialPaper) SetTrading() { + cp.state = TRADING +} + +// SetRedeemed sets the state to redeemed +func (cp *CommercialPaper) SetRedeemed() { + cp.state = REDEEMED +} + +// IsIssued returns true if state is issued +func (cp *CommercialPaper) IsIssued() bool { + return cp.state == ISSUED +} + +// IsTrading returns true if state is trading +func (cp *CommercialPaper) IsTrading() bool { + return cp.state == TRADING +} + +// IsRedeemed returns true if state is redeemed +func (cp *CommercialPaper) IsRedeemed() bool { + return cp.state == REDEEMED +} + +// GetSplitKey returns values which should be used to form key +func (cp *CommercialPaper) GetSplitKey() []string { + return []string{cp.Issuer, cp.PaperNumber} +} + +// Serialize formats the commercial paper as JSON bytes +func (cp *CommercialPaper) Serialize() ([]byte, error) { + return json.Marshal(cp) +} + +// Deserialize formats the commercial paper from JSON bytes +func Deserialize(bytes []byte, cp *CommercialPaper) error { + err := json.Unmarshal(bytes, cp) + + if err != nil { + return fmt.Errorf("Error deserializing commercial paper. %s", err.Error()) + } + + return nil +} diff --git a/library-tracker/organization/cannavino/contract-go/commercial-paper/paper_test.go b/library-tracker/organization/cannavino/contract-go/commercial-paper/paper_test.go new file mode 100644 index 00000000..07c888bf --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/commercial-paper/paper_test.go @@ -0,0 +1,125 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "testing" + + ledgerapi "github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp/contract-go/ledger-api" + "github.com/stretchr/testify/assert" +) + +func TestString(t *testing.T) { + assert.Equal(t, "ISSUED", ISSUED.String(), "should return string for issued") + assert.Equal(t, "TRADING", TRADING.String(), "should return string for issued") + assert.Equal(t, "REDEEMED", REDEEMED.String(), "should return string for issued") + assert.Equal(t, "UNKNOWN", State(REDEEMED+1).String(), "should return unknown when not one of constants") +} + +func TestCreateCommercialPaperKey(t *testing.T) { + assert.Equal(t, ledgerapi.MakeKey("someissuer", "somepaper"), CreateCommercialPaperKey("someissuer", "somepaper"), "should return key comprised of passed values") +} + +func TestGetState(t *testing.T) { + cp := new(CommercialPaper) + cp.state = ISSUED + + assert.Equal(t, ISSUED, cp.GetState(), "should return set state") +} + +func TestSetIssued(t *testing.T) { + cp := new(CommercialPaper) + cp.SetIssued() + assert.Equal(t, ISSUED, cp.state, "should set state to trading") +} + +func TestSetTrading(t *testing.T) { + cp := new(CommercialPaper) + cp.SetTrading() + assert.Equal(t, TRADING, cp.state, "should set state to trading") +} + +func TestSetRedeemed(t *testing.T) { + cp := new(CommercialPaper) + cp.SetRedeemed() + assert.Equal(t, REDEEMED, cp.state, "should set state to trading") +} + +func TestIsIssued(t *testing.T) { + cp := new(CommercialPaper) + + cp.SetIssued() + assert.True(t, cp.IsIssued(), "should be true when status set to issued") + + cp.SetTrading() + assert.False(t, cp.IsIssued(), "should be false when status not set to issued") +} + +func TestIsTrading(t *testing.T) { + cp := new(CommercialPaper) + + cp.SetTrading() + assert.True(t, cp.IsTrading(), "should be true when status set to trading") + + cp.SetRedeemed() + assert.False(t, cp.IsTrading(), "should be false when status not set to trading") +} + +func TestIsRedeemed(t *testing.T) { + cp := new(CommercialPaper) + + cp.SetRedeemed() + assert.True(t, cp.IsRedeemed(), "should be true when status set to redeemed") + + cp.SetIssued() + assert.False(t, cp.IsRedeemed(), "should be false when status not set to redeemed") +} + +func TestGetSplitKey(t *testing.T) { + cp := new(CommercialPaper) + cp.PaperNumber = "somepaper" + cp.Issuer = "someissuer" + + assert.Equal(t, []string{"someissuer", "somepaper"}, cp.GetSplitKey(), "should return issuer and paper number as split key") +} + +func TestSerialize(t *testing.T) { + cp := new(CommercialPaper) + cp.PaperNumber = "somepaper" + cp.Issuer = "someissuer" + cp.IssueDateTime = "sometime" + cp.FaceValue = 1000 + cp.MaturityDateTime = "somelatertime" + cp.Owner = "someowner" + cp.state = TRADING + + bytes, err := cp.Serialize() + assert.Nil(t, err, "should not error on serialize") + assert.Equal(t, `{"paperNumber":"somepaper","issuer":"someissuer","issueDateTime":"sometime","faceValue":1000,"maturityDateTime":"somelatertime","owner":"someowner","currentState":2,"class":"org.papernet.commercialpaper","key":"someissuer:somepaper"}`, string(bytes), "should return JSON formatted value") +} + +func TestDeserialize(t *testing.T) { + var cp *CommercialPaper + var err error + + goodJSON := `{"paperNumber":"somepaper","issuer":"someissuer","issueDateTime":"sometime","faceValue":1000,"maturityDateTime":"somelatertime","owner":"someowner","currentState":2,"class":"org.papernet.commercialpaper","key":"someissuer:somepaper"}` + expectedCp := new(CommercialPaper) + expectedCp.PaperNumber = "somepaper" + expectedCp.Issuer = "someissuer" + expectedCp.IssueDateTime = "sometime" + expectedCp.FaceValue = 1000 + expectedCp.MaturityDateTime = "somelatertime" + expectedCp.Owner = "someowner" + expectedCp.state = TRADING + cp = new(CommercialPaper) + err = Deserialize([]byte(goodJSON), cp) + assert.Nil(t, err, "should not return error for deserialize") + assert.Equal(t, expectedCp, cp, "should create expected commercial paper") + + badJSON := `{"paperNumber":"somepaper","issuer":"someissuer","issueDateTime":"sometime","faceValue":"NaN","maturityDateTime":"somelatertime","owner":"someowner","currentState":2,"class":"org.papernet.commercialpaper","key":"someissuer:somepaper"}` + cp = new(CommercialPaper) + err = Deserialize([]byte(badJSON), cp) + assert.EqualError(t, err, "Error deserializing commercial paper. json: cannot unmarshal string into Go struct field jsonCommercialPaper.faceValue of type int", "should return error for bad data") +} diff --git a/library-tracker/organization/cannavino/contract-go/commercial-paper/papercontext.go b/library-tracker/organization/cannavino/contract-go/commercial-paper/papercontext.go new file mode 100644 index 00000000..c346cf3b --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/commercial-paper/papercontext.go @@ -0,0 +1,35 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "github.com/hyperledger/fabric-contract-api-go/contractapi" +) + +// TransactionContextInterface an interface to +// describe the minimum required functions for +// a transaction context in the commercial +// paper +type TransactionContextInterface interface { + contractapi.TransactionContextInterface + GetPaperList() ListInterface +} + +// TransactionContext implementation of +// TransactionContextInterface for use with +// commercial paper contract +type TransactionContext struct { + contractapi.TransactionContext + paperList *list +} + +// GetPaperList return paper list +func (tc *TransactionContext) GetPaperList() ListInterface { + if tc.paperList == nil { + tc.paperList = newList(tc) + } + + return tc.paperList +} diff --git a/library-tracker/organization/cannavino/contract-go/commercial-paper/papercontext_test.go b/library-tracker/organization/cannavino/contract-go/commercial-paper/papercontext_test.go new file mode 100644 index 00000000..7ffc90fb --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/commercial-paper/papercontext_test.go @@ -0,0 +1,31 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "testing" + + ledgerapi "github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp/contract-go/ledger-api" + "github.com/stretchr/testify/assert" +) + +func TestGetPaperList(t *testing.T) { + var tc *TransactionContext + var expectedPaperList *list + + tc = new(TransactionContext) + expectedPaperList = newList(tc) + actualList := tc.GetPaperList().(*list) + assert.Equal(t, expectedPaperList.stateList.(*ledgerapi.StateList).Name, actualList.stateList.(*ledgerapi.StateList).Name, "should configure paper list when one not already configured") + + tc = new(TransactionContext) + expectedPaperList = new(list) + expectedStateList := new(ledgerapi.StateList) + expectedStateList.Ctx = tc + expectedStateList.Name = "existing paper list" + expectedPaperList.stateList = expectedStateList + tc.paperList = expectedPaperList + assert.Equal(t, expectedPaperList, tc.GetPaperList(), "should return set paper list when already set") +} diff --git a/library-tracker/organization/cannavino/contract-go/commercial-paper/papercontract.go b/library-tracker/organization/cannavino/contract-go/commercial-paper/papercontract.go new file mode 100644 index 00000000..4e8cee20 --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/commercial-paper/papercontract.go @@ -0,0 +1,96 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "fmt" + + "github.com/hyperledger/fabric-contract-api-go/contractapi" +) + +// Contract chaincode that defines +// the business logic for managing commercial +// paper +type Contract struct { + contractapi.Contract +} + +// Instantiate does nothing +func (c *Contract) Instantiate() { + fmt.Println("Instantiated") +} + +// Issue creates a new commercial paper and stores it in the world state +func (c *Contract) Issue(ctx TransactionContextInterface, issuer string, paperNumber string, issueDateTime string, maturityDateTime string, faceValue int) (*CommercialPaper, error) { + paper := CommercialPaper{PaperNumber: paperNumber, Issuer: issuer, IssueDateTime: issueDateTime, FaceValue: faceValue, MaturityDateTime: maturityDateTime, Owner: issuer} + paper.SetIssued() + + err := ctx.GetPaperList().AddPaper(&paper) + + if err != nil { + return nil, err + } + + return &paper, nil +} + +// Buy updates a commercial paper to be in trading status and sets the new owner +func (c *Contract) Buy(ctx TransactionContextInterface, issuer string, paperNumber string, currentOwner string, newOwner string, price int, purchaseDateTime string) (*CommercialPaper, error) { + paper, err := ctx.GetPaperList().GetPaper(issuer, paperNumber) + + if err != nil { + return nil, err + } + + if paper.Owner != currentOwner { + return nil, fmt.Errorf("Paper %s:%s is not owned by %s", issuer, paperNumber, currentOwner) + } + + if paper.IsIssued() { + paper.SetTrading() + } + + if !paper.IsTrading() { + return nil, fmt.Errorf("Paper %s:%s is not trading. Current state = %s", issuer, paperNumber, paper.GetState()) + } + + paper.Owner = newOwner + + err = ctx.GetPaperList().UpdatePaper(paper) + + if err != nil { + return nil, err + } + + return paper, nil +} + +// Redeem updates a commercial paper status to be redeemed +func (c *Contract) Redeem(ctx TransactionContextInterface, issuer string, paperNumber string, redeemingOwner string, redeenDateTime string) (*CommercialPaper, error) { + paper, err := ctx.GetPaperList().GetPaper(issuer, paperNumber) + + if err != nil { + return nil, err + } + + if paper.Owner != redeemingOwner { + return nil, fmt.Errorf("Paper %s:%s is not owned by %s", issuer, paperNumber, redeemingOwner) + } + + if paper.IsRedeemed() { + return nil, fmt.Errorf("Paper %s:%s is already redeemed", issuer, paperNumber) + } + + paper.Owner = paper.Issuer + paper.SetRedeemed() + + err = ctx.GetPaperList().UpdatePaper(paper) + + if err != nil { + return nil, err + } + + return paper, nil +} diff --git a/library-tracker/organization/cannavino/contract-go/commercial-paper/papercontract_test.go b/library-tracker/organization/cannavino/contract-go/commercial-paper/papercontract_test.go new file mode 100644 index 00000000..25c429b3 --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/commercial-paper/papercontract_test.go @@ -0,0 +1,185 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "errors" + "testing" + + "github.com/hyperledger/fabric-contract-api-go/contractapi" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +// ######### +// HELPERS +// ######### +type MockPaperList struct { + mock.Mock +} + +func (mpl *MockPaperList) AddPaper(paper *CommercialPaper) error { + args := mpl.Called(paper) + + return args.Error(0) +} + +func (mpl *MockPaperList) GetPaper(issuer string, papernumber string) (*CommercialPaper, error) { + args := mpl.Called(issuer, papernumber) + + return args.Get(0).(*CommercialPaper), args.Error(1) +} + +func (mpl *MockPaperList) UpdatePaper(paper *CommercialPaper) error { + args := mpl.Called(paper) + + return args.Error(0) +} + +type MockTransactionContext struct { + contractapi.TransactionContext + paperList *MockPaperList +} + +func (mtc *MockTransactionContext) GetPaperList() ListInterface { + return mtc.paperList +} + +func resetPaper(paper *CommercialPaper) { + paper.Owner = "someowner" + paper.SetTrading() +} + +// ######### +// TESTS +// ######### + +func TestIssue(t *testing.T) { + var paper *CommercialPaper + var err error + + mpl := new(MockPaperList) + ctx := new(MockTransactionContext) + ctx.paperList = mpl + + contract := new(Contract) + + var sentPaper *CommercialPaper + + mpl.On("AddPaper", mock.MatchedBy(func(paper *CommercialPaper) bool { sentPaper = paper; return paper.Issuer == "someissuer" })).Return(nil) + mpl.On("AddPaper", mock.MatchedBy(func(paper *CommercialPaper) bool { sentPaper = paper; return paper.Issuer == "someotherissuer" })).Return(errors.New("AddPaper error")) + + expectedPaper := CommercialPaper{PaperNumber: "somepaper", Issuer: "someissuer", IssueDateTime: "someissuedate", FaceValue: 1000, MaturityDateTime: "somematuritydate", Owner: "someissuer", state: 1} + paper, err = contract.Issue(ctx, "someissuer", "somepaper", "someissuedate", "somematuritydate", 1000) + assert.Nil(t, err, "should not error when add paper does not error") + assert.Equal(t, sentPaper, paper, "should send the same paper as it returns to add paper") + assert.Equal(t, expectedPaper, *paper, "should correctly configure paper") + + paper, err = contract.Issue(ctx, "someotherissuer", "somepaper", "someissuedate", "somematuritydate", 1000) + assert.EqualError(t, err, "AddPaper error", "should return error when add paper fails") + assert.Nil(t, paper, "should not return paper when fails") +} + +func TestBuy(t *testing.T) { + var paper *CommercialPaper + var err error + + mpl := new(MockPaperList) + ctx := new(MockTransactionContext) + ctx.paperList = mpl + + contract := new(Contract) + + wsPaper := new(CommercialPaper) + resetPaper(wsPaper) + + var sentPaper *CommercialPaper + var emptyPaper *CommercialPaper + shouldError := false + + mpl.On("GetPaper", "someissuer", "somepaper").Return(wsPaper, nil) + mpl.On("GetPaper", "someotherissuer", "someotherpaper").Return(emptyPaper, errors.New("GetPaper error")) + mpl.On("UpdatePaper", mock.MatchedBy(func(paper *CommercialPaper) bool { return shouldError })).Return(errors.New("UpdatePaper error")) + mpl.On("UpdatePaper", mock.MatchedBy(func(paper *CommercialPaper) bool { sentPaper = paper; return !shouldError })).Return(nil) + + paper, err = contract.Buy(ctx, "someotherissuer", "someotherpaper", "someowner", "someotherowner", 100, "2019-12-10:10:00") + assert.EqualError(t, err, "GetPaper error", "should return error when GetPaper errors") + assert.Nil(t, paper, "should return nil for paper when GetPaper errors") + + paper, err = contract.Buy(ctx, "someissuer", "somepaper", "someotherowner", "someowner", 100, "2019-12-10:10:00") + assert.EqualError(t, err, "Paper someissuer:somepaper is not owned by someotherowner", "should error when sent owner not correct") + assert.Nil(t, paper, "should not return paper for bad owner error") + + resetPaper(wsPaper) + wsPaper.SetRedeemed() + paper, err = contract.Buy(ctx, "someissuer", "somepaper", "someowner", "someotherowner", 100, "2019-12-10:10:00") + assert.EqualError(t, err, "Paper someissuer:somepaper is not trading. Current state = REDEEMED") + assert.Nil(t, paper, "should not return paper for bad state error") + + resetPaper(wsPaper) + shouldError = true + paper, err = contract.Buy(ctx, "someissuer", "somepaper", "someowner", "someotherowner", 100, "2019-12-10:10:00") + assert.EqualError(t, err, "UpdatePaper error", "should error when update paper fails") + assert.Nil(t, paper, "should not return paper for bad state error") + shouldError = false + + resetPaper(wsPaper) + wsPaper.SetIssued() + paper, err = contract.Buy(ctx, "someissuer", "somepaper", "someowner", "someotherowner", 100, "2019-12-10:10:00") + assert.Nil(t, err, "should not error when good paper and owner") + assert.Equal(t, "someotherowner", paper.Owner, "should update the owner of the paper") + assert.True(t, paper.IsTrading(), "should mark issued paper as trading") + assert.Equal(t, sentPaper, paper, "should update same paper as it returns in the world state") +} + +func TestRedeem(t *testing.T) { + var paper *CommercialPaper + var err error + + mpl := new(MockPaperList) + ctx := new(MockTransactionContext) + ctx.paperList = mpl + + contract := new(Contract) + + var sentPaper *CommercialPaper + wsPaper := new(CommercialPaper) + resetPaper(wsPaper) + + var emptyPaper *CommercialPaper + shouldError := false + + mpl.On("GetPaper", "someissuer", "somepaper").Return(wsPaper, nil) + mpl.On("GetPaper", "someotherissuer", "someotherpaper").Return(emptyPaper, errors.New("GetPaper error")) + mpl.On("UpdatePaper", mock.MatchedBy(func(paper *CommercialPaper) bool { return shouldError })).Return(errors.New("UpdatePaper error")) + mpl.On("UpdatePaper", mock.MatchedBy(func(paper *CommercialPaper) bool { sentPaper = paper; return !shouldError })).Return(nil) + + paper, err = contract.Redeem(ctx, "someotherissuer", "someotherpaper", "someowner", "2021-12-10:10:00") + assert.EqualError(t, err, "GetPaper error", "should error when GetPaper errors") + assert.Nil(t, paper, "should not return paper when GetPaper errors") + + paper, err = contract.Redeem(ctx, "someissuer", "somepaper", "someotherowner", "2021-12-10:10:00") + assert.EqualError(t, err, "Paper someissuer:somepaper is not owned by someotherowner", "should error when paper owned by someone else") + assert.Nil(t, paper, "should not return paper when errors as owned by someone else") + + resetPaper(wsPaper) + wsPaper.SetRedeemed() + paper, err = contract.Redeem(ctx, "someissuer", "somepaper", "someowner", "2021-12-10:10:00") + assert.EqualError(t, err, "Paper someissuer:somepaper is already redeemed", "should error when paper already redeemed") + assert.Nil(t, paper, "should not return paper when errors as already redeemed") + + shouldError = true + resetPaper(wsPaper) + paper, err = contract.Redeem(ctx, "someissuer", "somepaper", "someowner", "2021-12-10:10:00") + assert.EqualError(t, err, "UpdatePaper error", "should error when update paper errors") + assert.Nil(t, paper, "should not return paper when UpdatePaper errors") + shouldError = false + + resetPaper(wsPaper) + paper, err = contract.Redeem(ctx, "someissuer", "somepaper", "someowner", "2021-12-10:10:00") + assert.Nil(t, err, "should not error on good redeem") + assert.True(t, paper.IsRedeemed(), "should return redeemed paper") + assert.Equal(t, sentPaper, paper, "should update same paper as it returns in the world state") +} diff --git a/library-tracker/organization/cannavino/contract-go/commercial-paper/paperlist.go b/library-tracker/organization/cannavino/contract-go/commercial-paper/paperlist.go new file mode 100644 index 00000000..9946d512 --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/commercial-paper/paperlist.go @@ -0,0 +1,55 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ledgerapi "github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp/contract-go/ledger-api" + +// ListInterface defines functionality needed +// to interact with the world state on behalf +// of a commercial paper +type ListInterface interface { + AddPaper(*CommercialPaper) error + GetPaper(string, string) (*CommercialPaper, error) + UpdatePaper(*CommercialPaper) error +} + +type list struct { + stateList ledgerapi.StateListInterface +} + +func (cpl *list) AddPaper(paper *CommercialPaper) error { + return cpl.stateList.AddState(paper) +} + +func (cpl *list) GetPaper(issuer string, paperNumber string) (*CommercialPaper, error) { + cp := new(CommercialPaper) + + err := cpl.stateList.GetState(CreateCommercialPaperKey(issuer, paperNumber), cp) + + if err != nil { + return nil, err + } + + return cp, nil +} + +func (cpl *list) UpdatePaper(paper *CommercialPaper) error { + return cpl.stateList.UpdateState(paper) +} + +// NewList create a new list from context +func newList(ctx TransactionContextInterface) *list { + stateList := new(ledgerapi.StateList) + stateList.Ctx = ctx + stateList.Name = "org.papernet.commercialpaperlist" + stateList.Deserialize = func(bytes []byte, state ledgerapi.StateInterface) error { + return Deserialize(bytes, state.(*CommercialPaper)) + } + + list := new(list) + list.stateList = stateList + + return list +} diff --git a/library-tracker/organization/cannavino/contract-go/commercial-paper/paperlist_test.go b/library-tracker/organization/cannavino/contract-go/commercial-paper/paperlist_test.go new file mode 100644 index 00000000..c13ff32b --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/commercial-paper/paperlist_test.go @@ -0,0 +1,103 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package commercialpaper + +import ( + "errors" + "testing" + + ledgerapi "github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp/contract-go/ledger-api" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +// ######### +// HELPERS +// ######### + +type MockStateList struct { + mock.Mock +} + +func (msl *MockStateList) AddState(state ledgerapi.StateInterface) error { + args := msl.Called(state) + + return args.Error(0) +} + +func (msl *MockStateList) GetState(key string, state ledgerapi.StateInterface) error { + args := msl.Called(key, state) + + state.(*CommercialPaper).PaperNumber = "somepaper" + + return args.Error(0) +} + +func (msl *MockStateList) UpdateState(state ledgerapi.StateInterface) error { + args := msl.Called(state) + + return args.Error(0) +} + +// ######### +// TESTS +// ######### + +func TestAddPaper(t *testing.T) { + paper := new(CommercialPaper) + + list := new(list) + msl := new(MockStateList) + msl.On("AddState", paper).Return(errors.New("Called add state correctly")) + list.stateList = msl + + err := list.AddPaper(paper) + assert.EqualError(t, err, "Called add state correctly", "should call state list add state with paper") +} + +func TestGetPaper(t *testing.T) { + var cp *CommercialPaper + var err error + + list := new(list) + msl := new(MockStateList) + msl.On("GetState", CreateCommercialPaperKey("someissuer", "somepaper"), mock.MatchedBy(func(state ledgerapi.StateInterface) bool { _, ok := state.(*CommercialPaper); return ok })).Return(nil) + msl.On("GetState", CreateCommercialPaperKey("someotherissuer", "someotherpaper"), mock.MatchedBy(func(state ledgerapi.StateInterface) bool { _, ok := state.(*CommercialPaper); return ok })).Return(errors.New("GetState error")) + list.stateList = msl + + cp, err = list.GetPaper("someissuer", "somepaper") + assert.Nil(t, err, "should not error when get state on state list does not error") + assert.Equal(t, cp.PaperNumber, "somepaper", "should use state list GetState to fill commercial paper") + + cp, err = list.GetPaper("someotherissuer", "someotherpaper") + assert.EqualError(t, err, "GetState error", "should return error when state list get state errors") + assert.Nil(t, cp, "should not return commercial paper on error") +} + +func TestUpdatePaper(t *testing.T) { + paper := new(CommercialPaper) + + list := new(list) + msl := new(MockStateList) + msl.On("UpdateState", paper).Return(errors.New("Called update state correctly")) + list.stateList = msl + + err := list.UpdatePaper(paper) + assert.EqualError(t, err, "Called update state correctly", "should call state list update state with paper") +} + +func TestNewStateList(t *testing.T) { + ctx := new(TransactionContext) + list := newList(ctx) + stateList, ok := list.stateList.(*ledgerapi.StateList) + + assert.True(t, ok, "should make statelist of type ledgerapi.StateList") + assert.Equal(t, ctx, stateList.Ctx, "should set the context to passed context") + assert.Equal(t, "org.papernet.commercialpaperlist", stateList.Name, "should set the name for the list") + + expectedErr := Deserialize([]byte("bad json"), new(CommercialPaper)) + err := stateList.Deserialize([]byte("bad json"), new(CommercialPaper)) + assert.EqualError(t, err, expectedErr.Error(), "should call Deserialize when stateList.Deserialize called") +} diff --git a/library-tracker/organization/cannavino/contract-go/go.mod b/library-tracker/organization/cannavino/contract-go/go.mod new file mode 100644 index 00000000..b3493313 --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/go.mod @@ -0,0 +1,13 @@ +module github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp/contract-go + +go 1.13 + +require ( + github.com/go-openapi/jsonreference v0.19.3 // indirect + github.com/hyperledger/fabric-contract-api-go v1.0.0 + github.com/mailru/easyjson v0.7.0 // indirect + github.com/stretchr/testify v1.4.0 + golang.org/x/net v0.0.0-20191028085509-fe3aa8a45271 // indirect + google.golang.org/genproto v0.0.0-20191028173616-919d9bdd9fe6 // indirect + google.golang.org/grpc v1.24.0 // indirect +) diff --git a/library-tracker/organization/cannavino/contract-go/go.sum b/library-tracker/organization/cannavino/contract-go/go.sum new file mode 100644 index 00000000..022de1b3 --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/go.sum @@ -0,0 +1,254 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/DATA-DOG/godog v0.7.13/go.mod h1:z2OZ6a3X0/YAKVqLfVzYBwFt3j6uSt3Xrqa7XTtcQE0= +github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/awjh-ibm/fabric-chaincode-go v0.0.0-20190823162523-04390e015b85 h1:I27he/2AiTiQ7b9HNG69Yti+8Z5uRu9LyYI+zHK+3v0= +github.com/awjh-ibm/fabric-chaincode-go v0.0.0-20191101104715-ed6605dbcf4a h1:Og6B6TGwSJ+TANq/nVFldoq2vdFpq6eaz6uJdn4u6mc= +github.com/awjh-ibm/fabric-chaincode-go v0.0.0-20191101104715-ed6605dbcf4a/go.mod h1:EPsP9u9T1bG0HG3fxmh/88ijXC1ivmFpZImQe/XbJ34= +github.com/awjh-ibm/fabric-chaincode-go v0.0.0-20191101150549-e9d05b39373d h1:Wjv4Jb5Ir0ZhauaHFnKqLXrM5dywA0dryw4iOKfOTkk= +github.com/awjh-ibm/fabric-chaincode-go v0.0.0-20191101150549-e9d05b39373d/go.mod h1:EPsP9u9T1bG0HG3fxmh/88ijXC1ivmFpZImQe/XbJ34= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= +github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= +github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= +github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= +github.com/go-openapi/analysis v0.19.4/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= +github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= +github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= +github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= +github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= +github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= +github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= +github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= +github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= +github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= +github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= +github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= +github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= +github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= +github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/spec v0.19.4 h1:ixzUSnHTd6hCemgtAJgluaTSGYpLNpJY4mA2DIkdOAo= +github.com/go-openapi/spec v0.19.4/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= +github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= +github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= +github.com/go-openapi/strfmt v0.19.2/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= +github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= +github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= +github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= +github.com/go-openapi/validate v0.19.4/go.mod h1:BkJ0ZmXui7yB0bJXWSXgLPNTmbLVeX/3D1xn/N9mMUM= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/envy v1.7.1 h1:OQl5ys5MBea7OGCdvPbBJWRgnhC/fGona6QKfvFeau8= +github.com/gobuffalo/envy v1.7.1/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w= +github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= +github.com/gobuffalo/logger v1.0.1/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= +github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4= +github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= +github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg= +github.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk= +github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw= +github.com/gobuffalo/packr/v2 v2.7.1/go.mod h1:qYEvAazPaVxy7Y7KR0W8qYEE+RymX74kETFqjFoFlOc= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gucumber/gucumber v0.0.0-20180127021336-7d5c79e832a2/go.mod h1:YbdHRK9ViqwGMS0rtRY+1I6faHvVyyurKPIPwifihxI= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20191108205148-17c4b2760b56 h1:BUCrT0VEO4ryJ7DAEGccqnEJcdHydx7wIJQ0ZGFEjJM= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20191108205148-17c4b2760b56/go.mod h1:HZK6PKLWrvdD/t0oSLiyaRaUM6fZ7qjJuOlb0zrn0mo= +github.com/hyperledger/fabric-chaincode-go v0.0.0-20200128192331-2d899240a7ed/go.mod h1:N7H3sA7Tx4k/YzFq7U0EPdqJtqvM4Kild0JoCc7C0Dc= +github.com/hyperledger/fabric-contract-api-go v0.0.0-20191118113407-4c6ff12b4f96 h1:1PaDE2QfQB/5ZnvlrYZNH62xMtKE/9cjwIzy9fjpJmg= +github.com/hyperledger/fabric-contract-api-go v0.0.0-20191118113407-4c6ff12b4f96/go.mod h1:SdJkyS7/oJltu5Ap//5sCEdNlvj+ZzD3TwnJOt3zf4c= +github.com/hyperledger/fabric-contract-api-go v1.0.0 h1:ma1nQX1S/a3zDkfkTb0QXQHNGgJUmEfqHA9/CWmz8Y0= +github.com/hyperledger/fabric-contract-api-go v1.0.0/go.mod h1:PHF7I0hYI0cZF2j7cdyNHaY5FJD3Q49qnnNgsmxEPbM= +github.com/hyperledger/fabric-protos-go v0.0.0-20190821214336-621b908d5022/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-protos-go v0.0.0-20190919234611-2a87503ac7c9/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-protos-go v0.0.0-20191101064633-9949a658b7e5 h1:2GAVnTeca8eaet9Ked2Usqy7GstZd6JkmsFHiyJI5hY= +github.com/hyperledger/fabric-protos-go v0.0.0-20191101064633-9949a658b7e5/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-protos-go v0.0.0-20191114160927-6bee4929a99f h1:t6+iLphkbJrM8i6YB0T/XxvoTlo50FglEf2hMJHxuOo= +github.com/hyperledger/fabric-protos-go v0.0.0-20191114160927-6bee4929a99f/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/hyperledger/fabric-protos-go v0.0.0-20200124220212-e9cfc186ba7b/go.mod h1:xVYTjK4DtZRBxZ2D9aE4y6AbLaPwue2o/criQyQbVD0= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/karrick/godirwalk v1.13.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.0 h1:aizVhC/NAAcKWb+5QsU1iNOZb4Yws5UO2I+aIprQITM= +github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.4.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.5.0 h1:Usqs0/lDK/NqTkvrmKSwA/3XkZAs7ZAW/eLeQ2MVBTw= +github.com/rogpeppe/go-internal v1.5.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191028085509-fe3aa8a45271 h1:N66aaryRB3Ax92gH0v3hp1QYZ3zWWCCUR/j8Ifh45Ss= +golang.org/x/net v0.0.0-20191028085509-fe3aa8a45271/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542 h1:6ZQFf1D2YYDDI7eSwW8adlkkavTB9sw5I24FVtEvNUQ= +golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191029155521-f43be2a4598c h1:S/FtSvpNLtFBgjTqcKsRpsa6aVsI6iztaz1bQd9BJwE= +golang.org/x/sys v0.0.0-20191029155521-f43be2a4598c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191004055002-72853e10c5a3/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191024074452-7defa796fec0/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20191028173616-919d9bdd9fe6 h1:UXl+Zk3jqqcbEVV7ace5lrt4YdA4tXiz3f/KbmD29Vo= +google.golang.org/genproto v0.0.0-20191028173616-919d9bdd9fe6/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.24.0 h1:vb/1TCsVn3DcJlQ0Gs1yB1pKI6Do2/QNwxdKqmc/b0s= +google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/library-tracker/organization/cannavino/contract-go/ledger-api/state.go b/library-tracker/organization/cannavino/contract-go/ledger-api/state.go new file mode 100644 index 00000000..6d8c3f86 --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/ledger-api/state.go @@ -0,0 +1,27 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package ledgerapi + +import ( + "strings" +) + +// SplitKey splits a key on colon +func SplitKey(key string) []string { + return strings.Split(key, ":") +} + +// MakeKey joins key parts using colon +func MakeKey(keyParts ...string) string { + return strings.Join(keyParts, ":") +} + +// StateInterface interface states must implement +// for use in a list +type StateInterface interface { + // GetSplitKey return components that combine to form the key + GetSplitKey() []string + Serialize() ([]byte, error) +} diff --git a/library-tracker/organization/cannavino/contract-go/ledger-api/statelist.go b/library-tracker/organization/cannavino/contract-go/ledger-api/statelist.go new file mode 100644 index 00000000..492efb34 --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/ledger-api/statelist.go @@ -0,0 +1,61 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package ledgerapi + +import ( + "fmt" + + "github.com/hyperledger/fabric-contract-api-go/contractapi" +) + +// StateListInterface functions that a state list +// should have +type StateListInterface interface { + AddState(StateInterface) error + GetState(string, StateInterface) error + UpdateState(StateInterface) error +} + +// StateList useful for managing putting data in and out +// of the ledger. Implementation of StateListInterface +type StateList struct { + Ctx contractapi.TransactionContextInterface + Name string + Deserialize func([]byte, StateInterface) error +} + +// AddState puts state into world state +func (sl *StateList) AddState(state StateInterface) error { + key, _ := sl.Ctx.GetStub().CreateCompositeKey(sl.Name, state.GetSplitKey()) + data, err := state.Serialize() + + if err != nil { + return err + } + + return sl.Ctx.GetStub().PutState(key, data) +} + +// GetState returns state from world state. Unmarshalls the JSON +// into passed state. Key is the split key value used in Add/Update +// joined using a colon +func (sl *StateList) GetState(key string, state StateInterface) error { + ledgerKey, _ := sl.Ctx.GetStub().CreateCompositeKey(sl.Name, SplitKey(key)) + data, err := sl.Ctx.GetStub().GetState(ledgerKey) + + if err != nil { + return err + } else if data == nil { + return fmt.Errorf("No state found for %s", key) + } + + return sl.Deserialize(data, state) +} + +// UpdateState puts state into world state. Same as AddState but +// separate as semantically different +func (sl *StateList) UpdateState(state StateInterface) error { + return sl.AddState(state) +} diff --git a/library-tracker/organization/cannavino/contract-go/main.go b/library-tracker/organization/cannavino/contract-go/main.go new file mode 100644 index 00000000..ee83834d --- /dev/null +++ b/library-tracker/organization/cannavino/contract-go/main.go @@ -0,0 +1,35 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ + +package main + +import ( + "fmt" + + "github.com/hyperledger/fabric-contract-api-go/contractapi" + "github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp/contract-go/commercial-paper" +) + +func main() { + + contract := new(commercialpaper.Contract) + contract.TransactionContextHandler = new(commercialpaper.TransactionContext) + contract.Name = "org.papernet.commercialpaper" + contract.Info.Version = "0.0.1" + + chaincode, err := contractapi.NewChaincode(contract) + + if err != nil { + panic(fmt.Sprintf("Error creating chaincode. %s", err.Error())) + } + + chaincode.Info.Title = "CommercialPaperChaincode" + chaincode.Info.Version = "0.0.1" + + err = chaincode.Start() + + if err != nil { + panic(fmt.Sprintf("Error starting chaincode. %s", err.Error())) + } +} diff --git a/library-tracker/organization/cannavino/contract-java/.settings/org.eclipse.buildship.core.prefs b/library-tracker/organization/cannavino/contract-java/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 00000000..e8895216 --- /dev/null +++ b/library-tracker/organization/cannavino/contract-java/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git a/library-tracker/organization/cannavino/contract-java/build.gradle b/library-tracker/organization/cannavino/contract-java/build.gradle index 04626aec..f683babb 100644 --- a/library-tracker/organization/cannavino/contract-java/build.gradle +++ b/library-tracker/organization/cannavino/contract-java/build.gradle @@ -1,33 +1,39 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + */ plugins { - id 'com.github.johnrengelman.shadow' version '2.0.3' + id 'com.github.johnrengelman.shadow' version '5.1.0' id 'java' } + version '0.0.1' sourceCompatibility = 1.8 repositories { - mavenLocal() mavenCentral() - maven { - url 'https://jitpack.io' - } maven { - url "https://hyperledger.jfrog.io/hyperledger/fabric-maven" + url 'https://jitpack.io' } - } dependencies { - compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '1.4.2' - compile group: 'org.json', name: 'json', version: '20180813' + implementation group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.0.+' + implementation group: 'org.json', name: 'json', version: '20180813' testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' testImplementation 'org.assertj:assertj-core:3.11.1' testImplementation 'org.mockito:mockito-core:2.+' } +test { + useJUnitPlatform() + testLogging { + events "passed", "skipped", "failed" + } +} + shadowJar { baseName = 'chaincode' version = null @@ -38,13 +44,6 @@ shadowJar { } } -test { - useJUnitPlatform() - testLogging { - events "passed", "skipped", "failed" - } -} - tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters" diff --git a/library-tracker/organization/cannavino/contract-java/gradle/wrapper/gradle-wrapper.jar b/library-tracker/organization/cannavino/contract-java/gradle/wrapper/gradle-wrapper.jar index f6b961fd..5c2d1cf0 100644 Binary files a/library-tracker/organization/cannavino/contract-java/gradle/wrapper/gradle-wrapper.jar and b/library-tracker/organization/cannavino/contract-java/gradle/wrapper/gradle-wrapper.jar differ diff --git a/library-tracker/organization/cannavino/contract-java/gradle/wrapper/gradle-wrapper.properties b/library-tracker/organization/cannavino/contract-java/gradle/wrapper/gradle-wrapper.properties index bf3de218..7c4388a9 100644 --- a/library-tracker/organization/cannavino/contract-java/gradle/wrapper/gradle-wrapper.properties +++ b/library-tracker/organization/cannavino/contract-java/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/library-tracker/organization/cannavino/contract-java/gradlew b/library-tracker/organization/cannavino/contract-java/gradlew old mode 100644 new mode 100755 index cccdd3d5..83f2acfd --- a/library-tracker/organization/cannavino/contract-java/gradlew +++ b/library-tracker/organization/cannavino/contract-java/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` diff --git a/library-tracker/organization/cannavino/contract-java/gradlew.bat b/library-tracker/organization/cannavino/contract-java/gradlew.bat index f9553162..9618d8d9 100644 --- a/library-tracker/organization/cannavino/contract-java/gradlew.bat +++ b/library-tracker/organization/cannavino/contract-java/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/library-tracker/organization/cannavino/contract-java/settings.gradle b/library-tracker/organization/cannavino/contract-java/settings.gradle index 343bba0d..0c5f0723 100644 --- a/library-tracker/organization/cannavino/contract-java/settings.gradle +++ b/library-tracker/organization/cannavino/contract-java/settings.gradle @@ -1,2 +1,2 @@ -rootProject.name = 'java-contractcontract' +rootProject.name = 'papercontract' diff --git a/library-tracker/organization/cannavino/contract-java/src/main/java/org/example/CommercialPaper.java b/library-tracker/organization/cannavino/contract-java/src/main/java/org/example/CommercialPaper.java index cb38eb2c..13d16b66 100644 --- a/library-tracker/organization/cannavino/contract-java/src/main/java/org/example/CommercialPaper.java +++ b/library-tracker/organization/cannavino/contract-java/src/main/java/org/example/CommercialPaper.java @@ -1,5 +1,5 @@ /* - * SPDX-License-Identifier: + * SPDX-License-Identifier: Apache-2.0 */ package org.example; diff --git a/library-tracker/organization/cannavino/contract-java/src/main/java/org/example/CommercialPaperContract.java b/library-tracker/organization/cannavino/contract-java/src/main/java/org/example/CommercialPaperContract.java index a75f47e3..a781c360 100644 --- a/library-tracker/organization/cannavino/contract-java/src/main/java/org/example/CommercialPaperContract.java +++ b/library-tracker/organization/cannavino/contract-java/src/main/java/org/example/CommercialPaperContract.java @@ -24,7 +24,7 @@ import org.hyperledger.fabric.shim.ChaincodeStub; * Define commercial paper smart contract by extending Fabric Contract class * */ -@Contract(name = "org.papernet.commercialpaper", info = @Info(title = "MyAsset contract", description = "", version = "0.0.1", license = @License(name = "SPDX-License-Identifier: ", url = ""), contact = @Contact(email = "java-contract@example.com", name = "java-contract", url = "http://java-contract.me"))) +@Contract(name = "org.papernet.commercialpaper", info = @Info(title = "MyAsset contract", description = "", version = "0.0.1", license = @License(name = "SPDX-License-Identifier: Apache-2.0", url = ""), contact = @Contact(email = "java-contract@example.com", name = "java-contract", url = "http://java-contract.me"))) @Default public class CommercialPaperContract implements ContractInterface { diff --git a/library-tracker/organization/cannavino/contract-java/src/main/java/org/example/ledgerapi/State.java b/library-tracker/organization/cannavino/contract-java/src/main/java/org/example/ledgerapi/State.java index 5e0a15b6..46d35c38 100644 --- a/library-tracker/organization/cannavino/contract-java/src/main/java/org/example/ledgerapi/State.java +++ b/library-tracker/organization/cannavino/contract-java/src/main/java/org/example/ledgerapi/State.java @@ -53,7 +53,7 @@ public class State { } public static String[] splitKey(String key) { - System.out.println("Splittin gkey " + key + " " + java.util.Arrays.asList(key.split(":"))); + System.out.println("splitting key " + key + " " + java.util.Arrays.asList(key.split(":"))); return key.split(":"); } diff --git a/library-tracker/organization/cannavino/contract/ledger-api/statelist.js b/library-tracker/organization/cannavino/contract/ledger-api/statelist.js index 17604334..9600a348 100644 --- a/library-tracker/organization/cannavino/contract/ledger-api/statelist.js +++ b/library-tracker/organization/cannavino/contract/ledger-api/statelist.js @@ -42,7 +42,11 @@ class StateList { async getState(key) { let ledgerKey = this.ctx.stub.createCompositeKey(this.name, State.splitKey(key)); let data = await this.ctx.stub.getState(ledgerKey); +<<<<<<< HEAD:library-tracker/organization/cannavino/contract/ledger-api/statelist.js if (data){ +======= + if (data && data.toString('utf8')) { +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:commercial-paper/organization/magnetocorp/contract/ledger-api/statelist.js let state = State.deserialize(data, this.supportedClasses); return state; } else { diff --git a/library-tracker/organization/cannavino/contract/lib/papercontract.js b/library-tracker/organization/cannavino/contract/lib/papercontract.js index 4bbed909..8f5e3aa5 100644 --- a/library-tracker/organization/cannavino/contract/lib/papercontract.js +++ b/library-tracker/organization/cannavino/contract/lib/papercontract.js @@ -111,7 +111,11 @@ class CommercialPaperContract extends Contract { if (paper.isTrading()) { paper.setOwner(newOwner); } else { +<<<<<<< HEAD:library-tracker/organization/cannavino/contract/lib/papercontract.js throw new Error('Paper ' + issuer + paperNumber + ' is not trading. Current state = ' +paper.getCurrentState()); +======= + throw new Error('Paper ' + issuer + paperNumber + ' is not trading. Current state = ' + paper.getCurrentState()); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:commercial-paper/organization/digibank/contract/lib/papercontract.js } // Update the paper diff --git a/library-tracker/organization/cannavino/contract/package.json b/library-tracker/organization/cannavino/contract/package.json index e523a73f..4a8fb69c 100644 --- a/library-tracker/organization/cannavino/contract/package.json +++ b/library-tracker/organization/cannavino/contract/package.json @@ -18,8 +18,13 @@ "author": "hyperledger", "license": "Apache-2.0", "dependencies": { +<<<<<<< HEAD:library-tracker/organization/cannavino/contract/package.json "fabric-contract-api": "~1.4.0", "fabric-shim": "~1.4.0" +======= + "fabric-contract-api": "^2.0.0", + "fabric-shim": "^2.0.0" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6:commercial-paper/organization/digibank/contract/package.json }, "devDependencies": { "chai": "^4.1.2", diff --git a/library-tracker/organization/cannavino/gateway/.gitkeep b/library-tracker/organization/cannavino/gateway/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/library-tracker/organization/cannavino/magnetocorp.sh b/library-tracker/organization/cannavino/magnetocorp.sh new file mode 100755 index 00000000..af456384 --- /dev/null +++ b/library-tracker/organization/cannavino/magnetocorp.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# SPDX-License-Identifier: Apache-2.0 +shopt -s extglob + +function _exit(){ + printf "Exiting:%s\n" "$1" + exit -1 +} + + +: ${CHANNEL_NAME:="mychannel"} +: ${DELAY:="3"} +: ${MAX_RETRY:="5"} +: ${VERBOSE:="false"} + +# Where am I? +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Locate the test-network +cd "${DIR}/../../../test-network" +env | sort > /tmp/env.orig + +OVERRIDE_ORG="2" +. ./scripts/envVar.sh + + +parsePeerConnectionParameters 1 2 +export PEER_PARMS="${PEER_CONN_PARMS##*( )}" + +# set the fabric config path +export FABRIC_CFG_PATH="${DIR}/../../../config" +export PATH="${DIR}/../../../bin:${PWD}:$PATH" + +env | sort | comm -1 -3 /tmp/env.orig - | sed -E 's/(.*)=(.*)/export \1="\2"/' +rm /tmp/env.orig + +cd ${DIR} \ No newline at end of file diff --git a/library-tracker/organization/cannavino/t.js b/library-tracker/organization/cannavino/t.js new file mode 100644 index 00000000..031abd31 --- /dev/null +++ b/library-tracker/organization/cannavino/t.js @@ -0,0 +1 @@ +console.log(process.argv); \ No newline at end of file diff --git a/off_chain_data/README.md b/off_chain_data/README.md index e7630d33..03d3d435 100644 --- a/off_chain_data/README.md +++ b/off_chain_data/README.md @@ -92,13 +92,27 @@ node blockEventListener.js ``` If the command is successful, you should see the output of the listener reading +<<<<<<< HEAD the first 4 configuration blocks of `mychannel`: ``` +======= +the configuration blocks of `mychannel` in addition to the blocks that recorded +the approval and commitment of the marbles chaincode definition. + +``` +Listening for block events, nextblock: 0 +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 Added block 0 to ProcessingMap Added block 1 to ProcessingMap Added block 2 to ProcessingMap Added block 3 to ProcessingMap +<<<<<<< HEAD +======= +Added block 4 to ProcessingMap +Added block 5 to ProcessingMap +Added block 6 to ProcessingMap +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 ------------------------------------------------ Block Number: 0 ------------------------------------------------ @@ -107,10 +121,40 @@ Block Number: 1 Block Number: 2 ------------------------------------------------ Block Number: 3 +<<<<<<< HEAD Added block 4 to ProcessingMap ------------------------------------------------ Block Number: 4 +======= +Block Timestamp: 2019-08-08T19:47:56.148Z +ChaincodeID: _lifecycle +[] +------------------------------------------------ +Block Number: 4 +Block Timestamp: 2019-08-08T19:48:00.234Z +ChaincodeID: _lifecycle +[] +------------------------------------------------ +Block Number: 5 +Block Timestamp: 2019-08-08T19:48:14.092Z +ChaincodeID: _lifecycle +[ { key: 'namespaces/fields/marbles/Collections', + is_delete: false, + value: '\u0012\u0000' }, + { key: 'namespaces/fields/marbles/EndorsementInfo', + is_delete: false, + value: '\u0012\r\n\u00031.0\u0010\u0001\u001a\u0004escc' }, + { key: 'namespaces/fields/marbles/Sequence', + is_delete: false, + value: '\b\u0001' }, + { key: 'namespaces/fields/marbles/ValidationInfo', + is_delete: false, + value: '\u00122\n\u0004vscc\u0012*\n(\u0012\f\u0012\n\b\u0002\u0012\u0002\b\u0000\u0012\u0002\b\u0001\u001a\u000b\u0012\t\n\u0007Org1MSP\u001a\u000b\u0012\t\n\u0007Org2MSP' }, + { key: 'namespaces/metadata/marbles', + is_delete: false, + value: '\n\u0013ChaincodeDefinition\u0012\bSequence\u0012\u000fEndorsementInfo\u0012\u000eValidationInfo\u0012\u000bCollections' } ] +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 ``` `blockEventListener.js` creates a listener named "offchain-listener" on the @@ -124,9 +168,15 @@ started. `BlockProcessing.js` runs as a daemon and pulls each block in order from the BlockMap. It then uses the read-write set of that block to extract the latest +<<<<<<< HEAD key value data and store it in the database. The first four configuration blocks of `mychannel` did not any data to the database because the blocks did not contain a read-write set. +======= +key value data and store it in the database. The configuration blocks of +mychannel did not any data to the database because the blocks did not contain a +read-write set. +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 The channel event listener also writes metadata from each block to a log file defined as channelid_chaincodeid.log. In this example, events will be written to diff --git a/off_chain_data/addMarbles.js b/off_chain_data/addMarbles.js index 6219a2df..9f031060 100644 --- a/off_chain_data/addMarbles.js +++ b/off_chain_data/addMarbles.js @@ -2,7 +2,11 @@ * Copyright IBM Corp. All Rights Reserved. * * SPDX-License-Identifier: Apache-2.0 +<<<<<<< HEAD * +======= + * +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 */ /* @@ -28,7 +32,11 @@ 'use strict'; +<<<<<<< HEAD const { FileSystemWallet, Gateway } = require('fabric-network'); +======= +const { Wallets, Gateway } = require('fabric-network'); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 const fs = require('fs'); const path = require('path'); @@ -75,12 +83,20 @@ async function main() { // Configure a wallet. This wallet must already be primed with an identity that // the application can use to interact with the peer node. const walletPath = path.resolve(__dirname, 'wallet'); +<<<<<<< HEAD const wallet = new FileSystemWallet(walletPath); +======= + const wallet = await Wallets.newFileSystemWallet(walletPath); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Create a new gateway, and connect to the gateway peer node(s). The identity // specified must already exist in the specified wallet. const gateway = new Gateway(); +<<<<<<< HEAD await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +======= + await gateway.connect(ccp, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Get the network channel that the smart contract is deployed to. const network = await gateway.getNetwork(channelid); diff --git a/off_chain_data/blockEventListener.js b/off_chain_data/blockEventListener.js index 5b6a5ec8..72cbc400 100644 --- a/off_chain_data/blockEventListener.js +++ b/off_chain_data/blockEventListener.js @@ -2,7 +2,11 @@ * Copyright IBM Corp. All Rights Reserved. * * SPDX-License-Identifier: Apache-2.0 +<<<<<<< HEAD * +======= + * +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 */ /* @@ -40,17 +44,24 @@ is automatically created and initialized to zero if it does not exist. 'use strict'; +<<<<<<< HEAD const { FileSystemWallet, Gateway } = require('fabric-network'); +======= +const { Wallets, Gateway } = require('fabric-network'); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 const fs = require('fs'); const path = require('path'); const couchdbutil = require('./couchdbutil.js'); const blockProcessing = require('./blockProcessing.js'); +<<<<<<< HEAD const ccpPath = path.resolve(__dirname, '..', 'first-network', 'connection-org1.json'); const ccpJSON = fs.readFileSync(ccpPath, 'utf8'); const ccp = JSON.parse(ccpJSON); +======= +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 const config = require('./config.json'); const channelid = config.channelid; const peer_name = config.peer_name; @@ -98,26 +109,49 @@ async function main() { // Create a new file system based wallet for managing identities. const walletPath = path.join(process.cwd(), 'wallet'); +<<<<<<< HEAD const wallet = new FileSystemWallet(walletPath); console.log(`Wallet path: ${walletPath}`); // Check to see if we've already enrolled the user. const userExists = await wallet.exists('user1'); +======= + const wallet = await Wallets.newFileSystemWallet(walletPath); + console.log(`Wallet path: ${walletPath}`); + + // Check to see if we've already enrolled the user. + const userExists = await wallet.get('user1'); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 if (!userExists) { console.log('An identity for the user "user1" does not exist in the wallet'); console.log('Run the enrollUser.js application before retrying'); return; } +<<<<<<< HEAD // Create a new gateway for connecting to our peer node. const gateway = new Gateway(); await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +======= + // Parse the connection profile. This would be the path to the file downloaded + // from the IBM Blockchain Platform operational console. + const ccpPath = path.resolve(__dirname, '..', 'first-network', 'connection-org1.json'); + const ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8')); + // Create a new gateway for connecting to our peer node. + const gateway = new Gateway(); + await gateway.connect(ccp, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Get the network (channel) our contract is deployed to. const network = await gateway.getNetwork('mychannel'); +<<<<<<< HEAD const listener = await network.addBlockListener('offchain-listener', async (err, block) => { +======= + const listener = await network.addBlockListener( + async (err, blockNum, block) => { +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 if (err) { console.error(err); return; @@ -125,10 +159,17 @@ async function main() { // Add the block to the processing map by block number await ProcessingMap.set(block.header.number, block); +<<<<<<< HEAD console.log(`Added block ${block.header.number} to ProcessingMap`) }, // set the starting block for the listener { startBlock: parseInt(nextBlock, 10) } +======= + console.log(`Added block ${blockNum} to ProcessingMap`) + }, + // set the starting block for the listener + { filtered: false, startBlock: parseInt(nextBlock, 10) } +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 ); console.log(`Listening for block events, nextblock: ${nextBlock}`); diff --git a/off_chain_data/blockProcessing.js b/off_chain_data/blockProcessing.js index a5d2c619..becbe21c 100644 --- a/off_chain_data/blockProcessing.js +++ b/off_chain_data/blockProcessing.js @@ -50,14 +50,22 @@ exports.processBlockEvent = async function (channelname, block, use_couchdb, nan // filter through valid tx, refer below for list of error codes // https://github.com/hyperledger/fabric-sdk-node/blob/release-1.4/fabric-client/lib/protos/peer/transaction.proto if (txSuccess[dataItem] !== 0) { +<<<<<<< HEAD continue(); +======= + continue; +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 } const timestamp = dataArray[dataItem].payload.header.channel_header.timestamp; // continue to next tx if no actions are set if (dataArray[dataItem].payload.data.actions == undefined) { +<<<<<<< HEAD continue(); +======= + continue; +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 } // actions are stored as an array. In Fabric 1.4.3 only one diff --git a/off_chain_data/deleteMarble.js b/off_chain_data/deleteMarble.js index dacf029b..1e4a8007 100644 --- a/off_chain_data/deleteMarble.js +++ b/off_chain_data/deleteMarble.js @@ -2,7 +2,11 @@ * Copyright IBM Corp. All Rights Reserved. * * SPDX-License-Identifier: Apache-2.0 +<<<<<<< HEAD * +======= + * +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 */ /* @@ -16,7 +20,11 @@ 'use strict'; +<<<<<<< HEAD const { FileSystemWallet, Gateway } = require('fabric-network'); +======= +const { Wallets, Gateway } = require('fabric-network'); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 const fs = require('fs'); const path = require('path'); @@ -42,12 +50,20 @@ async function main() { // Configure a wallet. This wallet must already be primed with an identity that // the application can use to interact with the peer node. const walletPath = path.resolve(__dirname, 'wallet'); +<<<<<<< HEAD const wallet = new FileSystemWallet(walletPath); +======= + const wallet = await Wallets.newFileSystemWallet(walletPath); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Create a new gateway, and connect to the gateway peer node(s). The identity // specified must already exist in the specified wallet. const gateway = new Gateway(); +<<<<<<< HEAD await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +======= + await gateway.connect(ccp, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Get the network channel that the smart contract is deployed to. const network = await gateway.getNetwork(channelid); diff --git a/off_chain_data/enrollAdmin.js b/off_chain_data/enrollAdmin.js index 1b2e332b..02a12c90 100644 --- a/off_chain_data/enrollAdmin.js +++ b/off_chain_data/enrollAdmin.js @@ -2,12 +2,17 @@ * Copyright IBM Corp. All Rights Reserved. * * SPDX-License-Identifier: Apache-2.0 +<<<<<<< HEAD * +======= + * +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 */ 'use strict'; const FabricCAServices = require('fabric-ca-client'); +<<<<<<< HEAD const { FileSystemWallet, X509WalletMixin } = require('fabric-network'); const fs = require('fs'); const path = require('path'); @@ -18,6 +23,17 @@ const ccp = JSON.parse(ccpJSON); async function main() { try { +======= +const { Wallets, X509WalletMixin } = require('fabric-network'); +const fs = require('fs'); +const path = require('path'); + +async function main() { + try { + // load the network configuration + const ccpPath = path.resolve(__dirname, '..', 'first-network', 'connection-org1.json'); + let ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8')); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Create a new CA client for interacting with the CA. const caURL = ccp.certificateAuthorities['ca.org1.example.com'].url; @@ -25,11 +41,19 @@ async function main() { // Create a new file system based wallet for managing identities. const walletPath = path.join(process.cwd(), 'wallet'); +<<<<<<< HEAD const wallet = new FileSystemWallet(walletPath); console.log(`Wallet path: ${walletPath}`); // Check to see if we've already enrolled the admin user. const adminExists = await wallet.exists('admin'); +======= + const wallet = await Wallets.newFileSystemWallet(walletPath); + console.log(`Wallet path: ${walletPath}`); + + // Check to see if we've already enrolled the admin user. + const adminExists = await wallet.get('admin'); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 if (adminExists) { console.log('An identity for the admin user "admin" already exists in the wallet'); return; @@ -37,8 +61,20 @@ async function main() { // Enroll the admin user, and import the new identity into the wallet. const enrollment = await ca.enroll({ enrollmentID: 'admin', enrollmentSecret: 'adminpw' }); +<<<<<<< HEAD const identity = X509WalletMixin.createIdentity('Org1MSP', enrollment.certificate, enrollment.key.toBytes()); wallet.import('admin', identity); +======= + const x509Identity = { + credentials: { + certificate: enrollment.certificate, + privateKey: enrollment.key.toBytes(), + }, + mspId: 'Org1MSP', + type: 'X.509', + }; + await wallet.put('admin', x509Identity); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 console.log('Successfully enrolled admin user "admin" and imported it into the wallet'); } catch (error) { diff --git a/off_chain_data/package.json b/off_chain_data/package.json index eca1b518..32189b49 100644 --- a/off_chain_data/package.json +++ b/off_chain_data/package.json @@ -15,8 +15,13 @@ "author": "Hyperledger", "license": "Apache-2.0", "dependencies": { +<<<<<<< HEAD "fabric-ca-client": "~1.4.0", "fabric-network": "~1.4.0" +======= + "fabric-ca-client": "beta", + "fabric-network": "beta" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 }, "devDependencies": { "chai": "^4.2.0", diff --git a/off_chain_data/registerUser.js b/off_chain_data/registerUser.js index cc73f58a..493b2c58 100644 --- a/off_chain_data/registerUser.js +++ b/off_chain_data/registerUser.js @@ -2,11 +2,16 @@ * Copyright IBM Corp. All Rights Reserved. * * SPDX-License-Identifier: Apache-2.0 +<<<<<<< HEAD * +======= + * +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 */ 'use strict'; +<<<<<<< HEAD const { FileSystemWallet, Gateway, X509WalletMixin } = require('fabric-network'); const fs = require('fs'); const path = require('path'); @@ -25,19 +30,49 @@ async function main() { // Check to see if we've already enrolled the user. const userExists = await wallet.exists('user1'); +======= +const { Wallets, Gateway, X509WalletMixin } = require('fabric-network'); +const FabricCAServices = require('fabric-ca-client'); +const fs = require('fs'); +const path = require('path'); + +async function main() { + try { + // load the network configuration + const ccpPath = path.resolve(__dirname, '..', 'first-network', 'connection-org1.json'); + const ccp = JSON.parse(fs.readFileSync(ccpPath, 'utf8')); + + // Create a new CA client for interacting with the CA. + const caURL = ccp.certificateAuthorities['ca.org1.example.com'].url; + const ca = new FabricCAServices(caURL); + + // Create a new file system based wallet for managing identities. + const walletPath = path.join(process.cwd(), 'wallet'); + const wallet = await Wallets.newFileSystemWallet(walletPath); + console.log(`Wallet path: ${walletPath}`); + + // Check to see if we've already enrolled the user. + const userExists = await wallet.get('user1'); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 if (userExists) { console.log('An identity for the user "user1" already exists in the wallet'); return; } // Check to see if we've already enrolled the admin user. +<<<<<<< HEAD const adminExists = await wallet.exists('admin'); if (!adminExists) { +======= + const adminIdentity = await wallet.get('admin'); + if (!adminIdentity) { +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 console.log('An identity for the admin user "admin" does not exist in the wallet'); console.log('Run the enrollAdmin.js application before retrying'); return; } +<<<<<<< HEAD // Create a new gateway for connecting to our peer node. const gateway = new Gateway(); await gateway.connect(ccp, { wallet, identity: 'admin', discovery: { enabled: false } }); @@ -51,6 +86,31 @@ async function main() { const enrollment = await ca.enroll({ enrollmentID: 'user1', enrollmentSecret: secret }); const userIdentity = X509WalletMixin.createIdentity('Org1MSP', enrollment.certificate, enrollment.key.toBytes()); wallet.import('user1', userIdentity); +======= + // build a user object for authenticating with the CA + const provider = wallet.getProviderRegistry().getProvider(adminIdentity.type); + const adminUser = await provider.getUserContext(adminIdentity, 'admin'); + + // Register the user, enroll the user, and import the new identity into the wallet. + const secret = await ca.register({ + affiliation: 'org1.department1', + enrollmentID: 'user1', + role: 'client' + }, adminUser); + const enrollment = await ca.enroll({ + enrollmentID: 'user1', + enrollmentSecret: secret + }); + const x509Identity = { + credentials: { + certificate: enrollment.certificate, + privateKey: enrollment.key.toBytes(), + }, + mspId: 'Org1MSP', + type: 'X.509', + }; + await wallet.put('user1', x509Identity); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 console.log('Successfully registered and enrolled admin user "user1" and imported it into the wallet'); } catch (error) { diff --git a/off_chain_data/startFabric.sh b/off_chain_data/startFabric.sh index ab23094e..a725419d 100755 --- a/off_chain_data/startFabric.sh +++ b/off_chain_data/startFabric.sh @@ -11,11 +11,22 @@ set -e pipefail # don't rewrite paths for Windows Git Bash users export MSYS_NO_PATHCONV=1 starttime=$(date +%s) +<<<<<<< HEAD CC_SRC_LANGUAGE=${1:-"go"} CC_SRC_LANGUAGE=`echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:]` CC_RUNTIME_LANGUAGE=golang CC_SRC_PATH=github.com/chaincode/marbles02/go +======= +CC_SRC_LANGUAGE=golang +CC_RUNTIME_LANGUAGE=golang +CC_SRC_PATH=github.com/hyperledger/fabric-samples/chaincode/marbles02/go +echo Vendoring Go dependencies ... +pushd ../chaincode/marbles02/go +GO111MODULE=on go mod vendor +popd +echo Finished vendoring Go dependencies +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 # clean the keystore rm -rf ./hfc-key-store @@ -33,6 +44,17 @@ ORG2_MSPCONFIGPATH=${CONFIG_ROOT}/crypto/peerOrganizations/org2.example.com/user ORG2_TLS_ROOTCERT_FILE=${CONFIG_ROOT}/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt ORDERER_TLS_ROOTCERT_FILE=${CONFIG_ROOT}/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem +<<<<<<< HEAD +======= +echo "Packaging the marbles smart contract" +docker exec \ + cli \ + peer lifecycle chaincode package marbles.tar.gz \ + --path $CC_SRC_PATH \ + --lang $CC_RUNTIME_LANGUAGE \ + --label marblesv1 + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 echo "Installing smart contract on peer0.org1.example.com" docker exec \ -e CORE_PEER_LOCALMSPID=Org1MSP \ @@ -40,11 +62,15 @@ docker exec \ -e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \ -e CORE_PEER_TLS_ROOTCERT_FILE=${ORG1_TLS_ROOTCERT_FILE} \ cli \ +<<<<<<< HEAD peer chaincode install \ -n marbles \ -v 1.0 \ -p "$CC_SRC_PATH" \ -l "$CC_RUNTIME_LANGUAGE" +======= + peer lifecycle chaincode install marbles.tar.gz +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 echo "Installing smart contract on peer1.org1.example.com" docker exec \ @@ -53,11 +79,15 @@ docker exec \ -e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \ -e CORE_PEER_TLS_ROOTCERT_FILE=${ORG1_TLS_ROOTCERT_FILE} \ cli \ +<<<<<<< HEAD peer chaincode install \ -n marbles \ -v 1.0 \ -p "$CC_SRC_PATH" \ -l "$CC_RUNTIME_LANGUAGE" +======= + peer lifecycle chaincode install marbles.tar.gz +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 echo "Installing smart contract on peer0.org2.example.com" docker exec \ @@ -66,11 +96,15 @@ docker exec \ -e CORE_PEER_MSPCONFIGPATH=${ORG2_MSPCONFIGPATH} \ -e CORE_PEER_TLS_ROOTCERT_FILE=${ORG2_TLS_ROOTCERT_FILE} \ cli \ +<<<<<<< HEAD peer chaincode install \ -n marbles \ -v 1.0 \ -p "$CC_SRC_PATH" \ -l "$CC_RUNTIME_LANGUAGE" +======= + peer lifecycle chaincode install marbles.tar.gz +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 echo "Installing smart contract on peer1.org2.example.com" docker exec \ @@ -79,6 +113,7 @@ docker exec \ -e CORE_PEER_MSPCONFIGPATH=${ORG2_MSPCONFIGPATH} \ -e CORE_PEER_TLS_ROOTCERT_FILE=${ORG2_TLS_ROOTCERT_FILE} \ cli \ +<<<<<<< HEAD peer chaincode install \ -n marbles \ -v 1.0 \ @@ -86,10 +121,68 @@ docker exec \ -l "$CC_RUNTIME_LANGUAGE" echo "Instantiating smart contract on mychannel" +======= + peer lifecycle chaincode install marbles.tar.gz + +echo "Query the chaincode package id" +docker exec \ + -e CORE_PEER_LOCALMSPID=Org1MSP \ + -e CORE_PEER_ADDRESS=peer0.org1.example.com:7051 \ + -e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \ + -e CORE_PEER_TLS_ROOTCERT_FILE=${ORG1_TLS_ROOTCERT_FILE} \ + cli \ + /bin/bash -c "peer lifecycle chaincode queryinstalled > log" + PACKAGE_ID=`docker exec cli sed -nr '/Label: marblesv1/s/Package ID: (.*), Label: marblesv1/\1/p;' log` + +echo "Approving the chaincode definition for org1.example.com" +docker exec \ + -e CORE_PEER_LOCALMSPID=Org1MSP \ + -e CORE_PEER_ADDRESS=peer0.org1.example.com:7051 \ + -e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \ + -e CORE_PEER_TLS_ROOTCERT_FILE=${ORG1_TLS_ROOTCERT_FILE} \ + cli \ + peer lifecycle chaincode approveformyorg \ + -o orderer.example.com:7050 \ + --channelID mychannel \ + --name marbles \ + --version 1.0 \ + --init-required \ + --signature-policy AND"('Org1MSP.member','Org2MSP.member')" \ + --sequence 1 \ + --package-id $PACKAGE_ID \ + --tls \ + --cafile ${ORDERER_TLS_ROOTCERT_FILE} + +echo "Approving the chaincode definition for org2.example.com" +docker exec \ + -e CORE_PEER_LOCALMSPID=Org2MSP \ + -e CORE_PEER_ADDRESS=peer0.org2.example.com:9051 \ + -e CORE_PEER_MSPCONFIGPATH=${ORG2_MSPCONFIGPATH} \ + -e CORE_PEER_TLS_ROOTCERT_FILE=${ORG2_TLS_ROOTCERT_FILE} \ + cli \ + peer lifecycle chaincode approveformyorg \ + -o orderer.example.com:7050 \ + --channelID mychannel \ + --name marbles \ + --version 1.0 \ + --init-required \ + --signature-policy AND"('Org1MSP.member','Org2MSP.member')" \ + --sequence 1 \ + --package-id $PACKAGE_ID \ + --tls \ + --cafile ${ORDERER_TLS_ROOTCERT_FILE} + +echo "Waiting for the approvals to be committed ..." + +sleep 10 + +echo "Commit the chaincode definition to the channel" +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 docker exec \ -e CORE_PEER_LOCALMSPID=Org1MSP \ -e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \ cli \ +<<<<<<< HEAD peer chaincode instantiate \ -o orderer.example.com:7050 \ -C mychannel \ @@ -104,6 +197,45 @@ docker exec \ --tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} echo "Waiting for instantiation request to be committed ..." +======= + peer lifecycle chaincode commit \ + -o orderer.example.com:7050 \ + --channelID mychannel \ + --name marbles \ + --version 1.0 \ + --init-required \ + --signature-policy AND"('Org1MSP.member','Org2MSP.member')" \ + --sequence 1 \ + --tls \ + --cafile ${ORDERER_TLS_ROOTCERT_FILE} \ + --peerAddresses peer0.org1.example.com:7051 \ + --tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} \ + --peerAddresses peer0.org2.example.com:9051 \ + --tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE} + +echo "Waiting for the chaincode to be committed ..." + +sleep 10 + +echo "invoke the marbles chaincode init function ... " +docker exec \ + -e CORE_PEER_LOCALMSPID=Org1MSP \ + -e CORE_PEER_ADDRESS=peer0.org1.example.com:7051 \ + cli \ + peer chaincode invoke \ + -o orderer.example.com:7050 \ + -C mychannel \ + -n marbles \ + --isInit \ + -c '{"Args":["Init"]}' \ + --tls \ + --cafile ${ORDERER_TLS_ROOTCERT_FILE} \ + --peerAddresses peer0.org1.example.com:7051 \ + --tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE} \ + --peerAddresses peer0.org2.example.com:9051 \ + --tlsRootCertFiles ${ORG2_TLS_ROOTCERT_FILE} + +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 sleep 10 cat <>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 const fs = require('fs'); const path = require('path'); @@ -42,12 +46,20 @@ async function main() { // Configure a wallet. This wallet must already be primed with an identity that // the application can use to interact with the peer node. const walletPath = path.resolve(__dirname, 'wallet'); +<<<<<<< HEAD const wallet = new FileSystemWallet(walletPath); +======= + const wallet = await Wallets.newFileSystemWallet(walletPath); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Create a new gateway, and connect to the gateway peer node(s). The identity // specified must already exist in the specified wallet. const gateway = new Gateway(); +<<<<<<< HEAD await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +======= + await gateway.connect(ccp, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: true } }); +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 // Get the network channel that the smart contract is deployed to. const network = await gateway.getNetwork(channelid); diff --git a/scripts/ci_scripts/byfn_eyfn.sh b/scripts/ci_scripts/byfn_eyfn.sh index 635b07bc..d3b038b4 100755 --- a/scripts/ci_scripts/byfn_eyfn.sh +++ b/scripts/ci_scripts/byfn_eyfn.sh @@ -64,6 +64,7 @@ set +x echo echo " #################################### " +<<<<<<< HEAD echo -e "\033[1m NODE CHAINCODE\033[0m" echo " # ################################## " set -x @@ -71,5 +72,14 @@ echo y | ./byfn.sh -m up -l node -t 60 copy_logs $? default-channel-node echo y | ./eyfn.sh -m up -l node -t 60 copy_logs $? default-channel-node +======= +echo -e "\033[1m JAVASCRIPT CHAINCODE\033[0m" +echo " # ################################## " +set -x +echo y | ./byfn.sh -m up -l javascript -t 60 +copy_logs $? default-channel-javascript +echo y | ./eyfn.sh -m up -l javascript -t 60 +copy_logs $? default-channel-javascript +>>>>>>> 3dbe116a30d517e1e828afb61b2198763141f2e6 echo y | ./eyfn.sh -m down set +x diff --git a/test-network/.env b/test-network/.env new file mode 100644 index 00000000..eba89f91 --- /dev/null +++ b/test-network/.env @@ -0,0 +1,3 @@ +COMPOSE_PROJECT_NAME=net +IMAGE_TAG=latest +SYS_CHANNEL=system-channel diff --git a/test-network/.gitignore b/test-network/.gitignore new file mode 100644 index 00000000..ab11a4e8 --- /dev/null +++ b/test-network/.gitignore @@ -0,0 +1,14 @@ +/channel-artifacts/*.tx +/channel-artifacts/*.block +/ledgers +/ledgers-backup +/channel-artifacts/*.json +/org3-artifacts/crypto-config/* +organizations/fabric-ca/ordererOrg/* +organizations/fabric-ca/org1/* +organizations/fabric-ca/org2/* +organizations/ordererOrganizations/* +organizations/peerOrganizations/* +system-genesis-block/* +fabcar.tar.gz +log.txt diff --git a/test-network/README.md b/test-network/README.md new file mode 100644 index 00000000..0807bf40 --- /dev/null +++ b/test-network/README.md @@ -0,0 +1,5 @@ +## Running the test network + +You can use the `./network.sh` script to stand up a simple Fabric test network. The test network has two peer organizations with one peer each and a single node raft ordering service. You can also use the `./network.sh` script to create channels and deploy the fabcar chaincode. For more information, see [Using the Fabric test network](https://hyperledger-fabric.readthedocs.io/en/latest/test_network.html). The test network is being introduced in Fabric v2.0 as the long term replacement for the `first-network` sample. + +Before you can deploy the test network, you need to follow the instructions to [Install the Samples, Binaries and Docker Images](https://hyperledger-fabric.readthedocs.io/en/latest/install.html) in the Hyperledger Fabric documentation. diff --git a/basic-network/.env b/test-network/addOrg3/.env similarity index 59% rename from basic-network/.env rename to test-network/addOrg3/.env index 4fd2ee0d..a6665fed 100644 --- a/basic-network/.env +++ b/test-network/addOrg3/.env @@ -1 +1,2 @@ COMPOSE_PROJECT_NAME=net +IMAGE_TAG=latest diff --git a/test-network/addOrg3/README.md b/test-network/addOrg3/README.md new file mode 100644 index 00000000..82b1e8ac --- /dev/null +++ b/test-network/addOrg3/README.md @@ -0,0 +1,28 @@ +## Adding Org3 to the test network + +You can use the `addOrg3.sh` script to add another organization to the Fabric test network. The `addOrg3.sh` script generates the Org3 crypto material, creates an Org3 organization definition, and adds Org3 to a channel on the test network. + +You first need to run `./network.sh up createChannel` in the `test-network` directory before you can run the `addOrg3.sh` script. + +``` +./network.sh up createChannel +cd addOrg3 +./addOrg3.sh up +``` + +If you used `network.sh` to create a channel other than the default `mychannel`, you need pass that name to the `addorg3.sh` script. +``` +./network.sh up createChannel -c channel1 +cd addOrg3 +./addOrg3.sh up -c channel1 +``` + +You can also re-run the `addOrg3.sh` script to add Org3 to additional channels. +``` +cd .. +./network.sh createChannel -c channel2 +cd addOrg3 +./addOrg3.sh up -c channel2 +``` + +For more information, use `./addOrg3.sh -h` to see the `addOrg3.sh` help text. diff --git a/test-network/addOrg3/addOrg3.sh b/test-network/addOrg3/addOrg3.sh new file mode 100755 index 00000000..e43cbf34 --- /dev/null +++ b/test-network/addOrg3/addOrg3.sh @@ -0,0 +1,322 @@ +#!/bin/bash +# +# Copyright IBM Corp All Rights Reserved +# +# SPDX-License-Identifier: Apache-2.0 +# + +# This script extends the Hyperledger Fabric test network by adding +# adding a third organization to the network +# + +# prepending $PWD/../bin to PATH to ensure we are picking up the correct binaries +# this may be commented out to resolve installed version of tools if desired +export PATH=${PWD}/../../bin:${PWD}:$PATH +export FABRIC_CFG_PATH=${PWD} +export VERBOSE=false + +# Print the usage message +function printHelp () { + echo "Usage: " + echo " addOrg3.sh up|down|generate [-c ] [-t ] [-d ] [-f ] [-s ]" + echo " addOrg3.sh -h|--help (print this message)" + echo " - one of 'up', 'down', or 'generate'" + echo " - 'up' - add org3 to the sample network. You need to bring up the test network and create a channel first." + echo " - 'down' - bring down the test network and org3 nodes" + echo " - 'generate' - generate required certificates and org definition" + echo " -c - test network channel name (defaults to \"mychannel\")" + echo " -ca - Use a CA to generate the crypto material" + echo " -t - CLI timeout duration in seconds (defaults to 10)" + echo " -d - delay duration in seconds (defaults to 3)" + echo " -s - the database backend to use: goleveldb (default) or couchdb" + echo " -i - the tag to be used to launch the network (defaults to \"latest\")" + echo " -verbose - verbose mode" + echo + echo "Typically, one would first generate the required certificates and " + echo "genesis block, then bring up the network. e.g.:" + echo + echo " addOrg3.sh generate" + echo " addOrg3.sh up" + echo " addOrg3.sh up -c mychannel -s couchdb" + echo " addOrg3.sh down" + echo + echo "Taking all defaults:" + echo " addOrg3.sh up" + echo " addOrg3.sh down" +} + +# We use the cryptogen tool to generate the cryptographic material +# (x509 certs) for the new org. After we run the tool, the certs will +# be put in the organizations folder with org1 and org2 + +# Create Organziation crypto material using cryptogen or CAs +function generateOrg3() { + + # Create crypto material using cryptogen + if [ "$CRYPTO" == "cryptogen" ]; then + which cryptogen + if [ "$?" -ne 0 ]; then + echo "cryptogen tool not found. exiting" + exit 1 + fi + echo + echo "##########################################################" + echo "##### Generate certificates using cryptogen tool #########" + echo "##########################################################" + echo + + echo "##########################################################" + echo "############ Create Org1 Identities ######################" + echo "##########################################################" + + set -x + cryptogen generate --config=org3-crypto.yaml --output="../organizations" + res=$? + set +x + if [ $res -ne 0 ]; then + echo "Failed to generate certificates..." + exit 1 + fi + + fi + + # Create crypto material using Fabric CAs + if [ "$CRYPTO" == "Certificate Authorities" ]; then + + fabric-ca-client version > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Fabric CA client not found locally, downloading..." + cd ../.. + curl -s -L "https://github.com/hyperledger/fabric-ca/releases/download/v1.4.4/hyperledger-fabric-ca-${OS_ARCH}-1.4.4.tar.gz" | tar xz || rc=$? + if [ -n "$rc" ]; then + echo "==> There was an error downloading the binary file." + echo "fabric-ca-client binary is not available to download" + else + echo "==> Done." + cd test-network/addOrg3/ + fi + fi + + echo + echo "##########################################################" + echo "##### Generate certificates using Fabric CA's ############" + echo "##########################################################" + + IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE_CA_ORG3 up -d 2>&1 + + . fabric-ca/registerEnroll.sh + + sleep 10 + + echo "##########################################################" + echo "############ Create Org1 Identities ######################" + echo "##########################################################" + + createOrg3 + + fi + + echo + echo "Generate CCP files for Org3" + ./ccp-generate.sh +} + +# Generate channel configuration transaction +function generateOrg3Definition() { + which configtxgen + if [ "$?" -ne 0 ]; then + echo "configtxgen tool not found. exiting" + exit 1 + fi + echo "##########################################################" + echo "####### Generating Org3 organization definition #########" + echo "##########################################################" + export FABRIC_CFG_PATH=$PWD + set -x + configtxgen -printOrg Org3MSP > ../organizations/peerOrganizations/org3.example.com/org3.json + res=$? + set +x + if [ $res -ne 0 ]; then + echo "Failed to generate Org3 config material..." + exit 1 + fi + echo +} + +function Org3Up () { + # start org3 nodes + if [ "${DATABASE}" == "couchdb" ]; then + IMAGE_TAG=${IMAGETAG} docker-compose -f $COMPOSE_FILE_ORG3 -f $COMPOSE_FILE_COUCH_ORG3 up -d 2>&1 + else + IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE_ORG3 up -d 2>&1 + fi + if [ $? -ne 0 ]; then + echo "ERROR !!!! Unable to start Org3 network" + exit 1 + fi +} + +# Generate the needed certificates, the genesis block and start the network. +function addOrg3 () { + + # If the test network is not up, abort + if [ ! -d ../organizations/ordererOrganizations ]; then + echo + echo "ERROR: Please, run ./network.sh up createChannel first." + echo + exit 1 + fi + + # generate artifacts if they don't exist + if [ ! -d "../organizations/peerOrganizations/org3.example.com" ]; then + generateOrg3 + generateOrg3Definition + fi + + CONTAINER_IDS=$(docker ps -a | awk '($2 ~ /fabric-tools/) {print $1}') + if [ -z "$CONTAINER_IDS" -o "$CONTAINER_IDS" == " " ]; then + echo "Bringing up network" + Org3Up + fi + + # Use the CLI container to create the configuration transaction needed to add + # Org3 to the network + echo + echo "###############################################################" + echo "####### Generate and submit config tx to add Org3 #############" + echo "###############################################################" + docker exec Org3cli ./scripts/org3-scripts/step1org3.sh $CHANNEL_NAME $CLI_DELAY $CLI_TIMEOUT $VERBOSE + if [ $? -ne 0 ]; then + echo "ERROR !!!! Unable to create config tx" + exit 1 + fi + + echo + echo "###############################################################" + echo "############### Have Org3 peers join network ##################" + echo "###############################################################" + docker exec Org3cli ./scripts/org3-scripts/step2org3.sh $CHANNEL_NAME $CLI_DELAY $CLI_TIMEOUT $VERBOSE + if [ $? -ne 0 ]; then + echo "ERROR !!!! Unable to have Org3 peers join network" + exit 1 + fi + +} + +# Tear down running network +function networkDown () { + + cd .. + ./network.sh down +} + + +# Obtain the OS and Architecture string that will be used to select the correct +# native binaries for your platform +OS_ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') +# timeout duration - the duration the CLI should wait for a response from +# another container before giving up + +# Using crpto vs CA. default is cryptogen +CRYPTO="cryptogen" + +CLI_TIMEOUT=10 +#default for delay +CLI_DELAY=3 +# channel name defaults to "mychannel" +CHANNEL_NAME="mychannel" +# use this as the docker compose couch file +COMPOSE_FILE_COUCH_ORG3=docker/docker-compose-couch-org3.yaml +# use this as the default docker-compose yaml definition +COMPOSE_FILE_ORG3=docker/docker-compose-org3.yaml +# certificate authorities compose file +COMPOSE_FILE_CA_ORG3=docker/docker-compose-ca-org3.yaml +# default image tag +IMAGETAG="latest" +# database +DATABASE="leveldb" + +# Parse commandline args + +## Parse mode +if [[ $# -lt 1 ]] ; then + printHelp + exit 0 +else + MODE=$1 + shift +fi + +# parse flags + +while [[ $# -ge 1 ]] ; do + key="$1" + case $key in + -h ) + printHelp + exit 0 + ;; + -c ) + CHANNEL_NAME="$2" + shift + ;; + -ca ) + CRYPTO="Certificate Authorities" + ;; + -t ) + CLI_TIMEOUT="$2" + shift + ;; + -d ) + CLI_DELAY="$2" + shift + ;; + -s ) + DATABASE="$2" + shift + ;; + -i ) + IMAGETAG=$(go env GOARCH)"-""$2" + shift + ;; + -verbose ) + VERBOSE=true + shift + ;; + * ) + echo + echo "Unknown flag: $key" + echo + printHelp + exit 1 + ;; + esac + shift +done + + +# Determine whether starting, stopping, restarting or generating for announce +if [ "$MODE" == "up" ]; then + echo "Add Org3 to channel '${CHANNEL_NAME}' with '${CLI_TIMEOUT}' seconds and CLI delay of '${CLI_DELAY}' seconds and using database '${DATABASE}'" + echo +elif [ "$MODE" == "down" ]; then + EXPMODE="Stopping network" +elif [ "$MODE" == "generate" ]; then + EXPMODE="Generating certs and organization definition for Org3" +else + printHelp + exit 1 +fi + +#Create the network using docker compose +if [ "${MODE}" == "up" ]; then + addOrg3 +elif [ "${MODE}" == "down" ]; then ## Clear the network + networkDown +elif [ "${MODE}" == "generate" ]; then ## Generate Artifacts + generateOrg3 + generateOrg3Definition +else + printHelp + exit 1 +fi diff --git a/test-network/addOrg3/ccp-generate.sh b/test-network/addOrg3/ccp-generate.sh new file mode 100755 index 00000000..a3f254f3 --- /dev/null +++ b/test-network/addOrg3/ccp-generate.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +function one_line_pem { + echo "`awk 'NF {sub(/\\n/, ""); printf "%s\\\\\\\n",$0;}' $1`" +} + +function json_ccp { + local PP=$(one_line_pem $4) + local CP=$(one_line_pem $5) + sed -e "s/\${ORG}/$1/" \ + -e "s/\${P0PORT}/$2/" \ + -e "s/\${CAPORT}/$3/" \ + -e "s#\${PEERPEM}#$PP#" \ + -e "s#\${CAPEM}#$CP#" \ + ccp-template.json +} + +function yaml_ccp { + local PP=$(one_line_pem $4) + local CP=$(one_line_pem $5) + sed -e "s/\${ORG}/$1/" \ + -e "s/\${P0PORT}/$2/" \ + -e "s/\${CAPORT}/$3/" \ + -e "s#\${PEERPEM}#$PP#" \ + -e "s#\${CAPEM}#$CP#" \ + ccp-template.yaml | sed -e $'s/\\\\n/\\\n /g' +} + +ORG=3 +P0PORT=11051 +CAPORT=11054 +PEERPEM=../organizations/peerOrganizations/org3.example.com/tlsca/tlsca.org3.example.com-cert.pem +CAPEM=../organizations/peerOrganizations/org3.example.com/ca/ca.org3.example.com-cert.pem + +echo "$(json_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > ../organizations/peerOrganizations/org3.example.com/connection-org3.json +echo "$(yaml_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > ../organizations/peerOrganizations/org3.example.com/connection-org3.yaml diff --git a/test-network/addOrg3/ccp-template.json b/test-network/addOrg3/ccp-template.json new file mode 100644 index 00000000..b4fb3dfb --- /dev/null +++ b/test-network/addOrg3/ccp-template.json @@ -0,0 +1,49 @@ +{ + "name": "first-network-org${ORG}", + "version": "1.0.0", + "client": { + "organization": "Org${ORG}", + "connection": { + "timeout": { + "peer": { + "endorser": "300" + } + } + } + }, + "organizations": { + "Org${ORG}": { + "mspid": "Org${ORG}MSP", + "peers": [ + "peer0.org${ORG}.example.com" + ], + "certificateAuthorities": [ + "ca.org${ORG}.example.com" + ] + } + }, + "peers": { + "peer0.org${ORG}.example.com": { + "url": "grpcs://localhost:${P0PORT}", + "tlsCACerts": { + "pem": "${PEERPEM}" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org${ORG}.example.com", + "hostnameOverride": "peer0.org${ORG}.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org${ORG}.example.com": { + "url": "https://localhost:${CAPORT}", + "caName": "ca-org${ORG}", + "tlsCACerts": { + "pem": "${CAPEM}" + }, + "httpOptions": { + "verify": false + } + } + } +} diff --git a/test-network/addOrg3/ccp-template.yaml b/test-network/addOrg3/ccp-template.yaml new file mode 100644 index 00000000..dec3f059 --- /dev/null +++ b/test-network/addOrg3/ccp-template.yaml @@ -0,0 +1,34 @@ +--- +name: first-network-org${ORG} +version: 1.0.0 +client: + organization: Org${ORG} + connection: + timeout: + peer: + endorser: '300' +organizations: + Org${ORG}: + mspid: Org${ORG}MSP + peers: + - peer0.org${ORG}.example.com + certificateAuthorities: + - ca.org${ORG}.example.com +peers: + peer0.org${ORG}.example.com: + url: grpcs://localhost:${P0PORT} + tlsCACerts: + pem: | + ${PEERPEM} + grpcOptions: + ssl-target-name-override: peer0.org${ORG}.example.com + hostnameOverride: peer0.org${ORG}.example.com +certificateAuthorities: + ca.org${ORG}.example.com: + url: https://localhost:${CAPORT} + caName: ca-org${ORG} + tlsCACerts: + pem: | + ${CAPEM} + httpOptions: + verify: false diff --git a/test-network/addOrg3/configtx.yaml b/test-network/addOrg3/configtx.yaml new file mode 100644 index 00000000..1782a703 --- /dev/null +++ b/test-network/addOrg3/configtx.yaml @@ -0,0 +1,45 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +--- +################################################################################ +# +# Section: Organizations +# +# - This section defines the different organizational identities which will +# be referenced later in the configuration. +# +################################################################################ +Organizations: + - &Org3 + # DefaultOrg defines the organization which is used in the sampleconfig + # of the fabric.git development environment + Name: Org3MSP + + # ID to load the MSP definition as + ID: Org3MSP + + MSPDir: ../organizations/peerOrganizations/org3.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org3MSP.admin', 'Org3MSP.peer', 'Org3MSP.client')" + Writers: + Type: Signature + Rule: "OR('Org3MSP.admin', 'Org3MSP.client')" + Admins: + Type: Signature + Rule: "OR('Org3MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org3MSP.peer')" + + AnchorPeers: + # AnchorPeers defines the location of peers which can be used + # for cross org gossip communication. Note, this value is only + # encoded in the genesis block in the Application section context + - Host: peer0.org3.example.com + Port: 11051 diff --git a/test-network/addOrg3/docker/docker-compose-ca-org3.yaml b/test-network/addOrg3/docker/docker-compose-ca-org3.yaml new file mode 100644 index 00000000..46822e84 --- /dev/null +++ b/test-network/addOrg3/docker/docker-compose-ca-org3.yaml @@ -0,0 +1,22 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +version: '2' + +services: + + ca_org3: + image: hyperledger/fabric-ca:$IMAGE_TAG + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca-org3 + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_PORT=11054 + ports: + - "11054:11054" + command: sh -c 'fabric-ca-server start -b admin:adminpw -d' + volumes: + - ../fabric-ca/org3:/etc/hyperledger/fabric-ca-server + container_name: ca_org3 diff --git a/test-network/addOrg3/docker/docker-compose-couch-org3.yaml b/test-network/addOrg3/docker/docker-compose-couch-org3.yaml new file mode 100644 index 00000000..912b9a83 --- /dev/null +++ b/test-network/addOrg3/docker/docker-compose-couch-org3.yaml @@ -0,0 +1,39 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +version: '2' + +networks: + test: + +services: + couchdb4: + container_name: couchdb4 + image: hyperledger/fabric-couchdb + # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password + # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. + environment: + - COUCHDB_USER= + - COUCHDB_PASSWORD= + # Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service, + # for example map it to utilize Fauxton User Interface in dev environments. + ports: + - "9984:5984" + networks: + - test + + peer0.org3.example.com: + environment: + - CORE_LEDGER_STATE_STATEDATABASE=CouchDB + - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb4:5984 + # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD + # provide the credentials for ledger to connect to CouchDB. The username and password must + # match the username and password set for the associated CouchDB. + - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME= + - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD= + depends_on: + - couchdb4 + networks: + - test diff --git a/test-network/addOrg3/docker/docker-compose-org3.yaml b/test-network/addOrg3/docker/docker-compose-org3.yaml new file mode 100644 index 00000000..370d1db9 --- /dev/null +++ b/test-network/addOrg3/docker/docker-compose-org3.yaml @@ -0,0 +1,84 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +version: '2' + +volumes: + peer0.org3.example.com: + +networks: + test: + +services: + + peer0.org3.example.com: + container_name: peer0.org3.example.com + image: hyperledger/fabric-peer:$IMAGE_TAG + environment: + #Generic peer variables + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + # the following setting starts chaincode containers on the same + # bridge network as the peers + # https://docs.docker.com/compose/networking/ + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_test + - FABRIC_LOGGING_SPEC=INFO + #- FABRIC_LOGGING_SPEC=DEBUG + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_GOSSIP_USELEADERELECTION=true + - CORE_PEER_GOSSIP_ORGLEADER=false + - CORE_PEER_PROFILE_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt + # Peer specific variabes + - CORE_PEER_ID=peer0.org3.example.com + - CORE_PEER_ADDRESS=peer0.org3.example.com:11051 + - CORE_PEER_LISTENADDRESS=0.0.0.0:11051 + - CORE_PEER_CHAINCODEADDRESS=peer0.org3.example.com:11052 + - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:11052 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org3.example.com:11051 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.example.com:11051 + - CORE_PEER_LOCALMSPID=Org3MSP + volumes: + - /var/run/:/host/var/run/ + - ../../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/msp:/etc/hyperledger/fabric/msp + - ../../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls:/etc/hyperledger/fabric/tls + - peer0.org3.example.com:/var/hyperledger/production + working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer + command: peer node start + ports: + - 11051:11051 + networks: + - test + + Org3cli: + container_name: Org3cli + image: hyperledger/fabric-tools:$IMAGE_TAG + tty: true + stdin_open: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=INFO + #- FABRIC_LOGGING_SPEC=DEBUG + - CORE_PEER_ID=Org3cli + - CORE_PEER_ADDRESS=peer0.org3.example.com:11051 + - CORE_PEER_LOCALMSPID=Org3MSP + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt + - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp + working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer + command: /bin/bash + volumes: + - /var/run/:/host/var/run/ + - ../../../chaincode/:/opt/gopath/src/github.com/chaincode + - ../../organizations:/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations + - ../../scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/ + depends_on: + - peer0.org3.example.com + networks: + - test diff --git a/test-network/addOrg3/fabric-ca/org3/fabric-ca-server-config.yaml b/test-network/addOrg3/fabric-ca/org3/fabric-ca-server-config.yaml new file mode 100644 index 00000000..67016935 --- /dev/null +++ b/test-network/addOrg3/fabric-ca/org3/fabric-ca-server-config.yaml @@ -0,0 +1,406 @@ +############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpretted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.2.0 + +# Server's listening port (default: 7054) +port: 11054 + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: true + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts) and transaction +# certificates (TCerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: Org3CA + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and +# values which the fabric-ca-server optionally puts into TCerts +# which it issues for transacting on the Hyperledger Fabric blockchain. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid','member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + - department1 + - department2 + org2: + - department1 + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: ca.org3.example.com + names: + - C: US + ST: "North Carolina" + L: "Raleigh" + O: org3.example.com + OU: + hosts: + - localhost + - org3.example.com + ca: + expiry: 131400h + pathlength: 1 + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: diff --git a/test-network/addOrg3/fabric-ca/registerEnroll.sh b/test-network/addOrg3/fabric-ca/registerEnroll.sh new file mode 100644 index 00000000..f20fcf50 --- /dev/null +++ b/test-network/addOrg3/fabric-ca/registerEnroll.sh @@ -0,0 +1,108 @@ + + +function createOrg3 { + + echo + echo "Enroll the CA admin" + echo + mkdir -p ../organizations/peerOrganizations/org3.example.com/ + + export FABRIC_CA_CLIENT_HOME=${PWD}/../organizations/peerOrganizations/org3.example.com/ +# rm -rf $FABRIC_CA_CLIENT_HOME/fabric-ca-client-config.yaml +# rm -rf $FABRIC_CA_CLIENT_HOME/msp + + set -x + fabric-ca-client enroll -u https://admin:adminpw@localhost:11054 --caname ca-org3 --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem + set +x + + echo 'NodeOUs: + Enable: true + ClientOUIdentifier: + Certificate: cacerts/localhost-11054-ca-org3.pem + OrganizationalUnitIdentifier: client + PeerOUIdentifier: + Certificate: cacerts/localhost-11054-ca-org3.pem + OrganizationalUnitIdentifier: peer + AdminOUIdentifier: + Certificate: cacerts/localhost-11054-ca-org3.pem + OrganizationalUnitIdentifier: admin + OrdererOUIdentifier: + Certificate: cacerts/localhost-11054-ca-org3.pem + OrganizationalUnitIdentifier: orderer' > ${PWD}/../organizations/peerOrganizations/org3.example.com/msp/config.yaml + + echo + echo "Register peer0" + echo + set -x + fabric-ca-client register --caname ca-org3 --id.name peer0 --id.secret peer0pw --id.type peer --id.attrs '"hf.Registrar.Roles=peer"' --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem + set +x + + echo + echo "Register user" + echo + set -x + fabric-ca-client register --caname ca-org3 --id.name user1 --id.secret user1pw --id.type client --id.attrs '"hf.Registrar.Roles=client"' --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem + set +x + + echo + echo "Register the org admin" + echo + set -x + fabric-ca-client register --caname ca-org3 --id.name org3admin --id.secret org3adminpw --id.type admin --id.attrs '"hf.Registrar.Roles=admin"' --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem + set +x + + mkdir -p ../organizations/peerOrganizations/org3.example.com/peers + mkdir -p ../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com + + echo + echo "## Generate the peer0 msp" + echo + set -x + fabric-ca-client enroll -u https://peer0:peer0pw@localhost:11054 --caname ca-org3 -M ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/msp --csr.hosts peer0.org3.example.com --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem + set +x + + cp ${PWD}/../organizations/peerOrganizations/org3.example.com/msp/config.yaml ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/msp/config.yaml + + echo + echo "## Generate the peer0-tls certificates" + echo + set -x + fabric-ca-client enroll -u https://peer0:peer0pw@localhost:11054 --caname ca-org3 -M ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls --enrollment.profile tls --csr.hosts peer0.org3.example.com --csr.hosts localhost --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem + set +x + + + cp ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/tlscacerts/* ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt + cp ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/signcerts/* ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.crt + cp ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/keystore/* ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.key + + mkdir ${PWD}/../organizations/peerOrganizations/org3.example.com/msp/tlscacerts + cp ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/tlscacerts/* ${PWD}/../organizations/peerOrganizations/org3.example.com/msp/tlscacerts/ca.crt + + mkdir ${PWD}/../organizations/peerOrganizations/org3.example.com/tlsca + cp ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/tlscacerts/* ${PWD}/../organizations/peerOrganizations/org3.example.com/tlsca/tlsca.org3.example.com-cert.pem + + mkdir ${PWD}/../organizations/peerOrganizations/org3.example.com/ca + cp ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/msp/cacerts/* ${PWD}/../organizations/peerOrganizations/org3.example.com/ca/ca.org3.example.com-cert.pem + + mkdir -p ../organizations/peerOrganizations/org3.example.com/users + mkdir -p ../organizations/peerOrganizations/org3.example.com/users/User1@org3.example.com + + echo + echo "## Generate the user msp" + echo + set -x + fabric-ca-client enroll -u https://user1:user1pw@localhost:11054 --caname ca-org3 -M ${PWD}/../organizations/peerOrganizations/org3.example.com/users/User1@org3.example.com/msp --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem + set +x + + mkdir -p ../organizations/peerOrganizations/org3.example.com/users/Admin@org3.example.com + + echo + echo "## Generate the org admin msp" + echo + set -x + fabric-ca-client enroll -u https://org3admin:org3adminpw@localhost:11054 --caname ca-org3 -M ${PWD}/../organizations/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp --tls.certfiles ${PWD}/fabric-ca/org3/tls-cert.pem + set +x + + cp ${PWD}/../organizations/peerOrganizations/org3.example.com/msp/config.yaml ${PWD}/../organizations/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp/config.yaml + +} diff --git a/test-network/addOrg3/org3-crypto.yaml b/test-network/addOrg3/org3-crypto.yaml new file mode 100644 index 00000000..73ae7333 --- /dev/null +++ b/test-network/addOrg3/org3-crypto.yaml @@ -0,0 +1,21 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +# --------------------------------------------------------------------------- +# "PeerOrgs" - Definition of organizations managing peer nodes +# --------------------------------------------------------------------------- +PeerOrgs: + # --------------------------------------------------------------------------- + # Org3 + # --------------------------------------------------------------------------- + - Name: Org3 + Domain: org3.example.com + EnableNodeOUs: true + Template: + Count: 1 + SANS: + - localhost + Users: + Count: 1 diff --git a/test-network/configtx/configtx.yaml b/test-network/configtx/configtx.yaml new file mode 100644 index 00000000..9580184a --- /dev/null +++ b/test-network/configtx/configtx.yaml @@ -0,0 +1,333 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +--- +################################################################################ +# +# Section: Organizations +# +# - This section defines the different organizational identities which will +# be referenced later in the configuration. +# +################################################################################ +Organizations: + + # SampleOrg defines an MSP using the sampleconfig. It should never be used + # in production but may be used as a template for other definitions + - &OrdererOrg + # DefaultOrg defines the organization which is used in the sampleconfig + # of the fabric.git development environment + Name: OrdererOrg + + # ID to load the MSP definition as + ID: OrdererMSP + + # MSPDir is the filesystem path which contains the MSP configuration + MSPDir: ../organizations/ordererOrganizations/example.com/msp + + # Policies defines the set of policies at this level of the config tree + # For organization policies, their canonical path is usually + # /Channel/// + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + + - &Org1 + # DefaultOrg defines the organization which is used in the sampleconfig + # of the fabric.git development environment + Name: Org1MSP + + # ID to load the MSP definition as + ID: Org1MSP + + MSPDir: ../organizations/peerOrganizations/org1.example.com/msp + + # Policies defines the set of policies at this level of the config tree + # For organization policies, their canonical path is usually + # /Channel/// + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.admin', 'Org1MSP.client')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.peer')" + + # leave this flag set to true. + AnchorPeers: + # AnchorPeers defines the location of peers which can be used + # for cross org gossip communication. Note, this value is only + # encoded in the genesis block in the Application section context + - Host: peer0.org1.example.com + Port: 7051 + + - &Org2 + # DefaultOrg defines the organization which is used in the sampleconfig + # of the fabric.git development environment + Name: Org2MSP + + # ID to load the MSP definition as + ID: Org2MSP + + MSPDir: ../organizations/peerOrganizations/org2.example.com/msp + + # Policies defines the set of policies at this level of the config tree + # For organization policies, their canonical path is usually + # /Channel/// + Policies: + Readers: + Type: Signature + Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')" + Writers: + Type: Signature + Rule: "OR('Org2MSP.admin', 'Org2MSP.client')" + Admins: + Type: Signature + Rule: "OR('Org2MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org2MSP.peer')" + + AnchorPeers: + # AnchorPeers defines the location of peers which can be used + # for cross org gossip communication. Note, this value is only + # encoded in the genesis block in the Application section context + - Host: peer0.org2.example.com + Port: 9051 + +################################################################################ +# +# SECTION: Capabilities +# +# - This section defines the capabilities of fabric network. This is a new +# concept as of v1.1.0 and should not be utilized in mixed networks with +# v1.0.x peers and orderers. Capabilities define features which must be +# present in a fabric binary for that binary to safely participate in the +# fabric network. For instance, if a new MSP type is added, newer binaries +# might recognize and validate the signatures from this type, while older +# binaries without this support would be unable to validate those +# transactions. This could lead to different versions of the fabric binaries +# having different world states. Instead, defining a capability for a channel +# informs those binaries without this capability that they must cease +# processing transactions until they have been upgraded. For v1.0.x if any +# capabilities are defined (including a map with all capabilities turned off) +# then the v1.0.x peer will deliberately crash. +# +################################################################################ +Capabilities: + # Channel capabilities apply to both the orderers and the peers and must be + # supported by both. + # Set the value of the capability to true to require it. + Channel: &ChannelCapabilities + # V2_0 capability ensures that orderers and peers behave according + # to v2.0 channel capabilities. Orderers and peers from + # prior releases would behave in an incompatible way, and are therefore + # not able to participate in channels at v2.0 capability. + # Prior to enabling V2.0 channel capabilities, ensure that all + # orderers and peers on a channel are at v2.0.0 or later. + V2_0: true + + # Orderer capabilities apply only to the orderers, and may be safely + # used with prior release peers. + # Set the value of the capability to true to require it. + Orderer: &OrdererCapabilities + # V2_0 orderer capability ensures that orderers behave according + # to v2.0 orderer capabilities. Orderers from + # prior releases would behave in an incompatible way, and are therefore + # not able to participate in channels at v2.0 orderer capability. + # Prior to enabling V2.0 orderer capabilities, ensure that all + # orderers on channel are at v2.0.0 or later. + V2_0: true + + # Application capabilities apply only to the peer network, and may be safely + # used with prior release orderers. + # Set the value of the capability to true to require it. + Application: &ApplicationCapabilities + # V2_0 application capability ensures that peers behave according + # to v2.0 application capabilities. Peers from + # prior releases would behave in an incompatible way, and are therefore + # not able to participate in channels at v2.0 application capability. + # Prior to enabling V2.0 application capabilities, ensure that all + # peers on channel are at v2.0.0 or later. + V2_0: true + +################################################################################ +# +# SECTION: Application +# +# - This section defines the values to encode into a config transaction or +# genesis block for application related parameters +# +################################################################################ +Application: &ApplicationDefaults + + # Organizations is the list of orgs which are defined as participants on + # the application side of the network + Organizations: + + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + LifecycleEndorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + + Capabilities: + <<: *ApplicationCapabilities +################################################################################ +# +# SECTION: Orderer +# +# - This section defines the values to encode into a config transaction or +# genesis block for orderer related parameters +# +################################################################################ +Orderer: &OrdererDefaults + + # Orderer Type: The orderer implementation to start + # Available types are "solo" and "kafka" + OrdererType: etcdraft + + EtcdRaft: + Consenters: + - Host: orderer.example.com + Port: 7050 + ClientTLSCert: ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt + ServerTLSCert: ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt + Addresses: + - orderer.example.com:7050 + + # Batch Timeout: The amount of time to wait before creating a batch + BatchTimeout: 2s + + # Batch Size: Controls the number of messages batched into a block + BatchSize: + + # Max Message Count: The maximum number of messages to permit in a batch + MaxMessageCount: 10 + + # Absolute Max Bytes: The absolute maximum number of bytes allowed for + # the serialized messages in a batch. + AbsoluteMaxBytes: 99 MB + + # Preferred Max Bytes: The preferred maximum number of bytes allowed for + # the serialized messages in a batch. A message larger than the preferred + # max bytes will result in a batch larger than preferred max bytes. + PreferredMaxBytes: 512 KB + + # Organizations is the list of orgs which are defined as participants on + # the orderer side of the network + Organizations: + + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + # BlockValidation specifies what signatures must be included in the block + # from the orderer for the peer to validate it. + BlockValidation: + Type: ImplicitMeta + Rule: "ANY Writers" + +################################################################################ +# +# CHANNEL +# +# This section defines the values to encode into a config transaction or +# genesis block for channel related parameters. +# +################################################################################ +Channel: &ChannelDefaults + # Policies defines the set of policies at this level of the config tree + # For Channel policies, their canonical path is + # /Channel/ + Policies: + # Who may invoke the 'Deliver' API + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + # Who may invoke the 'Broadcast' API + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + # By default, who may modify elements at this config level + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + + # Capabilities describes the channel level capabilities, see the + # dedicated Capabilities section elsewhere in this file for a full + # description + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# +# Profile +# +# - Different configuration profiles may be encoded here to be specified +# as parameters to the configtxgen tool +# +################################################################################ +Profiles: + + TwoOrgsOrdererGenesis: + <<: *ChannelDefaults + Orderer: + <<: *OrdererDefaults + Organizations: + - *OrdererOrg + Capabilities: + <<: *OrdererCapabilities + Consortiums: + SampleConsortium: + Organizations: + - *Org1 + - *Org2 + TwoOrgsChannel: + Consortium: SampleConsortium + <<: *ChannelDefaults + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 + - *Org2 + Capabilities: + <<: *ApplicationCapabilities diff --git a/test-network/docker/docker-compose-ca.yaml b/test-network/docker/docker-compose-ca.yaml new file mode 100644 index 00000000..55457b85 --- /dev/null +++ b/test-network/docker/docker-compose-ca.yaml @@ -0,0 +1,50 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +version: '2' + +services: + + ca_org1: + image: hyperledger/fabric-ca:$IMAGE_TAG + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca-org1 + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_PORT=7054 + ports: + - "7054:7054" + command: sh -c 'fabric-ca-server start -b admin:adminpw -d' + volumes: + - ../organizations/fabric-ca/org1:/etc/hyperledger/fabric-ca-server + container_name: ca_org1 + + ca_org2: + image: hyperledger/fabric-ca:$IMAGE_TAG + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca-org2 + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_PORT=8054 + ports: + - "8054:8054" + command: sh -c 'fabric-ca-server start -b admin:adminpw -d' + volumes: + - ../organizations/fabric-ca/org2:/etc/hyperledger/fabric-ca-server + container_name: ca_org2 + + ca_orderer: + image: hyperledger/fabric-ca:$IMAGE_TAG + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca-orderer + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_PORT=9054 + ports: + - "9054:9054" + command: sh -c 'fabric-ca-server start -b admin:adminpw -d' + volumes: + - ../organizations/fabric-ca/ordererOrg:/etc/hyperledger/fabric-ca-server + container_name: ca_orderer diff --git a/test-network/docker/docker-compose-couch.yaml b/test-network/docker/docker-compose-couch.yaml new file mode 100644 index 00000000..85b14f7a --- /dev/null +++ b/test-network/docker/docker-compose-couch.yaml @@ -0,0 +1,64 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +version: '2' + +networks: + test: + +services: + couchdb0: + container_name: couchdb0 + image: hyperledger/fabric-couchdb + # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password + # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. + environment: + - COUCHDB_USER= + - COUCHDB_PASSWORD= + # Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service, + # for example map it to utilize Fauxton User Interface in dev environments. + ports: + - "5984:5984" + networks: + - test + + peer0.org1.example.com: + environment: + - CORE_LEDGER_STATE_STATEDATABASE=CouchDB + - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984 + # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD + # provide the credentials for ledger to connect to CouchDB. The username and password must + # match the username and password set for the associated CouchDB. + - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME= + - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD= + depends_on: + - couchdb0 + + couchdb1: + container_name: couchdb1 + image: hyperledger/fabric-couchdb + # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password + # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. + environment: + - COUCHDB_USER= + - COUCHDB_PASSWORD= + # Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service, + # for example map it to utilize Fauxton User Interface in dev environments. + ports: + - "7984:5984" + networks: + - test + + peer0.org2.example.com: + environment: + - CORE_LEDGER_STATE_STATEDATABASE=CouchDB + - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984 + # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD + # provide the credentials for ledger to connect to CouchDB. The username and password must + # match the username and password set for the associated CouchDB. + - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME= + - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD= + depends_on: + - couchdb1 diff --git a/test-network/docker/docker-compose-e2e.yaml b/test-network/docker/docker-compose-e2e.yaml new file mode 100644 index 00000000..57b9e60d --- /dev/null +++ b/test-network/docker/docker-compose-e2e.yaml @@ -0,0 +1,176 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +version: '2' + +volumes: + orderer.example.com: + peer0.org1.example.com: + peer0.org2.example.com: + +networks: + test: + +services: + + ca0: + image: hyperledger/fabric-ca:$IMAGE_TAG + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca-org1 + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_PORT=7054 + ports: + - "7054:7054" + command: sh -c 'fabric-ca-server start -b admin:adminpw -d' + volumes: + - ../organizations/fabric-ca/org1:/etc/hyperledger/fabric-ca-server + container_name: ca_org1 + networks: + - test + + ca1: + image: hyperledger/fabric-ca:$IMAGE_TAG + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca-org2 + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_PORT=8054 + ports: + - "8054:8054" + command: sh -c 'fabric-ca-server start -b admin:adminpw -d' + volumes: + - ../organizations/fabric-ca/org2:/etc/hyperledger/fabric-ca-server + container_name: ca_org2 + networks: + - test + + ca2: + image: hyperledger/fabric-ca:$IMAGE_TAG + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca-orderer + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_PORT=9054 + ports: + - "9054:9054" + command: sh -c 'fabric-ca-server start -b admin:adminpw -d' + volumes: + - ../organizations/fabric-ca/ordererOrg:/etc/hyperledger/fabric-ca-server + container_name: ca_orderer + networks: + - test + + orderer.example.com: + container_name: orderer.example.com + image: hyperledger/fabric-orderer:$IMAGE_TAG + environment: + - FABRIC_LOGGING_SPEC=INFO + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # enabled TLS + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1 + - ORDERER_KAFKA_VERBOSE=true + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + working_dir: /opt/gopath/src/github.com/hyperledger/fabric + command: orderer + volumes: + - ../system-genesis-block/genesis.block:/var/hyperledger/orderer/orderer.genesis.block + - ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp + - ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls + - orderer.example.com:/var/hyperledger/production/orderer + ports: + - 7050:7050 + networks: + - test + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:$IMAGE_TAG + environment: + #Generic peer variables + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + # the following setting starts chaincode containers on the same + # bridge network as the peers + # https://docs.docker.com/compose/networking/ + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_test + - FABRIC_LOGGING_SPEC=INFO + #- FABRIC_LOGGING_SPEC=DEBUG + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_GOSSIP_USELEADERELECTION=true + - CORE_PEER_GOSSIP_ORGLEADER=false + - CORE_PEER_PROFILE_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt + # Peer specific variabes + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 + - CORE_PEER_LISTENADDRESS=0.0.0.0:7051 + - CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052 + - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 + - CORE_PEER_LOCALMSPID=Org1MSP + volumes: + - /var/run/:/host/var/run/ + - ../organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp + - ../organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls + - peer0.org1.example.com:/var/hyperledger/production + working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer + command: peer node start + ports: + - 7051:7051 + networks: + - test + + peer0.org2.example.com: + container_name: peer0.org2.example.com + image: hyperledger/fabric-peer:$IMAGE_TAG + environment: + #Generic peer variables + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + # the following setting starts chaincode containers on the same + # bridge network as the peers + # https://docs.docker.com/compose/networking/ + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_test + - FABRIC_LOGGING_SPEC=INFO + #- FABRIC_LOGGING_SPEC=DEBUG + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_GOSSIP_USELEADERELECTION=true + - CORE_PEER_GOSSIP_ORGLEADER=false + - CORE_PEER_PROFILE_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt + # Peer specific variabes + - CORE_PEER_ID=peer0.org2.example.com + - CORE_PEER_ADDRESS=peer0.org2.example.com:9051 + - CORE_PEER_LISTENADDRESS=0.0.0.0:9051 + - CORE_PEER_CHAINCODEADDRESS=peer0.org2.example.com:9052 + - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:9052 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:9051 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:9051 + - CORE_PEER_LOCALMSPID=Org2MSP + volumes: + - /var/run/:/host/var/run/ + - ../organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp + - ../organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls + - peer0.org2.example.com:/var/hyperledger/production + working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer + command: peer node start + ports: + - 9051:9051 + networks: + - test diff --git a/test-network/docker/docker-compose-test-net.yaml b/test-network/docker/docker-compose-test-net.yaml new file mode 100644 index 00000000..278248f2 --- /dev/null +++ b/test-network/docker/docker-compose-test-net.yaml @@ -0,0 +1,128 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +version: '2' + +volumes: + orderer.example.com: + peer0.org1.example.com: + peer0.org2.example.com: + +networks: + test: + +services: + + orderer.example.com: + container_name: orderer.example.com + image: hyperledger/fabric-orderer:$IMAGE_TAG + environment: + - FABRIC_LOGGING_SPEC=INFO + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # enabled TLS + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1 + - ORDERER_KAFKA_VERBOSE=true + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + working_dir: /opt/gopath/src/github.com/hyperledger/fabric + command: orderer + volumes: + - ../system-genesis-block/genesis.block:/var/hyperledger/orderer/orderer.genesis.block + - ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp + - ../organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls + - orderer.example.com:/var/hyperledger/production/orderer + ports: + - 7050:7050 + networks: + - test + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:$IMAGE_TAG + environment: + #Generic peer variables + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + # the following setting starts chaincode containers on the same + # bridge network as the peers + # https://docs.docker.com/compose/networking/ + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_test + - FABRIC_LOGGING_SPEC=INFO + #- FABRIC_LOGGING_SPEC=DEBUG + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_GOSSIP_USELEADERELECTION=true + - CORE_PEER_GOSSIP_ORGLEADER=false + - CORE_PEER_PROFILE_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt + # Peer specific variabes + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 + - CORE_PEER_LISTENADDRESS=0.0.0.0:7051 + - CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052 + - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 + - CORE_PEER_LOCALMSPID=Org1MSP + volumes: + - /var/run/:/host/var/run/ + - ../organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp + - ../organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls + - peer0.org1.example.com:/var/hyperledger/production + working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer + command: peer node start + ports: + - 7051:7051 + networks: + - test + + peer0.org2.example.com: + container_name: peer0.org2.example.com + image: hyperledger/fabric-peer:$IMAGE_TAG + environment: + #Generic peer variables + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + # the following setting starts chaincode containers on the same + # bridge network as the peers + # https://docs.docker.com/compose/networking/ + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_test + - FABRIC_LOGGING_SPEC=INFO + #- FABRIC_LOGGING_SPEC=DEBUG + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_GOSSIP_USELEADERELECTION=true + - CORE_PEER_GOSSIP_ORGLEADER=false + - CORE_PEER_PROFILE_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt + # Peer specific variabes + - CORE_PEER_ID=peer0.org2.example.com + - CORE_PEER_ADDRESS=peer0.org2.example.com:9051 + - CORE_PEER_LISTENADDRESS=0.0.0.0:9051 + - CORE_PEER_CHAINCODEADDRESS=peer0.org2.example.com:9052 + - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:9052 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:9051 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:9051 + - CORE_PEER_LOCALMSPID=Org2MSP + volumes: + - /var/run/:/host/var/run/ + - ../organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp + - ../organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls + - peer0.org2.example.com:/var/hyperledger/production + working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer + command: peer node start + ports: + - 9051:9051 + networks: + - test diff --git a/test-network/network.sh b/test-network/network.sh new file mode 100755 index 00000000..b462048d --- /dev/null +++ b/test-network/network.sh @@ -0,0 +1,564 @@ +#!/bin/bash +# +# Copyright IBM Corp All Rights Reserved +# +# SPDX-License-Identifier: Apache-2.0 +# + +# This script brings up a Hyperledger Fabric network for testing smart contracts +# and applications. The test network consists of two organizations with one +# peer each, and a single node Raft ordering service. Users can also use this +# script to create a channel deploy a chaincode on the channel +# +# prepending $PWD/../bin to PATH to ensure we are picking up the correct binaries +# this may be commented out to resolve installed version of tools if desired +export PATH=${PWD}/../bin:${PWD}:$PATH +export FABRIC_CFG_PATH=${PWD}/configtx +export VERBOSE=false + +# Print the usage message +function printHelp() { + echo "Usage: " + echo " network.sh [Flags]" + echo " " + echo " - 'up' - bring up fabric orderer and peer nodes. No channel is created" + echo " - 'up createChannel' - bring up fabric network with one channel" + echo " - 'createChannel' - create and join a channel after the network is created" + echo " - 'deployCC' - deploy the fabcar chaincode on the channel" + echo " - 'down' - clear the network with docker-compose down" + echo " - 'restart' - restart the network" + echo + echo " Flags:" + echo " -ca - create Certificate Authorities to generate the crypto material" + echo " -c - channel name to use (defaults to \"mychannel\")" + echo " -s - the database backend to use: goleveldb (default) or couchdb" + echo " -r - CLI times out after certain number of attempts (defaults to 5)" + echo " -d - delay duration in seconds (defaults to 3)" + echo " -l - the programming language of the chaincode to deploy: go (default), javascript, or java" + echo " -v - chaincode version. Must be a round number, 1, 2, 3, etc" + echo " -i - the tag to be used to launch the network (defaults to \"latest\")" + echo " -verbose - verbose mode" + echo " network.sh -h (print this message)" + echo + echo " Possible Mode and flags" + echo " network.sh up -ca -c -r -d -s -i -verbose" + echo " network.sh up createChannel -ca -c -r -d -s -i -verbose" + echo " network.sh createChannel -c -r -d -verbose" + echo " network.sh deployCC -l -v -r -d -verbose" + echo + echo " Taking all defaults:" + echo " network.sh up" + echo + echo " Examples:" + echo " network.sh up createChannel -ca -c mychannel -s couchdb -i 2.0.0-beta" + echo " network.sh createChannel -c channelName" + echo " network.sh deployCC -l javascript" +} + +# Obtain CONTAINER_IDS and remove them +# TODO Might want to make this optional - could clear other containers +# This function is called when you bring a network down +function clearContainers() { + CONTAINER_IDS=$(docker ps -a | awk '($2 ~ /dev-peer.*/) {print $1}') + if [ -z "$CONTAINER_IDS" -o "$CONTAINER_IDS" == " " ]; then + echo "---- No containers available for deletion ----" + else + docker rm -f $CONTAINER_IDS + fi +} + +# Delete any images that were generated as a part of this setup +# specifically the following images are often left behind: +# This function is called when you bring the network down +function removeUnwantedImages() { + DOCKER_IMAGE_IDS=$(docker images | awk '($1 ~ /dev-peer.*/) {print $3}') + if [ -z "$DOCKER_IMAGE_IDS" -o "$DOCKER_IMAGE_IDS" == " " ]; then + echo "---- No images available for deletion ----" + else + docker rmi -f $DOCKER_IMAGE_IDS + fi +} + +# Versions of fabric known not to work with the test network +BLACKLISTED_VERSIONS="^1\.0\. ^1\.1\. ^1\.2\. ^1\.3\. ^1\.4\." + +# Do some basic sanity checking to make sure that the appropriate versions of fabric +# binaries/images are available. In the future, additional checking for the presence +# of go or other items could be added. +function checkPrereqs() { + ## Check if your have cloned the peer binaries and configuration files. + peer version > /dev/null 2>&1 + + if [[ $? -ne 0 || ! -d "../config" ]]; then + echo "ERROR! Peer binary and configuration files not found.." + echo + echo "Follow the instructions in the Fabric docs to install the Fabric Binaries:" + echo "https://hyperledger-fabric.readthedocs.io/en/latest/install.html" + exit 1 + fi + # use the fabric tools container to see if the samples and binaries match your + # docker images + LOCAL_VERSION=$(peer version | sed -ne 's/ Version: //p') + DOCKER_IMAGE_VERSION=$(docker run --rm hyperledger/fabric-tools:$IMAGETAG peer version | sed -ne 's/ Version: //p' | head -1) + + echo "LOCAL_VERSION=$LOCAL_VERSION" + echo "DOCKER_IMAGE_VERSION=$DOCKER_IMAGE_VERSION" + + if [ "$LOCAL_VERSION" != "$DOCKER_IMAGE_VERSION" ]; then + echo "=================== WARNING ===================" + echo " Local fabric binaries and docker images are " + echo " out of sync. This may cause problems. " + echo "===============================================" + fi + + for UNSUPPORTED_VERSION in $BLACKLISTED_VERSIONS; do + echo "$LOCAL_VERSION" | grep -q $UNSUPPORTED_VERSION + if [ $? -eq 0 ]; then + echo "ERROR! Local Fabric binary version of $LOCAL_VERSION does not match the versions supported by the test network." + exit 1 + fi + + echo "$DOCKER_IMAGE_VERSION" | grep -q $UNSUPPORTED_VERSION + if [ $? -eq 0 ]; then + echo "ERROR! Fabric Docker image version of $DOCKER_IMAGE_VERSION does not match the versions supported by the test network." + exit 1 + fi + done +} + + +# Before you can bring up a network, each organization needs to generate the crypto +# material that will define that organization on the network. Because Hyperledger +# Fabric is a permissioned blockchain, each node and user on the network needs to +# use certificates and keys to sign and verify its actions. In addition, each user +# needs to belong to an organization that is recognized as a member of the network. +# You can use the Cryptogen tool or Fabric CAs to generate the organization crypto +# material. + +# By default, the sample network uses cryptogen. Cryptogen is a tool that is +# meant for development and testing that can quicky create the certificates and keys +# that can be consumed by a Fabric network. The cryptogen tool consumes a series +# of configuration files for each organization in the "organizations/cryptogen" +# directory. Cryptogen uses the files to generate the crypto material for each +# org in the "organizations" directory. + +# You can also Fabric CAs to generate the crypto material. CAs sign the certificates +# and keys that they generate to create a valid root of trust for each organization. +# The script uses Docker Compose to bring up three CAs, one for each peer organization +# and the ordering organization. The configuration file for creating the Fabric CA +# servers are in the "organizations/fabric-ca" directory. Within the same diectory, +# the "registerEnroll.sh" script uses the Fabric CA client to create the identites, +# certificates, and MSP folders that are needed to create the test network in the +# "organizations/ordererOrganizations" directory. + +# Create Organziation crypto material using cryptogen or CAs +function createOrgs() { + + if [ -d "organizations/peerOrganizations" ]; then + rm -Rf organizations/peerOrganizations && rm -Rf organizations/ordererOrganizations + fi + + # Create crypto material using cryptogen + if [ "$CRYPTO" == "cryptogen" ]; then + which cryptogen + if [ "$?" -ne 0 ]; then + echo "cryptogen tool not found. exiting" + exit 1 + fi + echo + echo "##########################################################" + echo "##### Generate certificates using cryptogen tool #########" + echo "##########################################################" + echo + + echo "##########################################################" + echo "############ Create Org1 Identities ######################" + echo "##########################################################" + + set -x + cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --output="organizations" + res=$? + set +x + if [ $res -ne 0 ]; then + echo "Failed to generate certificates..." + exit 1 + fi + + echo "##########################################################" + echo "############ Create Org2 Identities ######################" + echo "##########################################################" + + set -x + cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --output="organizations" + res=$? + set +x + if [ $res -ne 0 ]; then + echo "Failed to generate certificates..." + exit 1 + fi + + echo "##########################################################" + echo "############ Create Orderer Org Identities ###############" + echo "##########################################################" + + set -x + cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --output="organizations" + res=$? + set +x + if [ $res -ne 0 ]; then + echo "Failed to generate certificates..." + exit 1 + fi + + fi + + # Create crypto material using Fabric CAs + if [ "$CRYPTO" == "Certificate Authorities" ]; then + + fabric-ca-client version > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Fabric CA client not found locally, downloading..." + cd .. + curl -s -L "https://github.com/hyperledger/fabric-ca/releases/download/v1.4.4/hyperledger-fabric-ca-${OS_ARCH}-1.4.4.tar.gz" | tar xz || rc=$? + if [ -n "$rc" ]; then + echo "==> There was an error downloading the binary file." + echo "fabric-ca-client binary is not available to download" + else + echo "==> Done." + cd test-network + fi + fi + + echo + echo "##########################################################" + echo "##### Generate certificates using Fabric CA's ############" + echo "##########################################################" + + IMAGE_TAG=$IMAGETAG docker-compose -f $COMPOSE_FILE_CA up -d 2>&1 + + . organizations/fabric-ca/registerEnroll.sh + + sleep 10 + + echo "##########################################################" + echo "############ Create Org1 Identities ######################" + echo "##########################################################" + + createOrg1 + + echo "##########################################################" + echo "############ Create Org2 Identities ######################" + echo "##########################################################" + + createOrg2 + + echo "##########################################################" + echo "############ Create Orderer Org Identities ###############" + echo "##########################################################" + + createOrderer + + fi + + echo + echo "Generate CCP files for Org1 and Org2" + ./organizations/ccp-generate.sh +} + +# Once you create the organization crypto material, you need to create the +# genesis block of the orderer system channel. This block is required to bring +# up any orderer nodes and create any application channels. + +# The configtxgen tool is used to create the genesis block. Configtxgen consumes a +# "configtx.yaml" file that contains the definitions for the sample network. The +# genesis block is defiend using the "TwoOrgsOrdererGenesis" profile at the bottom +# of the file. This profile defines a sample consortium, "SampleConsortium", +# consisting of our two Peer Orgs. This consortium defines which organizations are +# recognized as members of the network. The peer and ordering organizations are defined +# in the "Profiles" section at the top of the file. As part of each organization +# profile, the file points to a the location of the MSP directory for each member. +# This MSP is used to create the channel MSP that defines the root of trust for +# each organization. In essense, the channel MSP allows the nodes and users to be +# recognized as network members. The file also specifies the anchor peers for each +# peer org. In future steps, this same file is used to create the channel creation +# transaction and the anchor peer updates. +# +# +# If you receive the following warning, it can be safely ignored: +# +# [bccsp] GetDefault -> WARN 001 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP. +# +# You can ignore the logs regarding intermediate certs, we are not using them in +# this crypto implementation. + +# Generate orderer system channel genesis block. +function createConsortium() { + + which configtxgen + if [ "$?" -ne 0 ]; then + echo "configtxgen tool not found. exiting" + exit 1 + fi + + echo "######### Generating Orderer Genesis block ##############" + + # Note: For some unknown reason (at least for now) the block file can't be + # named orderer.genesis.block or the orderer will fail to launch! + set -x + configtxgen -profile TwoOrgsOrdererGenesis -channelID system-channel -outputBlock ./system-genesis-block/genesis.block + res=$? + set +x + if [ $res -ne 0 ]; then + echo "Failed to generate orderer genesis block..." + exit 1 + fi +} + +# After we create the org crypto material and the system channel genesis block, +# we can now bring up the peers and orderering service. By default, the base +# file for creating the network is "docker-compose-test-net.yaml" in the ``docker`` +# folder. This file defines the environment variables and file mounts that +# point the crypto material and genesis block that were created in earlier. + +# Bring up the peer and orderer nodes using docker compose. +function networkUp() { + + checkPrereqs + # generate artifacts if they don't exist + if [ ! -d "organizations/peerOrganizations" ]; then + createOrgs + createConsortium + fi + + COMPOSE_FILES="-f ${COMPOSE_FILE_BASE}" + + if [ "${DATABASE}" == "couchdb" ]; then + COMPOSE_FILES="${COMPOSE_FILES} -f ${COMPOSE_FILE_COUCH}" + fi + + IMAGE_TAG=$IMAGETAG docker-compose ${COMPOSE_FILES} up -d 2>&1 + + docker ps -a + if [ $? -ne 0 ]; then + echo "ERROR !!!! Unable to start network" + exit 1 + fi +} + +## call the script to join create the channel and join the peers of org1 and org2 +function createChannel() { + +## Bring up the network if it is not arleady up. + + if [ ! -d "organizations/peerOrganizations" ]; then + echo "Bringing up network" + networkUp + fi + + # now run the script that creates a channel. This script uses configtxgen once + # more to create the channel creation transaction and the anchor peer updates. + # configtx.yaml is mounted in the cli container, which allows us to use it to + # create the channel artifacts + scripts/createChannel.sh $CHANNEL_NAME $CLI_DELAY $MAX_RETRY $VERBOSE + if [ $? -ne 0 ]; then + echo "Error !!! Create channel failed" + exit 1 + fi + +} + +## Call the script to isntall and instantiate a chaincode on the channel +function deployCC() { + + scripts/deployCC.sh $CHANNEL_NAME $CC_RUNTIME_LANGUAGE $VERSION $CLI_DELAY $MAX_RETRY $VERBOSE + + if [ $? -ne 0 ]; then + echo "ERROR !!! Deploying chaincode failed" + exit 1 + fi + + exit 0 +} + + +# Tear down running network +function networkDown() { + # stop org3 containers also in addition to org1 and org2, in case we were running sample to add org3 + docker-compose -f $COMPOSE_FILE_BASE -f $COMPOSE_FILE_COUCH -f $COMPOSE_FILE_CA down --volumes --remove-orphans + docker-compose -f $COMPOSE_FILE_COUCH_ORG3 -f $COMPOSE_FILE_ORG3 down --volumes --remove-orphans + # Don't remove the generated artifacts -- note, the ledgers are always removed + if [ "$MODE" != "restart" ]; then + # Bring down the network, deleting the volumes + #Delete any ledger backups + docker run -v $PWD:/tmp/first-network --rm hyperledger/fabric-tools:$IMAGETAG rm -Rf /tmp/first-network/ledgers-backup + #Cleanup the chaincode containers + clearContainers + #Cleanup images + removeUnwantedImages + # remove orderer block and other channel configuration transactions and certs + rm -rf system-genesis-block/*.block organizations/peerOrganizations organizations/ordererOrganizations + ## remove fabric ca artifacts + rm -rf organizations/fabric-ca/org1/msp organizations/fabric-ca/org1/tls-cert.pem organizations/fabric-ca/org1/ca-cert.pem organizations/fabric-ca/org1/IssuerPublicKey organizations/fabric-ca/org1/IssuerRevocationPublicKey organizations/fabric-ca/org1/fabric-ca-server.db + rm -rf organizations/fabric-ca/org2/msp organizations/fabric-ca/org2/tls-cert.pem organizations/fabric-ca/org2/ca-cert.pem organizations/fabric-ca/org2/IssuerPublicKey organizations/fabric-ca/org2/IssuerRevocationPublicKey organizations/fabric-ca/org2/fabric-ca-server.db + rm -rf organizations/fabric-ca/ordererOrg/msp organizations/fabric-ca/ordererOrg/tls-cert.pem organizations/fabric-ca/ordererOrg/ca-cert.pem organizations/fabric-ca/ordererOrg/IssuerPublicKey organizations/fabric-ca/ordererOrg/IssuerRevocationPublicKey organizations/fabric-ca/ordererOrg/fabric-ca-server.db + rm -rf addOrg3/fabric-ca/org3/msp addOrg3/fabric-ca/org3/tls-cert.pem addOrg3/fabric-ca/org3/ca-cert.pem addOrg3/fabric-ca/org3/IssuerPublicKey addOrg3/fabric-ca/org3/IssuerRevocationPublicKey addOrg3/fabric-ca/org3/fabric-ca-server.db + + + # remove channel and script artifacts + rm -rf channel-artifacts log.txt fabcar.tar.gz fabcar + + fi +} + +# Obtain the OS and Architecture string that will be used to select the correct +# native binaries for your platform, e.g., darwin-amd64 or linux-amd64 +OS_ARCH=$(echo "$(uname -s | tr '[:upper:]' '[:lower:]' | sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') +# Using crpto vs CA. default is cryptogen +CRYPTO="cryptogen" +# timeout duration - the duration the CLI should wait for a response from +# another container before giving up +MAX_RETRY=5 +# default for delay between commands +CLI_DELAY=3 +# channel name defaults to "mychannel" +CHANNEL_NAME="mychannel" +# use this as the default docker-compose yaml definition +COMPOSE_FILE_BASE=docker/docker-compose-test-net.yaml +# docker-compose.yaml file if you are using couchdb +COMPOSE_FILE_COUCH=docker/docker-compose-couch.yaml +# certificate authorities compose file +COMPOSE_FILE_CA=docker/docker-compose-ca.yaml +# use this as the docker compose couch file for org3 +COMPOSE_FILE_COUCH_ORG3=addOrg3/docker/docker-compose-couch-org3.yaml +# use this as the default docker-compose yaml definition for org3 +COMPOSE_FILE_ORG3=addOrg3/docker/docker-compose-org3.yaml +# +# use golang as the default language for chaincode +CC_RUNTIME_LANGUAGE=golang +# Chaincode version +VERSION=1 +# default image tag +IMAGETAG="latest" +# default database +DATABASE="leveldb" + +# Parse commandline args + +## Parse mode +if [[ $# -lt 1 ]] ; then + printHelp + exit 0 +else + MODE=$1 + shift +fi + +# parse a createChannel subcommand if used +if [[ $# -ge 1 ]] ; then + key="$1" + if [[ "$key" == "createChannel" ]]; then + export MODE="createChannel" + shift + fi +fi + +# parse flags + +while [[ $# -ge 1 ]] ; do + key="$1" + case $key in + -h ) + printHelp + exit 0 + ;; + -c ) + CHANNEL_NAME="$2" + shift + ;; + -ca ) + CRYPTO="Certificate Authorities" + ;; + -r ) + MAX_RETRY="$2" + shift + ;; + -d ) + CLI_DELAY="$2" + shift + ;; + -s ) + DATABASE="$2" + shift + ;; + -l ) + CC_RUNTIME_LANGUAGE="$2" + shift + ;; + -v ) + VERSION="$2" + shift + ;; + -i ) + IMAGETAG=$(go env GOARCH)"-""$2" + shift + ;; + -verbose ) + VERBOSE=true + shift + ;; + * ) + echo + echo "Unknown flag: $key" + echo + printHelp + exit 1 + ;; + esac + shift +done + +# Are we generating crypto material with this command? +if [ ! -d "organizations/peerOrganizations" ]; then + CRYPTO_MODE="with crypto from '${CRYPTO}'" +else + CRYPTO_MODE="" +fi + +# Determine mode of operation and printing out what we asked for +if [ "$MODE" == "up" ]; then + echo "Starting nodes with CLI timeout of '${MAX_RETRY}' tries and CLI delay of '${CLI_DELAY}' seconds and using database '${DATABASE}' ${CRYPTO_MODE}" + echo +elif [ "$MODE" == "createChannel" ]; then + echo "Creating channel '${CHANNEL_NAME}'." + echo + echo "If network is not up, starting nodes with CLI timeout of '${MAX_RETRY}' tries and CLI delay of '${CLI_DELAY}' seconds and using database '${DATABASE} ${CRYPTO_MODE}" + echo +elif [ "$MODE" == "down" ]; then + echo "Stopping network" + echo +elif [ "$MODE" == "restart" ]; then + echo "Restarting network" + echo +elif [ "$MODE" == "deployCC" ]; then + echo "deploying chaincode on channel '${CHANNEL_NAME}'" + echo +else + printHelp + exit 1 +fi + +if [ "${MODE}" == "up" ]; then + networkUp +elif [ "${MODE}" == "createChannel" ]; then + createChannel +elif [ "${MODE}" == "deployCC" ]; then + deployCC +elif [ "${MODE}" == "down" ]; then + networkDown +elif [ "${MODE}" == "restart" ]; then + networkDown + networkUp +else + printHelp + exit 1 +fi diff --git a/test-network/organizations/ccp-generate.sh b/test-network/organizations/ccp-generate.sh new file mode 100755 index 00000000..40f52395 --- /dev/null +++ b/test-network/organizations/ccp-generate.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +function one_line_pem { + echo "`awk 'NF {sub(/\\n/, ""); printf "%s\\\\\\\n",$0;}' $1`" +} + +function json_ccp { + local PP=$(one_line_pem $4) + local CP=$(one_line_pem $5) + sed -e "s/\${ORG}/$1/" \ + -e "s/\${P0PORT}/$2/" \ + -e "s/\${CAPORT}/$3/" \ + -e "s#\${PEERPEM}#$PP#" \ + -e "s#\${CAPEM}#$CP#" \ + organizations/ccp-template.json +} + +function yaml_ccp { + local PP=$(one_line_pem $4) + local CP=$(one_line_pem $5) + sed -e "s/\${ORG}/$1/" \ + -e "s/\${P0PORT}/$2/" \ + -e "s/\${CAPORT}/$3/" \ + -e "s#\${PEERPEM}#$PP#" \ + -e "s#\${CAPEM}#$CP#" \ + organizations/ccp-template.yaml | sed -e $'s/\\\\n/\\\n /g' +} + +ORG=1 +P0PORT=7051 +CAPORT=7054 +PEERPEM=organizations/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem +CAPEM=organizations/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + +echo "$(json_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > organizations/peerOrganizations/org1.example.com/connection-org1.json +echo "$(yaml_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > organizations/peerOrganizations/org1.example.com/connection-org1.yaml + +ORG=2 +P0PORT=9051 +CAPORT=8054 +PEERPEM=organizations/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem +CAPEM=organizations/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem + +echo "$(json_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > organizations/peerOrganizations/org2.example.com/connection-org2.json +echo "$(yaml_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > organizations/peerOrganizations/org2.example.com/connection-org2.yaml diff --git a/test-network/organizations/ccp-template.json b/test-network/organizations/ccp-template.json new file mode 100755 index 00000000..b4fb3dfb --- /dev/null +++ b/test-network/organizations/ccp-template.json @@ -0,0 +1,49 @@ +{ + "name": "first-network-org${ORG}", + "version": "1.0.0", + "client": { + "organization": "Org${ORG}", + "connection": { + "timeout": { + "peer": { + "endorser": "300" + } + } + } + }, + "organizations": { + "Org${ORG}": { + "mspid": "Org${ORG}MSP", + "peers": [ + "peer0.org${ORG}.example.com" + ], + "certificateAuthorities": [ + "ca.org${ORG}.example.com" + ] + } + }, + "peers": { + "peer0.org${ORG}.example.com": { + "url": "grpcs://localhost:${P0PORT}", + "tlsCACerts": { + "pem": "${PEERPEM}" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org${ORG}.example.com", + "hostnameOverride": "peer0.org${ORG}.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org${ORG}.example.com": { + "url": "https://localhost:${CAPORT}", + "caName": "ca-org${ORG}", + "tlsCACerts": { + "pem": "${CAPEM}" + }, + "httpOptions": { + "verify": false + } + } + } +} diff --git a/test-network/organizations/ccp-template.yaml b/test-network/organizations/ccp-template.yaml new file mode 100755 index 00000000..dec3f059 --- /dev/null +++ b/test-network/organizations/ccp-template.yaml @@ -0,0 +1,34 @@ +--- +name: first-network-org${ORG} +version: 1.0.0 +client: + organization: Org${ORG} + connection: + timeout: + peer: + endorser: '300' +organizations: + Org${ORG}: + mspid: Org${ORG}MSP + peers: + - peer0.org${ORG}.example.com + certificateAuthorities: + - ca.org${ORG}.example.com +peers: + peer0.org${ORG}.example.com: + url: grpcs://localhost:${P0PORT} + tlsCACerts: + pem: | + ${PEERPEM} + grpcOptions: + ssl-target-name-override: peer0.org${ORG}.example.com + hostnameOverride: peer0.org${ORG}.example.com +certificateAuthorities: + ca.org${ORG}.example.com: + url: https://localhost:${CAPORT} + caName: ca-org${ORG} + tlsCACerts: + pem: | + ${CAPEM} + httpOptions: + verify: false diff --git a/test-network/organizations/cryptogen/crypto-config-orderer.yaml b/test-network/organizations/cryptogen/crypto-config-orderer.yaml new file mode 100755 index 00000000..ce50978f --- /dev/null +++ b/test-network/organizations/cryptogen/crypto-config-orderer.yaml @@ -0,0 +1,20 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +# --------------------------------------------------------------------------- +# "OrdererOrgs" - Definition of organizations managing orderer nodes +# --------------------------------------------------------------------------- +OrdererOrgs: + # --------------------------------------------------------------------------- + # Orderer + # --------------------------------------------------------------------------- + - Name: Orderer + Domain: example.com + EnableNodeOUs: true + # --------------------------------------------------------------------------- + # "Specs" - See PeerOrgs for complete description + # --------------------------------------------------------------------------- + Specs: + - Hostname: orderer diff --git a/basic-network/crypto-config.yaml b/test-network/organizations/cryptogen/crypto-config-org1.yaml old mode 100644 new mode 100755 similarity index 79% rename from basic-network/crypto-config.yaml rename to test-network/organizations/cryptogen/crypto-config-org1.yaml index 05bb2dc1..40738450 --- a/basic-network/crypto-config.yaml +++ b/test-network/organizations/cryptogen/crypto-config-org1.yaml @@ -3,20 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # -# --------------------------------------------------------------------------- -# "OrdererOrgs" - Definition of organizations managing orderer nodes -# --------------------------------------------------------------------------- -OrdererOrgs: - # --------------------------------------------------------------------------- - # Orderer - # --------------------------------------------------------------------------- - - Name: Orderer - Domain: example.com - # --------------------------------------------------------------------------- - # "Specs" - See PeerOrgs below for complete description - # --------------------------------------------------------------------------- - Specs: - - Hostname: orderer + # --------------------------------------------------------------------------- # "PeerOrgs" - Definition of organizations managing peer nodes # --------------------------------------------------------------------------- @@ -26,6 +13,7 @@ PeerOrgs: # --------------------------------------------------------------------------- - Name: Org1 Domain: org1.example.com + EnableNodeOUs: true # --------------------------------------------------------------------------- # "Specs" # --------------------------------------------------------------------------- @@ -42,7 +30,6 @@ PeerOrgs: # which obtains its values from the Spec.Hostname and # Org.Domain, respectively. # --------------------------------------------------------------------------- - # Specs: # - Hostname: foo # implicitly "foo.org1.example.com" # CommonName: foo27.org5.example.com # overrides Hostname-based FQDN set above # - Hostname: bar @@ -61,6 +48,8 @@ PeerOrgs: # --------------------------------------------------------------------------- Template: Count: 1 + SANS: + - localhost # Start: 5 # Hostname: {{.Prefix}}{{.Index}} # default # --------------------------------------------------------------------------- diff --git a/balance-transfer/artifacts/channel/cryptogen.yaml b/test-network/organizations/cryptogen/crypto-config-org2.yaml old mode 100644 new mode 100755 similarity index 56% rename from balance-transfer/artifacts/channel/cryptogen.yaml rename to test-network/organizations/cryptogen/crypto-config-org2.yaml index be2a9f86..6298ff6d --- a/balance-transfer/artifacts/channel/cryptogen.yaml +++ b/test-network/organizations/cryptogen/crypto-config-org2.yaml @@ -1,43 +1,18 @@ -# # Copyright IBM Corp. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # -# --------------------------------------------------------------------------- -# "OrdererOrgs" - Definition of organizations managing orderer nodes -# --------------------------------------------------------------------------- -OrdererOrgs: - # --------------------------------------------------------------------------- - # Orderer - # --------------------------------------------------------------------------- - - Name: Orderer - Domain: example.com - - # --------------------------------------------------------------------------- - # "Specs" - See PeerOrgs below for complete description - # --------------------------------------------------------------------------- - Specs: - - Hostname: orderer # --------------------------------------------------------------------------- # "PeerOrgs" - Definition of organizations managing peer nodes # --------------------------------------------------------------------------- PeerOrgs: # --------------------------------------------------------------------------- - # Org1 + # Org2 # --------------------------------------------------------------------------- - - Name: Org1 - Domain: org1.example.com - - # --------------------------------------------------------------------------- - # "CA" - # --------------------------------------------------------------------------- - # Uncomment this section to enable the explicit definition of the CA for this - # organization. This entry is a Spec. See "Specs" section below for details. - # --------------------------------------------------------------------------- - CA: - Hostname: ca # implicitly ca.org1.example.com - + - Name: Org2 + Domain: org2.example.com + EnableNodeOUs: true # --------------------------------------------------------------------------- # "Specs" # --------------------------------------------------------------------------- @@ -53,23 +28,12 @@ PeerOrgs: # # which obtains its values from the Spec.Hostname and # Org.Domain, respectively. - # - SANS: (Optional) Specifies one or more Subject Alternative Names - # the be set in the resulting x509. Accepts template - # variables {{.Hostname}}, {{.Domain}}, {{.CommonName}} - # NOTE: Two implicit entries are created for you: - # - {{ .CommonName }} - # - {{ .Hostname }} # --------------------------------------------------------------------------- # Specs: # - Hostname: foo # implicitly "foo.org1.example.com" # CommonName: foo27.org5.example.com # overrides Hostname-based FQDN set above - # SANS: - # - "bar.{{.Domain}}" - # - "altfoo.{{.Domain}}" - # - "{{.Hostname}}.org6.net" # - Hostname: bar # - Hostname: baz - # --------------------------------------------------------------------------- # "Template" # --------------------------------------------------------------------------- @@ -83,12 +47,11 @@ PeerOrgs: # name collisions # --------------------------------------------------------------------------- Template: - Count: 2 + Count: 1 + SANS: + - localhost # Start: 5 # Hostname: {{.Prefix}}{{.Index}} # default - SANS: - - "localhost" - # --------------------------------------------------------------------------- # "Users" # --------------------------------------------------------------------------- @@ -96,18 +59,3 @@ PeerOrgs: # --------------------------------------------------------------------------- Users: Count: 1 - - # --------------------------------------------------------------------------- - # Org2: See "Org1" for full specification - # --------------------------------------------------------------------------- - - Name: Org2 - Domain: org2.example.com - CA: - Hostname: ca # implicitly ca.org1.example.com - - Template: - Count: 2 - SANS: - - "localhost" - Users: - Count: 1 diff --git a/test-network/organizations/fabric-ca/ordererOrg/fabric-ca-server-config.yaml b/test-network/organizations/fabric-ca/ordererOrg/fabric-ca-server-config.yaml new file mode 100755 index 00000000..0591b3e1 --- /dev/null +++ b/test-network/organizations/fabric-ca/ordererOrg/fabric-ca-server-config.yaml @@ -0,0 +1,406 @@ +############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpretted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.2.0 + +# Server's listening port (default: 7054) +port: 7054 + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: true + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts) and transaction +# certificates (TCerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: OrdererCA + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and +# values which the fabric-ca-server optionally puts into TCerts +# which it issues for transacting on the Hyperledger Fabric blockchain. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid','member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + - department1 + - department2 + org2: + - department1 + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: ca.example.com + names: + - C: US + ST: "New York" + L: "New York" + O: example.com + OU: + hosts: + - localhost + - example.com + ca: + expiry: 131400h + pathlength: 1 + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: diff --git a/test-network/organizations/fabric-ca/org1/fabric-ca-server-config.yaml b/test-network/organizations/fabric-ca/org1/fabric-ca-server-config.yaml new file mode 100755 index 00000000..becf4456 --- /dev/null +++ b/test-network/organizations/fabric-ca/org1/fabric-ca-server-config.yaml @@ -0,0 +1,406 @@ +############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpretted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.2.0 + +# Server's listening port (default: 7054) +port: 7054 + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: true + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts) and transaction +# certificates (TCerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: Org1CA + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and +# values which the fabric-ca-server optionally puts into TCerts +# which it issues for transacting on the Hyperledger Fabric blockchain. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid','member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + - department1 + - department2 + org2: + - department1 + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: ca.org1.example.com + names: + - C: US + ST: "North Carolina" + L: "Durham" + O: org1.example.com + OU: + hosts: + - localhost + - org1.example.com + ca: + expiry: 131400h + pathlength: 1 + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: diff --git a/test-network/organizations/fabric-ca/org2/fabric-ca-server-config.yaml b/test-network/organizations/fabric-ca/org2/fabric-ca-server-config.yaml new file mode 100755 index 00000000..0062daf4 --- /dev/null +++ b/test-network/organizations/fabric-ca/org2/fabric-ca-server-config.yaml @@ -0,0 +1,406 @@ +############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpretted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.2.0 + +# Server's listening port (default: 7054) +port: 7054 + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: true + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts) and transaction +# certificates (TCerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: Org2CA + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and +# values which the fabric-ca-server optionally puts into TCerts +# which it issues for transacting on the Hyperledger Fabric blockchain. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid','member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + - department1 + - department2 + org2: + - department1 + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: ca.org2.example.com + names: + - C: UK + ST: "Hampshire" + L: "Hursley" + O: org2.example.com + OU: + hosts: + - localhost + - org2.example.com + ca: + expiry: 131400h + pathlength: 1 + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: diff --git a/test-network/organizations/fabric-ca/registerEnroll.sh b/test-network/organizations/fabric-ca/registerEnroll.sh new file mode 100755 index 00000000..cba2d734 --- /dev/null +++ b/test-network/organizations/fabric-ca/registerEnroll.sh @@ -0,0 +1,307 @@ + + +function createOrg1 { + + echo + echo "Enroll the CA admin" + echo + mkdir -p organizations/peerOrganizations/org1.example.com/ + + export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/peerOrganizations/org1.example.com/ +# rm -rf $FABRIC_CA_CLIENT_HOME/fabric-ca-client-config.yaml +# rm -rf $FABRIC_CA_CLIENT_HOME/msp + + set -x + fabric-ca-client enroll -u https://admin:adminpw@localhost:7054 --caname ca-org1 --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem + set +x + + echo 'NodeOUs: + Enable: true + ClientOUIdentifier: + Certificate: cacerts/localhost-7054-ca-org1.pem + OrganizationalUnitIdentifier: client + PeerOUIdentifier: + Certificate: cacerts/localhost-7054-ca-org1.pem + OrganizationalUnitIdentifier: peer + AdminOUIdentifier: + Certificate: cacerts/localhost-7054-ca-org1.pem + OrganizationalUnitIdentifier: admin + OrdererOUIdentifier: + Certificate: cacerts/localhost-7054-ca-org1.pem + OrganizationalUnitIdentifier: orderer' > ${PWD}/organizations/peerOrganizations/org1.example.com/msp/config.yaml + + echo + echo "Register peer0" + echo + set -x + fabric-ca-client register --caname ca-org1 --id.name peer0 --id.secret peer0pw --id.type peer --id.attrs '"hf.Registrar.Roles=peer"' --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem + set +x + + echo + echo "Register user" + echo + set -x + fabric-ca-client register --caname ca-org1 --id.name user1 --id.secret user1pw --id.type client --id.attrs '"hf.Registrar.Roles=client"' --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem + set +x + + echo + echo "Register the org admin" + echo + set -x + fabric-ca-client register --caname ca-org1 --id.name org1admin --id.secret org1adminpw --id.type admin --id.attrs '"hf.Registrar.Roles=admin"' --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem + set +x + + mkdir -p organizations/peerOrganizations/org1.example.com/peers + mkdir -p organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com + + echo + echo "## Generate the peer0 msp" + echo + set -x + fabric-ca-client enroll -u https://peer0:peer0pw@localhost:7054 --caname ca-org1 -M ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp --csr.hosts peer0.org1.example.com --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem + set +x + + cp ${PWD}/organizations/peerOrganizations/org1.example.com/msp/config.yaml ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/config.yaml + + echo + echo "## Generate the peer0-tls certificates" + echo + set -x + fabric-ca-client enroll -u https://peer0:peer0pw@localhost:7054 --caname ca-org1 -M ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls --enrollment.profile tls --csr.hosts peer0.org1.example.com --csr.hosts localhost --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem + set +x + + + cp ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/tlscacerts/* ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + cp ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/signcerts/* ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt + cp ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/keystore/* ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key + + mkdir ${PWD}/organizations/peerOrganizations/org1.example.com/msp/tlscacerts + cp ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/tlscacerts/* ${PWD}/organizations/peerOrganizations/org1.example.com/msp/tlscacerts/ca.crt + + mkdir ${PWD}/organizations/peerOrganizations/org1.example.com/tlsca + cp ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/tlscacerts/* ${PWD}/organizations/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem + + mkdir ${PWD}/organizations/peerOrganizations/org1.example.com/ca + cp ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/cacerts/* ${PWD}/organizations/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + + mkdir -p organizations/peerOrganizations/org1.example.com/users + mkdir -p organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com + + echo + echo "## Generate the user msp" + echo + set -x + fabric-ca-client enroll -u https://user1:user1pw@localhost:7054 --caname ca-org1 -M ${PWD}/organizations/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem + set +x + + mkdir -p organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com + + echo + echo "## Generate the org admin msp" + echo + set -x + fabric-ca-client enroll -u https://org1admin:org1adminpw@localhost:7054 --caname ca-org1 -M ${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp --tls.certfiles ${PWD}/organizations/fabric-ca/org1/tls-cert.pem + set +x + + cp ${PWD}/organizations/peerOrganizations/org1.example.com/msp/config.yaml ${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml + +} + + +function createOrg2 { + + echo + echo "Enroll the CA admin" + echo + mkdir -p organizations/peerOrganizations/org2.example.com/ + + export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/peerOrganizations/org2.example.com/ +# rm -rf $FABRIC_CA_CLIENT_HOME/fabric-ca-client-config.yaml +# rm -rf $FABRIC_CA_CLIENT_HOME/msp + + set -x + fabric-ca-client enroll -u https://admin:adminpw@localhost:8054 --caname ca-org2 --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem + set +x + + echo 'NodeOUs: + Enable: true + ClientOUIdentifier: + Certificate: cacerts/localhost-8054-ca-org2.pem + OrganizationalUnitIdentifier: client + PeerOUIdentifier: + Certificate: cacerts/localhost-8054-ca-org2.pem + OrganizationalUnitIdentifier: peer + AdminOUIdentifier: + Certificate: cacerts/localhost-8054-ca-org2.pem + OrganizationalUnitIdentifier: admin + OrdererOUIdentifier: + Certificate: cacerts/localhost-8054-ca-org2.pem + OrganizationalUnitIdentifier: orderer' > ${PWD}/organizations/peerOrganizations/org2.example.com/msp/config.yaml + + echo + echo "Register peer0" + echo + set -x + fabric-ca-client register --caname ca-org2 --id.name peer0 --id.secret peer0pw --id.type peer --id.attrs '"hf.Registrar.Roles=peer"' --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem + set +x + + echo + echo "Register user" + echo + set -x + fabric-ca-client register --caname ca-org2 --id.name user1 --id.secret user1pw --id.type client --id.attrs '"hf.Registrar.Roles=client"' --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem + set +x + + echo + echo "Register the org admin" + echo + set -x + fabric-ca-client register --caname ca-org2 --id.name org2admin --id.secret org2adminpw --id.type admin --id.attrs '"hf.Registrar.Roles=admin"' --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem + set +x + + mkdir -p organizations/peerOrganizations/org2.example.com/peers + mkdir -p organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com + + echo + echo "## Generate the peer0 msp" + echo + set -x + fabric-ca-client enroll -u https://peer0:peer0pw@localhost:8054 --caname ca-org2 -M ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp --csr.hosts peer0.org2.example.com --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem + set +x + + cp ${PWD}/organizations/peerOrganizations/org2.example.com/msp/config.yaml ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/config.yaml + + echo + echo "## Generate the peer0-tls certificates" + echo + set -x + fabric-ca-client enroll -u https://peer0:peer0pw@localhost:8054 --caname ca-org2 -M ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls --enrollment.profile tls --csr.hosts peer0.org2.example.com --csr.hosts localhost --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem + set +x + + + cp ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/tlscacerts/* ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt + cp ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/signcerts/* ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt + cp ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/keystore/* ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key + + mkdir ${PWD}/organizations/peerOrganizations/org2.example.com/msp/tlscacerts + cp ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/tlscacerts/* ${PWD}/organizations/peerOrganizations/org2.example.com/msp/tlscacerts/ca.crt + + mkdir ${PWD}/organizations/peerOrganizations/org2.example.com/tlsca + cp ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/tlscacerts/* ${PWD}/organizations/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem + + mkdir ${PWD}/organizations/peerOrganizations/org2.example.com/ca + cp ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/cacerts/* ${PWD}/organizations/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem + + mkdir -p organizations/peerOrganizations/org2.example.com/users + mkdir -p organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com + + echo + echo "## Generate the user msp" + echo + set -x + fabric-ca-client enroll -u https://user1:user1pw@localhost:8054 --caname ca-org2 -M ${PWD}/organizations/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem + set +x + + mkdir -p organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com + + echo + echo "## Generate the org admin msp" + echo + set -x + fabric-ca-client enroll -u https://org2admin:org2adminpw@localhost:8054 --caname ca-org2 -M ${PWD}/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp --tls.certfiles ${PWD}/organizations/fabric-ca/org2/tls-cert.pem + set +x + + cp ${PWD}/organizations/peerOrganizations/org2.example.com/msp/config.yaml ${PWD}/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml + +} + +function createOrderer { + + echo + echo "Enroll the CA admin" + echo + mkdir -p organizations/ordererOrganizations/example.com + + export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/ordererOrganizations/example.com +# rm -rf $FABRIC_CA_CLIENT_HOME/fabric-ca-client-config.yaml +# rm -rf $FABRIC_CA_CLIENT_HOME/msp + + set -x + fabric-ca-client enroll -u https://admin:adminpw@localhost:9054 --caname ca-orderer --tls.certfiles ${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem + set +x + + echo 'NodeOUs: + Enable: true + ClientOUIdentifier: + Certificate: cacerts/localhost-9054-ca-orderer.pem + OrganizationalUnitIdentifier: client + PeerOUIdentifier: + Certificate: cacerts/localhost-9054-ca-orderer.pem + OrganizationalUnitIdentifier: peer + AdminOUIdentifier: + Certificate: cacerts/localhost-9054-ca-orderer.pem + OrganizationalUnitIdentifier: admin + OrdererOUIdentifier: + Certificate: cacerts/localhost-9054-ca-orderer.pem + OrganizationalUnitIdentifier: orderer' > ${PWD}/organizations/ordererOrganizations/example.com/msp/config.yaml + + + echo + echo "Register orderer" + echo + set -x + fabric-ca-client register --caname ca-orderer --id.name orderer --id.secret ordererpw --id.type orderer --id.attrs '"hf.Registrar.Roles=orderer"' --tls.certfiles ${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem + set +x + + echo + echo "Register the orderer admin" + echo + set -x + fabric-ca-client register --caname ca-orderer --id.name ordererAdmin --id.secret ordererAdminpw --id.type admin --id.attrs '"hf.Registrar.Roles=admin"' --tls.certfiles ${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem + set +x + + mkdir -p organizations/ordererOrganizations/example.com/orderers + mkdir -p organizations/ordererOrganizations/example.com/orderers/example.com + + mkdir -p organizations/ordererOrganizations/example.com/orderers/orderer.example.com + + echo + echo "## Generate the orderer msp" + echo + set -x + fabric-ca-client enroll -u https://orderer:ordererpw@localhost:9054 --caname ca-orderer -M ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp --csr.hosts orderer.example.com --tls.certfiles ${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem + set +x + + cp ${PWD}/organizations/ordererOrganizations/example.com/msp/config.yaml ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/config.yaml + + echo + echo "## Generate the orderer-tls certificates" + echo + set -x + fabric-ca-client enroll -u https://orderer:ordererpw@localhost:9054 --caname ca-orderer -M ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls --enrollment.profile tls --csr.hosts orderer.example.com --tls.certfiles ${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem + set +x + + cp ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/tlscacerts/* ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt + cp ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/signcerts/* ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt + cp ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/keystore/* ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key + + mkdir ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts + cp ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/tlscacerts/* ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem + + mkdir ${PWD}/organizations/ordererOrganizations/example.com/msp/tlscacerts + cp ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/tlscacerts/* ${PWD}/organizations/ordererOrganizations/example.com/msp/tlscacerts/tlsca.example.com-cert.pem + + mkdir -p organizations/ordererOrganizations/example.com/users + mkdir -p organizations/ordererOrganizations/example.com/users/Admin@example.com + + echo + echo "## Generate the admin msp" + echo + set -x + fabric-ca-client enroll -u https://ordererAdmin:ordererAdminpw@localhost:9054 --caname ca-orderer -M ${PWD}/organizations/ordererOrganizations/example.com/users/Admin@example.com/msp --tls.certfiles ${PWD}/organizations/fabric-ca/ordererOrg/tls-cert.pem + set +x + + cp ${PWD}/organizations/ordererOrganizations/example.com/msp/config.yaml ${PWD}/organizations/ordererOrganizations/example.com/users/Admin@example.com/msp/config.yaml + + +} diff --git a/test-network/scripts/createChannel.sh b/test-network/scripts/createChannel.sh new file mode 100755 index 00000000..27667fda --- /dev/null +++ b/test-network/scripts/createChannel.sh @@ -0,0 +1,164 @@ +#!/bin/bash + + +CHANNEL_NAME="$1" +DELAY="$2" +MAX_RETRY="$3" +VERBOSE="$4" +: ${CHANNEL_NAME:="mychannel"} +: ${DELAY:="3"} +: ${MAX_RETRY:="5"} +: ${VERBOSE:="false"} + +# import utils +. scripts/envVar.sh + +if [ ! -d "channel-artifacts" ]; then + mkdir channel-artifacts +fi + +createChannelTx() { + + set -x + configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/${CHANNEL_NAME}.tx -channelID $CHANNEL_NAME + res=$? + set +x + if [ $res -ne 0 ]; then + echo "Failed to generate channel configuration transaction..." + exit 1 + fi + echo + +} + +createAncorPeerTx() { + + for orgmsp in Org1MSP Org2MSP; do + + echo "####### Generating anchor peer update for ${orgmsp} ##########" + set -x + configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/${orgmsp}anchors.tx -channelID $CHANNEL_NAME -asOrg ${orgmsp} + res=$? + set +x + if [ $res -ne 0 ]; then + echo "Failed to generate anchor peer update for ${orgmsp}..." + exit 1 + fi + echo + done +} + +createChannel() { + setGlobals 1 + + # Poll in case the raft leader is not set yet + local rc=1 + local COUNTER=1 + while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ] ; do + sleep $DELAY + if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then + set -x + peer channel create -o localhost:7050 -c $CHANNEL_NAME -f ./channel-artifacts/${CHANNEL_NAME}.tx --outputBlock ./channel-artifacts/${CHANNEL_NAME}.block >&log.txt + res=$? + set +x + else + set -x + peer channel create -o localhost:7050 -c $CHANNEL_NAME --ordererTLSHostnameOverride orderer.example.com -f ./channel-artifacts/${CHANNEL_NAME}.tx --outputBlock ./channel-artifacts/${CHANNEL_NAME}.block --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA >&log.txt + res=$? + set +x + fi + let rc=$res + COUNTER=$(expr $COUNTER + 1) + done + cat log.txt + verifyResult $res "Channel creation failed" + echo + echo "===================== Channel '$CHANNEL_NAME' created ===================== " + echo +} + +# queryCommitted ORG +joinChannel() { + ORG=$1 + setGlobals $ORG + local rc=1 + local COUNTER=1 + ## Sometimes Join takes time, hence retry + while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ] ; do + sleep $DELAY + set -x + peer channel join -b ./channel-artifacts/$CHANNEL_NAME.block >&log.txt + res=$? + set +x + let rc=$res + COUNTER=$(expr $COUNTER + 1) + done + cat log.txt + echo + verifyResult $res "After $MAX_RETRY attempts, peer0.org${ORG} has failed to join channel '$CHANNEL_NAME' " +} + +updateAnchorPeers() { + ORG=$1 + setGlobals $ORG + + if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then + set -x + peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com -c $CHANNEL_NAME -f ./channel-artifacts/${CORE_PEER_LOCALMSPID}anchors.tx >&log.txt + res=$? + set +x + else + set -x + peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com -c $CHANNEL_NAME -f ./channel-artifacts/${CORE_PEER_LOCALMSPID}anchors.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA >&log.txt + res=$? + set +x + fi + cat log.txt + verifyResult $res "Anchor peer update failed" + echo "===================== Anchor peers updated for org '$CORE_PEER_LOCALMSPID' on channel '$CHANNEL_NAME' ===================== " + sleep $DELAY + echo +} + +verifyResult() { + if [ $1 -ne 0 ]; then + echo "!!!!!!!!!!!!!!! "$2" !!!!!!!!!!!!!!!!" + echo "========= ERROR !!! FAILED to execute End-2-End Scenario ===========" + echo + exit 1 + fi +} + +FABRIC_CFG_PATH=${PWD}/configtx + +## Create channeltx +echo "### Generating channel configuration transaction '${CHANNEL_NAME}.tx' ###" +createChannelTx + +## Create anchorpeertx +echo "### Generating channel configuration transaction '${CHANNEL_NAME}.tx' ###" +createAncorPeerTx + +FABRIC_CFG_PATH=$PWD/../config/ + +## Create channel +echo "Creating channel "$CHANNEL_NAME +createChannel + +## Join all the peers to the channel +echo "Join Org1 peers to the channel..." +joinChannel 1 +echo "Join Org2 peers to the channel..." +joinChannel 2 + +## Set the anchor peers for each org in the channel +echo "Updating anchor peers for org1..." +updateAnchorPeers 1 +echo "Updating anchor peers for org2..." +updateAnchorPeers 2 + +echo +echo "========= Channel successfully joined =========== " +echo + +exit 0 diff --git a/test-network/scripts/deployCC.sh b/test-network/scripts/deployCC.sh new file mode 100755 index 00000000..b1a60aa2 --- /dev/null +++ b/test-network/scripts/deployCC.sh @@ -0,0 +1,337 @@ + +CHANNEL_NAME="$1" +CC_RUNTIME_LANGUAGE="$2" +VERSION="$3" +DELAY="$4" +MAX_RETRY="$5" +VERBOSE="$6" +: ${CHANNEL_NAME:="mychannel"} +: ${CC_RUNTIME_LANGUAGE:="golang"} +: ${VERSION:="1"} +: ${DELAY:="3"} +: ${MAX_RETRY:="5"} +: ${VERBOSE:="false"} +CC_RUNTIME_LANGUAGE=`echo "$CC_RUNTIME_LANGUAGE" | tr [:upper:] [:lower:]` + +FABRIC_CFG_PATH=$PWD/../config/ + +if [ "$CC_RUNTIME_LANGUAGE" = "go" -o "$CC_RUNTIME_LANGUAGE" = "golang" ] ; then + CC_RUNTIME_LANGUAGE=golang + CC_SRC_PATH="../chaincode/fabcar/go/" + + echo Vendoring Go dependencies ... + pushd ../chaincode/fabcar/go + GO111MODULE=on go mod vendor + popd + echo Finished vendoring Go dependencies + +elif [ "$CC_RUNTIME_LANGUAGE" = "javascript" ]; then + CC_RUNTIME_LANGUAGE=node # chaincode runtime language is node.js + CC_SRC_PATH="../chaincode/fabcar/javascript/" + +elif [ "$CC_RUNTIME_LANGUAGE" = "java" ]; then + CC_RUNTIME_LANGUAGE=java + CC_SRC_PATH="../chaincode/fabcar/java/build/install/fabcar" + + echo Compiling Java code ... + pushd ../chaincode/fabcar/java + ./gradlew installDist + popd + echo Finished compiling Java code + +else + echo The chaincode language ${CC_RUNTIME_LANGUAGE} is not supported by this script + echo Supported chaincode languages are: go, javascript, java + exit 1 +fi + +# import utils +. scripts/envVar.sh + + +packageChaincode() { + ORG=$1 + setGlobals $ORG + set -x + peer lifecycle chaincode package fabcar.tar.gz --path ${CC_SRC_PATH} --lang ${CC_RUNTIME_LANGUAGE} --label fabcar_${VERSION} >&log.txt + res=$? + set +x + cat log.txt + verifyResult $res "Chaincode packaging on peer0.org${ORG} has failed" + echo "===================== Chaincode is packaged on peer0.org${ORG} ===================== " + echo +} + +# installChaincode PEER ORG +installChaincode() { + ORG=$1 + setGlobals $ORG + set -x + peer lifecycle chaincode install fabcar.tar.gz >&log.txt + res=$? + set +x + cat log.txt + verifyResult $res "Chaincode installation on peer0.org${ORG} has failed" + echo "===================== Chaincode is installed on peer0.org${ORG} ===================== " + echo +} + +# queryInstalled PEER ORG +queryInstalled() { + ORG=$1 + setGlobals $ORG + set -x + peer lifecycle chaincode queryinstalled >&log.txt + res=$? + set +x + cat log.txt + PACKAGE_ID=$(sed -n "/fabcar_${VERSION}/{s/^Package ID: //; s/, Label:.*$//; p;}" log.txt) + verifyResult $res "Query installed on peer0.org${ORG} has failed" + echo PackageID is ${PACKAGE_ID} + echo "===================== Query installed successful on peer0.org${ORG} on channel ===================== " + echo +} + +# approveForMyOrg VERSION PEER ORG +approveForMyOrg() { + ORG=$1 + setGlobals $ORG + + if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ] ; then + set -x + peer lifecycle chaincode approveformyorg -o localhost:7050 --channelID $CHANNEL_NAME --name fabcar --version ${VERSION} --init-required --package-id ${PACKAGE_ID} --sequence ${VERSION} --waitForEvent >&log.txt + set +x + else + set -x + peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA --channelID $CHANNEL_NAME --name fabcar --version ${VERSION} --init-required --package-id ${PACKAGE_ID} --sequence ${VERSION} >&log.txt + set +x + fi + cat log.txt + verifyResult $res "Chaincode definition approved on peer0.org${ORG} on channel '$CHANNEL_NAME' failed" + echo "===================== Chaincode definition approved on peer0.org${ORG} on channel '$CHANNEL_NAME' ===================== " + echo +} + +# checkCommitReadiness VERSION PEER ORG +checkCommitReadiness() { + ORG=$1 + shift 1 + setGlobals $ORG + echo "===================== Checking the commit readiness of the chaincode definition on peer0.org${ORG} on channel '$CHANNEL_NAME'... ===================== " + local rc=1 + local COUNTER=1 + # continue to poll + # we either get a successful response, or reach MAX RETRY + while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ] ; do + sleep $DELAY + echo "Attempting to check the commit readiness of the chaincode definition on peer0.org${ORG} secs" + set -x + peer lifecycle chaincode checkcommitreadiness --channelID $CHANNEL_NAME --name fabcar $PEER_CONN_PARMS --version ${VERSION} --sequence ${VERSION} --output json --init-required >&log.txt + res=$? + set +x + #test $res -eq 0 || continue + let rc=0 + for var in "$@" + do + grep "$var" log.txt &>/dev/null || let rc=1 + done + COUNTER=$(expr $COUNTER + 1) + done + cat log.txt + if test $rc -eq 0; then + echo "===================== Checking the commit readiness of the chaincode definition successful on peer0.org${ORG} on channel '$CHANNEL_NAME' ===================== " + else + echo "!!!!!!!!!!!!!!! After $MAX_RETRY attempts, Check commit readiness result on peer0.org${ORG} is INVALID !!!!!!!!!!!!!!!!" + echo "================== ERROR !!! FAILED to execute End-2-End Scenario ==================" + echo + exit 1 + fi +} + +# commitChaincodeDefinition VERSION PEER ORG (PEER ORG)... +commitChaincodeDefinition() { + parsePeerConnectionParameters $@ + res=$? + verifyResult $res "Invoke transaction failed on channel '$CHANNEL_NAME' due to uneven number of peer and org parameters " + + # while 'peer chaincode' command can get the orderer endpoint from the + # peer (if join was successful), let's supply it directly as we know + # it using the "-o" option + if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ] ; then + set -x + peer lifecycle chaincode commit -o localhost:7050 --channelID $CHANNEL_NAME --name fabcar $PEER_CONN_PARMS --version ${VERSION} --sequence ${VERSION} --init-required >&log.txt + res=$? + set +x + else + set -x + peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA --channelID $CHANNEL_NAME --name fabcar $PEER_CONN_PARMS --version ${VERSION} --sequence ${VERSION} --init-required >&log.txt + res=$? + set +x + fi + cat log.txt + verifyResult $res "Chaincode definition commit failed on peer0.org${ORG} on channel '$CHANNEL_NAME' failed" + echo "===================== Chaincode definition committed on channel '$CHANNEL_NAME' ===================== " + echo +} + +# queryCommitted ORG +queryCommitted() { + ORG=$1 + setGlobals $ORG + EXPECTED_RESULT="Version: ${VERSION}, Sequence: ${VERSION}, Endorsement Plugin: escc, Validation Plugin: vscc" + echo "===================== Querying chaincode definition on peer0.org${ORG} on channel '$CHANNEL_NAME'... ===================== " + local rc=1 + local COUNTER=1 + # continue to poll + # we either get a successful response, or reach MAX RETRY + while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ] ; do + sleep $DELAY + echo "Attempting to Query committed status on peer0.org${ORG}, Retry after $DELAY seconds." + set -x + peer lifecycle chaincode querycommitted --channelID $CHANNEL_NAME --name fabcar >&log.txt + res=$? + set +x + test $res -eq 0 && VALUE=$(cat log.txt | grep -o '^Version: [0-9], Sequence: [0-9], Endorsement Plugin: escc, Validation Plugin: vscc') + test "$VALUE" = "$EXPECTED_RESULT" && let rc=0 + COUNTER=$(expr $COUNTER + 1) + done + echo + cat log.txt + if test $rc -eq 0; then + echo "===================== Query chaincode definition successful on peer0.org${ORG} on channel '$CHANNEL_NAME' ===================== " + echo + else + echo "!!!!!!!!!!!!!!! After $MAX_RETRY attempts, Query chaincode definition result on peer0.org${ORG} is INVALID !!!!!!!!!!!!!!!!" + echo + exit 1 + fi +} + +chaincodeInvokeInit() { + parsePeerConnectionParameters $@ + res=$? + verifyResult $res "Invoke transaction failed on channel '$CHANNEL_NAME' due to uneven number of peer and org parameters " + + # while 'peer chaincode' command can get the orderer endpoint from the + # peer (if join was successful), let's supply it directly as we know + # it using the "-o" option + if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then + set -x + peer chaincode invoke -o localhost:7050 -C $CHANNEL_NAME -n fabcar $PEER_CONN_PARMS --isInit -c '{"function":"init","Args":[]}' >&log.txt + res=$? + set +x + else + set -x + peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n fabcar $PEER_CONN_PARMS --isInit -c '{"function":"initLedger","Args":[]}' >&log.txt + res=$? + set +x + fi + cat log.txt + verifyResult $res "Invoke execution on $PEERS failed " + echo "===================== Invoke transaction successful on $PEERS on channel '$CHANNEL_NAME' ===================== " + echo +} + +chaincodeInvoke() { + parsePeerConnectionParameters $@ + res=$? + verifyResult $res "Invoke transaction failed on channel '$CHANNEL_NAME' due to uneven number of peer and org parameters " + + # while 'peer chaincode' command can get the orderer endpoint from the + # peer (if join was successful), let's supply it directly as we know + # it using the "-o" option + if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then + set -x + peer chaincode invoke -o localhost:7050 -C $CHANNEL_NAME -n fabcar $PEER_CONN_PARMS -c '{"function":"initLedger","Args":[]}' >&log.txt + res=$? + set +x + else + set -x + peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n fabcar $PEER_CONN_PARMS -c '{"function":"initLedger","Args":[]}' >&log.txt + res=$? + set +x + fi + cat log.txt + verifyResult $res "Invoke execution on $PEERS failed " + echo "===================== Invoke transaction successful on $PEERS on channel '$CHANNEL_NAME' ===================== " + echo +} + +chaincodeQuery() { + ORG=$1 + setGlobals $ORG + echo "===================== Querying on peer0.org${ORG} on channel '$CHANNEL_NAME'... ===================== " + local rc=1 + local COUNTER=1 + # continue to poll + # we either get a successful response, or reach MAX RETRY + while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ] ; do + sleep $DELAY + echo "Attempting to Query peer0.org${ORG} ...$(($(date +%s) - starttime)) secs" + set -x + peer chaincode query -C $CHANNEL_NAME -n fabcar -c '{"Args":["queryAllCars"]}' >&log.txt + res=$? + set +x + let rc=$res + COUNTER=$(expr $COUNTER + 1) + done + echo + cat log.txt + if test $rc -eq 0; then + echo "===================== Query successful on peer0.org${ORG} on channel '$CHANNEL_NAME' ===================== " + echo + else + echo "!!!!!!!!!!!!!!! After $MAX_RETRY attempts, Query result on peer0.org${ORG} is INVALID !!!!!!!!!!!!!!!!" + echo + exit 1 + fi +} + +## at first we package the chaincode +packageChaincode 1 + +## Install chaincode on peer0.org1 and peer0.org2 +echo "Installing chaincode on peer0.org1..." +installChaincode 1 +echo "Install chaincode on peer0.org2..." +installChaincode 2 + +## query whether the chaincode is installed +queryInstalled 1 + +## approve the definition for org1 +approveForMyOrg 1 + +## check whether the chaincode definition is ready to be committed +## expect org1 to have approved and org2 not to +checkCommitReadiness 1 "\"Org1MSP\": true" "\"Org2MSP\": false" +checkCommitReadiness 2 "\"Org1MSP\": true" "\"Org2MSP\": false" + +## now approve also for org2 +approveForMyOrg 2 + +## check whether the chaincode definition is ready to be committed +## expect them both to have approved +checkCommitReadiness 1 "\"Org1MSP\": true" "\"Org2MSP\": true" +checkCommitReadiness 2 "\"Org1MSP\": true" "\"Org2MSP\": true" + +## now that we know for sure both orgs have approved, commit the definition +commitChaincodeDefinition 1 2 + +## query on both orgs to see that the definition committed successfully +queryCommitted 1 +queryCommitted 2 + +## Invoke the chaincode +chaincodeInvokeInit 1 2 + +sleep 10 + +## Invoke the chaincode +chaincodeInvoke 1 2 + +# Query chaincode on peer0.org1 +echo "Querying chaincode on peer0.org1..." +chaincodeQuery 1 + +exit 0 diff --git a/test-network/scripts/envVar.sh b/test-network/scripts/envVar.sh new file mode 100755 index 00000000..104e723c --- /dev/null +++ b/test-network/scripts/envVar.sh @@ -0,0 +1,87 @@ +# +# Copyright IBM Corp All Rights Reserved +# +# SPDX-License-Identifier: Apache-2.0 +# + +# This is a collection of bash functions used by different scripts + +export CORE_PEER_TLS_ENABLED=true +export ORDERER_CA=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem +export PEER0_ORG1_CA=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt +export PEER0_ORG2_CA=${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt +export PEER0_ORG3_CA=${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt + +# Set OrdererOrg.Admin globals +setOrdererGlobals() { + export CORE_PEER_LOCALMSPID="OrdererMSP" + export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem + export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/ordererOrganizations/example.com/users/Admin@example.com/msp +} + +# Set environment variables for the peer org +setGlobals() { + local USING_ORG="" + if [ -z "$OVERRIDE_ORG" ]; then + USING_ORG=$1 + else + USING_ORG="${OVERRIDE_ORG}" + fi + echo "Using organization ${USING_ORG}" + if [ $USING_ORG -eq 1 ]; then + export CORE_PEER_LOCALMSPID="Org1MSP" + export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG1_CA + export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp + export CORE_PEER_ADDRESS=localhost:7051 + elif [ $USING_ORG -eq 2 ]; then + export CORE_PEER_LOCALMSPID="Org2MSP" + export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG2_CA + export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp + export CORE_PEER_ADDRESS=localhost:9051 + + elif [ $USING_ORG -eq 3 ]; then + export CORE_PEER_LOCALMSPID="Org3MSP" + export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG3_CA + export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp + export CORE_PEER_ADDRESS=localhost:11051 + else + echo "================== ERROR !!! ORG Unknown ==================" + fi + + if [ "$VERBOSE" == "true" ]; then + env | grep CORE + fi +} + +# parsePeerConnectionParameters $@ +# Helper function that takes the parameters from a chaincode operation +# (e.g. invoke, query, instantiate) and checks for an even number of +# peers and associated org, then sets $PEER_CONN_PARMS and $PEERS +parsePeerConnectionParameters() { + # check for uneven number of peer and org parameters + + PEER_CONN_PARMS="" + PEERS="" + while [ "$#" -gt 0 ]; do + setGlobals $1 + PEER="peer0.org$1" + PEERS="$PEERS $PEER" + PEER_CONN_PARMS="$PEER_CONN_PARMS --peerAddresses $CORE_PEER_ADDRESS" + if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "true" ]; then + TLSINFO=$(eval echo "--tlsRootCertFiles \$PEER0_ORG$1_CA") + PEER_CONN_PARMS="$PEER_CONN_PARMS $TLSINFO" + fi + # shift by two to get the next pair of peer/org parameters + shift + done + # remove leading space for output + PEERS="$(echo -e "$PEERS" | sed -e 's/^[[:space:]]*//')" +} + +verifyResult() { + if [ $1 -ne 0 ]; then + echo "!!!!!!!!!!!!!!! "$2" !!!!!!!!!!!!!!!!" + echo + exit 1 + fi +} diff --git a/test-network/scripts/org3-scripts/envVarCLI.sh b/test-network/scripts/org3-scripts/envVarCLI.sh new file mode 100644 index 00000000..a4e5b092 --- /dev/null +++ b/test-network/scripts/org3-scripts/envVarCLI.sh @@ -0,0 +1,79 @@ +# +# Copyright IBM Corp All Rights Reserved +# +# SPDX-License-Identifier: Apache-2.0 +# + +# This is a collection of bash functions used by different scripts + +ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem +PEER0_ORG1_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt +PEER0_ORG2_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt +PEER0_ORG3_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt + +# Set OrdererOrg.Admin globals +setOrdererGlobals() { + CORE_PEER_LOCALMSPID="OrdererMSP" + CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem + CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/users/Admin@example.com/msp +} + +# Set environment variables for the peer org +setGlobals() { + ORG=$1 + if [ $ORG -eq 1 ]; then + CORE_PEER_LOCALMSPID="Org1MSP" + CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG1_CA + CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp + CORE_PEER_ADDRESS=peer0.org1.example.com:7051 + elif [ $ORG -eq 2 ]; then + CORE_PEER_LOCALMSPID="Org2MSP" + CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG2_CA + CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp + CORE_PEER_ADDRESS=peer0.org2.example.com:9051 + elif [ $ORG -eq 3 ]; then + CORE_PEER_LOCALMSPID="Org3MSP" + CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG3_CA + CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp + CORE_PEER_ADDRESS=peer0.org3.example.com:11051 + else + echo "================== ERROR !!! ORG Unknown ==================" + fi + + if [ "$VERBOSE" == "true" ]; then + env | grep CORE + fi +} + +# parsePeerConnectionParameters $@ +# Helper function that takes the parameters from a chaincode operation +# (e.g. invoke, query, instantiate) and checks for an even number of +# peers and associated org, then sets $PEER_CONN_PARMS and $PEERS +parsePeerConnectionParameters() { + # check for uneven number of peer and org parameters + + PEER_CONN_PARMS="" + PEERS="" + while [ "$#" -gt 0 ]; do + setGlobals $1 + PEER="peer0.org$1" + PEERS="$PEERS $PEER" + PEER_CONN_PARMS="$PEER_CONN_PARMS --peerAddresses $CORE_PEER_ADDRESS" + if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "true" ]; then + TLSINFO=$(eval echo "--tlsRootCertFiles \$PEER0_ORG$1_CA") + PEER_CONN_PARMS="$PEER_CONN_PARMS $TLSINFO" + fi + # shift by two to get the next pair of peer/org parameters + shift + done + # remove leading space for output + PEERS="$(echo -e "$PEERS" | sed -e 's/^[[:space:]]*//')" +} + +verifyResult() { + if [ $1 -ne 0 ]; then + echo "!!!!!!!!!!!!!!! "$2" !!!!!!!!!!!!!!!!" + echo + exit 1 + fi +} diff --git a/test-network/scripts/org3-scripts/step1org3.sh b/test-network/scripts/org3-scripts/step1org3.sh new file mode 100755 index 00000000..87a3d29a --- /dev/null +++ b/test-network/scripts/org3-scripts/step1org3.sh @@ -0,0 +1,122 @@ +#!/bin/bash +# +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +# This script is designed to be run in the org3cli container as the +# first step of the EYFN tutorial. It creates and submits a +# configuration transaction to add org3 to the test network +# + +CHANNEL_NAME="$1" +DELAY="$2" +TIMEOUT="$3" +VERBOSE="$4" +: ${CHANNEL_NAME:="mychannel"} +: ${DELAY:="3"} +: ${TIMEOUT:="10"} +: ${VERBOSE:="false"} +COUNTER=1 +MAX_RETRY=5 + + +# import environment variables +. scripts/org3-scripts/envVarCLI.sh + + +# fetchChannelConfig +# Writes the current channel config for a given channel to a JSON file +fetchChannelConfig() { + ORG=$1 + CHANNEL=$2 + OUTPUT=$3 + + setOrdererGlobals + + setGlobals $ORG + + echo "Fetching the most recent configuration block for the channel" + if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then + set -x + peer channel fetch config config_block.pb -o orderer.example.com:7050 -c $CHANNEL --cafile $ORDERER_CA + set +x + else + set -x + peer channel fetch config config_block.pb -o orderer.example.com:7050 --ordererTLSHostnameOverride orderer.example.com -c $CHANNEL --tls --cafile $ORDERER_CA + set +x + fi + + echo "Decoding config block to JSON and isolating config to ${OUTPUT}" + set -x + configtxlator proto_decode --input config_block.pb --type common.Block | jq .data.data[0].payload.data.config >"${OUTPUT}" + set +x +} + +# createConfigUpdate +# Takes an original and modified config, and produces the config update tx +# which transitions between the two +createConfigUpdate() { + CHANNEL=$1 + ORIGINAL=$2 + MODIFIED=$3 + OUTPUT=$4 + + set -x + configtxlator proto_encode --input "${ORIGINAL}" --type common.Config >original_config.pb + configtxlator proto_encode --input "${MODIFIED}" --type common.Config >modified_config.pb + configtxlator compute_update --channel_id "${CHANNEL}" --original original_config.pb --updated modified_config.pb >config_update.pb + configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate >config_update.json + echo '{"payload":{"header":{"channel_header":{"channel_id":"'$CHANNEL'", "type":2}},"data":{"config_update":'$(cat config_update.json)'}}}' | jq . >config_update_in_envelope.json + configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope >"${OUTPUT}" + set +x +} + +# signConfigtxAsPeerOrg +# Set the peerOrg admin of an org and signing the config update +signConfigtxAsPeerOrg() { + PEERORG=$1 + TX=$2 + setGlobals $PEERORG + set -x + peer channel signconfigtx -f "${TX}" + set +x +} + +echo +echo "========= Creating config transaction to add org3 to network =========== " +echo + +# Fetch the config for the channel, writing it to config.json +fetchChannelConfig 1 ${CHANNEL_NAME} config.json + +# Modify the configuration to append the new org +set -x +jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"Org3MSP":.[1]}}}}}' config.json ./organizations/peerOrganizations/org3.example.com/org3.json > modified_config.json +set +x + +# Compute a config update, based on the differences between config.json and modified_config.json, write it as a transaction to org3_update_in_envelope.pb +createConfigUpdate ${CHANNEL_NAME} config.json modified_config.json org3_update_in_envelope.pb + +echo +echo "========= Config transaction to add org3 to network created ===== " +echo + +echo "Signing config transaction" +echo +signConfigtxAsPeerOrg 1 org3_update_in_envelope.pb + +echo +echo "========= Submitting transaction from a different peer (peer0.org2) which also signs it ========= " +echo +setGlobals 2 +set -x +peer channel update -f org3_update_in_envelope.pb -c ${CHANNEL_NAME} -o orderer.example.com:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile ${ORDERER_CA} +set +x + +echo +echo "========= Config transaction to add org3 to network submitted! =========== " +echo + +exit 0 diff --git a/test-network/scripts/org3-scripts/step2org3.sh b/test-network/scripts/org3-scripts/step2org3.sh new file mode 100755 index 00000000..ade5f3f2 --- /dev/null +++ b/test-network/scripts/org3-scripts/step2org3.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +# This script is designed to be run in the org3cli container as the +# second step of the EYFN tutorial. It joins the org3 peers to the +# channel previously setup in the BYFN tutorial and install the +# chaincode as version 2.0 on peer0.org3. +# + +echo +echo "========= Getting Org3 on to your test network ========= " +echo +CHANNEL_NAME="$1" +DELAY="$2" +TIMEOUT="$3" +VERBOSE="$4" +: ${CHANNEL_NAME:="mychannel"} +: ${DELAY:="3"} +: ${TIMEOUT:="10"} +: ${VERBOSE:="false"} +COUNTER=1 +MAX_RETRY=5 + +# import environment variables +. scripts/org3-scripts/envVarCLI.sh + +## Sometimes Join takes time hence RETRY at least 5 times +joinChannelWithRetry() { + ORG=$1 + setGlobals $ORG + + set -x + peer channel join -b $CHANNEL_NAME.block >&log.txt + res=$? + set +x + cat log.txt + if [ $res -ne 0 -a $COUNTER -lt $MAX_RETRY ]; then + COUNTER=$(expr $COUNTER + 1) + echo "peer0.org${ORG} failed to join the channel, Retry after $DELAY seconds" + sleep $DELAY + joinChannelWithRetry $PEER $ORG + else + COUNTER=1 + fi + verifyResult $res "After $MAX_RETRY attempts, peer0.org${ORG} has failed to join channel '$CHANNEL_NAME' " +} + + +echo "Fetching channel config block from orderer..." +set -x +peer channel fetch 0 $CHANNEL_NAME.block -o orderer.example.com:7050 --ordererTLSHostnameOverride orderer.example.com -c $CHANNEL_NAME --tls --cafile $ORDERER_CA >&log.txt +res=$? +set +x +cat log.txt +verifyResult $res "Fetching config block from orderer has Failed" + +joinChannelWithRetry 3 +echo "===================== peer0.org3 joined channel '$CHANNEL_NAME' ===================== " + +echo +echo "========= Finished adding Org3 to your test network! ========= " +echo + +exit 0 diff --git a/test-network/system-genesis-block/.gitkeep b/test-network/system-genesis-block/.gitkeep new file mode 100644 index 00000000..e69de29b