Coder Social home page Coder Social logo

ibm / blockchainnetwork-compositejourney Goto Github PK

View Code? Open in Web Editor NEW
232.0 40.0 174.0 1.83 MB

Part 1 in a series of patterns showing the building blocks of a Blockchain application

Home Page: https://developer.ibm.com/code/patterns/build-a-blockchain-network/

License: Apache License 2.0

Shell 72.20% JavaScript 27.80%
ibmcode blockchain hyperledger-fabric hyperledger-composer call-for-code

blockchainnetwork-compositejourney's Introduction

DISCLAIMER:

As of August 2018, IBM will not be contributing new features to Hyperledger Composer and will only be maintaining it through Fabric 2.x releases. IBM recommends using Hyperledger Composer solely for demos and proof-of-concepts. IBM does not provide support for networks using Hyperledger Composer in production (this includes the CLI, JavaScript APIs, REST server, and Web Playground).

This pattern has been upgraded to Fabric V2.0

Read this in other languages: 한국어, 日本.

BlockchainNetwork-CompositeJourney

Build Your First Network (BYFN)

Welcome to the first in a series of building a Blockchain application. Part 1 will show you how to create a Hyperledger Composer Business Network Archive (BNA) file for Commodity trade and deploy it on a Hyperledger Fabric. This will be the "Hello World" of Hyperledger Composer samples so beginner developers should be able to manage this. This pattern has been updated to support Hyperledger Composer V0.20.5, Hyperledger Fabric V1.2.

Hyperledger Fabric is a blockchain framework implementation and one of the Hyperledger projects hosted by The Linux Foundation. Intended as a foundation for developing applications or solutions with a modular architecture, Hyperledger Fabric allows components, such as consensus and membership services, to be plug-and-playIn

Part 2, we will explore more about creating a complex network with multiple participants and using Access Control Rules (ACL) to provide them network access permissions. In this journey, you will run Hyperledger Fabric locally.

You can use Hyperledger Composer to quickly model your current business network, containing your existing assets and the transactions related to them. Assets are tangible or intangible goods, services, or property. As part of your business network model, you define the transactions which can interact with assets. Business networks also include the participants who interact with them, each of which can be associated with a unique identity, across multiple business networks. A business network definition consists of model(.cto), script(.js) and ACL(.acl) files packaged and exported as an archive(.bna file). The archive file is then deployed to a Hyperledger Fabric network.

Included Components

  • Hyperledger Fabric v1.2
  • Hyperledger Composer for v20.5
  • Docker v1.13

Application Workflow Diagram

Application Workflow

  1. Install the Network Dependencies a) cryptogen b) configtxgen c) configtxlator d) peer
  2. Configure the network a) generating the network artifacts b) Starting up the network

Prerequisites

We find that Blockchain can be finicky when it comes to installing Node. We want to share this StackOverflow response - because many times the errors you see with Composer are derived in having installed either the wrong Node version or took an approach that is not supported by Composer:

  • Docker - v1.13 or higher
  • Docker Compose - v1.8 or higher
  • NPM - v5.6.0 or higher
  • nvm - v8.11.3 (use to download and set what node version you are using)
  • Node.js - node v8.11.3 ** don't install in SUDO mode
  • Git client - v 2.9.x or higher
  • Python - 2.7.x

Steps

  1. Installing Hyperledger Composer Development Tools
  2. Starting Hyperledger Fabric
  3. Generate the Business Network Archive (BNA)
  4. Deploy the Business Network Archive using Composer Playground
  5. Deploy the Business Network Archive on Hyperledger Composer running locally

1. Installing Hyperledger Composer Development Tools

Note: Check your node version nvm --version . If you are not using node version 8.11 some of the composer commands won't run correctly. Switch node versions using nvm use 8.

Note: You will be installing the latest version of composer-cli (0.20.5). If you have an older versions installed, go ahead and remove it by using the command:

npm uninstall composer-cli
npm uninstall generator-hyperledger-composer
npm uninstall composer-rest-server
npm uninstall yo
  • The composer-cli contains all the command line operations for developing business networks. To install composer-cli run the following command:
npm install -g [email protected]
  • The generator-hyperledger-composer is a Yeoman plugin that creates bespoke (e.g. customized) applications for your business network. Yeoman is an open source client-side development stack, consisting of tools and frameworks intended to help developers build web applications. To install generator-hyperledger-composer run the following command:
npm install -g [email protected]
  • The composer-rest-server uses the Hyperledger Composer LoopBack Connector to connect to a business network, extract the models and then present a page containing the REST APIs that have been generated for the model. To install composer-rest-server run the following command:
npm install -g [email protected]
  • When combining Yeoman with the generator-hyperledger-composer component, it can interpret business networks and generate applications based on them. To install Yeoman run the following command:
npm install -g [email protected]

2. Starting Hyperledger Fabric

** Note: **

If you have previously used an older version of Hyperledger Composer and are now setting up a new install, you may want to kill and remove all previous Docker containers, which you can do with these commands:


    docker kill $(docker ps -q)
    docker rm $(docker ps -aq)
    docker rmi -f $(docker images -q)

First download the docker files for Fabric in preparation for creating a Composer profile. Hyperledger Composer uses Connection Profiles to connect to a runtime. A Connection Profile is a JSON document that lives in the user's home directory (or may come from an environment variable) and is referenced by name when using the Composer APIs or the Command Line tools. Using connection profiles ensures that code and scripts are easily portable from one runtime instance to another.

The PeerAdmin card is a special ID card used to administer the local Hyperledger Fabric. In a development installation, such as the one on your computer, the PeerAdmin ID card is created when you install the local Hyperledger Fabric.

The form for a PeerAdmin card for a Hyperledger Fabric v1.0 network is PeerAdmin@hlfv1. In general, the PeerAdmin is a special role reserved for functions such as:

  • Deploying business networks
  • Creating, issuing, and revoking ID cards for business network admins*

First, clone the contents of this repo locally and cd into the project folder by running these commands:

git clone https://github.com/IBM/BlockchainNetwork-CompositeJourney

cd BlockchainNetwork-CompositeJourney

Then, start the Fabric and create a Composer profile using the following commands:

./downloadFabric.sh
./startFabric.sh
./createPeerAdminCard.sh

No need to do it now; however as an fyi - you can stop and tear down Fabric using:

./stopFabric.sh
./teardownFabric.sh

3. Generate the Business Network Archive (BNA)

This business network defines:

Participant Trader

Asset Commodity

Transaction Trade

Commodity is owned by a Trader, and the owner of a Commodity can be modified by submitting a Trade transaction.

The next step is to generate a Business Network Archive (BNA) file for your business network definition. The BNA file is the deployable unit -- a file that can be deployed to the Composer runtime for execution.

Use the following command to generate the network archive:

npm install

You should see the following output:

Creating Business Network Archive

Looking for package.json of Business Network Definition
	Input directory: /Users/ishan/Documents/git-demo/BlockchainNetwork-CompositeJourney

Found:
	Description: Sample Trade Network
	Name: my-network
	Identifier: [email protected]

Written Business Network Definition Archive file to
	Output file: ./dist/my-network.bna

Command succeeded

The composer archive create command has created a file called my-network.bna in the dist folder.

You can test the business network definition against the embedded runtime that stores the state of 'the blockchain' in-memory in a Node.js process. This embedded runtime is very useful for unit testing, as it allows you to focus on testing the business logic rather than configuring an entire Fabric. From your project working directory (BlockchainNetwork-CompositeJourney), run the command:

npm test

You should see the following output:

> [email protected] test /Users/laurabennett/2017-NewRole/Code/BlockchainNetwork-CompositeJourney
> mocha --recursive

Commodity Trading
    #tradeCommodity
      ✓ should be able to trade a commodity (198ms)


  1 passing (1s)

4. Deploy the Business Network Archive using Composer Playground

Open Composer Playground, by default the Basic Sample Network is imported. If you have previously used Playground, be sure to clear your browser local storage by running localStorage.clear() in your browser Console.

Now import the my-network.bna file and click on deploy button. If you don't know how to import, take a tour of Composer Playground

You can also setup Composer Playground locally.

You will see the following:

To test your Business Network Definition, first click on the Test tab:

Click on the Create New Participant button

Create Trader participants:

{
  "$class": "org.acme.mynetwork.Trader",
  "tradeId": "traderA",
  "firstName": "Tobias",
  "lastName": "Funke"
}
{
  "$class": "org.acme.mynetwork.Trader",
  "tradeId": "traderB",
  "firstName": "Simon",
  "lastName": "Stone"
}

Highlight the Commodity tab on the far left hand side and create a Commodity asset with owner as traderA:

{
  "$class": "org.acme.mynetwork.Commodity",
  "tradingSymbol": "commodityA",
  "description": "Sample Commodity",
  "mainExchange": "Dollar",
  "quantity": 100,
  "owner": "resource:org.acme.mynetwork.Trader#traderA"
}

Click on the Submit Transaction button on the lower left-hand side and submit a Trade transaction to change the owner of Commodity commodityA:

{
  "$class": "org.acme.mynetwork.Trade",
  "commodity": "resource:org.acme.mynetwork.Commodity#commodityA",
  "newOwner": "resource:org.acme.mynetwork.Trader#traderB"
}

You can verify the new owner by clicking on the Commodity registry. Also you can view all the transactions by selecting the All Transactions registry.

Example of transaction view:

5. Deploy the Business Network Archive on Hyperledger Composer running locally (alternative deployment approach)

Deploying a business network to the Hyperledger Fabric requires the Hyperledger Composer chaincode to be installed on the peer, then the business network archive (.bna) must be sent to the peer, and a new participant, identity, and associated card must be created to be the network administrator. Finally, the network administrator business network card must be imported for use, and the network can then be pinged to check it is responding.

Change directory to the dist folder containing my-network.bna file.

The composer network install command requires a PeerAdmin business network card (in this case one has been created and imported in advance), and the name of the business network. To install the composer runtime, run the following command:

cd dist
composer network install --card PeerAdmin@hlfv1 --archiveFile my-network.bna

The composer network start command requires a business network card, as well as the name of the admin identity for the business network, the file path of the .bna and the name of the file to be created ready to import as a business network card. To deploy the business network, run the following command:

composer network start --networkName my-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file networkadmin.card

The composer card import command requires the filename specified in composer network start to create a card. To import the network administrator identity as a usable business network card, run the following command:

composer card import --file networkadmin.card

You can verify that the network has been deployed by typing:

composer network ping --card admin@my-network

You should see the the output as follows:

The connection to the network was successfully tested: my-network
	Business network version: 0.0.1
  version: 0.20.5
	participant: org.hyperledger.composer.system.Identity#82c679fbcb1541eafeff1bc71edad4f2c980a0e17a5333a6a611124c2addf4ba

Command succeeded

To integrate with the deployed business network (creating assets/participants and submitting transactions) we can either use the Composer Node SDK or we can generate a REST API. To create the REST API we need to launch the composer-rest-server and tell it how to connect to our deployed business network. Now launch the server by changing directory to the project working directory and type:

cd ..
composer-rest-server

Answer the questions posed at startup. These allow the composer-rest-server to connect to Hyperledger Fabric and configure how the REST API is generated.

  • Enter admin@my-network as the card name.
  • Select never use namespaces when asked whether to use namespaces in the generated API.
  • Select No when asked whether to secure the generated API.
  • Select No when asked whether to enable authentication with Passport.
  • Select No when asked if you want to enable the explorer test interface.
  • Select No when asked if you want to enable dynamic logging.
  • Select Yes when asked whether to enable event publication.
  • Select No when asked whether to enable TLS security.

If the composer-rest-server started successfully you should see these output lines:

Discovering types from business network definition ...
Discovered types from business network definition
Generating schemas for all types in business network definition ...
Generated schemas for all types in business network definition
Adding schemas for all types to Loopback ...
Added schemas for all types to Loopback
Web server listening at: http://localhost:3000
Browse your REST API at http://localhost:3000/explorer

Open a web browser and navigate to http://localhost:3000/explorer

You should see the LoopBack API Explorer, allowing you to inspect and test the generated REST API. Follow the instructions to test Business Network Definition as mentioned above in the composer section.

Ready to move to Step 2!

Congratulations - you have completed Step 1 of this Composite Journey - move onto Step 2.

Additional Resources

License

This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.

Apache Software License (ASL) FAQ

blockchainnetwork-compositejourney's People

Contributors

abhik1998 avatar cradical avatar dependabot[bot] avatar dolph avatar eranavidor avatar hisunah avatar imgbotapp avatar ishangulhane avatar kant avatar ljbennett62 avatar odrodrig avatar rosielickorish avatar rsslldnphy avatar stevemar avatar wwalisa avatar yamachan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blockchainnetwork-compositejourney's Issues

can not ./startFabric.sh

Create the channel

docker exec peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c composerchannel -f /etc/hyperledger/configtx/composer-channel.tx
Error response from daemon: Container ab9a4817611487eeb9465b9c85b79fb2d1fd399f4aa591a9ad2ab8ea868e3900 is not running

when I see the docker log ,it says:
Error:Get http://couchdb:5984/: dial tcp 17*.22.0.4:5984: getsockopt: connection refused

Thanks for help!

error

npm test

[email protected] test /root/BlockchainNetwork-CompositeJourney
mocha --recursive

Commodity Trading
1) "before all" hook

0 passing (106ms)
1 failing

  1. Commodity Trading
    "before all" hook:
    TypeError: adminConnection.createProfile is not a function
    at Context.before (test/sample.js:36:32)

npm ERR! Test failed. See above for more details.

ReferenceError: require is not defined

trying out the same method step by step,
Composer version: v0.20.8
getting this error:


➜  dist git:(master) ✗ composer network start --networkName my-network  --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file networkadmin.card
Starting business network my-network at version 0.0.1

Processing these Network Admins: 
	userName: admin

✖ Starting business network definition. This may take a minute...
Error: Error trying to start business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: transaction returned with failure: ReferenceError: require is not defined
Command failed

➜  dist git:(master) ✗ composer --version
v0.20.8

Error executing createPeerAdminCard.sh

I followed the steps all the way till executing the script ./createPeerAdmin.sh, I get the below error when i run this script.

module.js:549
throw err:
Error : Cannot find module './api'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
............

Tried upgrading npm package but didn't solve the issue.

Need to update to version 0.19.5

I can't get the "composer network ping --card admin@my-network" command to work with composer-cli v0.19.1. I'm getting "Error: Connection is not in the READY state".

I updated to v0.19.5 and it works for me now. After some research it looks like this might be due to the underlying GRPC library being updated. I'd recommend just removing the "@v0.19.1" from the install steps.

Discussion on the issue can be found here.

Error on "composer network deploy"

Hi,

I'm at the step 5 (Deploy the Business Network Archive on Hyperledger Composer running locally).
When I execute the following command it gives an error "Missing argument value: networkAdminEnrollSecret"

composer network deploy -a my-network.bna -p hlfv1 -i PeerAdmin -s randomString -A admin -S

Then I added a string for the missing value as below

composer network deploy -a my-network.bna -p hlfv1 -i PeerAdmin -s randomString -A admin -S mypassword

But it fails with error "Unknown arguments: p, i, s".

Thank you all

Starting business network Error!

pavansoratur@pavansoratur-hp-pavilion-laptop-14-ce1xxx:~/Desktop/BlockchainNetwork-CompositeJourney$ ./createPeerAdminCard.sh
Development only script for Hyperledger Fabric control
Running 'createPeerAdminCard.sh'
FABRIC_VERSION is unset, assuming hlfv12
FABRIC_START_TIMEOUT is unset, assuming 15 (seconds)

Using composer-cli at v0.20.5

Successfully created business network card file to
Output file: /tmp/[email protected]

Command succeeded

Deleted Business Network Card: PeerAdmin@hlfv1

Command succeeded

Successfully imported business network card
Card file: /tmp/[email protected]
Card name: PeerAdmin@hlfv1

Command succeeded

The following Business Network Cards are available:

Connection Profile: hlfv1
┌─────────────────┬───────────┬──────────────────┐
│ Card Name │ UserId │ Business Network │
├─────────────────┼───────────┼──────────────────┤
│ PeerAdmin@hlfv1 │ PeerAdmin │ │
└─────────────────┴───────────┴──────────────────┘

Issue composer card list --card to get details a specific card

Command succeeded

Hyperledger Composer PeerAdmin card has been imported, host of fabric specified as 'localhost'
pavansoratur@pavansoratur-hp-pavilion-laptop-14-ce1xxx:~/Desktop/BlockchainNetwork-CompositeJourney$ npm install
npm WARN deprecated [email protected]: This module is no longer maintained, try this instead:
npm WARN deprecated npm i nyc
npm WARN deprecated Visit https://istanbul.js.org/integrations for other alternatives.
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/cryptiles. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/boom. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.

[email protected] install /home/pavansoratur/Desktop/BlockchainNetwork-CompositeJourney/node_modules/dtrace-provider
node-gyp rebuild || node suppress-error.js

make: Entering directory '/home/pavansoratur/Desktop/BlockchainNetwork-CompositeJourney/node_modules/dtrace-provider/build'
TOUCH Release/obj.target/DTraceProviderStub.stamp
make: Leaving directory '/home/pavansoratur/Desktop/BlockchainNetwork-CompositeJourney/node_modules/dtrace-provider/build'

[email protected] install /home/pavansoratur/Desktop/BlockchainNetwork-CompositeJourney/node_modules/pkcs11js
node-gyp rebuild

make: Entering directory '/home/pavansoratur/Desktop/BlockchainNetwork-CompositeJourney/node_modules/pkcs11js/build'
CXX(target) Release/obj.target/pkcs11/src/main.o
CXX(target) Release/obj.target/pkcs11/src/dl.o
CXX(target) Release/obj.target/pkcs11/src/const.o
CXX(target) Release/obj.target/pkcs11/src/pkcs11/error.o
CXX(target) Release/obj.target/pkcs11/src/pkcs11/v8_convert.o
CXX(target) Release/obj.target/pkcs11/src/pkcs11/template.o
CXX(target) Release/obj.target/pkcs11/src/pkcs11/mech.o
CXX(target) Release/obj.target/pkcs11/src/pkcs11/param.o
CXX(target) Release/obj.target/pkcs11/src/pkcs11/param_aes.o
CXX(target) Release/obj.target/pkcs11/src/pkcs11/param_rsa.o
CXX(target) Release/obj.target/pkcs11/src/pkcs11/param_ecdh.o
CXX(target) Release/obj.target/pkcs11/src/pkcs11/pkcs11.o
CXX(target) Release/obj.target/pkcs11/src/async.o
CXX(target) Release/obj.target/pkcs11/src/node.o
SOLINK_MODULE(target) Release/obj.target/pkcs11.node
COPY Release/pkcs11.node
make: Leaving directory '/home/pavansoratur/Desktop/BlockchainNetwork-CompositeJourney/node_modules/pkcs11js/build'

[email protected] install /home/pavansoratur/Desktop/BlockchainNetwork-CompositeJourney/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library

[grpc] Success: "/home/pavansoratur/Desktop/BlockchainNetwork-CompositeJourney/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node" is installed via remote
npm WARN prepublish-on-install As of npm@5, prepublish scripts are deprecated.
npm WARN prepublish-on-install Use prepare for build steps and prepublishOnly for upload-only.
npm WARN prepublish-on-install See the deprecation note in npm help scripts for more information.

[email protected] prepublish /home/pavansoratur/Desktop/BlockchainNetwork-CompositeJourney
mkdirp ./dist && composer archive create --sourceType dir --sourceName . -a ./dist/my-network.bna

Creating Business Network Archive

Looking for package.json of Business Network Definition
Input directory: /home/pavansoratur/Desktop/BlockchainNetwork-CompositeJourney

Found:
Description: Sample Trade Network
Name: my-network
Identifier: [email protected]

Written Business Network Definition Archive file to
Output file: ./dist/my-network.bna

Command succeeded

npm WARN [email protected] No repository field.

added 817 packages in 50.685s
pavansoratur@pavansoratur-hp-pavilion-laptop-14-ce1xxx:/Desktop/BlockchainNetwork-CompositeJourney$ cd dist
pavansoratur@pavansoratur-hp-pavilion-laptop-14-ce1xxx:
/Desktop/BlockchainNetwork-CompositeJourney/dist$ composer network install --card PeerAdmin@hlfv1 --archiveFile my-network.bna
✔ Installing business network. This may take a minute...
Successfully installed business network my-network, version 0.0.1

Command succeeded

pavansoratur@pavansoratur-hp-pavilion-laptop-14-ce1xxx:~/Desktop/BlockchainNetwork-CompositeJourney/dist$ composer network start --networkName my-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file networkadmin.card
Starting business network my-network at version 0.0.1

Processing these Network Admins:
userName: admin

✖ Starting business network definition. This may take a minute...
Error: Error trying to start business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: REQUEST_TIMEOUT
Command failed

pavansoratur@pavansoratur-hp-pavilion-laptop-14-ce1xxx:~/Desktop/BlockchainNetwork-CompositeJourney/dist$ composer network start --networkName my-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file networkadmin.card
Starting business network my-network at version 0.0.1

Processing these Network Admins:
userName: admin

✖ Starting business network definition. This may take a minute...
Error: Error trying to start business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: failed to execute transaction c476174caee0a7ecb6873282ba7d8393734b558ba89fcd401708a1108026be88: failed to register my-network:0.0.1 as launching: chaincode my-network:0.0.1 has already been launched
Command failed

Cannot Load Zend OPcache - it was already loaded

Description:

I've followed the exact steps given in this video to install private blockchain network. After cloning the github code given here and installing the prerequisites mentioned in the same link, the installation procedure is stopped due to an error given below.

Problem to solve:

This is the error which is stopping to proceed with the process.

Cannot load Zend OPcache - it was already loaded

[Symfony\Component\Console\Exception\RuntimeException]
The "--sourceType" option does not exist.

github-4

More Details:

1. Installed Prerequisites version details:

github-1

2. Installed node modules:

github-2-2

in which yo version is outdated as shown below,

github-3

Note: Please feel free to ask more required details to understand the issue better. Thank you.

composer network start Error !!!

Hi
I am looking for a solution and hope you can help me
I am trying to start the network and unfortunately, I get this error


fanta@blockchanger:~/BlockchainNetwork-CompositeJourney/dist$ composer network start --networkName my-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file networkadmin.card
Starting business network my-network at version 0.0.1

Processing these Network Admins:
userName: admin

