0

我有 5 个排序节点,4 个节点属于我的结构网络中的两个不同组织。我已经在所有对等方中安装了链码。当我提交购买同行时,一切正常:

[root@localhost chaincode]# peer chaincode query -C $CHANNEL_NAME -n asset -c '{"Args":["ReadAsset","asset1"]}'
{"objectType":"asset","ID":"asset1","name":"iphone","owner":"x509::CN=Admin@org2.example.com,OU=admin,L=San Francisco,ST=California,C=US::CN=ca.org2.example.com,O=org2.example.com,L=San Francisco,ST=California,C=US"}
[root@localhost chaincode]# 

但是,当我提交交易时fabric-sdk-go,我会收到这样的错误:

 [fabsdk/core] 2021/04/06 10:09:27 UTC - cryptosuite.GetDefault -> INFO No default cryptosuite found, using default SW implementation
 [fabsdk/client] 2021/04/06 10:09:27 UTC - greylist.(*Filter).Greylist -> INFO Greylisting peer localhost:7051
 [fabsdk/client] 2021/04/06 10:09:27 UTC - greylist.(*Filter).Accept -> INFO Rejecting peer localhost:7051
 [fabsdk/client] 2021/04/06 10:09:27 UTC - greylist.(*Filter).Accept -> INFO Rejecting peer localhost:7051
 [fabsdk/client] 2021/04/06 10:09:27 UTC - greylist.(*Filter).Accept -> INFO Rejecting peer localhost:7051
 [fabsdk/client] 2021/04/06 10:09:27 UTC - greylist.(*Filter).Accept -> INFO Rejecting peer localhost:7051
2021/04/06 18:09:27 Failed to submit: Discovery status Code: (11) UNKNOWN. Description: error getting endorsers: no endorsement combination can be satisfied

这是connection.jsonfor fabric-sdk-go

{
    "name": "test-network-org1",
    "version": "1.0.0",
    "client": {
        "organization": "Org1",
        "connection": {
            "timeout": {
                "peer": {
                    "endorser": "300"
                }
            }
        }
    },
    "organizations": {
        "Org1": {
            "mspid": "Org1MSP",
            "peers": [
                "peer0.org1.example.com",
                "peer1.org1.example.com"
            ]
        }
    },
    "peers": {
        "peer0.org1.example.com": {
            "url": "grpcs://localhost:6000",
            "tlsCACerts": {
                "pem": "-----BEGIN CERTIFICATE-----\nMIICWDCCAf2gAwIBAgIQSZaMDMy95GIPmd80JXDASDAKBggqhkjOPQQDAjB2MQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz\nY2Eub3JnMS5leGFtcGxlLmNvbTAeFw0yMTA0MDYwNjQ1MDBaFw0zMTA0MDQwNjQ1\nMDBaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH\nEw1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD\nVQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D\nAQcDQgAEMktWm0sYqs0imw8WpY00V0KluXgIWiQ0Aat7ke1jl7uf8kyv/aA+oDY1\nZ9ERQn0AIZH2jO0gJFJyiZO4BwArtKNtMGswDgYDVR0PAQH/BAQDAgGmMB0GA1Ud\nJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MCkGA1Ud\nDgQiBCDu6njWxiTd/dw7pDssC7qGg/+SWC92Fsr8c5ZgH2AMmjAKBggqhkjOPQQD\nAgNJADBGAiEA1o6iQVtK+gjjWJ+AAmjv//3F+GgL4hyL+LVS/TIvDYYCIQDcHuF8\n8LU1Ap/c2RHVgf9xOUodDizV7r191Vb6ytif+w==\n-----END CERTIFICATE-----\n"
            },
            "grpcOptions": {
                "ssl-target-name-override": "peer0.org1.example.com",
                "hostnameOverride": "peer0.org1.example.com"
            }
        },
        "peer1.org1.example.com": {
            "url": "grpcs://localhost:6001",
            "tlsCACerts": {
                "pem": "-----BEGIN CERTIFICATE-----\nMIICWDCCAf2gAwIBAgIQSZaMDMy95GIPmd80JXDASDAKBggqhkjOPQQDAjB2MQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEfMB0GA1UEAxMWdGxz\nY2Eub3JnMS5leGFtcGxlLmNvbTAeFw0yMTA0MDYwNjQ1MDBaFw0zMTA0MDQwNjQ1\nMDBaMHYxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH\nEw1TYW4gRnJhbmNpc2NvMRkwFwYDVQQKExBvcmcxLmV4YW1wbGUuY29tMR8wHQYD\nVQQDExZ0bHNjYS5vcmcxLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0D\nAQcDQgAEMktWm0sYqs0imw8WpY00V0KluXgIWiQ0Aat7ke1jl7uf8kyv/aA+oDY1\nZ9ERQn0AIZH2jO0gJFJyiZO4BwArtKNtMGswDgYDVR0PAQH/BAQDAgGmMB0GA1Ud\nJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATAPBgNVHRMBAf8EBTADAQH/MCkGA1Ud\nDgQiBCDu6njWxiTd/dw7pDssC7qGg/+SWC92Fsr8c5ZgH2AMmjAKBggqhkjOPQQD\nAgNJADBGAiEA1o6iQVtK+gjjWJ+AAmjv//3F+GgL4hyL+LVS/TIvDYYCIQDcHuF8\n8LU1Ap/c2RHVgf9xOUodDizV7r191Vb6ytif+w==\n-----END CERTIFICATE-----\n"
            },
            "grpcOptions": {
                "ssl-target-name-override": "peer1.org1.example.com",
                "hostnameOverride": "peer1.org1.example.com"
            }
        }
    }
}

