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