Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running Blockchain Applications in Hyperledger Explorer

#1
Running Blockchain Applications in Hyperledger Explorer

<div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2019/07/running-blockchain-applications-in-hyperledger-explorer.jpg" width="1545" height="813" title="" alt="" /></div><div><p>Hyperledger Explorer is a powerful utility that allows users to create user-friendly web-based applications. It is a blockchain dashboard and provides the ability to view, invoke, deploy, and query raw blockchain data and network information, including block details, chain codes, and transactions stored in the ledger.</p>
<p>For those who are not familiar with Hyperledger project <a href="https://weg2g.com/application/touchstonewords/article-intro-to-hyperledger-family-and-hyperledger-blockchain-ecosystem.php">Intro to Hyperledger Family and Hyperledger Blockchain Ecosystem</a> and <a href="https://weg2g.com/application/touchstonewords/article-overview-of-hyperledger-design-philosophy-and-framework-architecture.php">Hyperledger Design Philosophy and Framework Architecture</a> articles are strongly recommended.</p>
<p>Hyperledger Explorer is a highly maintainable and open source browser that can be configured and built natively on macOS and Ubuntu. At the time of writing, Hyperledger Explorer has not yet gone live. The latest release, v0.3.8, supports Fabric v1.3.</p>
<p>It is common to encounter errors here and there, especially around issues related to versions and/or setting up environments. To save time while debugging, I have included notes, along with recommended fixes, for some of errors you might run into while walking through this recipe.</p>
<p>In our previous tutorials, we learned how to i- <a href="https://myhsts.org/tutorial-learn-how-to-build-blockchain-hyperledger-explorer-and-development-environment.php">Work with Hyperledger Explorer and its Development Environment</a> ii- <a href="https://myhsts.org/tutorial-learn-how-to-install-blockchain-hyperledger-explorer-and-configure-it-with-fabric.php">Install Hyperledger Explorer and its PostgreSQL Database</a>, iii- <a href="https://developer.ibm.com/recipes/tutorials/configure-hyperledger-explorer-with-fabric-to-build-blockchain-applications/">Configure Explorer to connect to a blockchain network like Fabric</a> and iv- <a href="https://developer.ibm.com/recipes/tutorials/building-hyperledger-explorer-for-developing-blockchain-applications/">Build a Hyperledger Explorer application</a>. This recipe as a next step will show you how to run the Hyperledger Explorer application.</p>
<p><strong>Hyperledger Explorer Configuration </strong></p>
<p>Before running Hyperledger Explorer, we should examine the configuration of Explorer, which is defined in the <code>explorerconfig.json</code> file.</p>
<p>Update the following information according to the individual needs of the project:</p>
<ul>
<li>Where the synchronization will be running, which is either explorer (local) or from a different location standalone (host)</li>
<li>The type of blockchain network (Fabric)</li>
<li>How often the blockchain data will synchronize with explorer</li>
</ul>
<p><strong>Run Hyperledger Explorer Application </strong></p>
<p>Execute the following steps to run your Hyperledger application:</p>
<p>1. Use the vi editor or your editor of choice to make the modifications as needed:</p>
<pre>
<code> cd blockchain-explorer/app vi explorerconfig.json # Here we will run local with Explorer, update the "sync" property as needed to # as below: "sync": { "type": "local", "platform": "fabric", "blocksSyncTime": "3" } }
</code></pre>
<p>2. Now, start Explorer from another Terminal. When you are done using Explorer, you should stop Explorer and the node server:</p>
<pre>
<code> cd blockchain-explorer/ sudo ./start.sh # To stop Explorer, use this command: sudo ./stop.sh
</code></pre>
<p>3. You can check for error statuses in the log file: [logs/console/console-yyyy-mm-dd.log]. If everything goes well, you will see the following:</p>
<pre>
<code>postgres://hppoc:[email protected]:5432/fabricexplorer (node:14817) DeprecationWarning: grpc.load: Use the @grpc/proto- loader module with grpc.loadPackageDefinition instead Please open web browser to access: http://localhost:8080/ pid is 14817 postgres://hppoc:[email protected]:5432/fabricexplorer ...
</code></pre>
<p>4. The console log might show an Explorer error, such as the following:</p>
<pre>
<code>postgres://hppoc:[email protected]:5432/fabricexplorer &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; Explorer Error &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; { Error: The gRPC binary module was not installed. This may be fixed by running "npm rebuild" Original error: Cannot find module '/home/ubuntu/blockchain-explorer/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node' at Object.&lt;anonymous&gt; (/home/ubuntu/blockchain-explorer/node_modules/grpc/src/grpc_extension.js:43:17) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) at Module.require (module.js:597:17) at require (internal/module.js:11:18) at Object.&lt;anonymous&gt; (/home/ubuntu/blockchain-explorer/node_modules/grpc/src /client_interceptors.js:145:12) at Module._compile (module.js:653:30) code: 'MODULE_NOT_FOUND' } Received kill signal, shutting down gracefullyClosed out connections
</code></pre>
<p>5. This may be fixed by running npm rebuild and then starting Explorer again:</p>
<pre>
<code> cd ~/blockchain-explorer/ npm rebuild &gt; [email protected] install /home/ubuntu/blockchain-explorer/node_modules/grpc &gt; node-pre-gyp install --fallback-to-build --library=static_library ...
</code></pre>
<p><strong>Note: </strong>There is an application log,<code> [logs/app/app.log]</code>, that provides more information than the console log if there are any errors when running the Explorer application.</p>
<p>6. On the other hand, Explorer <code>start.sh</code> runs in the background. To observe the progression, you could use the tail command for the <code>app.log</code> file:</p>
<pre>
<code> tail -f logs/app/app.log</code></pre>
<p>7. We can now launch Explorer from a browser: <a href="http://localhost:8080">http://localhost:8080</a>.</p>
<p>8. If you are running on AWS EC2, you will need to carry out a further two steps. Replace the localhost with your instance’s public IP address and add or modify a security group associate with the EC2 instance to allow inbound traffic from TCP port 8080. If everything is good, you should see the explorer <strong>DASHBOARD </strong>default page. From here, you can navigate to the application to check and monitor various blockchain data:</p>
<p><img alt src="https://www.sickgaming.net/blog/wp-content/uploads/2019/07/running-blockchain-applications-in-hyperledger-explorer.jpg"></p>
<p>You have now successfully built the Hyperledger Explorer application, integrated it with the Hyperledger Fabric framework, and utilized Explorer to visualize the blockchain network data on the browser.</p>
<p><strong>About Authors</strong></p>
<p>This article is written by Matt Zand (Founder of <a href="https://myhsts.org/">High School Technology Services</a>) in collaboration with Brian Wu who is a senior blockchain instructor at <a href="https://coding-bootcamps.com/">Coding Bootcamps</a>.</p>
</div>
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016