简体   繁体   English

在Hyper Ledger Fabric Network中查询分类帐

[英]Querying the ledger in Hyper Ledger Fabric Network

I have refereed below link for Querying into the ledger in Hyper-ledger Fabric Network : 我已经参考了以下链接来查询Hyper-ledger Fabric Network中的分类帐:

http://hyperledger-fabric.readthedocs.io/en/release/write_first_app.html http://hyperledger-fabric.readthedocs.io/en/release/write_first_app.html

In above link, they have given git-hub link in which I have done all the steps like, - start the network - run the node scripts for querying to the ledger like invoke.js, query.js 在上面的链接中,他们给了git-hub链接,其中我完成了所有步骤,例如-启动网络-运行节点脚本以查询账本,例如invoke.js,query.js。

But in that scripts they have provided one example of Car, in which they called different functions for querying all car, adding car and so on. 但是在这些脚本中,他们提供了一个Car的示例,在其中调用了不同的函数来查询所有car,添加car等。

I have also run the marbles demo mentioned in below link : https://github.com/IBM-Blockchain/marbles 我还运行了以下链接中提到的大理石演示: https : //github.com/IBM-Blockchain/marbles

In this link, they have run the same network named "fabric-samples" which I have mentioned first link of this question. 在此链接中,他们运行了一个名为“ fabric-samples”的网络,我已经提到了该问题的第一个链接。

So, now I want to run queries for marbles and for that I have changed the query.js and in that I have give chaincode id as "marbles" and give function name "readMarble" and pass the marble name in argument. 因此,现在我要运行大理石查询,为此我更改了query.js,并给了链码ID作为“大理石”,并给了函数名称“ readMarble”,并在参数中传递了大理石名称。

And then I have node query.js so it gives an errors as below : 然后我有节点query.js,所以它给出如下错误:

Store path:/home/riyasoni/riya/blockchain/workspace/fabric-samples/fabcar/hfc-key-store Successfully loaded user1 from persistence error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 2 UNKNOWN: chaincode error (status: 500, message: Received unknown invoke function name - 'readMarble') at new createStatusError (/home/riyasoni/riya/blockchain/workspace/fabric-samples/fabcar/node_modules/grpc/src/client.js:65:15) at /home/riyasoni/riya/blockchain/workspace/fabric-samples/fabcar/node_modules/grpc/src/client.js:568:15 Query has completed, checking results error from query = { Error: 2 UNKNOWN: chaincode error (status: 500, message: Received unknown invoke function name - 'readMarble') at new createStatusError (/home/riyasoni/riya/blockchain/workspace/fabric-samples/fabcar/node_modules/grpc/src/client.js:65:15) at /home/riyasoni/riya/blockchain/workspace/fabric-samples/fabcar/node_modules/grpc/src/client.js:568:15 code: 2, metadata: Metadata { _internal_repr: {} }, det 商店路径:/ home / riyasoni / riya / blockchain / workspace / fabric-samples / fabcar / hfc-key-store从持久性错误成功加载了user1:[client-utils.js]:sendPeersProposal-承诺被拒绝:错误:2 UNKNOWN :链码错误(状态:500,消息:在新的createStatusError(/home/riyasoni/riya/blockchain/workspace/fabric-samples/fabcar/node_modules/grpc/src/client.js)上收到未知的调用函数名称-'readMarble') :65:15)在/home/riyasoni/riya/blockchain/workspace/fabric-samples/fabcar/node_modules/grpc/src/client.js:568:15查询已完成,检查查询中的结果错误= {错误:2未知:链码错误(状态:500,消息:在新的createStatusError(/ home / riyasoni / riya / blockchain / workspace / fabric-samples / fabcar / node_modules / grpc / src / client)处收到未知的调用函数名称-'readMarble'。 js:65:15)位于/home/riyasoni/riya/blockchain/workspace/fabric-samples/fabcar/node_modules/grpc/src/client.js:568:15代码:2,元数据:元数据{_internal_repr:{}​​} ,det ails: 'chaincode error (status: 500, message: Received unknown invoke function name - \\'readMarble\\')' } ails:'chaincode错误(状态:500,消息:收到未知的调用函数名称-\\'readMarble \\')'}

So, can anyone suggest me that how can querying to ledger for marbles demo related functions and transaction? 因此,有人可以建议我如何查询分类账的大理石演示相关功能和交易吗?

If you look in marbles.go, lines 144 - 177, you will see a list of the available function names. 如果您在marbles.go的第144-177行中查看,将会看到可用函数名称的列表。 readMarble is not one of them. readMarble不是其中之一。 You will also see the line 176 returning your error message. 您还将看到第176行返回您的错误消息。 return shim.Error("Received unknown invoke function name - '" + function + "'") return shim.Error(“接收到的未知调用函数名称-'” +函数+“'”)

readMarble is not a valid function. readMarble不是有效的函数。 Check for correct spelling. 检查拼写是否正确。 Also, make sure that readMarble is callable from Invoke function. 另外,请确保可以从Invoke函数调用readMarble。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM