Reputation: 947
I am using the hyper-ledger fabric network with 2 organisation and chain-code also installed on the network its working. I came across submitTransaction and EvaluateTransaction in fabric node js. what is difference between them, what i observer is.
When i initiate contract.submittransaction the submitTransaction from the fabric-node even though if i call the query method from the chain-code its create the new block and chain-code query method don't have put-state
If i use contract.evaluateTransaction the evaluate transaction from the fabric-node to query method its does not create any transaction.
Upvotes: 4
Views: 2718
Reputation: 5868
The difference between submitTransaction
vs evaluateTransaction
is that submitTransaction
takes the proposal results returned from invoking the smart contract and submits them to the orderer and waits for the transaction to be committed. This means that the proposal results will be ordered and delivered to the peers for validation and committed to the blockchain.
It is irrespective of what the smart contract transaction does, however the general pattern is that submitTransaction
is used for transactions that change the world state and evaluateTransaction
is used for transactions that only query the world state (or query key history).
However it's perfectly reasonable for example to want to record querying of the world state onto the ledger and so you would use submitTransaction
on a smart contract function that doesn't modify the world state in order to do this.
Upvotes: 6
Reputation: 132
contract.submittransaction execute the transaction against the chain code that's why it creates the new block. while contract.evaluateTransaction only query the state database that's why don't create the new block.
Upvotes: -1