How to enable private data in fabric v1.3.0 - hyperledger-fabric

I am using fabric 1.3.0 in docker environment. I am getting error while trying to instantiate the chaincode with --collections-config. The setup is working fine if I remove the --collections-config
While executing :
peer chaincode instantiate -C org12 -n tranargy -v 1.0 -c '{"Args":[]}' -P "OR('Org1MSP.member','Org2MSP.member')" --collections-config /opt/gopath/src/tranargy/collections/collections_config.json
Getting following error :
Error: could not assemble transaction, err Proposal response was not
successful, error code 500, msg as V1_2 or later capability is not
enabled, private channel collections and data are not available
Can any one help in how to enable private data in fabric v1.3.0.

You must enable the V1_3 capability when creating the channel configuration transaction. See the required configuration in the sample. This is required so that all peers on a channel behave consistently, even if a rolling upgrade is in progress for the peers in the channel.

Problem is you are not using fabric 1.3.0 docker image
Even though it is present in your local, when you do compose up at that time it will download a new image of different version
Make sure
hyperledger/fabric-peer 1.2.0 82c262e65984 3 months ago 159MB
compose file service image: hyperledger/fabric-ca-peer:1.2.0
Both versions are same here i used 1.2.0
In your case 1.3.0
Make Sure:
Application: &ApplicationCapabilities
V1_3: true
See configtx.yaml

Related

New chaincode container is not launched after upgrade

I followed the instructions to upgrade chaincode from here. I executed all the steps successfully. I was able to see the committed chaincode information by the command peer lifecycle chaincode querycommitted --channelID mychannel --name mycc. The docker images are also created for new chaincode but the containers were not launched. The chaincode invoke and query commands also give old results.
I also tried deleting the old chaincode from peers and removing old chaincode containers, but it starts the old chaincode containers again when I run chaincode query or invoke command.
I use peer lifecycle chaincode commands in Hyperledger Fabric 2.0 on Ubuntu 16.04.
I solved the issue. The problem was with the value of --package-id option in peer lifecycle chaincode approveformyorg command. I used the approveForMyOrg function in utils.sh file that comes in first-network directory in fabric-samples. The mistake was I passed the PACKAGE_ID from the results of queryInstalled function which had all the installed chaincode packages. I made a following change in the sed command in that function.
PACKAGE_ID=`sed -n "/$CCNAME_$VERSION/{s/^Package ID: //; s/, Label:.*$//; p;}" log.txt`

How can I deploy my own system chaincode in Hyperledger Fabric?

I'm trying to install and deploy my own system chaincode in hyperledger fabric. I'm using v1.3. I came across this answer Hyperledger Fabric System Chaincode Plugin - missing sample. But it's specific to v1.1 and now importsyscss.go looks very different.
I tried to follow the procedure mentioned in the above link but it didn't work out for me.
I copied myscc.so file in /opt/lib/. Made an entry myscc: enable in core.yaml as well.
Uncommented
example configuration:
- enabled: true
name: myscc
path: /opt/lib/myscc.so
invokableExternal: true
invokableCC2CC: true
docker restart peer0.org1.example.com
docker logs peer0.org1.example.com
Everything runs perfectly without any error but still, I don't see logs with myscc mentioned anywehere.
SCC plugins were disabled, but they added a secret flag to allow this for faster development.
The peer has to be built with the following flags:
GO_TAGS+=" pluginsenabled" make peer
End-to-End tests utilize docker containers hence the containers should also be built with
DOCKER_DYNAMIC_LINK=true GO_TAGS+=" pluginsenabled" make peer-docker

Hyperledger Fabric can't find go files when building chaincode

