Hyperledger fabric Hyperledger结构无法提交交易:错误:背书失败

Hyperledger fabric Hyperledger结构无法提交交易:错误:背书失败,hyperledger-fabric,hyperledger,Hyperledger Fabric,Hyperledger,我有3个组织和6个同行,我创建了渠道交易,甚至我可以从fabric节点客户端查询fabcar链码。但是,当我使用farbic sdk节点提交转换时,它会给我带来错误 提交交易失败:错误:背书失败 我使用下面的代码提交翻译 async function Invoke(userwallet,usename,channelName,chaincodeName) { try { // Create a new file system based wallet for managing iden

我有3个组织和6个同行,我创建了渠道交易,甚至我可以从fabric节点客户端查询fabcar链码。但是,当我使用farbic sdk节点提交转换时,它会给我带来错误

提交交易失败:错误:背书失败

我使用下面的代码提交翻译

async function Invoke(userwallet,usename,channelName,chaincodeName) {
try {

    // Create a new file system based wallet for managing identities.
    const walletPath = path.join(process.cwd(), 'wallet');
    const wallet = new FileSystemWallet(walletPath);
    console.log(`Wallet path: ${walletPath}`);

    // Check to see if we've already enrolled the user.
    const userExists = await wallet.exists(userwallet);
    if (!userExists) {
        console.log('An identity for the user "user1" does not exist in the wallet');
        console.log('Run the registerUser.js application before retrying');
        return;
    }

    // Create a new gateway for connecting to our peer node.
    const gateway = new Gateway();
    await gateway.connect(ccp, { wallet, identity: usename, discovery: { enabled: true } });

    // Get the network (channel) our contract is deployed to.
    const network = await gateway.getNetwork(channelName);

    // Get the contract from the network.
    const contract = network.getContract(chaincodeName);

    // Submit the specified transaction.
    // createCar transaction - requires 5 argument, ex: ('createCar', 'CAR12', 'Honda', 'Accord', 'Black', 'Tom')
    // changeCarOwner transaction - requires 2 args , ex: ('changeCarOwner', 'CAR10', 'Dave')
   // await contract.submitTransaction('CAR12', 'Honda', 'Accord', 'Black', 'Tom');
   await contract.createTransaction('createCar').submit('CAR22', 'Honda', 'Accord', 'Black', 'Tom')
    //await contract.submitTransaction('changeCarOwner', 'CAR10', 'Dave');
    console.log('Transaction has been submitted');


    // Disconnect from the gateway.
    await gateway.disconnect();

} catch (error) {
    console.error(`Failed to submit transaction: ${error}`);
    process.exit(1);
}
 }
配置发送

组织:
-&orderorg
姓名:OrderOrg
#将MSP定义加载为的ID
ID:ordermsp
#MSPDir是包含MSP配置的文件系统路径
MSPDir:crypto-config/orderOrganizations/example.com/msp
政策:
读者:
类型:签名
规则:“或('ordermsp.member')”
作者:
类型:签名
规则:“或('ordermsp.member')”
管理员:
类型:签名
规则:“或('ordermsp.admin')”
-&Org1
名称:Org1MSP
#将MSP定义加载为的ID
ID:Org1MSP
MSPDir:crypto-config/peerOrganizations/org1.example.com/msp
政策:
读者:
类型:签名
规则:“或('Org1MSP.admin','Org1MSP.peer','Org1MSP.client')”
作者:
类型:签名
规则:“或('Org1MSP.admin','Org1MSP.client')”
管理员:
类型:签名
规则:“或('Org1MSP.admin')”
#将此标志设置为true。
主持人:
-主持人:peer1.org1.example.com
港口:7051
-&Org2
#DefaultOrg定义sampleconfig中使用的组织
#fabric.git开发环境的
名称:Org2MSP
#将MSP定义加载为的ID
ID:Org2MSP
MSPDir:crypto-config/peerOrganizations/org2.example.com/msp
政策:
读者:
类型:签名
规则:“或('Org2MSP.admin','Org2MSP.peer','Org2MSP.client')”
作者:
类型:签名
规则:“或('Org2MSP.admin','Org2MSP.client')”
管理员:
类型:签名
规则:“或('Org2MSP.admin')”
主持人:
-主持人:peer1.org2.example.com
港口:7051
-&Org3
名称:Org3MSP
#将MSP定义加载为的ID
ID:Org3MSP
MSPDir:crypto-config/peerOrganizations/org3.example.com/msp
政策:
读者:
类型:签名
规则:“或('Org3MSP.admin','Org3MSP.peer','Org3MSP.client','Org3MSP.member')”
作者:
类型:签名
规则:“或('Org3MSP.admin','Org3MSP.client','Org3MSP.member')”
管理员:
类型:签名
规则:“或('Org3MSP.admin')”
主持人:
#主持人定义可以使用的对等点的位置
#用于跨组织的闲聊交流。注意,此值仅为
#编码在应用程序部分上下文中的genesis块中
-主持人:peer1.org3.example.com
港口:7051
能力:
通道:&通道功能
V1_4_3:正确
V1_3:错误
V1_1:错误
订购者:&订购者能力
V1_4_2:正确
V1_1:错误
应用程序:&应用程序容量
V1_4_2:正确
V1_3:错误
V1_2:错误
V1_1:错误
应用程序:&ApplicationDefaults
ACLs:&ACLsDefault
#---生命周期系统链码(lscc)功能到访问控制的策略映射---#
#lscc的“getid”函数的ACL策略
lscc/ChaincodeExists:/Channel/Application/Readers
#lscc的“getdepspec”函数的ACL策略
lscc/GetDeploymentSpec:/Channel/Application/Readers
#lscc“getccdata”函数的ACL策略
lscc/GetChaincodeData:/Channel/Application/Readers
#---查询系统链码(qscc)功能到访问控制的策略映射---#
#qscc“GetChainInfo”函数的ACL策略
qscc/GetChainInfo:/Channel/Application/Readers
#qscc的“GetBlockByNumber”函数的ACL策略
qscc/GetBlockByNumber:/Channel/Application/Readers
#qscc的“GetBlockByHash”函数的ACL策略
qscc/GetBlockByHash:/Channel/Application/Readers
#qscc的“GetTransactionByID”函数的ACL策略
qscc/GetTransactionByID:/Channel/Application/Readers
#qscc的“GetBlockByTxID”函数的ACL策略
qscc/GetBlockByTxID:/Channel/Application/Readers
#---用于访问控制的配置系统链码(cscc)功能到策略映射---#
#cscc“GetConfigBlock”函数的ACL策略
cscc/GetConfigBlock:/Channel/Application/Readers
#cscc“GetConfigTree”函数的ACL策略
cscc/GetConfigTree:/Channel/Application/Readers
#cscc“SimulateConfigTreeUpdate”功能的ACL策略
cscc/SimulateConfigTreeUpdate:/Channel/Application/Writer
#---访问控制的杂项对等功能到策略映射---#
#用于在对等机上调用链码的ACL策略
同行/提案:/Channel/Application/Writer
#链代码到链代码调用的ACL策略
对等/链码到链码:/Channel/Application/Readers
#---用于访问控制的事件资源到策略映射###---#
#用于发送块事件的ACL策略
事件/块:/Channel/Application/Readers
#用于发送筛选的块事件的ACL策略
事件/FilteredBlock:/Channel/Application/Readers
#Organizations是在上定义为参与者的组织列表
#网络的应用端
组织:
#策略在配置树的这个级别定义策略集
#对于应用程序策略,其规范路径为
#/频道/应用程序/
政策:
读者:
类型:ImplicitMeta
规则:“任何读者”
作者:
类型:ImplicitMeta
规则:“任何作家”
管理员:
类型:ImplicitMeta
规则:“多数管理员”
组织1成员政策:
类型:签名
规则:“或('Org1MSP.member')”
组织2成员政策:
类型:签名
  Organizations:

- &OrdererOrg
    Name: OrdererOrg

    # ID to load the MSP definition as
    ID: OrdererMSP

    # MSPDir is the filesystem path which contains the MSP configuration
    MSPDir: crypto-config/ordererOrganizations/example.com/msp

    Policies:
        Readers:
            Type: Signature
            Rule: "OR('OrdererMSP.member')"
        Writers:
            Type: Signature
            Rule: "OR('OrdererMSP.member')"
        Admins:
            Type: Signature
            Rule: "OR('OrdererMSP.admin')"

- &Org1

    Name: Org1MSP

    # ID to load the MSP definition as
    ID: Org1MSP

    MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
    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')"

    # leave this flag set to true.
    AnchorPeers:
        - Host: peer1.org1.example.com
          Port: 7051

- &Org2
    # DefaultOrg defines the organization which is used in the sampleconfig
    # of the fabric.git development environment
    Name: Org2MSP

    # ID to load the MSP definition as
    ID: Org2MSP

    MSPDir: crypto-config/peerOrganizations/org2.example.com/msp

    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')"

    AnchorPeers:
        - Host: peer1.org2.example.com
          Port: 7051

- &Org3
    Name: Org3MSP

    # ID to load the MSP definition as
    ID: Org3MSP

    MSPDir: crypto-config/peerOrganizations/org3.example.com/msp
    Policies:
        Readers:
            Type: Signature
            Rule: "OR('Org3MSP.admin', 'Org3MSP.peer', 'Org3MSP.client' , 'Org3MSP.member')"
        Writers:
            Type: Signature
            Rule: "OR('Org3MSP.admin', 'Org3MSP.client', 'Org3MSP.member')"
        Admins:
            Type: Signature
            Rule: "OR('Org3MSP.admin')"

    AnchorPeers:
        # AnchorPeers defines the location of peers which can be used
        # for cross org gossip communication.  Note, this value is only
        # encoded in the genesis block in the Application section context
        - Host: peer1.org3.example.com
          Port: 7051


 Capabilities:

   Channel: &ChannelCapabilities
     V1_4_3: true
     V1_3: false
     V1_1: false

Orderer: &OrdererCapabilities
    V1_4_2: true
    V1_1: false

Application: &ApplicationCapabilities
    V1_4_2: true

    V1_3: false

    V1_2: false

    V1_1: false

Application: &ApplicationDefaults

ACLs: &ACLsDefault

    #---Lifecycle System Chaincode (lscc) function to policy mapping for access control---#

    #ACL policy for lscc's "getid" function
    lscc/ChaincodeExists: /Channel/Application/Readers

    #ACL policy for lscc's "getdepspec" function
    lscc/GetDeploymentSpec: /Channel/Application/Readers

    #ACL policy for lscc's "getccdata" function
    lscc/GetChaincodeData: /Channel/Application/Readers

    #---Query System Chaincode (qscc) function to policy mapping for access control---#

    #ACL policy for qscc's "GetChainInfo" function
    qscc/GetChainInfo: /Channel/Application/Readers

    #ACL policy for qscc's "GetBlockByNumber" function
    qscc/GetBlockByNumber: /Channel/Application/Readers

    #ACL policy for qscc's  "GetBlockByHash" function
    qscc/GetBlockByHash: /Channel/Application/Readers

    #ACL policy for qscc's "GetTransactionByID" function
    qscc/GetTransactionByID: /Channel/Application/Readers

    #ACL policy for qscc's "GetBlockByTxID" function
    qscc/GetBlockByTxID: /Channel/Application/Readers

    #---Configuration System Chaincode (cscc) function to policy mapping for access control---#

    #ACL policy for cscc's "GetConfigBlock" function
    cscc/GetConfigBlock: /Channel/Application/Readers

    #ACL policy for cscc's "GetConfigTree" function
    cscc/GetConfigTree: /Channel/Application/Readers

    #ACL policy for cscc's "SimulateConfigTreeUpdate" function
    cscc/SimulateConfigTreeUpdate: /Channel/Application/Writers

    #---Miscellanesous peer function to policy mapping for access control---#

    #ACL policy for invoking chaincodes on peer
    peer/Proposal: /Channel/Application/Writers

    #ACL policy for chaincode to chaincode invocation
    peer/ChaincodeToChaincode: /Channel/Application/Readers

    #---Events resource to policy mapping for access control###---#

    #ACL policy for sending block events
    event/Block: /Channel/Application/Readers

    #ACL policy for sending filtered block events
    event/FilteredBlock: /Channel/Application/Readers
# Organizations is the list of orgs which are defined as participants on
# the application side of the network
   Organizations:

   # Policies defines the set of policies at this level of the config tree
  # For Application policies, their canonical path is
  #   /Channel/Application/<PolicyName>
Policies:
    Readers:
        Type: ImplicitMeta
        Rule: "ANY Readers"
    Writers:
        Type: ImplicitMeta
        Rule: "ANY Writers"
    Admins:
        Type: ImplicitMeta
        Rule: "MAJORITY Admins"
    Org1MemberPolicy:
        Type: Signature
        Rule: "OR('Org1MSP.member')"
    Org2MemberPolicy:
        Type: Signature
        Rule: "OR('Org2MSP.member')"
    Org1Org2MemberPolicy:
        Type: Signature
        Rule: "OR('Org1MSP.member','Org2MSP.member')"

Capabilities:
    <<: *ApplicationCapabilities

 Orderer: &OrdererDefaults

# Orderer Type: The orderer implementation to start
# Available types are "solo","kafka"  and "etcdraft"
OrdererType: etcdraft

Addresses:
    - orderer.example.com:7050

# Batch Timeout: The amount of time to wait before creating a batch
BatchTimeout: 2s

# Batch Size: Controls the number of messages batched into a block
BatchSize:

    # Max Message Count: The maximum number of messages to permit in a batch
    MaxMessageCount: 10

    # Absolute Max Bytes: The absolute maximum number of bytes allowed for
    # the serialized messages in a batch.
    AbsoluteMaxBytes: 99 MB

    # Preferred Max Bytes: The preferred maximum number of bytes allowed for
    # the serialized messages in a batch. A message larger than the preferred
    # max bytes will result in a batch larger than preferred max bytes.
    PreferredMaxBytes: 512 KB

Kafka:
    # Brokers: A list of Kafka brokers to which the orderer connects
    # NOTE: Use IP:port notation
    Brokers:
        - 127.0.0.1:9092

# EtcdRaft defines configuration which must be set when the "etcdraft"
# orderertype is chosen.
EtcdRaft:
    # The set of Raft replicas for this network. For the etcd/raft-based
    # implementation, we expect every replica to also be an OSN. Therefore,
    # a subset of the host:port items enumerated in this list should be
    # replicated under the Orderer.Addresses key above.
    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


# Organizations is the list of orgs which are defined as participants on
# the orderer side of the network
Organizations:

# Policies defines the set of policies at this level of the config tree
# For Orderer policies, their canonical path is
#   /Channel/Orderer/<PolicyName>
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"

  Channel: &ChannelDefaults
   # Policies defines the set of policies at this level of the config tree
   # For Channel policies, their canonical path is
   #   /Channel/<PolicyName>
  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"

Capabilities:
    <<: *ChannelCapabilities

Profiles:

ThreeOrgsOrdererGenesis:
    <<: *ChannelDefaults
    Application:
        <<: *ApplicationDefaults
    Orderer:
        <<: *OrdererDefaults
        Organizations:
            - *OrdererOrg
        Capabilities:
            <<: *OrdererCapabilities
    Consortiums:
        SampleConsortium:
            Organizations:
                - *Org1
                - *Org2
                - *Org3
ChannelAll:
    Consortium: SampleConsortium
    <<: *ChannelDefaults
    Application:
        <<: *ApplicationDefaults
        Organizations:
            - *Org1
            - *Org2
            - *Org3
        Capabilities:
            <<: *ApplicationCapabilities
Channel12:
    Consortium: SampleConsortium
    <<: *ChannelDefaults
    Application:
        <<: *ApplicationDefaults
        Organizations:
            - *Org1
            - *Org2
        Capabilities:
            <<: *ApplicationCapabilities
- &Org1

    Name: Org1MSP

    # ID to load the MSP definition as
    ID: Org1MSP

    MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
    Policies:
        Readers:
            Type: Signature
            Rule: "OR('Org1MSP.member')"
        Writers:
            Type: Signature
            Rule: "OR('Org1MSP.member')"
        Admins:
            Type: Signature
            Rule: "OR('Org1MSP.admin')"

    # leave this flag set to true.
    AnchorPeers:
        - Host: peer1.org1.example.com
          Port: 7051

- &Org2
    # DefaultOrg defines the organization which is used in the sampleconfig
    # of the fabric.git development environment
    Name: Org2MSP

    # ID to load the MSP definition as
    ID: Org2MSP

    MSPDir: crypto-config/peerOrganizations/org2.example.com/msp

    Policies:
        Readers:
            Type: Signature
            Rule: "OR('Org2MSP.member')"
        Writers:
            Type: Signature
            Rule: "OR('Org2MSP.member')"
        Admins:
            Type: Signature
            Rule: "OR('Org2MSP.admin')"

    AnchorPeers:
        - Host: peer1.org2.example.com
          Port: 7051

- &Org3
    Name: Org3MSP

    # ID to load the MSP definition as
    ID: Org3MSP

    MSPDir: crypto-config/peerOrganizations/org3.example.com/msp
    Policies:
        Readers:
            Type: Signature
            Rule: "OR('Org3MSP.member')"
        Writers:
            Type: Signature
            Rule: "OR('Org3MSP.member')"
        Admins:
            Type: Signature
            Rule: "OR('Org3MSP.admin')"

    AnchorPeers:
        # AnchorPeers defines the location of peers which can be used
        # for cross org gossip communication.  Note, this value is only
        # encoded in the genesis block in the Application section context
        - Host: peer1.org3.example.com
          Port: 7051