Chaincode docker 容器未在 hyperledger fabric 2.2 上创建
Chaincode docker container not created on hyperledger fabric 2.2
我已经通过以下步骤使用测试网络在我的机器上创建了 hyperledger 2.2 设置
- 在
/fabric-samples/test-network
目录和 org1
、org2
和 orderer
的上层容器中使用它们的 CA。
./network.sh up createChannel -ca -c mychannel -s couchdb -i 2.2.0
- 使用
在mychannel
上部署链代码
./network.sh deployCC -ccn basic1 -ccp ../asset-transfer-basic/chaincode-go/ -ccl go
- 以
channel1
身份创建了新频道,并且仅 org1
先加入此频道
- 已将新组织添加为
org3
并使用命令 加入了 channel1
./addOrg3.sh up -ca -c channel1 -s couchdb -i 2.2.0
在那之后想在 channel1
上部署 chaicode 但是当我使用命令部署链代码时它尝试在 org1
和 org2
上部署链代码这导致它失败请任何人建议我如何在 org1
和 org3
上部署 channel1
上的链码,仅加入 channel1
.
./network.sh deployCC -c channel1 -ccn basic1 -ccp ../asset-transfer-basic/chaincode-go/ -ccl go
来自 test network documentation,“deployCC 子命令将在 peer0.org1.example.com 和 peer0.org2.example.com 上安装资产转移(基本)链码,然后将链码部署到使用通道标志指定的通道(如果未指定通道,则为 mychannel)。
您应该仍然能够部署您的链代码,但您需要直接使用 Fabric peer 命令而不是测试网络脚本。 Deploying a smart contract to a channel tutorial and there is more detail in the Fabric chaincode lifecycle documentation.
中描述了该过程
./test-network/network.sh deployCC ...
呼叫 ./test-network/scripts/deployCC.sh
在此 deployCC.sh
中,在 org1
和 org2
中部署链码是硬编码的。
它的工作原理是从 org1 & org2
更改为 org1 & org3
- ./test-network/scripts/deployCC.sh
...
## package the chaincode
packageChaincode
## Install chaincode on peer0.org1 and peer0.org3
infoln "Installing chaincode on peer0.org1..."
installChaincode 1
infoln "Install chaincode on peer0.org3..."
installChaincode 3
## query whether the chaincode is installed
queryInstalled 1
## approve the definition for org1
approveForMyOrg 1
## check whether the chaincode definition is ready to be committed
## expect org1 to have approved and org3 not to
checkCommitReadiness 1 "\"Org1MSP\": true" "\"Org3MSP\": false"
checkCommitReadiness 3 "\"Org1MSP\": true" "\"Org3MSP\": false"
## now approve also for org3
approveForMyOrg 3
## check whether the chaincode definition is ready to be committed
## expect them both to have approved
checkCommitReadiness 1 "\"Org1MSP\": true" "\"Org3MSP\": true"
checkCommitReadiness 3 "\"Org1MSP\": true" "\"Org3MSP\": true"
## now that we know for sure both orgs have approved, commit the definition
commitChaincodeDefinition 1 3
## query on both orgs to see that the definition committed successfully
queryCommitted 1
queryCommitted 3
## Invoke the chaincode - this does require that the chaincode have the 'initLedger'
## method defined
if [ "$CC_INIT_FCN" = "NA" ]; then
infoln "Chaincode initialization is not required"
else
chaincodeInvokeInit 1 3
fi
...
我已经通过以下步骤使用测试网络在我的机器上创建了 hyperledger 2.2 设置
- 在
/fabric-samples/test-network
目录和org1
、org2
和orderer
的上层容器中使用它们的 CA。
./network.sh up createChannel -ca -c mychannel -s couchdb -i 2.2.0
- 使用 在
mychannel
上部署链代码
./network.sh deployCC -ccn basic1 -ccp ../asset-transfer-basic/chaincode-go/ -ccl go
- 以
channel1
身份创建了新频道,并且仅org1
先加入此频道 - 已将新组织添加为
org3
并使用命令 加入了
channel1
./addOrg3.sh up -ca -c channel1 -s couchdb -i 2.2.0
在那之后想在 channel1
上部署 chaicode 但是当我使用命令部署链代码时它尝试在 org1
和 org2
上部署链代码这导致它失败请任何人建议我如何在 org1
和 org3
上部署 channel1
上的链码,仅加入 channel1
.
./network.sh deployCC -c channel1 -ccn basic1 -ccp ../asset-transfer-basic/chaincode-go/ -ccl go
来自 test network documentation,“deployCC 子命令将在 peer0.org1.example.com 和 peer0.org2.example.com 上安装资产转移(基本)链码,然后将链码部署到使用通道标志指定的通道(如果未指定通道,则为 mychannel)。
您应该仍然能够部署您的链代码,但您需要直接使用 Fabric peer 命令而不是测试网络脚本。 Deploying a smart contract to a channel tutorial and there is more detail in the Fabric chaincode lifecycle documentation.
中描述了该过程./test-network/network.sh deployCC ...
呼叫 ./test-network/scripts/deployCC.sh
在此 deployCC.sh
中,在 org1
和 org2
中部署链码是硬编码的。
它的工作原理是从 org1 & org2
更改为 org1 & org3
- ./test-network/scripts/deployCC.sh
...
## package the chaincode
packageChaincode
## Install chaincode on peer0.org1 and peer0.org3
infoln "Installing chaincode on peer0.org1..."
installChaincode 1
infoln "Install chaincode on peer0.org3..."
installChaincode 3
## query whether the chaincode is installed
queryInstalled 1
## approve the definition for org1
approveForMyOrg 1
## check whether the chaincode definition is ready to be committed
## expect org1 to have approved and org3 not to
checkCommitReadiness 1 "\"Org1MSP\": true" "\"Org3MSP\": false"
checkCommitReadiness 3 "\"Org1MSP\": true" "\"Org3MSP\": false"
## now approve also for org3
approveForMyOrg 3
## check whether the chaincode definition is ready to be committed
## expect them both to have approved
checkCommitReadiness 1 "\"Org1MSP\": true" "\"Org3MSP\": true"
checkCommitReadiness 3 "\"Org1MSP\": true" "\"Org3MSP\": true"
## now that we know for sure both orgs have approved, commit the definition
commitChaincodeDefinition 1 3
## query on both orgs to see that the definition committed successfully
queryCommitted 1
queryCommitted 3
## Invoke the chaincode - this does require that the chaincode have the 'initLedger'
## method defined
if [ "$CC_INIT_FCN" = "NA" ]; then
infoln "Chaincode initialization is not required"
else
chaincodeInvokeInit 1 3
fi
...