fabric升级链码步骤
Fabric 2.2.1 升级链码步骤
- 在通道所属的对等节点安装链码
peer lifecycle chaincode install \
${CC_NAME}.tar.gzs
- 查询链码是否被安装
peer lifecycle chaincode queryinstalled
- 机构1审批,检查链码定义是否准备好提交
(1) 机构审批
peer lifecycle chaincode \
approveformyorg \
-o localhost:7050 \
--ordererTLSHostnameOverride orderer.example.com \
--tls \
--cafile $ORDERER_CA \
--channelID $CHANNEL_NAME \
--name ${CC_NAME} \
--version ${CC_VERSION} \
--package-id ${PACKAGE_ID} \
--sequence ${CC_SEQUENCE} ${INIT_REQUIRED} ${CC_END_POLICY} ${CC_COLL_CONFIG}
(2) 检查链码是否准备好
peer lifecycle chaincode checkcommitreadiness \
--channelID $CHANNEL_NAME \
--name ${CC_NAME} \
--version ${CC_VERSION} \
--sequence ${CC_SEQUENCE} ${INIT_REQUIRED} ${CC_END_POLICY} ${CC_COLL_CONFIG} \
--output json
- 机构2审批,检查链码定义是否准备好提交
- 提交链码定义
peer lifecycle chaincode commit \
-o localhost:7050 \
--ordererTLSHostnameOverride orderer.example.com \
--tls \
--cafile $ORDERER_CA \
--channelID $CHANNEL_NAME \
--name ${CC_NAME} $PEER_CONN_PARMS \
--version ${CC_VERSION} \
--sequence ${CC_SEQUENCE} ${INIT_REQUIRED} ${CC_END_POLICY} ${CC_COLL_CONFIG}
- 查询提交定义的结果
peer lifecycle chaincode \
querycommitted \
--channelID $CHANNEL_NAME \
--name ${CC_NAME}
验证升级成功
链码更新完成,日志
2021-09-27 02:25:48.886 UTC [lifecycle] update -> INFO 0b0 Updating cached definition for chaincode 'ncapledger' on channel 'chl-01'
2021-09-27 02:25:48.886 UTC [lifecycle] update -> INFO 0b1 Chaincode with package ID 'ncapledger_20210927:cd7711fdbb05c99c74f3a7cc50dc7516eb3d84c17b5da1019f539a0099750a0a' now available on channel chl-01 for chaincode definition ncapledger:20210927