Я работал с Hyperledger Fabric и Composer, пытаясь развернуть его на двух виртуальных машинах.Моя работа основана на учебном пособии Composer multi-org , которое распространяется только на две машины.
Настройка сети:
Хост1: Заказчик,Peer1.Org1, Peer2.Org1, CLI
Host2: Peer1.Org2, Peer2.Org2
Fabric - Что работает:
- Пиры запущены и работают;
- Они могут присоединиться к каналу;
- Обновлены якорные пиры;
- В качестве теста я установил цепной код мраморако всем узлам, и я могу успешно запросить;
Composer - Что работает:
У меня есть 2 профиля подключениядля обеих организаций:
Я могу установить .bna на обоих хостах без ошибок;
Я могу запустить сеть;
Я могу создать карты и импортировать их на оба хоста;
Проблемы возникают при попытке пропинговать любой из хостов:
Когда я пингую сеть host 1 :
Error: Error trying invoke business network. Error: Peer localhost:8051 has rejected transaction '1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346' with code ENDORSEMENT_POLICY_FAILURE
Когда я пингую сеть на host 2 :
Error: Error trying to ping. Error: transaction returned with failure: Error: The current identity, with the name 'admin' and the identifier '74d166962b282e9f04b17f6d7a8856a1565a257b310aceed5845831b15a710a4', has not been registered
Это журналы для host1 - peer0 :
2018-10-03 11:18:46.704 UTC [lscc] executeInstall -> INFO 03c Installed Chaincode [proa-network] Version [0.0.1] to peer
2018-10-03 11:19:31.081 UTC [couchdb] CreateDatabaseIfNotExist -> INFO 03d Created state database mychannel_proa-network
2018-10-03 11:19:34.521 UTC [cceventmgmt] HandleStateUpdates -> INFO 03e Channel [mychannel]: Handling LSCC state update for chaincode [proa-network]
2018-10-03 11:19:34.546 UTC [couchdb] CreateIndex -> INFO 03f Created CouchDB index [selectClaimsByService] in state database [mychannel_proa-network] using design document [_design/selectClaimsByServiceDoc]
2018-10-03 11:19:34.549 UTC [couchdb] CreateIndex -> INFO 040 Created CouchDB index [selectInvoicesByPolicy] in state database [mychannel_proa-network] using design document [_design/selectInvoicesByPolicyDoc]
2018-10-03 11:19:34.551 UTC [couchdb] CreateIndex -> INFO 041 Created CouchDB index [selectPoliciesByEvaluator] in state database [mychannel_proa-network] using design document [_design/selectPoliciesByEvaluatorDoc]
2018-10-03 11:19:34.554 UTC [couchdb] CreateIndex -> INFO 042 Created CouchDB index [selectPoliciesByInsurer] in state database [mychannel_proa-network] using design document [_design/selectPoliciesByInsurerDoc]
2018-10-03 11:19:34.557 UTC [couchdb] CreateIndex -> INFO 043 Created CouchDB index [selectPoliciesBySponsor] in state database [mychannel_proa-network] using design document [_design/selectPoliciesBySponsorDoc]
2018-10-03 11:19:34.560 UTC [couchdb] CreateIndex -> INFO 044 Created CouchDB index [selectProductsByEvaluator] in state database [mychannel_proa-network] using design document [_design/selectProductsByEvaluatorDoc]
2018-10-03 11:19:34.564 UTC [couchdb] CreateIndex -> INFO 045 Created CouchDB index [selectProductsByInsurer] in state database [mychannel_proa-network] using design document [_design/selectProductsByInsurerDoc]
2018-10-03 11:19:34.565 UTC [couchdb] CreateIndex -> INFO 046 Created CouchDB index [selectProductsBySponsor] in state database [mychannel_proa-network] using design document [_design/selectProductsBySponsorDoc]
2018-10-03 11:19:34.576 UTC [kvledger] CommitWithPvtData -> INFO 047 Channel [mychannel]: Committed block [3] with 1 transaction(s)
2018-10-03 11:19:36.964 UTC [endorser] SimulateProposal -> ERRO 048 [mychannel][d2dade2d] failed to invoke chaincode name:"proa-network" , error: transaction returned with failure: Error: The current identity, with the name 'admin' and the identifier '09a1e3cfc2f2d4d297653b30151c9bf0fd8356b324199780fda49c10536551d2', must be activated (ACTIVATION_REQUIRED)
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:202
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:141
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:136
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:287
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:501
github.com/hyperledger/fabric/core/handlers/auth/filter.(*expirationCheckFilter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/expiration.go:61
github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:31
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler
/opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:112
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:923
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1148
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:637
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:2361
2018-10-03 11:19:42.026 UTC [vscc] Validate -> WARN 049 Endorsement policy failure for transaction txid=1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346, err: signature set did not satisfy policy
2018-10-03 11:19:42.026 UTC [committer/txvalidator] validateTx -> ERRO 04a VSCCValidateTx for transaction txId = 1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346 returned error: VSCC error: endorsement policy failure, err: signature set did not satisfy policy
2018-10-03 11:19:42.026 UTC [valimpl] preprocessProtoBlock -> WARN 04b Channel [mychannel]: Block [4] Transaction index [0] TxId [1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346] marked as invalid by committer. Reason code [ENDORSEMENT_POLICY_FAILURE]
2018-10-03 11:19:42.067 UTC [kvledger] CommitWithPvtData -> INFO 04c Channel [mychannel]: Committed block [4] with 1 transaction(s)
Обновление: endorsement-policy.json
{
"identities": [
{
"role": {
"name": "member",
"mspId": "ManagerMSP"
}
},
{
"role": {
"name": "member",
"mspId": "SponsorMSP"
}
}
],
"policy": {
"2-of": [
{
"signed-by": 0
},
{
"signed-by": 1
}
]
}
}
composer network install --card PeerAdmin@exManager --archiveFile ex-network@0.0.1.bna
cp endorsement-policy.json /tmp/composer/endorsement-policy.json
echo "Retrieving business network administrator certificates for Manager"
composer identity request -c PeerAdmin@exManager -u admin -s adminpw -d andreim
#-------------------
#-- START NETWORK
#-------------------
echo "Starting the business network"
composer network start -c PeerAdmin@exManager -n ex-network -V 0.0.1 -o endorsementPolicyFile=/tmp/composer/endorsement-policy.json -A andreim -C andreim/admin-pub.pem
Еще одно замечание, которое я хотел бы сделать, это то, что после сетизапускается, 2 контейнера (вероятно, для цепного кода) появляются на хосте 1 , но ни один не появляется на хосте 2 .(с единственным исключением, когда контейнер для peer0 появился на хосте 2 , почти случайно, без какого-либо изменения кода).
Обновление 2: журналы peer0 с хоста 2
.....
2018-10-03 11:15:21.109 UTC [lscc] executeInstall -> INFO 03c Installed Chaincode [proa-network] Version [0.0.1] to peer
2018-10-03 11:18:24.190 UTC [endorser] ProcessProposal -> ERRO 03d [][1bec8b15] simulateProposal() resulted in chaincode name:"lscc" response status 500 for txid: 1bec8b15b953df0f5e00213916cb092219f949800a0f249ea5f8ef90fcc7eb06
2018-10-03 11:19:34.545 UTC [couchdb] CreateDatabaseIfNotExist -> INFO 03e Created state database mychannel_proa-network
2018-10-03 11:19:34.556 UTC [cceventmgmt] HandleStateUpdates -> INFO 03f Channel [mychannel]: Handling LSCC state update for chaincode [proa-network]
2018-10-03 11:19:34.587 UTC [couchdb] CreateIndex -> INFO 040 Created CouchDB index [selectClaimsByService] in state database [mychannel_proa-network] using design document [_design/selectClaimsByServiceDoc]
2018-10-03 11:19:34.589 UTC [couchdb] CreateIndex -> INFO 041 Created CouchDB index [selectInvoicesByPolicy] in state database [mychannel_proa-network] using design document [_design/selectInvoicesByPolicyDoc]
2018-10-03 11:19:34.593 UTC [couchdb] CreateIndex -> INFO 042 Created CouchDB index [selectPoliciesByEvaluator] in state database [mychannel_proa-network] using design document [_design/selectPoliciesByEvaluatorDoc]
2018-10-03 11:19:34.595 UTC [couchdb] CreateIndex -> INFO 043 Created CouchDB index [selectPoliciesByInsurer] in state database [mychannel_proa-network] using design document [_design/selectPoliciesByInsurerDoc]
2018-10-03 11:19:34.598 UTC [couchdb] CreateIndex -> INFO 044 Created CouchDB index [selectPoliciesBySponsor] in state database [mychannel_proa-network] using design document [_design/selectPoliciesBySponsorDoc]
2018-10-03 11:19:34.600 UTC [couchdb] CreateIndex -> INFO 045 Created CouchDB index [selectProductsByEvaluator] in state database [mychannel_proa-network] using design document [_design/selectProductsByEvaluatorDoc]
2018-10-03 11:19:34.602 UTC [couchdb] CreateIndex -> INFO 046 Created CouchDB index [selectProductsByInsurer] in state database [mychannel_proa-network] using design document [_design/selectProductsByInsurerDoc]
2018-10-03 11:19:34.606 UTC [couchdb] CreateIndex -> INFO 047 Created CouchDB index [selectProductsBySponsor] in state database [mychannel_proa-network] using design document [_design/selectProductsBySponsorDoc]
2018-10-03 11:19:34.618 UTC [kvledger] CommitWithPvtData -> INFO 048 Channel [mychannel]: Committed block [3] with 1 transaction(s)
2018-10-03 11:19:42.027 UTC [vscc] Validate -> WARN 049 Endorsement policy failure for transaction txid=1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346, err: signature set did not satisfy policy
2018-10-03 11:19:42.027 UTC [committer/txvalidator] validateTx -> ERRO 04a VSCCValidateTx for transaction txId = 1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346 returned error: VSCC error: endorsement policy failure, err: signature set did not satisfy policy
2018-10-03 11:19:42.028 UTC [valimpl] preprocessProtoBlock -> WARN 04b Channel [mychannel]: Block [4] Transaction index [0] TxId [1ff21ebc89a5d19c2c377f13b10b934168c1dd23d723446b6f51c0bfd79ff346] marked as invalid by committer. Reason code [ENDORSEMENT_POLICY_FAILURE]
2018-10-03 11:19:42.053 UTC [kvledger] CommitWithPvtData -> INFO 04c Channel [mychannel]: Committed block [4] with 1 transaction(s)
2018-10-03 11:42:02.836 UTC [endorser] SimulateProposal -> ERRO 04d [mychannel][f750d0c4] failed to invoke chaincode name:"proa-network" , error: transaction returned with failure: Error: The current identity, with the name 'admin' and the identifier '74d166962b282e9f04b17f6d7a8856a1565a257b310aceed5845831b15a710a4', has not been registered
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:202
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:141
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:136
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:287
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:501
github.com/hyperledger/fabric/core/handlers/auth/filter.(*expirationCheckFilter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/expiration.go:61
github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:31
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler
/opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:112
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:923
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1148
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:637
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:2361