这是configtx.yaml

Organizations:
  - &OrdererOrg
    Name: OrdererOrg

    ID: OrdererMSP
    MSPDir: crypto-config/ordererOrganizations/example.com/msp
    OrdererEndpoints:
      - orderer.example.com:7050
    Policies: &OrdererOrgPolicies
      Readers:
        Type: Signature
        Rule: "OR('OrdererMSP.member')"
      Writers:
        Type: Signature
        Rule: "OR('OrdererMSP.member')"
      Admins:
        Type: Signature
        Rule: "OR('OrdererMSP.admin')"
      Endorsement:
        Type: Signature
        Rule: "OR('OrdererMSP.member')"

  - &Org1
    Name: Org1MSP
    ID: Org1MSP
    MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
    AnchorPeers:
      - Host: peer0.org1.example.com
        Port: 7051
    Policies:
      Readers:
        Type: Signature
        Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')"
      Writers:
        Type: Signature
        Rule: "OR('Org1MSP.admin', 'Org1MSP.client')"
      Admins:
        Type: Signature
        Rule: "OR('Org1MSP.admin')"
      Endorsement:
        Type: Signature
        Rule: "OR('Org1MSP.peer')"

  - &Org2
    Name: Org2MSP
    ID: Org2MSP
    MSPDir: crypto-config/peerOrganizations/org2.example.com/msp
    AnchorPeers:
      - Host: peer0.org2.example.com
        Port: 7051
    Policies:
      Readers:
        Type: Signature
        Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')"
      Writers:
        Type: Signature
        Rule: "OR('Org2MSP.admin', 'Org2MSP.client')"
      Admins:
        Type: Signature
        Rule: "OR('Org2MSP.admin')"
      Endorsement:
        Type: Signature
        Rule: "OR('Org2MSP.peer')"

Capabilities:
  Channel: &ChannelCapabilities
    V2_0: true

  Orderer: &OrdererCapabilities
    V2_0: true

  Application: &ApplicationCapabilities
    V2_0: true

