如何在离线过程中获得fabcar对象响应?

时间:2019-06-18 09:46:10

标签: hyperledger-fabric

我想知道“如何在[离线]流程中获得fabcar对象响应”

我试图执行以下教程。

https://fabric-sdk-node.github.io/release-1.4/tutorial-sign-transaction-offline.html

[fabcar] https://hyperledger-fabric.readthedocs.io/en/release-1.4/write_first_app.html

我更改了以下源代码并为fabcar开发环境,因此我成功执行了fabcar的链代码。

https://github.com/hyperledger/fabric-sdk-node/blob/release-1.4/test/integration/signTransactionOffline.js#L178-L183

但是我只能通过sendSignedTransaction得到以下响应。

https://github.com/hyperledger/fabric-sdk-node/blob/release-1.4/test/integration/signTransactionOffline.js#L214

{ status: 'SUCCESS', info: '' }

我按照

更改了此测试代码
const transactionProposalReq = {
  fcn: 'move',
  args: ['a', 'b', '100'],
  chaincodeId: 'end2endnodesdk',
  channelId: 'mychannel',
};
 :
 :
const response = await channel.sendSignedTransaction({
  signedProposal: signedCommitProposal,
  request: commitReq,
});
t.equal(response.status, 'SUCCESS', 'commit should response success');
 :

const transactionProposalReq = {
  fcn: 'queryCar',
  args: ['CAR12'],
  chaincodeId: 'fabcar',
  channelId: 'mychannel',
};
 :
const response = await channel.sendSignedTransaction({
  signedProposal: signedCommitProposal,
  request: commitReq,
});
console.log('response is ', response);

“ querycar”在后面。 https://github.com/hyperledger/fabric-samples/blob/release/chaincode/fabcar/fabcar.go#L85-L93

我希望得到以下回应。

{
    color: 'blue',
    make: 'Toyota',
    model: 'Prius',
    owner: 'Tomoko',
},

但是我只能通过sendSignedTransaction得到以下响应。

{ status: 'SUCCESS', info: '' }

如何在离线过程中获得fabcar对象响应? 我可以使用某些通过sendSignedTransaction插入的方法吗?

1 个答案:

答案 0 :(得分:0)

我得到了确切的答复...

我应该使用以下回复。

const proposalResponses = await channel.sendSignedProposal(sendSignedProposalReq);

https://github.com/hyperledger/fabric-sdk-node/blob/release-1.4/test/integration/signTransactionOffline.js#L193