Problem
I'm getting the following error on a fabric-peer: Failed to generate platform-specific docker build: Error returned from build: 1 "can't load package: package chaincodes/simple: no buildable Go source files in /chaincode/input/src/chaincodes/simple.
Context
I'm trying to instantiate a chaincode package after having successfully installed it.
Both the install and instantiate proposals are created by the Fabric NodeJS SDK (fabric-client).
Steps leading up to the problem
Package a go file using the fabric-client (succeeds)
Create an install proposal and send it to the peer (succeeds
Create and instantiate proposal and send it to the peer (fails with above error-message)
Steps taken to solve the problem
I tried to assert how the chaincode container create process works by reading the code.
What I got from it was the following:
- The chaincode is build using the fabric-ccenv image
- It loads a .tar as an Inputstream (The package?)
I tried adding the files to the go-path but I still couldn't get it to work.
What I want to know
- Where does the chaincode building process expect these files to be?
- Why do I need to provide the files when I've previously sent a package of chaincode inside an InstallRequest?
Further information
I'm also getting an error about an MSP being unknown. Something along the lines of: Error: MSP Org1MSP is unkown. This happens during deserialization of the proposal.
Which is weird because I'm 100% that MSP exists. What I'm not certain about is whether I need to add anchor peers to the channel I'm installing and instantiating the chaincode on in order for the MSP to be found.
I thought that happens during channel creation.
Versions
This happens in the following versions:
- 1.0.0
- 1.0.6
Please do not suggest I try version 1.1 because I cannot upgrade easily.
Please advise.
Above was caused by an actual unknown MSP.
Double check the profile/profiles in configtx.yaml used for creating the channel and the genesis block for orderers. I had a mismatch between those.
I read a related issue [FAB-7952] in Fabric's issue manager and it made me think something else was going on, instead of an actual unknown MSP.

Hyperledger on IBM Cloud, chaincode launched and waiting for registration

Code
Currently I followed this article to develop my BNA to IBM blockchain cloud platform (started plan). Unluckily, I got the error when I try to run this line of code:
composer network start -c admin#mynetwork-fabric -A admin -C ./creds/admin-pub.pem -f delete.card -n my_network -V 0.0.4
Error
I am very sure that all parameters are good, the full errors are:
Error: Error trying to start business network. Error: No valid responses
from any peers.
Response from attempted peer comms was an error: Error: 2 UNKNOWN:
premature execution - chaincode (my_network:0.0.4) launched and
waiting for registration
Or sometimes the error is:
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
I understand sometimes maybe there is a timeout, but I do not really got the launched and waiting for registration error.
P.S.
My hyperledger composer version is 0.19.
I also view this deploying tutorial, there might be some different commands, because of the different versions of Hyperledger Composer. I checked the composer hep to transfer the commands to running on composer 0.19.
Solution:
down grade composer-cli to 0.18.1
change your package.json, composer-cli to 0.18.1
npm install to create new bna
reinstall
restart
If you are using IBM Cloud Starter Plan, then you need to be using v0.18.1 of Composer not v0.19.
Also, this is the doc you should be following:
https://console.bluemix.net/docs/services/blockchain/develop_starter.html#deploying-a-business-networks-on-starter-plan

"channel [{channel-name}]: MSP error: channel doesn't exist" warning fails the instantiation of chaincode on Hyperledger Fabric

I'm trying to run the Hyperledger Fabric network, which consists of a single orderer, a single peer, and a cli. To learn the procedure of launching Hyperledger Fabric network, from creating crypto-related artifacts to running cli as a docker container, I execute them one by one.
Everything is okay, but when I try to instantiate the installed chaincode, the peer produces channel [reputationch]: MSP error: channel doesn't exist (reputationch is my channel name) and the instantiation has been failed.
(Check the below screenshot)
I'm not sure that this warning on the peer node causes the failure of the instantiation of chaincode, but I guess it is the reason.
My crypto-config.yaml and configtx.yaml are like below. They are nothing special because I just modified some names based on the official example.
crytp-config.yaml and configtx.yaml
And the script to create crypto-related artifacts based on the above yaml files is:
script to create crypto-related artifacts
My running scripts to launch an orderer, a peer, and a cli are like below. It calls docker commands.
running scripts to launch an orderer, a peer, and a cli
After I launch a cli, I connect the cli using docker exec -it cli bash. Then, I run three commands, which work well without an error or a warning:
peer channel create -o orderer.operator.com:7050 -c reputationch -f ./channel-artifacts/reputation-channel.tx
peer channel update -o orderer.operator.com:7050 -c reputationch -f ./channel-artifacts/Company1anchors.tx
peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/
Then, the following command is failed.
peer chaincode instantiate -o orderer.operator.com:7050 -C reputationch -n mycc -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "OR ('Company1MSP.peer')"
My version information is:
macOS: macOS High Sierra 10.13.3
Go: 1.10
Docker: Version 18.03.0-ce-mac59 (23608)
Hyperledger Fabric: 1.1
cryptogen: 1.1.0
configtxgen: 1.1.0
Any kind of comment or help will be very great for me. Thanks.
Basically you also need your peers to join your channels. Which it seems like you are not doing here. If your peers do not join any channel, you will be getting this error. Make sure that your peers join channel before installing chaincode.
peer channel join -b $CHANNEL_NAME.block

Resources