Tools, FAQ, Tutorials:
View "console.log()" Output in Playground
How to view "console.log()" Output in Hyperledger Composer Playground?
✍: FYIcenter.com
If you use "console.log()" to print out debug information
in your transaction process functions,
you can follow this tutorial to see the "console.log()" in
Hyperledger Composer Playground.
1. Add the following CTO modeling file to your business network:
/* models/hello.cto
* Copyright (c) FYIcenter.com
*/
namespace com.fyicenter.hyperledger.hello
transaction Hello {
o String name default="World"
}
2. Add the following JavaScript scripting file to your business network:
/* lib/hello.js
* Copyright (c) FYIcenter.com
*/
/* @transaction
* @param {com.fyicenter.hyperledger.hello.Hello} req
*/
function helloProcessor(req) {
console.log("Hello "+req.name+"!");
}
3. Deploy the modified business network to the Composer Playground.
4. Click F12 to open the browser developer panel.
5. Click "Console" tab in the developer panel.
6. Click "Test" tab and "Submit Transaction" button in the browser panel.
7. Select "Hello" Transaction Type and enter the following transaction request input message:
{
"$class": "com.fyicenter.hyperledger.hello.Hello",
"name": "Tom"
}
8. View the "Console" tab in the developer panel. You the "consol.log()" output: "Hello Tom!".
Â
⇒ Install Hyplerledger Composer Environment
⇠"transaction" Process Function Defined in JS
2021-06-05, ∼1361🔥, 0💬
Popular Posts:
How to create a navigation file like navigation.xhtml for an EPUB 3.0 book? At least one navigation ...
Where to find tutorials on JSON (JavaScript Object Notation) text string format? I want to know how ...
How to how to use matched string and groups in replacements with re.sub()? When calling the re.sub()...
How to use the built-in "context" object in Policy expressions? The built-in "context" object can be...
How to make application release build with Visual Studio 2017? If you want to make a final release b...