Tools, FAQ, Tutorials:
Differences of evaluateTransaction() and submitTransaction()
What are the differences of Differences of evaluateTransaction() and submitTransaction() of the fabric-network.Contract class?
✍: FYIcenter.com
Here are the Differences of evaluateTransaction() and submitTransaction()
of the fabric-network.Contract class:
evaluateTransaction() method - Calls the given transaction function on the chaincode and returns the response without commit any changes on assets to the ledger.
In other words, evaluateTransaction() performs a transaction and rollbacks any changes at the end.
submitTransaction() method - Calls the given transaction function on the chaincode and returns the response. Changes on assets will be sent to the orderer to commit to the ledger.
In other words, submitTransaction() forforms a transaction and commits changes at the end.
For example, if you run evaluate-transaction.js to call queryCar() on "fabcar" chaincode, you get the response.
$ node evaluate-transaction alice mychannel fabcar queryCar CAR12 Tx function and arguments: [ 'queryCar', 'CAR12' ] Tx result: {"colour":"Black","make":"Honda","model":"Accord","owner":"Tom"}
If you run submit-transaction.js to call queryCar() on "fabcar" chaincode, you get the same response.
$ node submit-transaction alice mychannel fabcar queryCar CAR12 Tx function and arguments: [ 'queryCar', 'CAR12' ] Tx result: {"colour":"Black","make":"Honda","model":"Accord","owner":"Tom"}
But if you run evaluate-transaction.js to call createCar() on "fabcar" chaincode, no car is created.
But if you run submit-transaction.js to call createCar() on "fabcar" chaincode, the new car is created.
Â
⇒ Fabric CA (Certificate Authority)
⇠submit-transaction.js - Submit Chaincode Transaction
⇑ Interfaces to Communicate with Ledger Peer
⇑⇑ Hyperledger Tutorials
2019-04-22, 1714👍, 0💬
Popular Posts:
How to Instantiate Chaincode on BYFN Channel? You can follow this tutorial to Instantiate Chaincode ...
How to use the XML to JSON Conversion Tool at freeformatter.com? If you want to try the XML to JSON ...
Where to find tutorials on Using Azure API Management Developer Portal? Here is a list of tutorials ...
How to use the "send-one-way-request" Policy statement to call an extra web service for an Azure API...
How to read Atom validation errors at w3.org? If your Atom feed has errors, the Atom validator at w3...