Does composer support endorsement policy? How?

2019-06-13 03:32发布

问题:

I understand that it is possible to specify the endorsement policy using -o or -O options during composer network deploy or composer network start, but given that composer connection profile contains the connection information for only one MSP/Org, how does composer sends the transaction proposal to the Peers of other Orgs in the endorsement policy?

回答1:

The connection profile has information which represents the organisation to which you belong (mspID), this doesn't restrict from sending transaction proposals to other organisations' peers. To do so all you need to do is add those peer definitions to your connection profile, but do not include the eventURL for those peers as you are unlikely to be authorised to listen for events from those peers, so for example your connection profile may look like

{
    "type": "hlfv1",
    "orderers": [
       { "url" : "grpc://consortium_orderer:7050" }
    ],
    "ca": { "url": "http://myorg_ca:7054",
            "name": "ca.example.com"
    },
    "peers": [
        {
            "requestURL": "grpc://myorg_peer:7051",
            "eventURL": "grpc://myorg_peer:7053"
        },
        {
            "requestURL": "grpc://otherorg_peer:7051"
        }
    ],
    "keyValStore": "/home/vagrant/.composer-credentials",
    "channel": "mychannel",
    "mspID": "Org1MSP",
    "timeout": 300
}