4

I try do deploy my own network with hyperledger fabric. I have : - 1 orderer - 1 CA - 2 peers (with there DB)

Everything works well except when I post a Transaction. I've got this error in my server NodeJS :

error: [Channel.js]: compareProposalResponseResults - read/writes result sets do not match index=1

The thing is that the TX has been created.

Any idea ?

You can ask me if you need more precisions to answer me ;)

Cocorico
  • 1,998
  • 1
  • 22
  • 38
  • 1
    what is your endorsement policy? are invoking against multiple peers? does invocation of chaincode with same input parameters given equal state ends up with same results? – Artem Barger Mar 23 '18 at 21:39
  • @ArtemBarger The answer is your last suggestion. I explain in my answer below. thx. – Cocorico Mar 26 '18 at 09:43

1 Answers1

7

I answer my own question.

Problem : In your chaincode (logic.js in your BNA), you absolutly need to AVOID Math.random() and new Date() and maybe other stuff like that. Why ? Because if you run this transaction two time with the exact same parameter, it can (will ?) generate different result and it's forbidden in chaincode.

Solution : If you need to generation an ID with random function, new Date, etc, do it in your server, not in your chaincode, otherwise, you will have the same error like me

Cocorico
  • 1,998
  • 1
  • 22
  • 38
  • 1
    true, if you have any date/time component into chaincode then you will face this error. I had same issue was using "time.now()" and was facing same error. Resolved with above mentioned approach. Thanks @Cocorico – sw_engineer Mar 26 '18 at 15:11