required chaincodes are not installed on sufficient peers - hyperledger-fabric

I'm working with hyperledger fabric on the IBM Blockchain Platform service. I've been able to test chain codes with no problems, however, after the last update, I started to get the error required chain codes are not installed on sufficient peers that looks simple but the problem is that the chaincode is in fact installed in all peers.
Log for Peer1
2021-10-28 20:12:53.535 UTC [lifecycle] CheckCommitReadiness -> INFO 111c Successfully
checked commit readiness of chaincode name 'test-cc' on channel 'testchannel2' with
definition {sequence: 5, endorsement info: (version: '0.0.9', plugin: 'escc', init
required: false), validation info: (plugin: 'vscc', policy:
'12202f4368616e6e656c2f4170706c69636174696f6e2f456e646f7273656d656e74'), collections: ()}
Log for Peer2
2021-10-28 20:12:25.575 UTC [lifecycle] CheckCommitReadiness -> INFO 7bf1 Successfully
checked commit readiness of chaincode name 'test-cc' on channel 'testchannel2' with
definition {sequence: 5, endorsement info: (version: '0.0.9', plugin: 'escc', init
required: false), validation info: (plugin: 'vscc', policy:
'12202f4368616e6e656c2f4170706c69636174696f6e2f456e646f7273656d656e74'), collections: ()}
However, when I execute the newly committed chaincode, I get:
2021-10-28 20:20:00.004 UTC [discovery] chaincodeQuery -> ERRO 1126 Failed constructing
descriptor for chaincode chaincodes:<name:"test-cc" > ,: required chaincodes are not
installed on sufficient peers
Any ideas?

CheckCommitReadiness only checks if the chaincode definition has been approved. It does not check if the chaincode has actually been installed on the peers. Use queryinstalled for that. If you find that the chaincode is indeed installed on each peer, then the next thing to check is that the discovery service can see each of the peers where the chaincode is installed. To check that, look in the peer logs for the "Membership view" messages. If the "Membership view" is incomplete, then it is likely a gossip configuration issue across the peers.

The problem was related to how I was deploying the CC. IBM Blockchain platform has a way to install CC on peer copying from another, simply uploading the CC again (for each peer). I tried again using the "copy from another" peer method and it worked. So, perhaps I was choosing a different version when uploading from my laptop.

Related

Issue while Upgrading fabric from 1.4.4 to 2.2

we are able to update peer and orderer components to the latest version but while updating the channel capababilities to fetch the config block,peers are not able to connect with the orderer
Error: could not not connect to ordering service:could not dial endpoint:dial tcp:lookup orderer.example.com on 192.168.0.1:53 :no such host channel=mychannel
peer logs
you'll need to backup the msp and tls folders and load them in your the upgraded containers!
the official documentation mentions that you need to backup the msp but they don't do it.

Failed to upgrade a chaincode in v2.1 Hyperledger Fabric Network

