Improved documentation
The following topics have been described in the documentation webpage:
Network config as a Kubernetes secret
You can use the Network Config as a CRD to define the organizations that you want to use in your client application.
The following CRD will create a secret named org1-nc
in the default
namespace containing the network config for all the peers created in your Kubernetes Cluster.
apiVersion: hlf.kungfusoftware.es/v1alpha1
kind: FabricNetworkConfig
metadata:
name: test-nc
namespace: default
spec:
internal: false
organization: ""
organizations:
- Org1MSP
secretName: org1-nc
Example application in Node.JS and GoLang
Examples on how to use the network config in Node.JS and GoLang are available in the following repositories:
Thanks to @adityajoshi12 for the contribution.
Kubectl Plugin 1.5.0
You can update to the latest version using krew
:
kubectl krew update hlf
This new version includes:
getlatest
commandcalculatepackageid
command
Get latest version or sequence from chaincode
In case you need to get the last version or sequence in order to install a new version of the chaincode there's a command that will give you this information:
export CHAINCODE_NAME=mycc
export CHANNEL_NAME=demo
export HLF_NETWORK_CONFIG=org1-nc.yaml
# get latest sequence
kubectl hlf chaincode getlatest --property=sequence --msp-id=Org1MSP \
--user=admin --channel="$CHANNEL_NAME" --name="$CHAINCODE_NAME" --config="$HLF_NETWORK_CONFIG" \
--out=SEQUENCE.txt
# get latest version
kubectl hlf chaincode getlatest --property=version --msp-id=Org1MSP \
--user=admin --channel="$CHANNEL_NAME" --name="$CHAINCODE_NAME" --config="$HLF_NETWORK_CONFIG" \
--out=VERSION.txt
The sequence will be written to the file SEQUENCE.txt and the version will be written to the file VERSION.txt.
export VERSION=$(cat VERSION.txt)
export SEQUENCE=$(cat SEQUENCE.txt)
You can now increase sequence by one
export SEQUENCE=$(($SEQUENCE+1))
And then, following the steps in the getting started to approve and commit the new version of the chaincode.
Calculate Package ID
If you're running a new version of the chaincode, you need to calculate the package id to approve the chaincode with the right packageId
.
To solve this, we created the calculatepackageid
command, which you can use to get the package id of the chaincode:
export LABEL=mycc
export PACKAGE_ID=$(kubectl hlf chaincode calculatepackageid --path=$CHAINCODE_PATH --language=node --label=$LABEL)
Then, with the Package ID and with the help of getlatest
command, you could approve and commit the chaincode:
kubectl hlf chaincode approveformyorg --config=org1.yaml --user=admin --peer=org1-peer0.default \
--package-id=$PACKAGE_ID \
--version $VERSION --sequence $SEQUENCE --name=fabcar \
--policy="OR('Org1MSP.member')" --channel=demo
And finally, commit:
kubectl hlf chaincode commit --config=org1.yaml --user=admin --peer=org1-peer0.default \
--version $VERSION --sequence $SEQUENCE --name=fabcar \
--policy="OR('Org1MSP.member')" --channel=demo
CouchDB image configurable
You can now configure the image
, tag
and pullPolicy
of the CouchDB container, in case you want to run another CouchDB version or configure it.
More information on this topic is available on the documentation
Delete anchor peer
A new command has been added, delanchorpeer
, to delete an anchor peer in a specific channel.
kubectl hlf channel delanchorpeer --channel=<CHANNEL> --config=network-config.yaml --msp-id=Org1MSP \
--user=admin --peer-host=<PEER_HOST> --peer-port=<PORT>