Tools, FAQ, Tutorials:
"transaction" Process Function Defined in JS
How to define a "transaction" process function in the JS scripting file?
✍: FYIcenter.com
If you want your Hyplerledger Composer business network
to process a business transaction, you need to the "function"
JavaScript statement to define a "transaction" process function
in a JS scripting file.
When Hyplerledger Composer runtime receives a business transaction, it will automatically parse the transaction request input message into an JavaScript data object based on the given "transaction" data type.
Then Hyplerledger Composer runtime invokes the "transaction" process function provided in the JavaScript file to process the transaction data object.
Here is an example of a JS file , lib/hello.js: that defines transaction process function called "Hello", which will process the transaction data object, named as "req", passed from the Hyplerledger Composer runtime:
/* Copyright (c) FYIcenter.com
*/
/* @transaction
* @param {com.fyicenter.hyperledger.hello.Hello} req
*/
function helloHandler(req) {
console.log("Hello "+req.name+"!");
}
Note that:
Â
⇒ View "console.log()" Output in Playground
⇠"transaction" Data Type Declared in CTO
2021-06-05, ∼1558🔥, 0💬
Popular Posts:
How to Install Docker Desktop 2.5.0 on Windows 10? You can follow this tutorial to Install Docker De...
How to use the "Ctrl-p Ctrl-q" sequence to detach console from the TTY terminal of container's runni...
Why I am getting "The Windows SDK version 8.1 was not found" error, when building my C++ application...
What is the Azure AD v1.0 OpenID Metadata Document? Azure AD v1.0 OpenID Metadata Document is an onl...
How to use the "return-response" Policy statement to build the response from scratch for an Azure AP...