I'm trying to upgrade my Hyperledger Fabric network from v1.4.7 to v2.1. Upgrading peers and orderers is done smoothly and already instantiated chaincodes work well. (Channel capabilities still remaining v1.x.) However, when I try to upgrade the new version of my chaincode, it keeps failed.
In v1.4.7, I built a server to install/instantiate/upgrade a chaincode using Fabric SDK v1.4.x. However, I found that all APIs related to installing/instantiating/upgrading a chaincode had been removed from Fabric SDK v2.1. So, as the doc said, I tried to upgrade a chaincode using peer CLI.
First, I packaged my chaincode using peer lifecycle chaincode ... command. At this time, I set FABRIC_CFG_PATH to a core.yaml in fabric-samples folder (I don't understand why I do this for only packaging a chaincode, but anyway I did what the doc said). And I set CORE_PEER_MSPCONFIGPATH to my admin user msp folder.
After I got my chaincode package, I connect to my first peer, peer0.identity.bpl, using docker exec -it peer0.identity.bpl /bin/sh command. My docker container doesn't open the port outside in the production mode, so I need to connect the container inside.
Then, I typed the following command and I got the error message:
/artifacts # peer lifecycle chaincode install identity_cc_v1.2.0.tar.gz
Error: chaincode install failed with status: 500 - Failed to authorize invocation due to failed ACL check: Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [The identity is not an admin under this MSP [BPLMSP]: The identity does not contain OU [ADMIN], MSP: [BPLMSP]]
So, I think I need some 'admin' identity, so I copied my admin msp folder to this peer. Then, I set CORE_PEER_MSPCONFIGPATH to this copied admin msp folder. Then I got:
/artifacts # export CORE_PEER_MSPCONFIGPATH=/artifacts/org-admin/msp
/artifacts # peer lifecycle chaincode install identity_cc_v1.2.0.tar.gz
2020-05-26 07:21:47.020 UTC [main] InitCmd -> ERRO 001 Cannot run peer because error when setting up MSP of type bccsp from directory /artifacts/org-admin/msp: administrators must be declared when no admin ou classification is set
Now, I thought that maybe the OU setting had some problem. So, I disabled OU setting from the config.yaml file. But, I got the same error message again.
So, I changed CORE_PEER_MSPCONFIGPATH setting to original setting again, but now it said this is not an admin identity.
/artifacts # export CORE_PEER_MSPCONFIGPATH=/artifacts/msp
/artifacts # peer lifecycle chaincode install identity_cc_v1.2.0.tar.gz
Error: chaincode install failed with status: 500 - Failed to authorize invocation due to failed ACL check: Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [This identity is not an admin]
I understand. This identity is just a peer identity, not an admin identity. So, I tried to enroll admin in this peer, but this fabric-peer docker image doesn't contain fabric-ca-client binary. So, I thought I did something wrong and this is not the intended way.
At this point, how can I install and instantiate the new version of my chaincode?
After I set OU config to admin msp that is copied to peer, every problem has been solved and installing/committing a chaincode works well.

In Hyperledger Fabric v2.1, in the test-network repo sample - Error in channel creation

I'm trying to create a channel from the test-network sample of Hyperledger Fabric v2.1. I have installed all the latest fabric binaries & Docker images. The channel-artifacts, 2 peers and a ordering node were successfully created.
However, the command ./network.sh createChannel gives the following error.
Error: failed to create deliver client for orderer: failed to load config for OrdererClient: unable to load orderer.tls.rootcert.file: open /home/fabric/HLF/fabric-sample: no such file or directory
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
I believe CreateChannel is roughly 5 steps.
Generate a CreateChannel Transaction
Generate an Anchor peer transaction
Create the channel with the genesis block
Join the peers to the channel and
Update one peer in each organization to Anchor peer.
Any chance you can share the output of ./network.sh createChannel, I'd like to see how far you got before you ran into this error.
I was able to solve this issue by removing the spaces from name of parent directory in which the "fabric-samples" repo were installed. This was the final output was:
2020-05-14 16:56:04.064 IST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-05-14 16:56:04.130 IST [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org2MSP' on channel 'mychannel' =====================
========= Channel successfully joined ===========
In my opinion, The problem is with the directory fabric-samples kindly re-download the binaries and try again.
Download using curl via:
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/release-2.1/scripts/bootstrap.sh | bash -s -- 2.1.0 1.5.2
Hope this helps, otherwise see the directory structures and path exports.

Instantiation of chaincode fails with Fabric v1.2.0 due to missing escc

Setup is working fine with Fabric 1.1.0
When I tried to upgrade to Fabric 1.2.0, I got the following errors during instantiation of chaincode saying that „escc was not found“
[golang-platform] GenerateDockerBuild -> INFO 072 building chaincode with ldflagsOpt: '-ldflags "-linkmode external -extldflags '-static'"'
2018-08-09 20:00:31.815 UTC [golang-platform] GenerateDockerBuild -> INFO 073 building chaincode with tags:
2018-08-09 20:01:01.188 UTC [endorser] EndorseWithPlugin -> WARN 074 Endorsement with plugin for {plugin: escc, channel: channel3, tx: 01427f701088a8e8cdfe2b543892af33d4012a661474f88670c8e2739717062f, chaincode: lscc} failed: plugin with name escc wasn't found
My Fabric peer setup is not based on docker images, but I did install fabric myself using with git clone and build (git reset --hard v1.2.0; make peer...). It is a fresh installed Ubuntu Linux 16.04.
Didn't change any setup.
Any ideas?
You need to make sure your core.yaml file is also updated to v1.2

Timeout expired while starting chaincode error when instantiating chaincode

When I run the example here: fabric e2e examples it fails at instantiating chaincode. You can see a screenshot here of the error:
I can see that the chaincode instance/container was started but exited shortly after.
Any ideas on why this is happening and how to resolve?
I had the same issue while testing fabric-samples balance-transfer and fabcar samples, and fabric PTE testing.
Solved it by setting CORE_PEER_CHAINCODELISTENADDRESS to peer's containername:port in the docker compose file.
eg., CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7052
Issue: Chaincode container (which gets created and killed after certain time) log shows below error, when inspected with docker logs CONTAINER-ID.
UTC [shim] userChaincodeStreamGetter -> ERRO 001 x509: cannot validate certificate for 172.18.0.5 because it doesn't contain any IP SANs
error trying to connect to local peer
github.com/hyperledger/fabric/core/chaincode/shim.userChaincodeStreamGetter
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:109
github.com/hyperledger/fabric/core/chaincode/shim.Start
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:148
main.main
/chaincode/input/src/github.com/example_cc/go/example_cc.go:199
runtime.main
/opt/go/src/runtime/proc.go:185
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:2337
2017-12-26 09:59:52.823 UTC [example_cc0] Errorf -> ERRO 002 Error starting Simple chaincode: error trying to connect to local peer: x509: cannot validate certificate for 172.18.0.5 because it doesn't contain any IP SANs

Resources