问题描述
我是Hyperledger面料的新手.我已经下载了Fabric v1.2.0,并且尝试从fabric-sample文件夹运行fabcar示例.我对chaincode的查询进行得很好,但是当我尝试调用chaincode时,我从cmd中收到以下错误.
I am new to hyperledger fabric. I have downloaded the fabric v1.2.0 and I tried to run fabcar example from the fabric-sample folder. My querying on the chaincode went well, but when I tried to invoke the chaincode I got the below error from the cmd.
这是我对锁码的要求
var request = {
//targets: let default to the peer assigned to the client
chaincodeId: 'fabcar',
fcn: 'changeCarOwner',
args: ['CAR4', 'Dave'],
chainId: 'mychannel',
txId: tx_id
};
错误:
当我尝试在 index.t.ds 中找到newEventHub时,找不到该函数.有人可以帮我吗.谢谢.
When I tried to find newEventHub in index.t.ds, I could not find the function. Can anyone help me with this.Thanks in advance.
推荐答案
我认为他们已将EventHub类替换为 ChannelEventHub .
I think they've replaced the EventHub class with ChannelEventHub.
您可以使用以下命令更新invoke.js文件:
You can update the invoke.js file with following:
第105行:
let event_hub = channel.newChannelEventHub('localhost:7051');
// event_hub.setPeerAddr('grpc://localhost:7053');
第130行:
console.log('The transaction has been committed on peer ' + event_hub.getPeerAddr());
那应该解决它.
这篇关于找不到newEventHub函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!