✖ Starting business network definition. This may take a minute...
Error: Error trying to start business network. Error: Failed to connect to any peer event hubs. It is required that at least 1 event hub has been connected to receive the commit event
Command failed


I did not faced any problems in the previous steps except for this step
I'm using ubuntu 20.04

Cannot Drop ban file into composer

The network funs fine locally however I am unable to drop the bna file into the online composer playground or a local version of it. It simply states that the bna file is not supported. How can I resolve this?

SyntaxError: Unexpected identifier

Getting error after running createPeerAdminCard.sh

/Users/satishchhatpar/node-v6.10.0-darwin-x64/lib/node_modules/composer-cli/node_modules/composer-common/lib/cardstore/businessnetworkcardstore.js:54
async get(cardName) {
^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/Users/satishchhatpar/node-v6.10.0-darwin-x64/lib/node_modules/composer-cli/node_modules/composer-common/index.js:56:43)
at Module._compile (module.js:570:32)
/Users/satishchhatpar/node-v6.10.0-darwin-x64/lib/node_modules/composer-cli/node_modules/composer-common/lib/cardstore/businessnetworkcardstore.js:54
async get(cardName) {
^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/Users/satishchhatpar/node-v6.10.0-darwin-x64/lib/node_modules/composer-cli/node_modules/composer-common/index.js:56:43)
at Module._compile (module.js:570:32)
Using composer-cli at
/Users/satishchhatpar/node-v6.10.0-darwin-x64/lib/node_modules/composer-cli/node_modules/composer-common/lib/cardstore/businessnetworkcardstore.js:54
async get(cardName) {
^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/Users/satishchhatpar/node-v6.10.0-darwin-x64/lib/node_modules/composer-cli/node_modules/composer-common/index.js:56:43)
at Module._compile (module.js:570:32)

./startFabric gives error

Error: channel create configuration tx file not found open C:/Program Files/Git/etc/hyperledger/configtx/composer-channel.tx: no such file or directory

Please help me on this

npm test failed

root@ubuntu:~/BlockchainNetwork-CompositeJourney# npm test --unsafe-perm

[email protected] test /root/BlockchainNetwork-CompositeJourney
mocha --recursive

Commodity Trading
1) "before all" hook

0 passing (2s)
1 failing

  1. Commodity Trading
    "before all" hook:
    AccessException: Participant 'org.hyperledger.composer.system.NetworkAdmin#admin' does not have 'READ' access to resource 'org.hyperledger.composer.system.Network#[email protected]'
    at aclRules.reduce.then (node_modules/composer-runtime/lib/accesscontroller.js:134:23)
    at process._tickCallback (internal/process/next_tick.js:109:7)

npm ERR! Test failed. See above for more details.

npm test fails with timeout error

npm test fails with below error:

[email protected] test /home/nodejs/BlockchainNetwork-CompositeJourney
mocha --recursive

Commodity Trading
1) "before all" hook in "Commodity Trading"

0 passing (3s)
1 failing

  1. Commodity Trading
    "before all" hook in "Commodity Trading":
    Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/nodejs/BlockchainNetwork-CompositeJourney/test/sample.js)

npm ERR! Test failed. See above for more details.


peer log below

