Skip to content

Chaincode Analyzer generates call graphs from javascript chaincodes and extracts relevant contextual information from each function. The extracted information and the call graph are then used for modelling the system as a network of stochastic timed automata in UPPAAL-SMC using drag and drop feature.

Notifications You must be signed in to change notification settings

mdtauseefalam/JavaScriptChaincodeAnalyzer

Repository files navigation

JavaScriptChaincodeAnalyzer

Chaincode Analyzer generates call graphs from javascript chaincodes and extracts relevant contextual information from each function. The extracted information and the call graph are then used for modelling the system as a network of stochastic timed automata in UPPAAL-SMC using drag and drop feature.

It is also useful for:

  • Untangling spaghetti code.
  • Identifying orphaned functions.
  • Getting new developers up to speed.

Prerequisite

One should have following dependencies installed before running the file.

  • Node.js (Latest version >= 18.0.0)
  • NPM (version >= 9.0.0)
  • Graphviz (node-graphviz)
  • Google Closure Compiler (To visualize the generated AST of code)

Usage

The call graph of a chaincode written in JavaScript is generated by running the callGraphGenerator.js file. Initially, clone the JavaScriptChaincodeAnalyzer github repository to your machine and run the command as shown below to generate call graph:

node .\callGraphGenerator.js chaincode_file_path.js Output_file_Name

Here, replace chaincode_file_path.js with the filename of chaincode, whose call graph is to be generated. Replace Output_file_Name with the name of output file you want to save it with.

In order to generate the call graph, our approach is not based on the AST traversal because of the limited information available by the generated AST (using Closure Compiler). However, we have worked for the visualization of generated AST of the source code and included it in our analyzer.

The details of folders are:

  • Chaincodes folder contains the JavaScript chaincodes file.
  • OutputGraph folder contains the generated call graph of chaincode in svg format.
  • ASTOutputGraph folder contains the generated AST of source chaincode in dot/pdf format.

About

Chaincode Analyzer generates call graphs from javascript chaincodes and extracts relevant contextual information from each function. The extracted information and the call graph are then used for modelling the system as a network of stochastic timed automata in UPPAAL-SMC using drag and drop feature.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published