简体   繁体   English

将背书或链码查询角色动态分配给 Fabric 节点 SDK 中的通道对等方

[英]Dynamically assign endorsing or chaincode query role to channel peers in the Fabric Node SDK

I am using the following Fabric Versions:我正在使用以下 Fabric 版本:

  1. Fabric binaries: 1.4.4. Fabric 二进制文件:1.4.4。
  2. Fabric Node SDK version: 1.4.9 (fabric-network, fabric-client, fabric-ca-client). Fabric 节点 SDK 版本:1.4.9(fabric-network、fabric-client、fabric-ca-client)。
  3. Node.js version: v8.10.0 Node.js版本:v8.10.0

I wish to perform query operation on the channel using Fabric Node SDK, preferably using the "fabric-network" components.我希望使用 Fabric Node SDK 在通道上执行query操作,最好使用“fabric-network”组件。 I have only 1 peer as the endorsing peer (one that has chaincode installed on it) out of 3 peers in total on the channel for that peer organization.在该对等组织的通道上总共有 3 个对等点中,我只有 1 个对等点作为背书对等点(一个安装了链代码的对等点)。 NOTE: I do not have the roles assigned to these peers in the "connection-profile" explicitly and I am using "discovery" to be enabled on the channel.注意:我没有在“连接配置文件”中明确分配给这些对等方的角色,并且我正在使用“发现”在通道上启用。

I assumed that the SDK function setEndorsingPeers from the transaction.js module will allow me to dynamically assign role to the peers based upon user input.我假设transaction.js模块中的 SDK function setEndorsingPeers将允许我根据用户输入动态分配角色给对等方。 But when I deep-dived into the Fabric Node SDK code, I saw that, the evaluate function in the transaction.js calls the default query handler, which sends the proposal randomly to one of the peers using MSPID_SCOPE_SINGLE phenomenon.但是当我深入研究 Fabric 节点 SDK 代码时,我看到, transaction.js中的evaluate function 调用了默认查询处理程序,该处理程序使用 MSPID_SCOPE_SINGLE 现象将提案随机发送到其中一个节点。

But because the discovery is enabled, the request may go to dynamically a committing peer, and returns failure.但是由于启用了发现,请求可能 go 动态地提交给对等体,并返回失败。 I know one possible solution is to use my custom query handler.我知道一种可能的解决方案是使用我的自定义查询处理程序。 But I wish to identify, if dynamically I can assign endorsingPeer or chaincodeQuery role to channel peers in the Fabric Node SDK (v1.4.9)?但我想确定,如果我可以动态地将endorsingPeerchaincodeQuery角色分配给 Fabric 节点 SDK (v1.4.9) 中的通道对等点?

Have you ever used 'javascript-low-level'?你用过'javascript-low-level'吗? you can specify endorsing peer with channel.addPeer() function.您可以使用channel.addPeer() function 指定背书节点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 执行查询交易时仅选择背书节点 - 节点 SDK - Choose only endorsing peers when performing query transaction - Node SDK 如何使用Node SDK Hyperledger Fabric在通道上添加锚点对等点 - How to add anchor peers on channel using node sdk hyperledger fabric CentOS上的Hyperledger Fabric 1.0是否支持链码错误? - Hyperledger Fabric 1.0 on CentOS Error endorsing chaincode? 使用节点SDK在Hyperledger Fabric上升级Chaincode - Upgrade Chaincode on hyperledger fabric using node sdk 如何使用node.js SDK和TLS查询Hyperledger Fabric Go Chaincode? - How to query Hyperledger Fabric Go Chaincode by using the node.js SDK and TLS? 是否可以使用节点 SDK 来 package Hyperledger Fabric 链码? - Is it possible to package the Hyperledger Fabric chaincode using the node SDK? 调用Chaincode时出错,Node SDK,方法:channel.sendTransactionProposal() - Error Invoking Chaincode, Node SDK, Method: channel.sendTransactionProposal() 同一组织的Hyperledger Fabric 2对等节点导致Chaincode和Couchdb问题 - Hyperledger Fabric 2 peers of same organisation causing issue with chaincode and couchdb 从Hyperledger Fabric Node SDK中的函数InvokeChaincode()获取chaincode调用者ID - Get chaincode caller ID from the function InvokeChaincode() in Hyperledger Fabric Node SDK 超级账本结构通道创建节点 SDK - 错误 - Hyper ledger fabric-channel creation Node SDK -Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM