Hyperledger - Chaincode Fingerprint Mismatch - hyperledger-fabric

We have internally set up a Hyperledger network to run some tests. The version of Hyperledger Fabric being used is 1.1.
We have a network of 5 machines, each representing an organization, and all of them have - running over Docker - two peers, a CA, as well as a Command-line Interface. We also have an Orderer node that is running on a standalone machine.
We can install Golang chaincodes and make the organizations communicate just fine. The problem arises when we try to install business network logic via BNAs. We are using Hyperledger Composer 0.19.7. to do that and here is what happens:
I generate the BNA by using npm install.
I install it successfully on my local peers and start the network via the composer install and composer start commands.
I send the very same BNA file over to other members of the network, and they also successfully install it on their peers with the composer install command.
However, when they try to communicate with the network (composer network ping) with the appropriate admin card the following message is shown:
Error: Error trying to ping. Error: 2 UNKNOWN: error executing
chaincode: could not get ChaincodeDeploymentSpec for
todo-poc5-network:0.0.1: get ChaincodeDeploymentSpec for
todo-poc5-network/default from LSCC error: chaincode fingerprint
mismatch data mismatch Command failed
The really weird part is that if I - instead of the BNA - distribute the bin file that is installed on my peers (which is found in the /var/hyperledger/peer0/chaincodes folder) the ping command works perfectly and the organizations can communicate. But distributing bin files rather than the BNA itself does not seem like the ideal solution.
Has anyone experienced anything that is similar to that?
Thanks in advance.
EDIT:
Ok, sorry for the long absence.
It turns out we had different versions of CLI running, but even after normalizing them the error still appears. Any other suggestions?
You mentioned that following an install a path, ID, and version are provided. Is there anywhere I can see them?
Over the command line, by doing a composer install all I see is:
✔ Installing business network.
This may take a minute...
Successfully installed business network predic-poc, version 1.0.2 Command succeeded

A fingerprint mismatch data mismatch occurs because the package that is installed onto the peers differs in same way and as such fabric sees this difference as an issue and reports this error.
In order to understand how this can occur, details about how composer puts the bna onto a peer is needed.
An expanded bna file looks like a node module, it has a package.json file and some artifacts that make up the business network, so composer unpacks the bna file and uses the fabric-node-sdk to package it up, telling it is is a node module and the fabric-node-sdk will package it up appropriately and send it to the peer. fabric can then unpackage this package and perform an npm install --production to complete the setting up of this business network.
However there is a need to ensure that a reference to some composer npm modules are present in the package.json of the bna in order for the business network to be able to actually run, if these references do not exist then the composer network install command injects them into the package.json for you before the fabric-node-sdk creates the final package and sends it to the peer.
What the command effectively does is to add these lines to the dependencies section of the package.json file
“composer-runtime-hlfv1”: “0.19.9”,
“composer-common”: “0.19.9”
(note the version number presented here was the latest version at the time of writing, you may want to use a different/newer version of the composer runtime)
And the version number that is inserted is taken from the version of the composer-cli you have currently installed, so if you have differing versions of the composer-cli you can see that when you deploy the same bna onto different peers, the package that ends up on the peer will differ if different versions of composer-cli are installed.
(As a side point, the fabric-node-sdk doesn’t use the date/time of the files but sets them to a deterministic value so differing date/times are not an issue.)
There are 2 ways you can ensure this problem doesn’t occur.
Ensure you use the exact same levels of composer-cli for installing onto different organisations’ peers
You can explicitly set the version of the composer-runtime-hlfv1 and composer-common dependencies yourself inside the package.json of your business network implementation. If these are present then the command line will not overwrite or inject entries into the package.json prior to sending the package to the peers.

When installing chaincode you provide a path, ID, and version. All three attributes become part of a "fingerprint" that must match when invoking chaincode. The issue appears when you install the same chaincode but used a different path. This situation will happen organically when different people on the same channel want to run the chaincode independently. example:
person A installs on Peer1 with:
path - /uhoh/chaincode/marbles/dir,
id - marbles
version - v1
and person B installs on Peer2 with:
path - /marbles
id - marbles
version - v1
then lets pick Person A to instantiate the chaincode on a channel both peers have joined. the intent was that each person would have their own chaincode running, but b/c the path is different invokes will fail to run on person B's peer.
This issue has been closed at the version of fabric v1.1.3, v1.2.2, and v1.3+ , see issues FABN-855 for more detail.

