<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vandan Gogna on Medium]]></title>
        <description><![CDATA[Stories by Vandan Gogna on Medium]]></description>
        <link>https://medium.com/@vandangogna?source=rss-a9c3ad74a05c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*f-ovmiR-y_WDaeC8.jpg</url>
            <title>Stories by Vandan Gogna on Medium</title>
            <link>https://medium.com/@vandangogna?source=rss-a9c3ad74a05c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 14:01:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vandangogna/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Practical Example using Test Driven Development]]></title>
            <link>https://vandangogna.medium.com/a-practical-example-using-test-driven-development-88b4536ac574?source=rss-a9c3ad74a05c------2</link>
            <guid isPermaLink="false">https://medium.com/p/88b4536ac574</guid>
            <dc:creator><![CDATA[Vandan Gogna]]></dc:creator>
            <pubDate>Wed, 14 Jul 2021 16:57:32 GMT</pubDate>
            <atom:updated>2021-07-19T13:59:32.393Z</atom:updated>
            <content:encoded><![CDATA[<p>While there are plenty of examples explaining Test Driven Development, I wanted to share a simple example of TDD that has helped me understand the methodology in detail. TDD is a process that focuses on creating a series of tests and then developing the code that passes those unit tests. It relies on repetition of short development cycles that focus on specific test cases based on software requirements instead of just code implementation. This approach results in production ready code that is extensible, maintainable and of high quality.</p><p>TDD offers several benefits, including faster development cycles that result in more innovative code. As the code is built over time, you end up with a suite of automated test cases that can be used at any point in time to make sure no new bugs have been introduced, which gives more confidence about the code. You’re also able to achieve easier automation through CI\CD, since having unit tests in place allow you to run them quickly and deploy the changes.</p><p>TDD also allows the code to be less documentation dependent. In the absence of specific team member(s) or sufficient documentation, other team members can easily pick up and work on the code by understanding the test cases and requirements. It also aids knowledge sharing, thereby making the team more effective overall.</p><p>TDD allows you to make your code more flexible and extensible. The code can be refactored or <em>moved with minimal risk of introducing bugs</em>. Refactored code will force the developer(s) to think about “<em>how</em>” the code will be used and make it more reusable. This results in better design decisions for the development process, producing more maintainable code. It also allows one to write a smaller piece of code focusing on single responsibility rather than monolithic procedures with multiple responsibilities. This makes the code simpler to understand and easier to extend or refactor as needed.</p><h4>Basic Steps for writing unit tests using TDD</h4><p>▸ Write a test</p><p>▸ Fail compile</p><p>▸ Write stub</p><p>▸ Fail test</p><p>▸ Write implementation</p><p>▸ Pass test</p><p>▸ Refactor</p><p>▸ Pass test</p><p>▸ Commit</p><p>Importance of failure:</p><p>Failing test cases can provide very important feedback. Some of the important characteristics of failures in TDD are:</p><p>▸ A failing test is the road to a passing test</p><p>▸ A failing test provides a safety net</p><p>▸ A failing test gives us assurance</p><p>▸ A failing test provides vital information</p><p>Common Pitfalls:</p><p>Test cases should be run and successfully executed before new ones are added. All new test cases should be written with requirements in mind; they should not be written if they’re not needed. Some of the common pitfalls to avoid when writing test cases are:</p><p>▸ Forgetting to run tests frequently</p><p>▸ Writing too many tests together</p><p>▸ Writing large or complex tests</p><p>▸ Writing tests that are missing assertions</p><h3>Red, Green, Refactor</h3><p>This approach helps developers focus their efforts into three specific phases:</p><h4>Red</h4><p>▸ Write test for a behavior to be implemented</p><p>▸ Analyze the requirements without the implementation</p><p>▸ Behavior of the interface as <em>expected</em> by the caller</p><p>▸ Should be clean and consumable</p><h4>Green</h4><p>▸ Write just enough production code to pass the test</p><p>▸ Don’t worry about algorithms or its performance</p><p>▸ Less code is better</p><h4>Refactor</h4><p>▸ Rework the code to make it more efficient and optimized</p><p>A Simple Scenario</p><p>Problem: As a developer I want to implement code so that it prints the numbers from 1 to 100.</p><blockquote>Given: an input of numbers from 1–100<br>When:<br> A number is a multiple of ‘3’ return “Fizz”<br> A number is a of ‘5’ return “Buzz”<br> A number is a of both ‘3’ and ‘5’ return “FizzBuzz”<br> A number is not divisible by ‘3’ or ‘5’ return the number itself<br>Then: print “Fizz”, “Buzz”, “FizzBuzz” or the number accordingly</blockquote><pre>Expected output: 1, 2, Fizz, 4, Buzz, ……, 14, FizzBuzz, 16, …</pre><ol><li>Write the initial test(s), divisible by 3</li></ol><pre>//FizzBuzzTest.java</pre><pre>// this should test if a number is a multiple of 3 or not</pre><pre>Public void test_multipleOf3(3) { ... <br>// should test for &quot;1 2 Fizz&quot;<br>...<br>}</pre><p>2. Write the implementation</p><pre>//FizzBuzz.java<br>Public String FizzBuzz(int num){</pre><pre>  for(int count = 1; count &lt;= num; count++){<br>     if (count % 3 == 0)<br>     ...<br>   }</pre><pre>}</pre><p>3. Update tests with additional requirements, divisible by 5</p><pre>//FizzBuzzTest.java:</pre><pre>// this will test if a number is a multiple of 5 or not</pre><pre>Public void test_multipleOf5(5) {{ ... <br>// should test for &quot;1 2 3 4 Buzz&quot;<br> ...<br>}</pre><p>4. Update implementation</p><pre>//FizzBuzz.java<br>Public String FizzBuzz(int num){</pre><pre>for(int count = 1; count &lt;= num; count++){</pre><pre>     if (count % 5== 0)<br>     ...<br> <br>   }</pre><pre>}</pre><p>5. Update tests with additional requirements, divisible by 3 and 5</p><pre>//FizzBuzzTest.java:</pre><pre>// this will test if a number is a multiple of both 3 <em>and</em> 5 or not</pre><pre>Public void test_multipleOf3And5(5) {<br>// should test for &quot;1 2 .... 14 FizzBuzz..&quot;<br>...</pre><pre>}</pre><p>6. Update implementation</p><pre>//FizzBuzz.java</pre><pre>Public String FizzBuzz(int num){</pre><pre>for(int count = 1; count &lt;= num; count++){</pre><pre>   if (count % 15 == 0)</pre><pre>   ...</pre><pre>   ...</pre><pre>  }</pre><pre>}</pre><p>7. Refactor — Update the implementation, optimize and bring all the code together</p><pre>//FizzBuzz.java<br>Public String FizzBuzz(int num){</pre><pre>for ( int idx = 1; idx &lt;= count; idx ++){</pre><pre>  switch(idx % 15)</pre><pre>   {</pre><pre>    case 0:</pre><pre>     print &quot;FizzBuzz &quot;;</pre><pre>     …</pre><pre>    case 3:</pre><pre>     print &quot;Fizz &quot;;</pre><pre>     …</pre><pre>    case 5:</pre><pre>     print &quot;Buzz &quot;;</pre><pre>     …</pre><pre>    default:</pre><pre>     …</pre><pre>    print number</pre><pre>  }</pre><pre> }</pre><pre>}</pre><p>Finally, run all the tests and make sure they succeed.</p><h4>Closing thoughts</h4><p>It’s easy to get sidetracked and miss out on code optimizations. It’s the developer’s responsibility to take a step back and analyze the code to see if any improvements can be added or not. A few helpful tips to stay on track are:</p><p>▸ Make a change, run the test(s) and get the feedback</p><p>▸ If you get stuck, go back to your last predictable place when you knew exactly what was happening</p><p>▸ Simplify the logic as much as possible</p><p>▸ Use the IDE tools to play with language syntax</p><p>▸ If your pair is stuck, talk to another pair</p><p>TDD offers the ability to deliver excellent production ready software. While it may seem slow initially and developers have to spend more time in writing test cases upfront, it takes a lot less time for debugging and developing new features. You end up with cleaner, less complicated code that much more maintainable in the long run. The resulting software will have higher quality, from having a faster CI\CD process and a broad unit test suite making sure that all the requirements are met.</p><p><em>This article was written by an IBM Garage expert. To learn more about IBM’s innovation and transformation consultancy IBM Garage, visit </em><a href="http://ibm.com/garage"><em>ibm.com/garage</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88b4536ac574" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Exercise with VMware Solutions Shared]]></title>
            <link>https://vandangogna.medium.com/an-exercise-with-vmware-solutions-shared-fa0fd81c8e66?source=rss-a9c3ad74a05c------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa0fd81c8e66</guid>
            <dc:creator><![CDATA[Vandan Gogna]]></dc:creator>
            <pubDate>Tue, 05 Jan 2021 03:06:25 GMT</pubDate>
            <atom:updated>2021-01-05T17:04:26.905Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*DqH6wgtvVwsrApwqKE9iUw.png" /></figure><p>While there are many choices available to select from for a VMware environment, I’m going to discuss how to configure VMware workloads and have them up and running on VMware Solutions Shared. Two possible choices available on IBM Cloud are VMware Solutions Shared and VMWare Solutions Dedicated-vCenter. I’ll be sharing my experience with the former, VMware Solutions Shared since I found it simple to use and easy to get started with. While VMware Solutions Shared doesn’t allow you to control all the aspects of your virtual environment like VMWare Solutions Dedicated, it does give you enough capability to have your VMs up and running both quickly and securely. I’m going to use the example of deploying a 3-tier web application and go over the setup and configuration at a high level.</p><p>Virtual Data Center (<em>vdc</em>) environment setup :</p><ul><li>3 Virtual machines (presentation, application, and the data tier)</li><li>An available network, although each VM can be on a separate network</li><li>An Edge gateway, communicating with the external network</li><li>A vAPP, that will logically group the entire environment for easier management</li></ul><p>By having the above minimal configuration, I was able to deploy a 3-tier application using <em>WordPress</em>. For logging purposes, I deployed an optional fourth VM that was running as the <em>Syslog</em> server. To keep things organized, I created a `vAPP` (for logical grouping of components) in which I added all the other required components for the virtual environment. I started out by creating 3 CentOS VMs where the first VM was the proxy server, followed by the next virtual machine which was the webserver, and finally the third one as the database server. Setting up new VMs was very trivial since there is a list of OS choices available within the <em>vdc</em> to pick and choose from such as <em>RHEL</em>, <em>CentOS,</em> and <em>Microsoft</em> <em>Windows</em>. The templatized VMs were ready to be used quickly and I could also scale the specific VMs if needed. This allowed all 3 tiers to be configured independently so that each can be customized and optimized without affecting the other.</p><p>In order for the VMs to be configured correctly and communicate with each other, I created a new `<em>network`</em>. For simplicity, I placed all the VMs on the same network, even though the VMs should be on different networks ideally. Configuration of different networks will require a more advanced setup and something beyond the scope of the article. This new single network would connect to the `<em>edge gateway</em>` network connection that would allow all the VMs access to external resources. The `<em>edge gateway</em>` is another virtual network object that’s available out of the box, once an instance of a virtual data center is created in VMware Solutions Shared. The `<em>edge network</em>` also allows you to configure settings for firewall rules, routing, DHCP, NAT amongst others.</p><p>After making sure that the network is available, I first configured the database server VM by installing MySQL and making sure it had the correct dependencies and the accounts required to run the instance properly. This was followed by installing and configuring `<em>httpd</em>` and `<em>WordPress</em>` itself on the web server VM and finally installing and configuring `nginx` on the proxy VM. Following the 3-tier architecture, the requests would go to the proxy server and the proxy server will forward the request to the webserver. The web server would process the request and send the response back to the request originator. Finally, I configured the fourth CentOS VM with Syslog enabled. Using the `edge gateway` settings I was able to specify the IP address of my Syslog server which was then able to collect all the logs from the internal network. For more details regarding VMware Solutions Shared, see: <a href="https://cloud.ibm.com/docs/vmwaresolutions?topic=vmwaresolutions-shared_overview">https://cloud.ibm.com/docs/vmwaresolutions?topic=vmwaresolutions-shared_overview</a>.</p><p>The manual steps mentioned above are fine when setting up a small test or a demo environment. However, for bigger and repetitive daily tasks creating VMs, network(s) and other components can be quite laborious, error-prone and a time-consuming process. This is where we can take advantage of Infrastructure as Code (<em>IaC)</em> where all the installation and configurations can be automated. Using IBM Cloud Schematics (available in the IBM Cloud menu) I was able to provision IBM Cloud resources by using a Terraform configuration file which can be stored in a GitHub repository as a template. This new reusable Terraform template should include all the settings and configurations for all the components such as vAPPs, VMs, Networks including all the rules, IP address(es) amongst others. Once the template is ready to be consumed from the GitHub repository, it will be used within the IBM Cloud Schematics workspace that will execute the configuration and create all the virtual environment components. For more details regarding how to use and run the Terraform template within IBM Cloud Schematics, see the following url: <a href="https://cloud.ibm.com/docs/schematics?topic=schematics-getting-started">https://cloud.ibm.com/docs/schematics?topic=schematics-getting-started</a></p><p>In conclusion, VMware Solutions Shared is an excellent option available for a quick and seamless way to migrate or deploy VMware workloads to the cloud on IBM-hosted VMware infrastructure. It allows an organization to have customizable and standardized deployment choices for VMware virtual data center environments. With more and more organizations looking to move to the cloud, having the VMware Solutions Shared option would be a good choice in my opinion.</p><p>Learn more at <a href="http://www.ibm.com/garage">www.ibm.com/garage</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa0fd81c8e66" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[App Modernization with JAVA]]></title>
            <link>https://vandangogna.medium.com/app-modernization-with-java-7691efc31178?source=rss-a9c3ad74a05c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7691efc31178</guid>
            <dc:creator><![CDATA[Vandan Gogna]]></dc:creator>
            <pubDate>Mon, 30 Nov 2020 23:14:22 GMT</pubDate>
            <atom:updated>2020-12-08T01:40:26.905Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*JFGL8hM6a5614X-alwXWKg.png" /></figure><p>JAVA Frameworks as well as the language itself has gone through significant changes that have provided capabilities required to develop an application. JAVA and its Frameworks evolving over time have offered some of the best capabilities to address various technical issues as stated below to make sure that applications are secure and robust</p><p>i. Security</p><p>ii. Performance improvements</p><p>iii. Resilience</p><p>iv. Cloud support</p><p>v. Handling deprecated code</p><p>Addressing the above-mentioned issues are very important, especially in a cloud-focused environment since most of the emphasis is placed on writing applications that can be deployed quickly, securely, and with the least amount of technical debt. While there is a wide variety of frameworks available that can be used with JAVA today, I will be discussing my experience with the Quarkus Framework and Spring Boot. The benefits of using Frameworks as mentioned are not only helpful in creating new applications that follow all the standard practices and principles but also help with upgrading existing legacy applications.</p><p>To achieve the modernization of JAVA applications there are a few possibilities available such as:</p><p>i. Lift and shift the existing application without changing the code too much.</p><p>ii. Upgrading the legacy java code from the previous version(s) to the latest versions including the frameworks they’re using to get the latest features and capabilities.</p><p>· Using / integrating the Spring boot framework is a popular choice when upgrading legacy Java applications that allow it to be more cloud-centric that follow the best practices as well as provide web-friendly behavior such as embedded container support, independent execution of jar files, amongst others. Spring framework has been tried and tested for a significant amount of time and offers advantages such as being fast and a quick easy setup amongst others. However, there are some drawbacks:</p><p>i. The binary generated is large in size</p><p>ii. Lots of annotations</p><p>iii. Significant amount of configuration required</p><p>iv. Reactive</p><p>· Quarkus is a relatively new framework that has gained a lot of popularity amongst developers. It also helps in the migration of legacy applications to be more cloud-native. Quarkus allows the capability to run the code in its native form by using GraalVM, which in turn reduces the startup time for a given microservice with a much lower memory footprint. GraalVM also provides a high-performance runtime that allows for ahead of time (AOT) compilation which in turn converts the bytecode into machine code. This allows the generated binary to run natively on the machine.</p><p>· To provide better backward compatibility for legacy applications and a quick start ability for new ones, Quarkus is made of community projects like Eclipse, RESTEasy, MicroProfile for which there is plenty of support available. To add to its list advantages:</p><p>i. It offers K8 liveness/readiness probes. By adding a `smallrye-health` dependency one can quickly expose health status endpoints.</p><p>ii. CDI bean injection — quickly expose metrics from class with a bean definition annotation.</p><p>iii. Due to various optimizations of the traditional frameworks, called extensions the result is significantly efficient during runtime: <a href="https://quarkus.io/assets/images/quarkus_metrics_graphic_bootmem_wide.png">https://quarkus.io/assets/images/quarkus_metrics_graphic_bootmem_wide.png</a></p><p>Two other features I thought were tremendously helpful for writing code/debug/test quickly are:</p><p>· Live coding — instead of stopping and then restarting the microservice, just save the changes and set the breakpoint at the appropriate line of code and send a new request to resource (via CRUD) and catch in the debugger (VSCODE, Eclipse, IntelliJ). This makes the debugging process a whole lot simpler and quicker.</p><p>· Identifying dependency injection errors — instead of catching the error during runtime and starting the entire process again, Quarkus will catch the error during compilation itself.</p><p>While Spring boot is an excellent framework to work with and has its own numerous advantages, the quick startup time and less memory usage can offer Quarkus a significant edge. Spring boot is closing the gap by offering support for GraalVM and other additional new tools, even though I think Quarkus will hold its own for some time.</p><p>Learn more about IBM Garage at <a href="http://www.ibm.com/garage">www.ibm.com/garage</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7691efc31178" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developing using pair programming]]></title>
            <link>https://vandangogna.medium.com/developing-using-pair-programming-9ca053b1251a?source=rss-a9c3ad74a05c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ca053b1251a</guid>
            <dc:creator><![CDATA[Vandan Gogna]]></dc:creator>
            <pubDate>Wed, 21 Oct 2020 14:35:34 GMT</pubDate>
            <atom:updated>2020-10-21T15:18:09.714Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*Rf2jlWGBojWnk-f_0Zv73g.png" /></figure><p>Often when I start working on an application development project, I start by doing my own research and analysis followed by writing the code. It’s very easy to work within a siloed mindset and not explore any alternative development practices such as pair programming. While most developers are very comfortable working at their own individual pace in a siloed approach, it can potentially come at a cost of quality, ingenuity, and even cost-effectiveness of the delivered product. When I finished my last project for a customer and was working with their developers and technical staff I forced myself to keep in mind that I would not go down the traditional path, instead focus on improving the overall solution by following the pair programming methodology.</p><p>Pair programming can seem a bit intimidating at first but once we understand the practice and get familiar with tools that are used for pair programming it becomes simple and second nature. Pair programming is about working collaboratively with another developer in parallel, sharing the same screen (having individual monitors), and having your own keyboard and mouse to develop the code. Pair programming uses the terms <strong>driver </strong>and<strong> navigator </strong>where the person writing the code is the <strong>driver</strong> and the person observing the code is the <strong>navigator</strong>. Since the team decided to use the Java Quarkus framework to build the application which was new for almost everyone including myself both the driver and navigator could investigate complementing approaches for a given technical challenge.</p><p>By using the Agile development methodology, we created our tasks in such a manner that suited to both myself and the other developer so that we could learn about the new framework and see how it could be used to implement the solution in the best way possible. Another advantage of the pair programming approach that really helped me was instead of learning and implementing the solution for a specific/associated task myself, I could learn what the other developer was working on and they would do the same. We would spot the hurdles much sooner and come up with the best solution possible based on our combined efforts. Pairing also allowed for better, quicker code reviews since the code being implemented is adhered to conventions by two people simultaneously.</p><p>As the project progressed, we faced more complexities and challenges in the codebase as well as the environment. Certain aspects of the code that we thought were understood, didn’t seem to work as expected due to the new Java framework. Pairing allowed us to anticipate and devise innovative solutions while leveraging our previous experience to problems such as building/packaging the code, running all the unit test cases successfully all the way to successful deployment in the cloud. We could clearly see the major advantages where we saw:</p><p>· fewer defects since 2 people were looking at the code to anticipate issues and avoid pitfalls</p><p>· created a more comprehensive and complete unit test cases</p><p>· wrote fewer lines of code</p><p>· shared our past experiences and knowledge</p><p>· improved the overall development solution</p><p>· better awareness of the implementation details in case a team member is not available due to any reason</p><p>Pairing also ensured both the driver and navigator stay focused and on-task. If one starts to deviate the other can very easily bring the focus back to the task at hand allowing for increased productivity in the overall project. Since there is someone always looking over the driver’s code missed defects are caught sooner by the navigator. This in turn helped in decreasing the time required for a project deliverable. Given the successful experience I had, I will recommend using pair programming as much as possible and will definitely incorporate it into my future projects.</p><p><strong>Bring your plan to the IBM Garage.<br></strong>IBM Garage is built for moving faster, working smarter, and innovating in a way that lets you disrupt disruption.</p><p>Learn more at <a href="http://www.ibm.com/garage">www.ibm.com/garage</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ca053b1251a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Achieve CI\CD Using a Toolchain Template for Hyperledger Fabric]]></title>
            <link>https://vandangogna.medium.com/how-achieve-ci-cd-using-a-toolchain-template-for-hyperledger-fabric-bccca736d854?source=rss-a9c3ad74a05c------2</link>
            <guid isPermaLink="false">https://medium.com/p/bccca736d854</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[hyperledger-fabric]]></category>
            <dc:creator><![CDATA[Vandan Gogna]]></dc:creator>
            <pubDate>Tue, 24 Dec 2019 15:38:41 GMT</pubDate>
            <atom:updated>2020-01-02T15:21:53.259Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*WUZwxVbQRlS4KvVY2_9Zcg.jpeg" /></figure><p>As an engineer working on HLF, there is a frequent need to deploy chaincode using continuous deployment on a blockchain network, either running on a cloud platform such as IBP or on a self-hosted environment. At the time of writing this article there was no such publicly available toolchain template available that could be used to deploy smart contracts on HLF regardless of the platform.</p><p>There is also the requirement that the toolchain should support chaincode(s) written in different languages. Currently Hyperledger Fabric v1.4 supports three smart contract SDKs that are available for Go, Node.js, and Java. A smart contract can be implemented in one of the preferred fore mentioned language(s) of the developer and then use the toolchain to deploy their smart contract in the blockchain network of their choice. The template mentioned in this article takes advantage of the IBM cloud toolchain template library and can only be used under a specific organization/user’s IBM cloud account.</p><p>Some of the earlier versions of blockchain toolchain(s) that I used took advantage of platform specific APIs which would easily break between different versions of a platform. The toolchain discussed in this article makes use of the HLF Node.js client SDK that is capable of handling all the network operational tasks including installing, instantiating, and invoking chaincode on an actual blockchain network.</p><p>Follow the Readme file using the link below by selecting the chaincode language of your choice.</p><p>Build the toolchain</p><p><a href="https://github.com/IBM-Blockchain-Starter-Kit/blockchain-toolchain/tree/chaincode">https://github.com/IBM-Blockchain-Starter-Kit/blockchain-toolchain/tree/chaincode</a></p><p><strong>I.</strong></p><p><strong><em>Create the toolchain</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*S7ku7-367tI7LOYGwgdRug.png" /></figure><p><strong>II.</strong></p><p><strong><em>Provide the environment information to build the toolchain</em></strong></p><p>In order to use the toolchain, one must provide the required details specific to the blockchain instance that contains the network information in a file referred to as the ‘connection-profile’. This file includes all the address/port(s) information for different components of the network among other pieces of information. The toolchain also requires the peer admin identity so that chaincode can be installed and instantiated properly on the peer(s) that belong to an organization. Both the `connection-profile` and the `identity file` can be retrieved from the IBP platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*jbCUHvMwMxoMgLVdlUm1hQ.png" /></figure><p><strong><em>Multiple Organization support</em></strong></p><p>Using this toolchain a developer can deploy the same chaincode across different organizations as long as they have access to the appropriate `connection-profile` and the admin `identity` file(s). The information provided in the UI below the <em>Admin Identity</em> and <em>Organization Connection Profile</em> fields optionally take in an array of values, where the values must correspond with specific individual organizations with each other.</p><p>For example:</p><p><em>Admin Identity</em> can accept [{org1 Credentials},{ org2 Credentials },…]</p><p><em>Organization Connection Profile</em> can accept [{org1 connection profile },{ org2 connection profile },…]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*3u5vxDU0lt2b9X2Uanh5EQ.png" /></figure><p><strong><em>III.</em></strong></p><p><strong><em>Deployment using Hyperledger Fabric SDK for Node.js</em></strong></p><p>The toolchain uses another open source tool built using NodeJS that uses the HLF NodeJS SDK to perform all the required installation for the chaincode. It is called <em>Fabric-cli</em> and it uses all the information provided by the deployment stage in the toolchain pipeline such as the environment variables, configuration files, etc., and finally calls the appropriate APIs to install the chaincode, followed by instantiation of the chaincode. See the link below for more information.</p><p><a href="https://github.com/IBM-Blockchain-Starter-Kit/fabric-cli">https://github.com/IBM-Blockchain-Starter-Kit/fabric-cli</a></p><p><strong><em>Deployment configuration</em></strong></p><p>Another requirement for the toolchain is that the chaincode source code must include the ‘deploy-config.json’ file in the root directory. This file dictates chaincode specific deployment configuration, for example the orgs and its channel(s), the chaincode name(s), private data collection configuration, etc., which are critical in order to install the chaincode properly during the deploy stage in the pipeline.</p><p>See the link for example: <a href="https://github.com/IBM-Blockchain-Starter-Kit/nodejs-chaincode-bootstrap/blob/master/deploy_config.json">https://github.com/IBM-Blockchain-Starter-Kit/nodejs-chaincode-bootstrap/blob/master/deploy_config.json</a></p><p><strong>IV.</strong></p><p>Once the toolchain pipeline is successfully deployed it gives you 4 stages:</p><p>1. Prepare — Gets all the required scripts and the code together to be deployed.</p><p>2. Build — Fetches the code from the previous stage and builds the source code.</p><p>3. Test — Runs all the unit test cases that are part of the source code.</p><p>4. Deploy — Builds the fabric-cli tool and then deploys the chaincode to the blockchain network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*Iyu-I8xr3_Am9s9FfHC26g.png" /></figure><p>Using the toolchain above is good starting point for anyone achieve Continuous Integration\Deployment. Additional stages can easily be added to do other custom tasks such as code quality checks and integrations with 3rd party tools resulting in an efficient development and deployment control processes.</p><p>That’s all for now. Stay tuned for further enhancements.</p><p>Notes:</p><p>HLF refers to Hyperledger Fabric</p><p>Blockchain network refers to Hyperledger Fabric v1.4+</p><p><strong>Bring your plan to the IBM Garage.<br></strong>Are you ready to learn more about working with the IBM Garage? We’re here to help. Contact us today to schedule time to speak with a Garage expert about your next big idea. Learn about our IBM Garage Method, the design, development and startup communities we work in, and the deep expertise and capabilities we bring to the table.</p><p><a href="https://www.ibm.com/account/reg/us-en/signup?formid=urx-38887"><em>Schedule a no-charge visit</em></a><em> with the IBM Garage.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bccca736d854" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use IBM Blockchain Visual Studio Code extension to connect to IBM Blockchain Platform]]></title>
            <link>https://vandangogna.medium.com/how-to-use-ibm-blockchain-visual-studio-code-extension-to-connect-to-ibm-blockchain-platform-ffa120ebe57a?source=rss-a9c3ad74a05c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffa120ebe57a</guid>
            <category><![CDATA[ibm-blockchain]]></category>
            <category><![CDATA[ibm-blockchain-platform]]></category>
            <dc:creator><![CDATA[Vandan Gogna]]></dc:creator>
            <pubDate>Tue, 26 Nov 2019 21:04:50 GMT</pubDate>
            <atom:updated>2019-11-27T16:54:48.586Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*WUZwxVbQRlS4KvVY2_9Zcg.jpeg" /></figure><h3>I. <strong><em>Description</em></strong></h3><p>Using the VScode plugin, a developer can complete the following tasks easily and avoid the tedious and manual steps that are time consuming and error prone, in turn providing a quick and efficient development experience.</p><p>a. Create a smart contract</p><p>b. Import /generate a package that can be deployed on an HLF environment</p><p>c. Deploy an existing smart contract</p><p>The plugin allows the HLF developer to save significant amount of time and effort when it comes to chaincode development and testing it against IBM Blockchain Platform. A developer can choose between languages such as Golang and the ones supported by the Java Virtual Machine and Node.js runtimes like Java, JavaScript, TypeScipt to write the smart contract. The developer can then use the VS code plugin to deploy (local fabric instance only) the smart contract and then test to verify all the functionality. Currently the VS code plugin only allows query or invoke transactions on IBM Blockchain platform.</p><p>Having the ability to connect the VScode plugin to IBP and invoke transactions allows one to quickly test against an actual blockchain network and see the results executed by your chaincode. This is particularly helpful during the development cycle when diagnosing a problem or doing general sanity testing/verification.</p><h3>II. <strong><em>Requirements</em></strong></h3><p>1) How to install the VScode plugin:</p><p><a href="https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain-platform">https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain-platform</a></p><p>2) For detailed steps on how to create a new smart contract project using VScode plugin:</p><p><a href="https://developer.ibm.com/tutorials/ibm-blockchain-platform-vscode-smart-contract/">https://developer.ibm.com/tutorials/ibm-blockchain-platform-vscode-smart-contract/</a></p><p>3) How to deploy a smart contract on IBP:</p><p><a href="https://cloud.ibm.com/docs/services/blockchain?topic=blockchain-ibp-console-smart-contracts#ibp-console-smart-contracts-install">IBM Cloud Docs</a></p><h3>III. <strong><em>Steps to execute</em></strong></h3><p>1. Pre-requisites — VS code plugin and an available IBPv2 instance (see above section II)</p><p>2. Download connection profile for Org1:</p><p><a href="https://cloud.ibm.com/docs/services/blockchain?topic=blockchain-ibp-console-app#ibp-console-app-profile">https://cloud.ibm.com/docs/services/blockchain?topic=blockchain-ibp-console-app#ibp-console-app-profile</a></p><p>3. Download JSON peer admin identity file, you must use the correct identity from the following step while setting up the IBP instance.</p><p><a href="https://cloud.ibm.com/docs/services/blockchain?topic=blockchain-ibp-console-identities#ibp-console-identities-enroll">https://cloud.ibm.com/docs/services/blockchain?topic=blockchain-ibp-console-identities#ibp-console-identities-enroll</a></p><p>4. Generate public certificate and private key from the base64 encoded values from the identity file used above. The identity’s public certificate and private key can be obtained using 2 ways :</p><p>a. Using nodeJS — Buffer.from(‘string_to_be_decoded’, ‘base64’).toString()</p><p>b. Using command line — <a href="https://cloud.ibm.com/docs/services/blockchain?topic=blockchain-ibp-console-identities#ibp-console-identities-expiration">https://cloud.ibm.com/docs/services/blockchain?topic=blockchain-ibp-console-identities#ibp-console-identities-expiration</a></p><p>5. Save the public certificate and the private key for use in the next step.</p><p>6. Select IBM Blockchain platform extension in vs code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/114/1*n6OlRqeANuEnW-KFJY91FA.png" /></figure><p>7. Under `Fabric Wallets`, create a new wallet by clicking on `+` sign</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*npi0HXQyRyilstC-XtYOHw.png" /></figure><p>a. Choose `Create a new wallet and add an identity`.</p><p>b. Provide a name for this new wallet (Ex: IbpConnectionWallet).</p><p>c. Provide a new for the Identity (Ex: org1admin).</p><p>d. Enter the MSPID for the associated org (Ex: Org1MSP).</p><p>e. Select `Provide certificate and private key files` — this comes from step 4 in the section above</p><p>i. Browse for the public certificate file in pem format</p><p>ii. Browse for the private key file in pem format.</p><p>f. A new wallet should now be visible under `Fabric Wallets` section.</p><p>8. Under `Fabric Gateways` create a new gateway by clicking on the `+` sign.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*RENpWkQtoGYW1MIPb5Fuig.png" /></figure><p>a. Select `Create a gateway from a connection profile`</p><p>b. Enter a name for the new gateway (Ex: IBP-conn-gateway)</p><p>c. Browse for the connection profile (from step 2 from section above)</p><p>d. The new gateway should now appear under `Fabric Gateways`.</p><p>9. Click on the new\existing fabric gateway you want to use:</p><p>a. Select the new\existing wallet associated with that IBPv2 instance.</p><p>b. The gateway should successfully connect to specific instance of IPBv2</p><p>c. You should now see:</p><p>i. Connected use id to IBPv2</p><p>ii. Channel(s)</p><p>iii. Expand channel(s) and see the available chaincode(s) installed on the channel(s)</p><p>10. Once you see the available chaincode(s) you can perform Query operation:</p><p>a. Right click on the chaincode and select Evaluate transaction (READONLY).</p><p>b. Provide the method name.</p><p>c. Optional — Provided any required parameters.</p><p>11. Once you see the available chaincode(s) you can perform Invoke operation:</p><p>a. Right click on the chaincode and select Submit transaction.</p><p>b. Provide the method name.</p><p>c. Optional — Provided any required parameters.</p><p>In conclusion, as a HLF developer the VS code plugin has been an invaluable tool for me which allows me to deliver and hopefully it will provide the same value to anyone developing smart contracts.</p><p>**NOTES:</p><p>1. VS code refers to Visual Studio code</p><p>2. Plugin refers to IBM Blockchain platform extension</p><p>3. VSCode plugin currently does not support chaincode installation and instantiation on IBM Blockchain platform.</p><p>4. HLF refers to Hyperledger Fabric</p><p>5. VSCode refers to Visual Studio Code</p><p><strong>Bring your plan to the IBM Garage.<br></strong>Are you ready to learn more about working with the IBM Garage? We’re here to help. Contact us today to schedule time to speak with a Garage expert about your next big idea. Learn about our IBM Garage Method, the design, development and startup communities we work in, and the deep expertise and capabilities we bring to the table.</p><p><a href="https://www.ibm.com/account/reg/us-en/signup?formid=urx-38887"><em>Schedule a no-charge visit</em></a><em> with the IBM Garage.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffa120ebe57a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>