来自不同主机的Composer请求标识

时间:2018-10-22 07:02:58

标签: hyperledger-fabric hyperledger hyperledger-composer hyperledger-fabric-ca

我正在跟踪本教程,并提供了从其他主机添加组织的方法。 https://medium.com/@mahoney_33893/hyperledger-composer-adding-another-organization-to-an-existing-running-multi-organization-fff5c8104a82

我正在尝试从其他主机(例如Org3)向现有渠道添加新组织。我已经设法将来自org3的同龄人加入该渠道。我有运行org3的CA。

然后,我使用修改后的连接配置文件创建并导入了PeerAdmin卡。

但是,当我运行作曲者身份请求时,出现错误消息错误:无法请求身份。尝试注册用户并返回证书时出错。错误:注册失败并显示错误[[{{“ code”:19,“ message”:“ CA'ca.org1.example.com'不存在”}]]。请注意,运行我的org1的ca的端口是开放的。

然后,我试图从org3的ca中获取日志,只是发现该日志(POST / api / v1 / enroll 404 19“ CA'ca.org1.example.com'不存在)。为什么我的ca来自org3需要与来自org1的ca进行通信吗?为什么它说我的org1的ca实际上已经启动并运行时不存在呢?非常感谢任何帮助

当前使用Hyperledger作曲器,Hyperledger Fabric v 1.2.1。当前未使用TLS。

{
"name": "hlfv1",
"x-type": "hlfv1",
"x-commitTimeout": 300,
"version": "1.0.0",
"client": {
    "organization": "Org3",
    "connection": {
        "timeout": {
            "peer": {
                "endorser": "300",
                "eventHub": "300",
                "eventReg": "300"
            },
            "orderer": "300"
        }
    }
},
"channels": {
    "composerchannel": {
        "orderers": [
            "orderer.example.com"
        ],
        "peers": {
            "peer0.org1.example.com": {},
            "peer0.org3.example.com":{}
        }
    }
},
"organizations": {
    "Org1": {
        "mspid": "Org1MSP",
        "peers": [
            "peer0.org1.example.com"
        ],
        "certificateAuthorities": [
            "ca.org1.example.com"
        ]
    },
    "Org3":{
        "mspid": "Org3MSP",
        "peers": [
            "peer0.org3.example.com"
        ],
        "certificateAuthorities": [
            "ca.org3.example.com"
        ]
    }
},
"orderers": {
    "orderer.example.com": {
        "url": "grpc://{{hostmachineurl}}:7050"
    }
},
"peers": {
    "peer0.org1.example.com": {
        "url": "grpc://{{hostmachineurl}}:7051"
    },
    "peer0.org3.example.com": {
        "url": "grpc://{{localmachineurl}}:11051"
    }
},
"certificateAuthorities": {
    "ca.org1.example.com": {
        "url": "http://{{hostmachineurl}}:7054",
        "caName": "ca.org1.example.com"
    },
    "ca.org3.example.com": {
        "url": "http://{{localmachineurl}}:9054",
        "caName": "ca.org1.example.com"
    }
}

}

我的docker创建对等org3

version: '2'

volumes:
  peer0.org3.example.com:

networks:
  byfn:

services:

  peer0.org3.example.com:
    container_name: peer0.org3.example.com
    extends:
      file: peer-base.yaml
      service: peer-base
    environment:
      - CORE_PEER_ID=peer0.org3.example.com
      - CORE_PEER_ADDRESS=peer0.org3.example.com:7051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.example.com:7051
      - CORE_PEER_LOCALMSPID=Org3MSP
    volumes:
        - /var/run/:/host/var/run/
        - ~/fabric-samples/first-network/org3-artifacts/crypto-config/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp:/etc/hyperledger/fabric/msp
        - ~/fabric-samples/first-network/org3-artifacts/crypto-config/peerOrganizations/org3.example.com/users/Admin@org3.example.com/tls:/etc/hyperledger/fabric/tls
        - peer0.org3.example.com:/var/hyperledger/production
    ports:
      - 11051:7051
      - 11053:7053
    networks:
      - byfn

1 个答案:

答案 0 :(得分:0)

看着上面的connection.json-我可以看到为什么它会向Org1 CA(而不是Org 3的CA)提出要求:

“ certificateAuthorities”下的此部分应为“ ca.org3.example.com”(请参见下面的//):

"certificateAuthorities": {
    "ca.org1.example.com": {
        "url": "http://{{hostmachineurl}}:7054",
        "caName": "ca.org1.example.com"
    },
    "ca.org3.example.com": {
        "url": "http://{{localmachineurl}}:9054",
        "caName": "ca.org1.example.com" // change this line
    }
}

您可能还需要检查其他条目。