How can I deploy my own system chaincode in Hyperledger Fabric? - 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

Related

How to customize the chaincode container name during installation (using chaincode lifecycle install)

I'm trying to deploy the chaincode to a fabric peer using "peer lifecycle install".
It works perfectly. System can build and create the chaincode container as expected.
The images are automatically created after installing chaincode with prefix "dev-peer0.xxx"
I'd like to set the custom name like : pro-peer0.xxx.. instead of default (dev-peer0).
Can you help to advise?
Thank you.
enter image description here
It's a configurable option of a peer to change the network id see https://github.com/hyperledger/fabric/blob/8576508403cd6e3cbb5f7a2ff05dfae123de227b/sampleconfig/core.yaml#L19, you can change the core.yaml file in the peer.
If you are using docker-compose then you can change it using an env var of
CORE_PEER_NETWORKID

How to make core.yaml effect in a container in Hyperledger Fabric

A peer has been installed in a container.
I wanted to instantiate a chaincode in the container, but it failed because the version of a docker image doesn't exist.
so, I want to change "fabric-ccenv:latest" to "fabric-ccenv:2.1".
I have tried to modify the core.yaml, but it has no effect.
I also tried to directly export the varible, it also has no effect.
my question is how to make the configure effective. maybe my solution is false, but i reffer this link:Instantiation of Chaincode using Fabric Node SDK gives API error (404): manifest for hyperledger/fabric-ccenv:latest not found
I really appreciate your warm-hearted help.
In docker-compose.yaml
in "volumes" section of your peer: create bind to location of your edited core.yaml
e.g.: - ./channel/config-peers/org1-peer0/:/etc/hyperledger/peer
in the "environment" section of your peer: add FABRIC_CFG_PATH= path to location of edited core.yaml
e.g.: FABRIC_CFG_PATH=/etc/hyperledger/peer

debug node js chaincode ...?

This link gives tutorial on debugging javascript chaincode in hyperledger fabric. I was able to debug my chaincode following it but recently I updated to fabric 1.2 and the peer channel list command
CORE_PEER_LOCALMSPID=Org1MSP CORE_PEER_MSPCONFIGPATH=/home/bct/fabric-samples/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp peer channel list
fails with:
Fatal error when initializing core config : error when reading core
config file: Unsupported Config Type ""
I tried to go back to v1.1 but the problem persists. Can someone give me the complete list of configuration steps that may have been missed in tutorial video (which I was following) that make the debugging chaincode work.
Thanks in advance.
Finally, figured out that fabric sdk (https://github.com/hyperledger/fabric-sdk-node) has to be downloaded and configured before following the video tutorial in the question.

How to enable private data in fabric v1.3.0

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

Yet Another "ERROR: manifest for hyperledger/fabric-orderer:latest not found" error

Part of the answer (!) to this question is that I must know (in advance) that this is a problem, identify the images that I must pull (here's Orderer) and then retag them all with "latest". This seems sub-optimal. I know this problem because I've experienced it before, but... I'm being a noob and following along here:
Excited Noob wanting to write first app
Dutifully follows along with Prereqs
Then
/startFabric.sh
# don't rewrite paths for Windows Git Bash users
export MSYS_NO_PATHCONV=1
docker-compose -f docker-compose.yml down
Removing network net_basic
WARNING: Network net_basic not found.
docker-compose -f docker-compose.yml up -d ca.example.com orderer.example.com peer0.org1.example.com couchdb
Creating network "net_basic" with the default driver
Pulling orderer.example.com (hyperledger/fabric-orderer:latest)...
ERROR: manifest for hyperledger/fabric-orderer:latest not found
Noob departs frustrated?
Please revise the tutorial page to reference this additional pre-req
Or parameterize scripts to take DOCKER_TAG={{VALUE}}
Or am I missing something?
These instructions could be:
Identify the latest version for your architecture using "fabric-orderer" as a template:
https://hub.docker.com/r/hyperledger/fabric-orderer/tags/
In my case the latest tag is x86_64-1.0.3 and I'm using bash, so:
TAG={{THE CORRECT VALUE}} // In my case x86_64-1.0.3
for IMAGE in orderer couchdb peer ca tools
do
docker pull hyperledger/fabric-${IMAGE}:${TAG} && \
docker tag \
hyperledger/fabric-${IMAGE}:${TAG} \
hyperledger/fabric-${IMAGE}:latest
done
References:
ERROR: manifest for hyperledger/fabric-orderer:latest not found
hyperledger fabric tutoral - write first application error
Error building images: Tag latest not found in repository docker.io/hyperledger/fabric-baseimage
BlockChain : Issue setting up dev environment for hyperledger fabric
What you missing is the step where you have to download binaries, see "Download Platform-specific Binaries".
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap-1.0.3.sh | bash
PS. you can find more explanation on one of your references, e.g.:
"hyperledger fabric tutoral - write first application error"

Resources