Related

Not able to implement chaincode on peers

Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': chaincode already successfully installed (package ID 'mychaincode_1.0:39889cf0623cce2500261b22914a7aa9037a897bc7f6c5b36df7a922f29b05e0').
Throwing this error. Telling Successfully installed but not implementing on peers. What to do?
If the chaincode is already installed, it may be that you need to increment the sequence number when trying to install a newer version. If you install the contract from the command line, you may need to increment these values by one
export CC_PACKAGE_VERSION=1
export CC_PACKAGE_SEQUENCE=1
If you are using the deployCC.sh script to install the contract, you should increment the sequence number either on the parameter list when running the script, or else make the change internally by incrementing the following variables which take the parameter values if supplied
CC_VERSION=${5:-"1.0"}
CC_SEQUENCE=${6:-"1"}
... change to
CC_VERSION=${5:-"2"}
CC_SEQUENCE=${6:-"2"}
This is my first suspicion as to the reason why your code will not install. If this doesn't help, have a look at the docker logs for the peer to see if there are any hints.

Instantiation of Chaincode using Fabric Node SDK gives API error (404): manifest for hyperledger/fabric-ccenv:latest not found

I am trying to instantiate a Golang chaincode on my Hyperledger Fabric network (setup on cloud) using Fabric Node SDK. However, I am facing the following error while performing the same:
Error: error starting container: error starting container: Failed to generate platform-specific docker build: Failed to pull hyperledger/fabric-ccenv:latest: API error (404): manifest for hyperledger/fabric-ccenv:latest not found: manifest unknown: manifest unknown
The stack trace for the same is:
at self._endorserClient.processProposal (./node_modules/fabric-client/lib/Peer.js:140:36)
at Object.onReceiveStatus (./node_modules/grpc/src/client_interceptors.js:1207:9)
at InterceptingListener._callNext (./node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (./node_modules/grpc/src/client_interceptors.js:618:8)
at callback (./node_modules/grpc/src/client_interceptors.js:845:24)
I also tried to directly pull the image hyperledger/fabric-ccenv in my local environment but getting a similar error there as well:
Command:
docker pull hyperledger/fabric-ccenv
Error:
Using default tag: latest
Error response from daemon: manifest for hyperledger/fabric-ccenv:latest not found: manifest unknown: manifest unknown
Fabric Peer Version: 1.4.4
Fabric Node SDK Version: 1.4.4
As mentioned by alpha above, latest tag for hyperledger/fabric-ccenv does not exist anymore.
The value is defined as chaincode.builder in core.yaml file and can be overridden by the environment variable CORE_CHAINCODE_BUILDER.
So, the correct approach to solve the issue is passing the environment variable to peer with preferred ccenv version. For example:
CORE_CHAINCODE_BUILDER: hyperledger/fabric-ccenv:2.1
See this commit as an example of how to use it in a Helm chart.
latest tag isn't available anymore. you have to use specific tag. Below is the snippet of dave comment infabric-maintainers group.
The Hyperledger Fabric maintainers are pleased to announce the availability of Fabric v2.2.0!
v2.2 continues to build on the v2.0 foundation with additional improvements and fixes. For details, check out the release notes:
https://github.com/hyperledger/fabric/releases/tag/v2.2.0
Additionally we are happy to announce that v2.2 is the next long-term support (LTS) release for Hyperledger Fabric. v2.2.x will be the target release for most fix backports, while the most important fixes will continue to be backported to v1.4.x as well.
More details of the LTS strategy can be found in the RFC that was merged earlier this year:
https://github.com/hyperledger/fabric-rfcs/blob/master/text/0000-lts-release-strategy.md
Finally, it is worth noting that the 'latest' tag on dockerhub images has been retired. We felt that the tag was too confusing, given that there is a combination of regular releases and LTS releases available now - the definition of 'latest' may not be the same for everyone.
Give v2.2 a try and let us know what you think!
https://hyperledger-fabric.readthedocs.io/en/release-2.2/install.html```
link: https://chat.hyperledger.org/channel/fabric-maintainers?msg=dCMSGymRoWPiJ8fiv
I was trying to install/instantiate a year old chaincode and obviously I haven't updated any dependencies so I also ran into this issue.
This particular [hyperledger/fabric-ccenv:latest] docker pull is being done by one of dependencies and following is the way around that.
Do a docker pull of fabric-ccenv for whatever version you want.
docker pull hyperledger/fabric-ccenv:2.1
And then tag it as latest,
docker tag hyperledger/fabric-ccenv:2.1 hyperledger/fabric-ccenv:latest
Now when you try to install the chaincode, the docker pull for latest image wont happen as the image with the tag is already available on your machine.
The above two commands is something you can add in your start script.
Thanks to #alpha for mentioning that the latest tag has been taken down.

Problem on changing Hyperledger Composer version from 0.16.60 to 0.19.14

I am new in blockchain development. Actually i done a demo in composer vertion .16.6. Now i upgrade my composer vertion from 0.16.6 to 0.19.14. And i changed the code in createPeerAdmin.sh file for suitable to vertion 0.19.14. But always showing an error that
Connection profile has no x-type property defined. It is not valid for this version of composer
Please help me as possible.
Thanks
try to reset the environment variable for before starting or setup the development server using the following command by changing the fabric version u're going to use specific version from the development servers.
cd ~/fabric-dev-servers
export FABRIC_VERSION=hlfv11
./startFabric.sh
./createPeerAdminCard.sh
You can also find better information about the installation of the documentation in the link below:
https://hyperledger.github.io/composer/v0.19/installing/development-tools.html

Not able to run composer rest server

While starting composer rest server I am getting error :
Connection fails: Error: Failed to load connector module "composer-connector-hlfv1" for connection type "hlfv1". Cannot find module '/home/user/.nvm/versions/node/v8.9.3/lib/node_modules/composer-rest-server/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node
there is no grpc_node.node file present in the above folder. I tried reinstalling compoer rest server but no luck.
There are lots of reasons for this. the grpc module is a binary module and usually npm will download a prebuilt binary for your platform. If however it cannot do that (eg server down, or the platform is not recognised) then it will attempt to build the binary from source.
You need to look at the output during the npm -g install of composer-rest-server to see what is reported when npm attempts to install grpc to determine what the problem is.
The following advice from another thread has worked for me. Please try:
Rebuild it
Go to the folder cd '/root/.nvm/versi ons/node/v8.9.1/lib/node_modules/composer-rest-server/'
(into the folder where you have 'composer-rest-server')
then run npm rebuild --unsafe-prem
It will work now
source - Error while generating REST api using hyperledger composer-rest-server in centOS

Hyperledger Composer not being able to deploy Business Network

I updated my local environment to Composer v0.14.3 and I have been following the Developer Tutorial from Hyperledger Composer website. Then, when I try to deploy the Business Network to local Hyperledger Fabric I am getting the following error under the section "Deploy to the running Hyperledger Fabric". The error I get is shown below:
Deploying business network from archive: my-network.bna
Business network definition:
Identifier: my-network#0.0.1
Description: My Commodity Trading network
✖ Deploying business network definition. This may take a minute...
Error: Error trying deploy. Error: Error trying install composer runtime. Error: Endpoint read failed
Command failed
Another issue I saw is that I am able to start the local Hyperledger Fabric via "startFabric.sh" script, but after several minutes the container "hyperledger/fabric-peer:x86_64-1.0.4" stops suddenly, so I have to run the "stopFabric.sh" and "startFabric.sh" scripts again, see this picture.
As a reference, I have done what is suggested on this Post, but I am still getting the same error.
Suggest to update (ie re-install) your Composer dev environment to the current release v0.15.0 (as of Nov 10th) - there is a new tutorial (its changed from what you saw) and it will use Business network cards for the network deploy (createComposerProfile.sh is no longer needed) - makes life easier. To get the latest version, you will need to install the modules as per the docs -> https://hyperledger.github.io/composer/installing/development-tools.html - this will get the latest release. Make sure you do a full teardown using the scripts you downloaded in fabric-tools (as your CC containers will be 0.14.3 or earlier and thus out of date) and that you then subsequently, do an npm -g uninstall of the same module names eg composer-cli, composer-playground etc and such that they are all at the same level (0.15.0) upon subsequent npm -g install of same composer modules.

Resources