我目前正在尝试将Hyperledger Fabric网络的docker-compose设置移植到Kubernetes中,并在使用结构中提供的端到端方案从cli容器实例化链代码时继续遇到此错误示例:
2017-11-07 20:49:55.476 UTC [shim] userChaincodeStreamGetter -> ERRO 001 Error trying to connect to local peer: x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "tlsca.org0.example.com")
Error starting Simple chaincode: Error trying to connect to local peer: x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "tlsca.org0.example.com")
这是我的crypto-config.yml:
OrdererOrgs:
- Name: Orderer
Domain: example.com
Specs:
- Hostname: orderer
PeerOrgs:
- Name: Org0
Domain: org0.example.com
Specs:
- Hostname: peer0
- Hostname: peer1
- Hostname: ca
Users:
Count: 2
以下是我在Kubernetes清单中用于对等pod的环境变量:
env:
- name: CORE_PEER_ID
value: peer0.org0.example.com
- name: CORE_PEER_ADDRESS
value: peer0.org0.example.com:7051
- name: CORE_PEER_ADDRESSAUTODETECT
value: "true"
- name: CORE_PEER_TLS_SERVERHOSTOVERRIDE
value: peer0.org0.example.com
- name: CORE_PEER_GOSSIP_EXTERNALENDPOINT
value: peer0.org0.example.com:7051
- name: CORE_PEER_LOCALMSPID
value: Org0MSP
- name: CORE_LEDGER_STATE_STATEDATABASE
value: CouchDB
- name: CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS
value: localhost:5984
- name: CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME
value:
- name: CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
value:
- name: CORE_VM_ENDPOINT
value: unix:///host/var/run/docker.sock
- name: CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE
value: bridge
- name: CORE_LOGGING_LEVEL
value: DEBUG
- name: CORE_PEER_TLS_ENABLED
value: "true"
- name: CORE_PEER_GOSSIP_USELEADERELECTION
value: "true"
- name: CORE_PEER_GOSSIP_ORGLEADER
value: "false"
- name: CORE_PEER_PROFILE_ENABLED
value: "true"
- name: CORE_PEER_TLS_CERT_FILE
value: /etc/hyperledger/fabric/tls/server.crt
- name: CORE_PEER_TLS_KEY_FILE
value: /etc/hyperledger/fabric/tls/server.key
- name: CORE_PEER_TLS_ROOTCERT_FILE
value: /etc/hyperledger/fabric/tls/ca.crt
直到链代码实例化步骤,一切正常 - 通道创建,将对等方连接到通道,锚点对等更新,链代码安装。
答案 0 :(得分:0)
所以我还没有能够验证源代码(当我这样做时我会编辑我的答案)因为Fabric已经发生了很大的变化而我没有重新找到生成此错误的源代码的一部分,但我很确定我终于弄明白了。
因此,在非常具体的情况下可能会发生此错误:
发生的情况是,使用tls rootcert(以及烘焙的一些CORE_*
环境变量)创建链代码图像。但是,如果在end-to-run的运行之间重新生成一组证书在没有删除链代码图像的情况下结束方案,您将最终尝试针对已经烘焙到链代码映像中的旧rootcert验证新的最终实体证书,从中创建链代码容器。
我刚刚通过以下步骤成功验证了最终用户方:
tl; dr 如果使用cryptogen
重新生成一组新证书,请不要忘记删除您的链代码容器图像。