[[36m2019-07-09 17:38:38.718 UTC [chaincode] LaunchConfig -> DEBU 3cd^[[0m launchConfig: executable:"/bin/sh",Args:[/bin/sh,-c,cd /usr/local/src; npm start -- --peer.address peer0.org1.example.com:7052],Envs:[CORE_CHAINCODE_LOGGING_LEVEL=DEBUG,CORE_CHAINCODE_LOGGING_SHIM=warning,CORE_CHAINCODE_LOGGING_FORMAT=%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message},CORE_CHAINCODE_ID_NAME=my-network:0.0.1,CORE_PEER_TLS_ENABLED=false],Files:[]
^[[36m2019-07-09 17:38:38.718 UTC [chaincode] Start -> DEBU 3ce^[[0m start container: my-network:0.0.1
^[[36m2019-07-09 17:38:38.718 UTC [chaincode] Start -> DEBU 3cf^[[0m start container with args: /bin/sh -c cd /usr/local/src; npm start -- --peer.address peer0.org1.example.com:7052
^[[36m2019-07-09 17:38:38.718 UTC [chaincode] Start -> DEBU 3d0^[[0m start container with env:
CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
CORE_CHAINCODE_LOGGING_SHIM=warning
CORE_CHAINCODE_LOGGING_FORMAT=%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}
CORE_CHAINCODE_ID_NAME=my-network:0.0.1
CORE_PEER_TLS_ENABLED=false
^[[36m2019-07-09 17:38:38.718 UTC [container] lockContainer -> DEBU 3d1^[[0m waiting for container(my-network-0.0.1) lock
^[[36m2019-07-09 17:38:38.718 UTC [container] lockContainer -> DEBU 3d2^[[0m got container (my-network-0.0.1) lock
^[[36m2019-07-09 17:38:38.720 UTC [dockercontroller] Start -> DEBU 3d3^[[0m Cleanup container dev-peer0.org1.example.com-my-network-0.0.1
^[[36m2019-07-09 17:38:38.731 UTC [dockercontroller] stopInternal -> DEBU 3d4^[[0m Stop container dev-peer0.org1.example.com-my-network-0.0.1(No such container: dev-peer0.org1.example.com-my-network-0.0.1)
^[[36m2019-07-09 17:38:38.734 UTC [dockercontroller] stopInternal -> DEBU 3d5^[[0m Kill container dev-peer0.org1.example.com-my-network-0.0.1 (No such container: dev-peer0.org1.example.com-my-network-0.0.1)
^[[36m2019-07-09 17:38:38.737 UTC [dockercontroller] stopInternal -> DEBU 3d6^[[0m Remove container dev-peer0.org1.example.com-my-network-0.0.1 (No such container: dev-peer0.org1.example.com-my-network-0.0.1)
^[[36m2019-07-09 17:38:38.738 UTC [dockercontroller] Start -> DEBU 3d7^[[0m Start container dev-peer0.org1.example.com-my-network-0.0.1
^[[36m2019-07-09 17:38:38.738 UTC [dockercontroller] getDockerHostConfig -> DEBU 3d8^[[0m docker container hostconfig NetworkMode: composer_default
^[[36m2019-07-09 17:38:38.741 UTC [dockercontroller] createContainer -> DEBU 3d9^[[0m Create container: dev-peer0.org1.example.com-my-network-0.0.1
^[[36m2019-07-09 17:38:38.757 UTC [dockercontroller] Start -> DEBU 3da^[[0m start-could not find image <dev-peer0.org1.example.com-my-network-0.0.1-d3389f9e23aecff59bba2fd5a2aaa6c0e009c0fbf7ba1c00fed746f8a9cd23e7> (container id <dev-peer0.org1.example.com-my-network-0.0.1>), because of ...attempt to recreate image
^[[36m2019-07-09 17:38:38.757 UTC [chaincode-platform] generateDockerfile -> DEBU 3db^[[0m
FROM hyperledger/fabric-baseimage:amd64-0.4.10
ADD binpackage.tar /usr/local/src
LABEL org.hyperledger.fabric.chaincode.id.name="my-network"
org.hyperledger.fabric.chaincode.id.version="0.0.1"
org.hyperledger.fabric.chaincode.type="NODE"
org.hyperledger.fabric.version="1.2.1"
org.hyperledger.fabric.base.version="0.4.10"
ENV CORE_CHAINCODE_BUILDLEVEL=1.2.1
^[[36m2019-07-09 17:38:38.764 UTC [util] DockerBuild -> DEBU 3dc^[[0m Attempting build with image hyperledger/fabric-ccenv:latest


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.