Orderer: &OrdererDefaults
  OrdererType: etcdraft
  Addresses:
    - orderer.example.com:7050
    - orderer2.example.com:7050
    - orderer3.example.com:7050
    - orderer4.example.com:7050
    - orderer5.example.com:7050

  BatchTimeout: 2s

  BatchSize:
    MaxMessageCount: 500
    AbsoluteMaxBytes: 10 MB
    PreferredMaxBytes: 2 MB

  MaxChannels: 0

  EtcdRaft:
    Consenters:
      - Host: orderer.example.com
        Port: 7050
        ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
        ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
      - Host: orderer2.example.com
        Port: 7050
        ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
        ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
      - Host: orderer3.example.com
        Port: 7050
        ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
        ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
      - Host: orderer4.example.com
        Port: 7050
        ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
        ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
      - Host: orderer5.example.com
        Port: 7050
        ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt
        ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt

    # Options to be specified for all the etcd/raft nodes. The values here
    # are the defaults for all new channels and can be modified on a
    # per-channel basis via configuration updates.
    Options:
      # TickInterval is the time interval between two Node.Tick invocations.
      TickInterval: 500ms

      # ElectionTick is the number of Node.Tick invocations that must pass
      # between elections. That is, if a follower does not receive any
      # message from the leader of current term before ElectionTick has
      # elapsed, it will become candidate and start an election.
      # ElectionTick must be greater than HeartbeatTick.
      ElectionTick: 10

      # HeartbeatTick is the number of Node.Tick invocations that must
      # pass between heartbeats. That is, a leader sends heartbeat
      # messages to maintain its leadership every HeartbeatTick ticks.
      HeartbeatTick: 1

      # MaxInflightBlocks limits the max number of in-flight append messages
      # during optimistic replication phase.
      MaxInflightBlocks: 5

      # SnapshotIntervalSize defines number of bytes per which a snapshot is taken
      SnapshotIntervalSize: 16 MB

  Kafka:
    Brokers:
      - 127.0.0.1:9092

  Capabilities:
    <<: *OrdererCapabilities

  Policies:
    Readers:
      Type: ImplicitMeta
      Rule: "ANY Readers"
    Writers:
      Type: ImplicitMeta
      Rule: "ANY Writers"
    Admins:
      Type: ImplicitMeta
      Rule: "MAJORITY Admins"
    # BlockValidation specifies what signatures must be included in the block
    # from the orderer for the peer to validate it.
    BlockValidation:
      Type: ImplicitMeta
      Rule: "ANY Writers"

  Organizations:

Channel: &ChannelDefaults
  Capabilities:
    <<: *ChannelCapabilities

  Policies:
    # Who may invoke the 'Deliver' API
    Readers:
      Type: ImplicitMeta
      Rule: "ANY Readers"
    # Who may invoke the 'Broadcast' API
    Writers:
      Type: ImplicitMeta
      Rule: "ANY Writers"
    # By default, who may modify elements at this config level
    Admins:
      Type: ImplicitMeta
      Rule: "MAJORITY Admins"

Application: &ApplicationDefaults
  Organizations:
  Policies: &ApplicationDefaultPolicies
    LifecycleEndorsement:
      Type: Signature
      Rule: "OR('Org1MSP.admin.peer', 'Org2MSP.peer')"
    Endorsement:
      Type: ImplicitMeta
      Rule: "MAJORITY Endorsement"
    Readers:
      Type: ImplicitMeta
      Rule: "ANY Readers"
    Writers:
      Type: ImplicitMeta
      Rule: "ANY Writers"
    Admins:
      Type: ImplicitMeta
      Rule: "MAJORITY Admins"
  Capabilities:
    <<: *ApplicationCapabilities
    
Profiles:
  SampleDevModeEtcdRaft:
    <<: *ChannelDefaults
    Orderer:
      <<: *OrdererDefaults
      Organizations:
        - *OrdererOrg
      Capabilities:
        <<: *OrdererCapabilities

    Consortiums:
      SampleConsortium:
        Organizations:
          - *Org1
          - *Org2

  SampleAppChannelEtcdRaft:
    <<: *ChannelDefaults
    Consortium: SampleConsortium

    Orderer:
      <<: *OrdererDefaults
      OrdererType: etcdraft
      Organizations:
        - <<: *OrdererOrg
      Capabilities:
        - <<: *OrdererCapabilities

    Application:
      <<: *ApplicationDefaults
      Organizations:
        - *Org1
        - *Org2

我不知道我的结构网络出了什么问题。有人能帮我吗?

4

0 回答 0