<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: MacBobby Chibuzor</title>
    <description>The latest articles on Forem by MacBobby Chibuzor (@theghostmac).</description>
    <link>https://forem.com/theghostmac</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F717176%2Fe9dcde38-cba1-4ba3-9c72-51331139e16c.jpg</url>
      <title>Forem: MacBobby Chibuzor</title>
      <link>https://forem.com/theghostmac</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/theghostmac"/>
    <language>en</language>
    <item>
      <title>Using AWS Blockchain Templates for Hyperledger Fabric Development in Go (2)</title>
      <dc:creator>MacBobby Chibuzor</dc:creator>
      <pubDate>Sun, 20 Feb 2022 20:38:49 +0000</pubDate>
      <link>https://forem.com/theghostmac/using-aws-blockchain-templates-for-hyperledger-fabric-development-in-go-2-588b</link>
      <guid>https://forem.com/theghostmac/using-aws-blockchain-templates-for-hyperledger-fabric-development-in-go-2-588b</guid>
      <description>&lt;h2&gt;
  
  
  Components and Frameworks
&lt;/h2&gt;

&lt;p&gt;All the software to be used for Hyperledger Fabric Blockchain development is available in the AWS Elastic Container Registry (ECR) in Docker containers. The components on the network will run in containers, which will run on a single AWS EC2 Instance.&lt;/p&gt;

&lt;p&gt;The peer, orderers, and endorsers will be provisioned in docker containers, and a PostgreSQL database ledger will be used in a separate docker container. Hyperledger Explorer will also run in a separate docker container that will allow you to monitor transactions and blocks on your blockchain network.&lt;/p&gt;

&lt;p&gt;These containers are the components and frameworks that make up your Hyperledger Fabric blockchain on the AWS Cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  Docker Containers
&lt;/h2&gt;

&lt;p&gt;Docker containers package source codes and dependencies in images. The image contains everything needed to host an application.&lt;/p&gt;

&lt;p&gt;The AWS ECS is a fault-tolerant, scalable Docker container management service for managing container lifecycle. It has two launch types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Fargate&lt;/li&gt;
&lt;li&gt;AWS EC2 Instance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Docker-compose will be used to create a multi-container application, having its configuration setting in a YAML file. AWS provides the YAML file, making setup easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  Network Architecture on Hyperledger Fabric
&lt;/h2&gt;

&lt;p&gt;The network architecture on the Hyperledger Fabric blockchain network is structured as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set up a VPC on a single availability zone&lt;/li&gt;
&lt;li&gt;A public subnet will be set up&lt;/li&gt;
&lt;li&gt;An EC2 instance will be set up also, connected to the Security Groups via SSH&lt;/li&gt;
&lt;li&gt;The EC2 instance will access the containers that will contain the blockchain network resources&lt;/li&gt;
&lt;li&gt;In the EC2 Instance, Docker containers will host the peers, the orderers, the Explorer, and a PostgreSQL database ledger.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Creating a VPC
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Create a VPC with a public subnet&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Follow these steps to create a VPC with a public subnet:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the &lt;a href="http://aws.amazon.com"&gt;AWS home page&lt;/a&gt; on your browser. Click on &lt;strong&gt;Create an AWS Account&lt;/strong&gt; if you do not already have one, or &lt;strong&gt;Sign in&lt;/strong&gt;. AWS has a 12-month free tier access account you can use for the time being, so you can create a new account.&lt;/li&gt;
&lt;li&gt;Enable billing for your account as you will be billed for overusing the free privileges in the free tier access.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Services&lt;/strong&gt; and search for &lt;strong&gt;VPC&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;VPC&lt;/strong&gt; &amp;gt; &lt;strong&gt;Launch VPC Wizard .&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Select&lt;/strong&gt; in the first option: &lt;strong&gt;VPC with a Single Public Subnet&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Leave the default settings on the first section on IP addresses, but at a VPC name of your choice. This article uses the VPC name: HyperLVPC.&lt;/li&gt;
&lt;li&gt;In selecting &lt;strong&gt;Availability Zone&lt;/strong&gt;, keep in mind that AWS Blockchain Templates are only available in three zones: US East 1 in North Virginia, US East 2 in Ohio, and US West 2 in Oregon.&lt;/li&gt;
&lt;li&gt;Name the Subnet however you want. This article uses the Subnet name: HyperLSubnet.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Create VPC&lt;/strong&gt; after completing these settings as seen below.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UcrdCfsS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1645389247532/uoMGBEGJi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UcrdCfsS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1645389247532/uoMGBEGJi.png" alt="VPC Config window.png" width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will see a success message. Click on &lt;strong&gt;Your VPCs&lt;/strong&gt; and you will see your VPC running.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up key pair and Configuring Security Groups
&lt;/h2&gt;

&lt;p&gt;Setting up a Public-Private key pair allows authentication of connections from your local machine to the EC2 Instance on AWS. Follow the steps below to set this up:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go back to the &lt;strong&gt;Services&lt;/strong&gt; dashboard and search for &lt;strong&gt;EC2&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Next, browse through the left navigation pane for the &lt;strong&gt;Key Pairs&lt;/strong&gt; option under the &lt;strong&gt;Network &amp;amp; Security&lt;/strong&gt; section. Select &lt;strong&gt;Key Pairs&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Create key pair&lt;/strong&gt; at the top of the screen. Confirm that you are creating a Key Pair under the same region as your VPC.&lt;/li&gt;
&lt;li&gt;Name the key pair as you wish. This article uses the Key pair name: HyperNewKey.&lt;/li&gt;
&lt;li&gt;Leave the default settings once again and click on &lt;strong&gt;Create key pair&lt;/strong&gt; below the screen.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The next window displays a Success message, along with your active key pair as seen below. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8y0D1HIl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1645389280829/_TB-y2l5_.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8y0D1HIl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1645389280829/_TB-y2l5_.png" alt="EC2 Key Pair window.png" width="800" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy and store the key safely as you will need it to authenticate yourself while connecting to the new Instance. Notice that it is downloaded in a .ppk file immediately after this window was displayed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;our key pair:
key-0a666d865fc023d4c
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Click on &lt;strong&gt;Security Groups&lt;/strong&gt; on the navigation pane and under the &lt;strong&gt;Network &amp;amp; Security&lt;/strong&gt; section.&lt;/li&gt;
&lt;li&gt;In the new window, click on &lt;strong&gt;Create security group&lt;/strong&gt; at the top of the page. Security Groups in AWS are similar to Firewalls.&lt;/li&gt;
&lt;li&gt;Name the Security Group as you wish. This article uses the Security Group name: HyperFabSG. &lt;/li&gt;
&lt;li&gt;Next, add a description of your choice and click on the &lt;strong&gt;Create Security Group&lt;/strong&gt; at the bottom of the page. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qHeelO2g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1645389307366/ymVhjFmH2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qHeelO2g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1645389307366/ymVhjFmH2.png" alt="EC2 Security Group window.png" width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Group rules can be created here in the Security Groups section. These rules control the traffic flow. To create a few rules, scroll down the current page displaying the Success message and click on the &lt;strong&gt;Edit Inbound Rules&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;On the new screen, click on the &lt;strong&gt;Type&lt;/strong&gt; field displaying &lt;strong&gt;Custom TCP&lt;/strong&gt; by default and select &lt;strong&gt;SSH&lt;/strong&gt;. In the &lt;strong&gt;Source type&lt;/strong&gt; field displaying &lt;strong&gt;Custom&lt;/strong&gt; by default, select My IP. &lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Add rule&lt;/strong&gt; to create a new rule with the following credentials: &lt;strong&gt;Type:&lt;/strong&gt; Custom TCP, &lt;strong&gt;Source Type:&lt;/strong&gt; My IP, &lt;strong&gt;Port Range:&lt;/strong&gt; 8080.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Save rules&lt;/strong&gt; now.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cE9bK4Xz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1645389392357/1_dh4uu_v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cE9bK4Xz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1645389392357/1_dh4uu_v.png" alt="Rules for EC2 Instance.png" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the successful modification, new Policies and Roles will be created.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Policies and Roles
&lt;/h2&gt;

&lt;p&gt;The policies and roles will be created next. The roles are first created, then policies are attached to them.&lt;/p&gt;

&lt;p&gt;This will require the AWS Identity and Access Management (IAM) service. Follow these steps below to set Roles and Policies on AWS IAM:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In &lt;strong&gt;Services&lt;/strong&gt;, search for &lt;strong&gt;IAM.&lt;/strong&gt; After clicking on it, you should see the window display&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Policies&lt;/strong&gt; in the left navigation pane. &lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Create Policy,&lt;/strong&gt; which should take you to a new window where you can create new policies with either a Visual editor or with JSON.&lt;/li&gt;
&lt;li&gt;Select whichever you wish and paste your new policy. This article uses JSON with the &lt;a href="https://docs.aws.amazon.com/blockchain-templates/latest/developerguide/blockchain-templates-hyperledger.html"&gt;policy available here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Next, click on &lt;strong&gt;Next: Tags&lt;/strong&gt; and click &lt;strong&gt;Next: Review.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Finally, add the name of your Review Policy. This article uses the Review Policy name: EC2HyperFPolicy.&lt;/li&gt;
&lt;li&gt;Review the summary and click &lt;strong&gt;Create Policy.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Next, the roles that will manage these policies will be created.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click on &lt;strong&gt;Roles&lt;/strong&gt; on the left navigation pane.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Create Role&lt;/strong&gt; at the top of the page to create a new role.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;EC2&lt;/strong&gt; instance in the &lt;strong&gt;Use Case&lt;/strong&gt; section at the bottom of the page.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Next&lt;/strong&gt; and on the next window, select the policy you just created: EC2HyperFPolicy.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Next&lt;/strong&gt; at the bottom of the page again, and specify a &lt;strong&gt;Role name&lt;/strong&gt; as you wish. This article uses the Role name: EC2HyperFRole.&lt;/li&gt;
&lt;li&gt;Next, Click on &lt;strong&gt;Create Role.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;View Role&lt;/strong&gt; to see the summary of the newly created role. Copy the instance profile ARN (Amazon Resource Name) in the summary.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arn:aws:iam::428223012719:instance-profile/EC2HyperFRole
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating the Hyperledger Fabric Network with AWS CloudFormation Stack
&lt;/h2&gt;

&lt;p&gt;To create the Hyperledger Fabric, navigate to the &lt;a href="https://aws.amazon.com/blockchain/"&gt;AWS Blockchain Templates page&lt;/a&gt; and follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click on the &lt;strong&gt;Get Started with AWS Managed Blockchain&lt;/strong&gt; link.&lt;/li&gt;
&lt;li&gt;Navigate to &lt;a href="https://aws.amazon.com/blockchain/templates/getting-started/"&gt;AWS Blockchain Templates for Hyperledger Fabric&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Launch in US East (Ohio) region (us-east-2)&lt;/strong&gt; which is the region for the subnet used in this article.&lt;/li&gt;
&lt;li&gt;It automatically launches the CloudFormation stack and displays the home screen to quickly create a stack on AWS and configure the Hyperledger Fabric network on a single Amazon EC2 instance.&lt;/li&gt;
&lt;li&gt;Create a new &lt;strong&gt;Stack Name&lt;/strong&gt; with your preferred name. This article uses the Stack Name: HyperFabricStack.&lt;/li&gt;
&lt;li&gt;Next, specify your organization’s domain name in the &lt;strong&gt;Domain&lt;/strong&gt; field. This article is a demo, hence, the default is used. &lt;/li&gt;
&lt;li&gt;Peer organizations are also available, should you have organizations to add.&lt;/li&gt;
&lt;li&gt;Scroll to the field for &lt;strong&gt;VPC ID,&lt;/strong&gt; and select the VPC you created. HyperLVPC is selected for this article. Also, do the same for the VPC Subnet, EC2 Key Pair, Security Group, and paste the copied instance profile ARN.&lt;/li&gt;
&lt;li&gt;Select the Default for other settings.&lt;/li&gt;
&lt;li&gt;Click the two checkboxes under the &lt;strong&gt;Capabilities&lt;/strong&gt; section and click the &lt;strong&gt;Create Stack&lt;/strong&gt; button at the bottom of the page. The following page is displayed:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T4Mr19L_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1645389436706/Mb13h01fw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T4Mr19L_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1645389436706/Mb13h01fw.png" alt="CloudFormation Stack Completed.png" width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point, you have a complete Hyperledger Fabric blockchain network running on the AWS Cloud.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;This article walked you through the process of creating your first Hyperledger Fabric Blockchain platform on the AWS Cloud. &lt;/p&gt;

&lt;p&gt;The next article will also be technical as you will learn how to write a Chaincode in the Go programming language, and deploy it on AWS. &lt;/p&gt;

&lt;p&gt;Being the final article in the series, you will put all you have learned into practice, and build your foundation as a Hyperledger Fabric Blockchain Developer.&lt;/p&gt;

</description>
      <category>go</category>
      <category>blockchain</category>
      <category>devops</category>
      <category>aws</category>
    </item>
    <item>
      <title>Blockchain DevOps on AWS with The Hyperledger Fabric Model and Golang (1)</title>
      <dc:creator>MacBobby Chibuzor</dc:creator>
      <pubDate>Sun, 20 Feb 2022 20:20:02 +0000</pubDate>
      <link>https://forem.com/theghostmac/blockchain-devops-on-aws-with-the-hyperledger-fabric-model-and-golang-1-4k1i</link>
      <guid>https://forem.com/theghostmac/blockchain-devops-on-aws-with-the-hyperledger-fabric-model-and-golang-1-4k1i</guid>
      <description>&lt;h1&gt;
  
  
  The Blockchain
&lt;/h1&gt;

&lt;p&gt;The Blockchain is an encrypted database of transactions stored in a distributed ledger.&lt;/p&gt;

&lt;p&gt;Blockchain transactions are exchanges of value in the form of digital money, and the transactions are stored on a ledger to record the transactions. Transactions are immutable, verifiable, and incorruptible.&lt;/p&gt;

&lt;p&gt;Blockchains operate with decentralized technology, hence have no single point of failure. &lt;/p&gt;

&lt;p&gt;Smart Contracts are pieces of code that control actions on a blockchain network. They are similar to the business logic of Web2.0.&lt;/p&gt;

&lt;p&gt;To add entries to a shared ledger, a smart contract must be executed. Consensus protocols are what regulate and decide which node/computer/peer can add entries to a blockchain. Consensus protocols are what empower these nodes to be able to agree upon:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the transactions that get added&lt;/li&gt;
&lt;li&gt;the order of transactions to be added&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once nodes accept a blockchain transaction, the transaction gets stored permanently on the blockchain network.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Hyperledger Project
&lt;/h3&gt;

&lt;p&gt;Hyperledger is not a blockchain, company, or cryptocurrency.&lt;/p&gt;

&lt;p&gt;It is a parent project of open-source blockchains and tools started in December 2015 by the Linux Foundation.&lt;/p&gt;

&lt;p&gt;It is made up of three components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Developers and communities&lt;/li&gt;
&lt;li&gt;Frameworks and tools&lt;/li&gt;
&lt;li&gt;Industries like finance, IoT, supply chain, and manufacturing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Developers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The developers of the Hyperledger Projects are blockchain specialists who are also developers working in different industries and who want to see the blockchain technology used in diverse fields.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Frameworks and Tools&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Frameworks include the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hyperledger Fabric by IBM&lt;/li&gt;
&lt;li&gt;Hyperledger Sawtooth&lt;/li&gt;
&lt;li&gt;Hyperledger Iroha for mobile apps&lt;/li&gt;
&lt;li&gt;Hyperledger Burrow built to support the EVM&lt;/li&gt;
&lt;li&gt;Hyperledger Indy which supports independent identities on distributed ledgers&lt;/li&gt;
&lt;li&gt;Hyperledger Cello for deployment&lt;/li&gt;
&lt;li&gt;Hyperledger Composer for UI&lt;/li&gt;
&lt;li&gt;Hyperledger Caliper for benchmarking&lt;/li&gt;
&lt;li&gt;Hyperledger Explorer for monitoring application status&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Industries&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;IBM, Intel, Wells Fargo, etc., are examples of companies who are involved in the Hyperledger Project&lt;/p&gt;

&lt;h2&gt;
  
  
  Deep Dive in Comparison
&lt;/h2&gt;

&lt;p&gt;Ethereum is an open-source, public blockchain-based platform that is used to build smart contracts. Ethereum has a cryptocurrency called Ether, used to reward nodes for work done on the network. The smart contracts are written with language such as Solidity.&lt;/p&gt;

&lt;p&gt;Ethereum has problems with scaling and speed. The Proof-of-Work algorithm consumes relatively more computing power and resources. Also, each transaction in the Ethereum network gets broadcasted to all nodes in the network, discouraging the idea of confidentiality. &lt;/p&gt;

&lt;p&gt;These issues are behind the creation of the Hyperledger Project.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hyperledger Fabric
&lt;/h3&gt;

&lt;p&gt;The Hyperledger Fabric framework is an open-source, enterprise-grade, permissioned distributed ledger technology platform designed for use in an enterprise application. Hyperledger Fabric is used to build private blockchain networks where all nodes are known and verified. “Known” does not mean trustworthy, but that the peers on the network are not anonymous.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of Hyperledger Fabric
&lt;/h3&gt;

&lt;p&gt;The following are advantages of the Hyperledger Fabric framework:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. It is permissioned&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Unknown peers are not allowed to participate, and there are private channels between the peers. Membership Service Providers (MSPs) are used to regulate the peers who join the network. Verification is important and compulsory in Hyperledger Fabric. Channels can also be set up to allow for private communication between subsets of nodes. These private channels have private ledgers that no external node can access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Transactions are fast&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There is low latency and high throughput for verifying and accepting transactions. Transactions on Hyperledger Fabric are executed using smart contracts also, but they are called Chaincodes in Hyperledger Fabric. Hyperledger Fabric Chaincodes are written in languages such as Golang, or NodeJS. They are not written with contract-purpose programming languages like Solidity. &lt;/p&gt;

&lt;p&gt;Chaincodes have standard interfaces with two methods: the &lt;code&gt;init&lt;/code&gt; and &lt;code&gt;invoke&lt;/code&gt; methods to initialize the smart contract and to invoke or execute the smart contract, respectively. &lt;/p&gt;

&lt;p&gt;The execution of a transaction through a smart contract is done by a few endorsing peers. The percentage of the peers endorsing the transaction is determined by an Endorsement Policy. However, the execution does not update the actual ledger. Instead, endorsed transactions are passed down to Orderers.&lt;/p&gt;

&lt;p&gt;Orderers determine the sequence of the transaction. Ordering is of different types:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;SOLO Ordering&lt;/li&gt;
&lt;li&gt;Kafka distributing system&lt;/li&gt;
&lt;li&gt;Practical Byzantine-Fault Tolerance&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Next, the transaction is passed on to Committing peers. The Committing peers of that particular Hyperledger Fabric network are responsible for validation and “merging” or committing the transaction to their private ledger copy.&lt;/p&gt;

&lt;p&gt;They only accept/validate correctly endorsed transactions, and verify that the transaction is valid with the latest version of the shared ledger. If the transaction is found wanting, they are invalidated by the Committed peers.&lt;/p&gt;

&lt;p&gt;The lifecycle of a transaction on the Hyperledger Fabric network makes the issue of double-spending inexistent and makes sure that the sender has the asset they want to send.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Easy to Plug&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is designed to be modular, so developers can use different databases, membership service providers, consensus algorithms, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Transaction’s Lifecycle on the Hyperledger Fabric
&lt;/h2&gt;

&lt;p&gt;A client application submits a transaction proposal to Endorsing peers through a Chaincode or smart contract. The Endorsing peers execute the Chaincode and endorse the transaction. The transaction is then sent back to the client application with signatures. The client application then sends the signed transaction to Orderers. &lt;/p&gt;

&lt;p&gt;Once the Orderers order the transaction, they pass it on to the Committing peers who perform their duty as explained above and add the transaction to their private copy of the ledger. The Committing peers then send the Confirmation of the transaction to the client application.&lt;/p&gt;

&lt;p&gt;Transactions involve hardware assets or software assets; apparently anything of monetary value that can be exchanged between two parties.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hyperledger Fabric vs Ethereum
&lt;/h2&gt;

&lt;p&gt;The following are highlights of the differences between Hyperledger Fabric and Ethereum&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Ethereum is permission-less, Hyperledger Fabric is permissioned&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Peers have to be verified, known, and approved to be part of the private Hyperledger Fabric platform.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In Hyperledger Fabric, not all users can validate or endorse transactions, but it is so on Ethereum.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hyperledger Fabric does not have a cryptocurrency to incentivize nodes for reward of work done. Ethereum has the Ether cryptocurrency for this.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In Hyperledger Fabric, transaction execution mechanism is with Chaincodes and not Smart Contracts as in Ethereum.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The transaction lifecycle on Hyperledger Fabric involves: execute transaction —&amp;gt; order the transaction —&amp;gt; validate the transaction. In Ethereum, it involves: order the transaction —&amp;gt; then execute the transaction. Validation does not exist separately in Ethereum.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Transactions can be kept private from some peers in the Hyperledger Fabric network, but in Ethereum, all transactions are broadcasted to all nodes in the network.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;General-purpose languages like Go, Node.js and Java are supported on Hyperledger Fabric, but contract-purposed, domain-specific language like Solidity is used on Ethereum.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On Hyperledger Fabric, the consensus protocol is broad and generic. On Ethereum, it is Proof-of-Work (soon, Proof-of-Scale).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Little effort and resource is wasted in Hyperledger, making it scale far more easily than Ethereum which consumes much more effort and resource.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  AWS Blockchain Templates
&lt;/h1&gt;

&lt;p&gt;AWS Blockchain Templates supports two blockchains (Verify this):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ethereum&lt;/li&gt;
&lt;li&gt;Hyperledger Fabric&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Only build on the Hyperledger Fabric if you want to a private network for your organization, as only known and verified peers are allowed.&lt;/p&gt;

&lt;p&gt;AWS Blockchain Templates specify the network components of your blockchain platform, with a network configuration file.  You can also run Chaincode or DApps on the AWS Cloud.&lt;/p&gt;

&lt;p&gt;The following are tools on the AWS Cloud that will be used in building the Hyperledger Fabric platform:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;AWC EC2 to configure peers, orderers, and the ledger&lt;/li&gt;
&lt;li&gt;AWS ECR Docker container registry to provision containers for nodes&lt;/li&gt;
&lt;li&gt;Amazon VPC to provide private network access to cloud resources&lt;/li&gt;
&lt;li&gt;AWS Security Groups for controlling traffic flows to and from the network.&lt;/li&gt;
&lt;li&gt;AWS Roles for access control&lt;/li&gt;
&lt;li&gt;AWS CloudFormation Stack for the blockchain network&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;This article presents a swift guide to the Hyperledger Blockchain platform. The Hyperledger Fabric framework is explained and compared to the popularly adopted Ethereum blockchain.&lt;/p&gt;

&lt;p&gt;The next article will take a more technical approach to practice some DevOps principles using the AWS Blockchain Template explained in this article, to build a private Hyperledger Fabric network with the Go programming language.&lt;/p&gt;

&lt;p&gt;You can learn more about the &lt;a href="https://www.techtarget.com/searchcio/definition/Hyperledger"&gt;Hyperledger Project here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>go</category>
      <category>aws</category>
      <category>devops</category>
    </item>
    <item>
      <title>Data Structures and Algorithms with Go (2): Growing Your Go Skills with Trees</title>
      <dc:creator>MacBobby Chibuzor</dc:creator>
      <pubDate>Sat, 19 Feb 2022 18:12:21 +0000</pubDate>
      <link>https://forem.com/theghostmac/data-structures-and-algorithms-with-go-2-growing-your-go-skills-with-trees-248a</link>
      <guid>https://forem.com/theghostmac/data-structures-and-algorithms-with-go-2-growing-your-go-skills-with-trees-248a</guid>
      <description>&lt;h2&gt;
  
  
  Trees
&lt;/h2&gt;

&lt;p&gt;Trees are non-linear data structures used mainly for searching. Trees have maximum nodes of two children and a minimum of none. In trees, the property values of the left node are lesser than the property values of the right node. Nodes with no children are considered leaves.&lt;/p&gt;

&lt;h3&gt;
  
  
  Must-knows about trees
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;A binary tree is a data structure where each node has 0, 1, or 2 sub-nodes.&lt;/li&gt;
&lt;li&gt;The root node is the first node of the tree, having no parents.&lt;/li&gt;
&lt;li&gt;An edge is the link from child to parent.&lt;/li&gt;
&lt;li&gt;The depth/height of the tree is the longest path from the root node to the furthest node.&lt;/li&gt;
&lt;li&gt;The depth of a node is the number of edges from the node to the root of the tree.&lt;/li&gt;
&lt;li&gt;A leaf is a node with no children.&lt;/li&gt;
&lt;li&gt;The children of the same parent are called siblings.&lt;/li&gt;
&lt;li&gt;Ancestors of a node are parent/grandparents to the parent of the node's parent.&lt;/li&gt;
&lt;li&gt;Trees are either balanced or unbalanced and balancing a tree is difficult and slow.&lt;/li&gt;
&lt;li&gt;The size of a tree is the number of descendants it has including itself.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Binary search tree
&lt;/h3&gt;

&lt;p&gt;A tree is called a binary tree if it has a maximum of two child nodes. An empty tree &lt;br&gt;
is also a valid binary tree. Binary trees have a root node with a left and a right subtree.&lt;br&gt;
Binary search trees allow look-up operations, as well as addition, and removal of elements.&lt;br&gt;
They store keys in a sorted order, to make look-up operations faster. Their space complexity is &lt;br&gt;
of the order O(n), but their operations like insert, search, and delete are of the order O(log n).&lt;br&gt;
Binary trees have the following properties:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;key of type

&lt;code&gt;int&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li&gt;value of type

&lt;code&gt;int&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li&gt;LeftNode of the node's type instance&lt;/li&gt;
&lt;li&gt;RightNode of the node's type instance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, the properties are arranged thus:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;TreeNode&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;
    &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;
    &lt;span class="n"&gt;leftNode&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;TreeNode&lt;/span&gt; &lt;span class="c"&gt;// best to put it first, as the orientation is left | value | right&lt;/span&gt;
    &lt;span class="n"&gt;rightNode&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;TreeNode&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Binary tree operations
&lt;/h3&gt;

&lt;p&gt;Operations possible with binary trees are grouped into two:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basic Operations&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inserting elements to a tree&lt;/li&gt;
&lt;li&gt;Deleting elements from a tree&lt;/li&gt;
&lt;li&gt;Searching for elements in a tree&lt;/li&gt;
&lt;li&gt;Traversing the tree&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Auxiliary Operations&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finding the size of a tree&lt;/li&gt;
&lt;li&gt;Finding the height of a tree&lt;/li&gt;
&lt;li&gt;Finding the level with the maximum sum&lt;/li&gt;
&lt;li&gt;Finding the least common ancestor (LCA) for a particular pair of nodes&lt;/li&gt;
&lt;li&gt;Others&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Applications of binary trees
&lt;/h3&gt;

&lt;p&gt;The following are examples of use-cases of binary trees:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Expression trees for compilers&lt;/li&gt;
&lt;li&gt;Huffman coding trees for data compression algorithms&lt;/li&gt;
&lt;li&gt;Binary search trees (BST) for searching, inserting, and deleting in O(log n)&lt;/li&gt;
&lt;li&gt;Priority queues (PQ) for searching and deleting minimum or maximum values in O(log n) time.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Implementing binary trees in Go
&lt;/h3&gt;

&lt;p&gt;Below is an example code where binary trees are implemented:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"math/rand"&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;// Tree type of recursive struct&lt;/span&gt;
&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Tree&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Left&lt;/span&gt;  &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Tree&lt;/span&gt;
    &lt;span class="n"&gt;Value&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;
    &lt;span class="n"&gt;Right&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Tree&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// traverse method allows visiting of nodes with recursion&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Tree&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Left&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;" "&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Right&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// create function populates the branches with random integers&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Tree&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Tree&lt;/span&gt;
    &lt;span class="n"&gt;rand&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Seed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Unix&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;temp&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;rand&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Intn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;temp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// insert recursive function does lots of functions with each if statements&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Tree&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Tree&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c"&gt;// if the tree is empty&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;Tree&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="no"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Value&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c"&gt;// if the value exists in the tree&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Value&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c"&gt;// if the value should go left or right&lt;/span&gt;
        &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Right&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// main function&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;tree&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"The root of the tree is "&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tree&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;" &lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tree&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c"&gt;// fmt.Println()&lt;/span&gt;
    &lt;span class="n"&gt;tree&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tree&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;tree&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tree&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tree&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c"&gt;// fmt.Println()&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;" &lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt; The root of the tree is "&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tree&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This article teaches the reader about Trees and binary trees. The possible operations &lt;br&gt;
with binary trees were also given, along with an implementation of some of these &lt;br&gt;
operations.&lt;br&gt;
In a future article, applications of binary trees in problem-solving with the Go&lt;br&gt;
programming languages will be given.&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>go</category>
      <category>computerscience</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Get Started with ROS for Embedded Robotics</title>
      <dc:creator>MacBobby Chibuzor</dc:creator>
      <pubDate>Sat, 12 Feb 2022 18:52:50 +0000</pubDate>
      <link>https://forem.com/theghostmac/get-started-with-ros-for-embedded-robotics-4em8</link>
      <guid>https://forem.com/theghostmac/get-started-with-ros-for-embedded-robotics-4em8</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Robotic systems are built to have both software and hardware parts. While the hardware is easier to build, the software — which is responsible for adding intelligence to the robot — is not as easy.&lt;/p&gt;

&lt;p&gt;To make the development process less cumbersome and more efficient, an ex-Google researcher built the ROS framework. This article provides fundamental knowledge required to learn about ROS and Robotics, and to apply ROS in projects.&lt;/p&gt;

&lt;h1&gt;
  
  
  On Robotics
&lt;/h1&gt;

&lt;h2&gt;
  
  
  What are Robots?
&lt;/h2&gt;

&lt;p&gt;A robot is a machine built to execute one or more tasks automatically with speed and precision. IEEE defined a robot as “An autonomous machine capable of sensing its environment, carrying out computations to make decisions, and performing actions in the real world.&lt;/p&gt;

&lt;h2&gt;
  
  
  Anatomy of a Robot
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Sensors
&lt;/h3&gt;

&lt;p&gt;Robots have sensors for the eyes and for gathering information. There are different types of sensors for other tasks. For example, the ultrasonic sensor is used for obstacle detection and avoidance, while the PIR motion sensor is used for motion detection. LiDAR stands for Light Detection and Ranging and uses laser pulses. LiDAR is used for obstacle detection and avoidance and object recognition due to its scanning and 3D mapping functionality. &lt;/p&gt;

&lt;p&gt;Robots use cameras and AI algorithms to identify and recognize objects. An example of an AI algorithm used by robots is the YOLOv5.&lt;/p&gt;

&lt;h3&gt;
  
  
  Actuators
&lt;/h3&gt;

&lt;p&gt;Robots use actuators to carry out mechanical action (motion) based on the feedback data gotten through sensors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mobility
&lt;/h3&gt;

&lt;p&gt;Mobility is achieved in a technically complex way. It involves the use of Navigation processes (like the ROS Navigation Stack), Sensors (like IMU, Encoders, and LiDAR), software algorithms like (Obstacle Detection and Avoidance algorithms), motors and wheels of different kinds, 3D Cameras, and Mechanical Arms for Spatial Manipulation.&lt;/p&gt;

&lt;p&gt;As mentioned, wheels provide translational motion for robots. They come in different forms and sizes for different terrestrial settings and tasks.&lt;/p&gt;

&lt;p&gt;Motors are responsible for spinning the wheels. An engine is a device that converts electrical energy into mechanical energy. &lt;/p&gt;

&lt;p&gt;Encoders allow you to measure the speed of a motor dynamically. &lt;/p&gt;

&lt;p&gt;Microcontrollers are the brains of the robot. All the codes and machine learning workflows required to automate the robot — to tell it what to do — lives embedded inside these microcontrollers. Examples include the Arduino and Raspberry Pi microcontrollers. &lt;/p&gt;

&lt;h3&gt;
  
  
  Communication
&lt;/h3&gt;

&lt;p&gt;Communication is achieved with 4G or 5G WiFi Modules. &lt;/p&gt;

&lt;h1&gt;
  
  
  The ROS Framework
&lt;/h1&gt;

&lt;p&gt;For Route Planning and Navigation, robots can make use of the ROS. ROS provides the Software Development Kit needed to configure the robots to navigate their motion. Being software, ROS requires hardware to run. The hardware is in the form of a computer. Examples of computers that are suitable to run ROS include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NVIDIA’s Jetson Nano&lt;/li&gt;
&lt;li&gt;Raspberry Pi computers&lt;/li&gt;
&lt;li&gt;Laptops and PCs&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ROS Tools and Syntax
&lt;/h3&gt;

&lt;p&gt;Tools used include the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;RVIZ&lt;/li&gt;
&lt;li&gt;Gazebo&lt;/li&gt;
&lt;li&gt;RTQ&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;RVIZ is a visualization tool provided by ROS. It is a GUI interface that lets you visualize big data from sensors and ROS Topics. It also allows the roboticist to create a real-time map of a given space.&lt;/p&gt;

&lt;p&gt;Gazebo is a virtual prototyping tool that roboticists can use to simulate their robotics project without having to spend on acquiring or using hardware. This makes robotics development even more cost-friendly as it nullifies the need for Rapid Prototyping. It helps minimize errors, and maximize accuracy and efficiency in robotics development.&lt;/p&gt;

&lt;p&gt;The RQT Tool is used to visualize the communication between Nodes in a ROS program. With this tool, you can plot messages for communication, monitor data created by a Node on other Nodes. &lt;/p&gt;

&lt;p&gt;ROS programs are broken down into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nodes and child nodes&lt;/li&gt;
&lt;li&gt;Topics&lt;/li&gt;
&lt;li&gt;ROS Master&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ROS nodes are written in C++ and Python; hence a roboticist must know both languages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started with ROS
&lt;/h2&gt;

&lt;p&gt;The best resources for getting started in ROS installation and setup are available on the &lt;a href="https://www.ros.org/blog/getting-started/"&gt;official ROS website&lt;/a&gt;. Every new ROS version is given a new name: at the time of this writing, Foxy Fitzroy is the name for the latest version.&lt;/p&gt;

&lt;p&gt;Follow the guide in the link above to install ROS for your specific operating system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Navigation Stack in ROS
&lt;/h2&gt;

&lt;p&gt;ROS navigation makes it easier for robots to carry out translational motion without issues. Sensors publish information using Nodes and Topics. Nodes interchange information with each other using Topics. ROS provides Nodes that manage the movement of robots using the navigation stack. This is achieved in three steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Perception - collecting data/information using sensors as mentioned above&lt;/li&gt;
&lt;li&gt;Decision Making - the making of decisions using information gotten from the perception stage, based on algorithms&lt;/li&gt;
&lt;li&gt;Actuation - carrying out motors’ decisions to move at specific speed and direction.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Navigation Stack has a more profound and more complex process than is explained here, like Mapping, Sensor Transforms, and Odometry.&lt;/p&gt;

&lt;h3&gt;
  
  
  Who uses ROS and why?
&lt;/h3&gt;

&lt;p&gt;ROS is a set of software libraries that provide tools to build robot applications. It covers the need for drivers, algorithms, dev tools, and visualization/data monitoring tools.&lt;/p&gt;

&lt;p&gt;Companies that use the ROS framework include — but are not limited to — NVIDIA, PAL Robotics, INTEL, AWS, ROBOTIS, FETCH Robotics, DJI, CLEAR-PATH.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where to learn about ROS and Robotics
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Online Robotics Programs in Northwestern University&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Modern Robotics Program is online and free and is taught by Professor Kevin Lynch. The specialization includes topics in the following categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Foundation of Robot Motion&lt;/li&gt;
&lt;li&gt;Robot Kinematics&lt;/li&gt;
&lt;li&gt;Robot Dynamics&lt;/li&gt;
&lt;li&gt;Robot Motion Planning&lt;/li&gt;
&lt;li&gt;Robot Manipulation and Wheeled Mobile Robots&lt;/li&gt;
&lt;li&gt;Capstone Project&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Online Robotics in University of Pennsylvania&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The courses are taught by 6 lecturers, including Vijay Kumar and Daniel Koditschek. The topics in the specialization include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Aerial Robotics&lt;/li&gt;
&lt;li&gt;Computational Motion Planning&lt;/li&gt;
&lt;li&gt;Mobility&lt;/li&gt;
&lt;li&gt;Perception&lt;/li&gt;
&lt;li&gt;Estimation and Learning&lt;/li&gt;
&lt;li&gt;Capstone&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Wiki ROS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://wiki.ros.org"&gt;ROS wiki page&lt;/a&gt; has in-depth and helpful tutorials on ROS. It is the most important website for ROS learning because it has tutorials, examples, and projects.&lt;/p&gt;

&lt;p&gt;Others include MIT Open Courseware on Robotics, MIT’s Introduction to Deep Learning, Robot Programming in the Queensland University of Technology by Peter Corke, and Udacity’s Basics of ROS Applied in Self-Driving Cars.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Now that you have understood what robots are and how the ROS software development kit is useful for developing robotics software applications, you should go on with developing your knowledge of Robotic systems if you haven’t already while learning and applying the ROS framework.&lt;/p&gt;

&lt;p&gt;You can find and build open-source projects on linorobots.org, Arduino.cc, or automaticaddison.com.&lt;/p&gt;

&lt;p&gt;Cheers.&lt;/p&gt;

</description>
      <category>ros</category>
      <category>ai</category>
      <category>robotics</category>
      <category>tinyml</category>
    </item>
    <item>
      <title>Creating Virtual Machines and NGINX Servers on Google Cloud Platform for Go Web Apps</title>
      <dc:creator>MacBobby Chibuzor</dc:creator>
      <pubDate>Sat, 12 Feb 2022 15:23:00 +0000</pubDate>
      <link>https://forem.com/theghostmac/creating-virtual-machines-and-nginx-servers-on-google-cloud-platform-for-go-web-apps-p3b</link>
      <guid>https://forem.com/theghostmac/creating-virtual-machines-and-nginx-servers-on-google-cloud-platform-for-go-web-apps-p3b</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;This article teaches the reader the concept of virtual machines that run on the cloud, their uses, and how to set them up on the Google Cloud Platform.&lt;/p&gt;

&lt;p&gt;The reader might be a web developer looking to get started with Cloud or DevOps engineering on the Google Cloud Platform. &lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites for this course
&lt;/h2&gt;

&lt;p&gt;This article is a practical one, requiring the reader to follow along with the procedures while working on their own computer. Hence, the following are prerequisites for this article:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a personal computer&lt;/li&gt;
&lt;li&gt;a free tier or normal account on GCP with Billing enabled&lt;/li&gt;
&lt;li&gt;working knowledge of Go programming language&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Virtual Machines
&lt;/h1&gt;

&lt;p&gt;The concept of virtual machines is similar to launching a secondary operating system on your computer. Think of it as creating a virtualized version of a computer. The idea is to recreate or mimic everything you can do with your physical computer relating to specific computing functions. &lt;/p&gt;

&lt;p&gt;Example uses of virtual machines include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;creating remote operating systems on your local computer&lt;/li&gt;
&lt;li&gt;connecting temporarily to a network, platform, or system to perform tasks solely exclusive to that platform&lt;/li&gt;
&lt;li&gt;practicing unsafe concepts like pwning a machine, etc&lt;/li&gt;
&lt;li&gt;development and testing environments&lt;/li&gt;
&lt;li&gt;supporting DevOps practices&lt;/li&gt;
&lt;li&gt;enabling workload migrations, etc&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s look at the Go language that we will use for the project in this article.&lt;/p&gt;

&lt;h1&gt;
  
  
  Go
&lt;/h1&gt;

&lt;p&gt;The Go programming language was created in 2007 by Google to solve problems in the area of multicore processors, networking systems, large codebases, computation clusters, and general web development. It has intense dependency management, supports scalable software architecture, and maintains cross-platform robustness.&lt;/p&gt;

&lt;p&gt;Google developed the language to simplify development, eliminate clumsiness during development, control dependency, ease of writing script automation tools, boost code reuse, etc.&lt;/p&gt;

&lt;p&gt;It is logical to work on the Google Cloud Platform with Google’s Go programming language 🙂. You can learn more about &lt;a href="[https://talks.golang.org/2012/splash.article](https://talks.golang.org/2012/splash.article)"&gt;Go at Google here&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Starting the Cloud Shell
&lt;/h1&gt;

&lt;p&gt;First, navigate to the &lt;a href="https://cloud.google.com" rel="noopener noreferrer"&gt;Google Cloud Platform&lt;/a&gt; on your browser. Next, create an account (This article assumes you know how to set up an account comfortably).&lt;/p&gt;

&lt;p&gt;Upon login on the cloud platform, you will be greeted with the following or similar window:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F01h82sf577v5zz4n4tqs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F01h82sf577v5zz4n4tqs.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the search icon in the navigation bar, you will see another icon that symbolizes “Code” or “Terminal,” depending on your familiarity. It has a greater than sign and an underscore: [&lt;code&gt;&amp;gt;_&lt;/code&gt; ].&lt;/p&gt;

&lt;p&gt;Click the icon, and it will spawn a remote terminal just below your current page.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You Can Do On The Google Cloud Shell
&lt;/h2&gt;

&lt;p&gt;The Google Cloud Shell, or &lt;code&gt;gcloud&lt;/code&gt; &lt;code&gt;CLI&lt;/code&gt;, is a useful tool similar to your Git Bash or standard shell. The difference is that it has its own set of commands and functionalities. You can do the following on &lt;code&gt;gcloud CLI&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;creating and managing Compute Engine virtual machine instances and other resources&lt;/li&gt;
&lt;li&gt;deploying App Engine applications&lt;/li&gt;
&lt;li&gt;creating and managing Cloud SQL instances&lt;/li&gt;
&lt;li&gt;managing authentication&lt;/li&gt;
&lt;li&gt;creating and managing Google Kubernetes Engine clusters&lt;/li&gt;
&lt;li&gt;creating and managing Dataproc clusters and jobs&lt;/li&gt;
&lt;li&gt;for Cloud DNS managed zones and record sets&lt;/li&gt;
&lt;li&gt;for Cloud Deployment Manager deployments&lt;/li&gt;
&lt;li&gt;customizing local configuration, etc&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can download the &lt;code&gt;gcloud CLI&lt;/code&gt;  locally or remotely use it on the Compute Engine shell. If you decide to download the CLI to your local computer — especially if you’re going to be using it for long — you should Install the CLI with these &lt;a href="[https://cloud.google.com/sdk/docs/install](https://cloud.google.com/sdk/docs/install)"&gt;instructions.&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Commands
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;gcloud CLI&lt;/code&gt; commands can be run on the Cloud Shell or cloud automation platforms. For example, you could run Cloud Compute commands on Kubernetes Engine to automate it. The four categories of commands for gcloud include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gcloud compute&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gcloud compute instances&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gcloud beta compute&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gcloud alpha app&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These categories support commands that are product- or feature-specific for the Google Cloud Platform. &lt;/p&gt;

&lt;p&gt;Let’s take a look at some basic commands.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Initialize the &lt;code&gt;gcloud CLI&lt;/code&gt; with the following command:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;gcloud init


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;you can display the version of the CLI with the following command:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;gcloud version


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;gcloud CLI&lt;/code&gt; supports the installation of specific components. You can install and update components with the following commands:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;gcloud components &lt;span class="nb"&gt;install&lt;/span&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;gcloud components update


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;List active user account with the following command:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;gcloud auth list


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Check the current project ID with the following command:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;gcloud config list project


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Like other CLI you may have used before, the &lt;code&gt;gcloud CLI&lt;/code&gt; support options and flags too.&lt;/p&gt;

&lt;p&gt;To learn more about the CLI commands on &lt;code&gt;gcloud&lt;/code&gt;, click &lt;a href="[https://cloud.google.com/sdk/docs/cheatsheet](https://cloud.google.com/sdk/docs/cheatsheet)"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Starting a new project on Google Cloud Platform with the &lt;code&gt;gcloud CLI&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;You may be launching the cloud shell only when you want to start a new VM for a project. This way, you can start a VM with the command below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;gcloud compute instances create &amp;lt;project_name&amp;gt; &lt;span class="nt"&gt;--machine-type&lt;/span&gt; &amp;lt;type_of_machine&amp;gt; &lt;span class="nt"&gt;--zone&lt;/span&gt; &amp;lt;a_preferred_zone&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For example, let’s create a project named &lt;code&gt;projtest&lt;/code&gt;. The entire command will be:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;gcloud compute instances create projtest &lt;span class="nt"&gt;--machine-type&lt;/span&gt; n1-standard-2 &lt;span class="nt"&gt;--zone&lt;/span&gt; us-central1-f


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This command spins an instance with the following output:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

Created &lt;span class="o"&gt;[&lt;/span&gt;...projtest].
NAME     ZONE           MACHINE_TYPE  ...    STATUS
projtest us-central1-f  n1-standard-2 ...    RUNNING


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  On Machine Types
&lt;/h3&gt;

&lt;p&gt;When you create a virtual machine instance on the Google Cloud Platform, you are required to choose a machine type that will determine the resources available to your new virtual machine.&lt;/p&gt;

&lt;p&gt;This article created an instance that uses the &lt;code&gt;n1-standard-2&lt;/code&gt; machine type. Nevertheless, you can choose an alternative like nq-highmem-4 or n1-highcpu-4 machine types. You can even &lt;a href="[https://cloud.google.com/compute/docs/instances/creating-instance%20ith-custom-machine-type](https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type)"&gt;create your machine type&lt;/a&gt;. There are machine series and family categories in the Google Cloud Platform, and you can learn about them &lt;a href="[https://cloud.google.com/compute/docs/machine-types](https://cloud.google.com/compute/docs/machine-types)"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Also, you can use the GUI to create a new VM instance. by following these procedures:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click the &lt;strong&gt;Navigation Menu&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Compute Engine&lt;/strong&gt; and select &lt;strong&gt;VM Instances&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Instance&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Configure every parameter in your preferred way&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It is advisable to &lt;a href="[https://cloud.google.com/compute/docs/instances/connecting-to-instance](https://cloud.google.com/compute/docs/instances/connecting-to-instance)"&gt;setup an instance using ssh&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, let’s see what an NGINX web server is and how to install it on the Google Cloud Platform.&lt;/p&gt;
&lt;h1&gt;
  
  
  Installing an NGINX web server on Google Cloud Platform
&lt;/h1&gt;

&lt;p&gt;The NGINX (pronounced “Engine X”) webserver is among the most popular and widely used web servers in cloud/web development. Nginx runs about 30% of the web servers in the world, and is seeing more adoption. Like every other web server software, NGINX runs on top of an operating system. The operating system runs on physical hardware. You can have NGINX installed on your local machine, or on the Google Cloud Platform.&lt;/p&gt;

&lt;p&gt;// more about NGINX servers&lt;/p&gt;
&lt;h2&gt;
  
  
  Installing an NGINX webserver
&lt;/h2&gt;

&lt;p&gt;Navigate to the console and run the following command to get root access:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;su -


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Next, update your selected operating system with the following command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;apt-get update


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The following or similar output will be generated:&lt;/p&gt;

&lt;p&gt;(image)&lt;/p&gt;

&lt;p&gt;Now, install NGINX on your console with this command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

apt-get &lt;span class="nb"&gt;install &lt;/span&gt;nginx &lt;span class="nt"&gt;-y&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can confirm that NGINX is appropriately set up on your console with the command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;ps auwx | &lt;span class="nb"&gt;grep &lt;/span&gt;nginx


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The following or similar output will be generated:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

root      2320  0.0  0.0 175532  1748 ?        Ss   14:06   0:00 nginx: master process /usr/sbin/nginx &lt;span class="nt"&gt;-g&lt;/span&gt; daemon on&lt;span class="p"&gt;;&lt;/span&gt; master_process on&lt;span class="p"&gt;;&lt;/span&gt;
www-data  2321  0.0  0.0 159924  3004 ?        S    14:06   0:00 nginx: worker process
www-data  2322  0.0  0.0 154874  3114 ?        S    14:06   0:00 nginx: worker process
root      2332  0.0  0.0  19680   758 pts/0    S+   14:07   0:00 &lt;span class="nb"&gt;grep &lt;/span&gt;nginx


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You have successfully installed an NGINX web server on your GCP VM instance.&lt;/p&gt;

&lt;p&gt;Next, let’s create a basic Go web app on a Google Cloud Platform Virtual Machine instance.&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating a Basic Web App with Go on a Virtual Machine
&lt;/h1&gt;

&lt;p&gt;To build a Go web app on top of Google Cloud Platform, we will utilize our just learned knowledge of the &lt;code&gt;gcloud CLI&lt;/code&gt; and others.&lt;/p&gt;

&lt;p&gt;First, open the &lt;a href="[https://console.cloud.google.com/appengine?cloudshell=true&amp;amp;_ga=2.208983890.191663363.1644651489-465190043.1644651489](https://console.cloud.google.com/appengine?cloudshell=true&amp;amp;_ga=2.208983890.191663363.1644651489-465190043.1644651489)"&gt;Google Cloud Shell&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Next, create a project in the &lt;a href="[https://console.cloud.google.com/projectselector2/home/dashboard?_ga=2.134724273.191663363.1644651489-465190043.1644651489](https://console.cloud.google.com/projectselector2/home/dashboard?_ga=2.134724273.191663363.1644651489-465190043.1644651489)"&gt;Project Selector&lt;/a&gt; page on GCP.&lt;/p&gt;

&lt;p&gt;After this, you need to enable the GCP Cloud Build API using the following procedure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;Navigation Menu&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click on the &lt;strong&gt;APIs &amp;amp; Services,&lt;/strong&gt; select &lt;strong&gt;Library,&lt;/strong&gt; then search for the &lt;strong&gt;Cloud Build API&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Enable&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To enable billing, you need to have a free tier account if you’re not using GCP professionally.&lt;/p&gt;

&lt;p&gt;Afterward, you will install and initialize the &lt;code&gt;gcloud CLI&lt;/code&gt; if you didn’t before. Running the following command will create an app engine that will provide the needed resources to develop and maintain your app.&lt;/p&gt;

&lt;p&gt;To start the web app, you need to run the following command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;gcloud app create


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After this, you can start your web app directly by creating a directory that will contain a yaml file and your Go source file.&lt;/p&gt;

&lt;p&gt;The yaml file is what will initialize the Go environment to run your application. Without a yaml file, no application project will run.&lt;/p&gt;

&lt;p&gt;Thus, we create an &lt;code&gt;app.yaml&lt;/code&gt; file in the directory and the &lt;code&gt;main.go&lt;/code&gt; source file. Your basic web application code will reside in the source file.&lt;/p&gt;

&lt;p&gt;To deploy the web application on the App engine, run the following command:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;gcloud app deploy


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can view your new web application if it is done right by running the following command:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;p&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;gcloud app browse&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Conclusion&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;In this article, we learned about Virtual Machines and their uses. Next, we looked at the Go programming language and why it was created by Google. We further learned how to start a Cloud Shell session on the Google Compute Engine as a Virtual Machine instance. Furthermore, we looked at NGINX web servers and how to install and spawn them in the Cloud. &lt;/p&gt;

&lt;p&gt;In a future article, we will build a web app in Go, putting all we have learned here into practice. We will build a proper Go application, learn how to structure a complete codebase for a project on GCP, and finally deploy the web app on the App Engine. &lt;/p&gt;

&lt;p&gt;See you soon!&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloud</category>
      <category>go</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Get Smarter About Smart Contracts</title>
      <dc:creator>MacBobby Chibuzor</dc:creator>
      <pubDate>Sun, 06 Feb 2022 08:24:28 +0000</pubDate>
      <link>https://forem.com/theghostmac/get-smarter-about-smart-contracts-5e4m</link>
      <guid>https://forem.com/theghostmac/get-smarter-about-smart-contracts-5e4m</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;This article is an unusual introduction to smart contracts, Solidity, and Blockchain. &lt;br&gt;
You will add to your knowledge about Smart Contracts, their building languages, development environment, vulnerabilities in smart contracts, and the syntax of contract-specific languages.&lt;/p&gt;
&lt;h1&gt;
  
  
  Smart Contracts - What's Smart About Them?
&lt;/h1&gt;

&lt;p&gt;Smart contracts are pieces of computer software or a transaction protocol intended to execute automatically, control, or document legally relevant events and actions according to the terms of a contract or an agreement.&lt;br&gt;
They are considered smart, perhaps due to their self-executing nature.&lt;/p&gt;
&lt;h1&gt;
  
  
  On Choosing a Language to Author a Smart Contract
&lt;/h1&gt;

&lt;p&gt;Solidity is the most popular language for authoring smart contracts. However, there are other Ethereum-specific languages that are compatible with the Ethereum Virtual Machine. They include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Serpent&lt;/li&gt;
&lt;li&gt;Vyper (a close competitor to Solidity)&lt;/li&gt;
&lt;li&gt;Bamboo&lt;/li&gt;
&lt;li&gt;LLL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The EVM is rigid, hence the importance of sticking with languages that are specifically built for author smart contracts. Why were they built in the first place? It's relatively easy building a specific-purpose language from scratch compared to hammering and bending a general-purpose language to suit the needs of the EVM.&lt;/p&gt;

&lt;p&gt;If you are interested in using a high-level, general-purpose language for smart contracts, you must choose between Golang and Rust. Reasons include Rust being the language for the Party client and Golang, the Geth client.&lt;/p&gt;
&lt;h1&gt;
  
  
  Tools for Authoring Smart Contracts
&lt;/h1&gt;

&lt;p&gt;Setting up your Development environment for smart contracts development is not a specific process. The following are tools you may require:&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Remix IDE
&lt;/h3&gt;

&lt;p&gt;Remix is a powerful, open-source tool that helps you write Solidity contracts straight from the browser. Written in JavaScript, Remix supports both usage in the browser and locally.&lt;br&gt;
Remix also supports testing, debugging, deploying smart contracts, and much more.&lt;br&gt;
You can read further about Remix in the &lt;a href="https://remix.readthedocs.io/en/latest/"&gt;official documentation.&lt;/a&gt; You can also download &lt;a href="https://remix.ethereum.org/"&gt;Remix&lt;/a&gt; here.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Truffle Framework
&lt;/h3&gt;

&lt;p&gt;Truffle is a world class development environment, testing framework and asset pipeline for blockchains using the Ethereum Virtual Machine (EVM), aiming to make life as a developer easier.&lt;br&gt;
You can learn further about Truffle from the [official documentation.](&lt;a href="https://truffleframework.com/docs/truffle/overview"&gt;https://truffleframework.com/docs/truffle/overview&lt;/a&gt;] You can also get &lt;a href="https://truffleframework.com/"&gt;Truffle&lt;/a&gt; here.&lt;/p&gt;
&lt;h3&gt;
  
  
  3. Embark Framework
&lt;/h3&gt;

&lt;p&gt;Embark is a fast, easy to use, and powerful developer environment to build and deploy decentralized applications, also known as “DApps”. It integrates with Ethereum blockchains, decentralized storages like IPFS and Swarm, and decentralized communication platforms like Whisper.&lt;/p&gt;

&lt;p&gt;Embark’s goal is to make building decentralized applications as easy as possible, by providing all the tools needed and staying extensible at the same time.&lt;br&gt;
You can read further in the &lt;a href="https://embark.status.im/docs/"&gt;official documentation.&lt;/a&gt; You can also get &lt;a href="https://embark.status.im/"&gt;Embark&lt;/a&gt; here.&lt;/p&gt;
&lt;h1&gt;
  
  
  Greeting the Blockchain in .sol
&lt;/h1&gt;

&lt;p&gt;It is a common tradition to print out “Hello World” in Web2. Whoever invented that rule should accept the Decentralization gospel. &lt;br&gt;
We are going to print out “Hello Blockchain” in Solidity in comparison to other languages. We will also learn the basic structure of a contract.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pragma solidity ^0.8.10;

contract HelloWorld {
    string public greet = "Hello World!";
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Dissecting Solidity Code with Solidness
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;



```pragma```

 is the compulsory first word in the first line of code within any Solidity file.

 ```pragma```

 is a directive that specifies the version of Solidity compiler to be used for current Solidity file.

### 2.

 ```Solidity ^0.8.10;```


Solidity is a new language and is subject to continuous improvement on an on-going basis. Thus, there are older and newer versions and you could set a range of compiler version with this syntax:



```Solidity
pragma solidity &amp;gt;= ^0.5.0 &amp;lt; 0.9.0;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means that any version between that range can run/compile the Solidity source file.&lt;/p&gt;

&lt;h3&gt;
  
  
  3.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

As stated earlier, Solidity is created to be EVM-Compatible. It is a contract-specific language. A smart contract is a set of functions that does stuff. Thus, in-between the

 ```contract Name{ }```

 tags, there are other properties, including functions, data types, and technically every other thing you have in a normal object oriented language.

### 4.

 ```public```


The

 ```public```

 keyword signifies functions that can be called internally and externally, by any one. 

# Greeting the Blockchain in .vy
Let's greet the rest of the Web3 world again, but this time, with Vyper.



```Python
# @version ^0.2.0

greet: public(String[100])

@external
def __init__():
      self.greet = "Hello Blockchain"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Dissecting Vyper Code without a Bite
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

You can instantly tell that it means the version of the current Vyper source file.
### 2.

 ```greet```


A public variable named greet is declared as a string data types, and initialized with a max length of 100.
### 3.

 ```@external```


Despite that the contract is set to public, the

 ```@external```

 keyword is repeated. What this means is that the function below it can only be called via transactions or other smart contracts.

....

After comparing these languages, you will notice that Solidity is JavaScript influenced, while Vyper is... you guessed right, Python influenced.

Why build Vyper when Solidity is in high demand and adoption?

# Coming to terms with the Vyper
A [research was conducted in 2018](https://arxiv.org/pdf/1802.06038.pdf), where roughly one million deployed Ethereum Smart Contracts were analyzed. The research uncovered vulnerabilities in these smart contracts. The researchers grouped these vulnerabilities into threw: for ease of identification:
- *Suicidal Contracts* - smart contracts that arbitrary addresses can kill.
- *Greedy Contracts* - smart contracts in a state where they can no longer release ether
- *Prodigal Contracts* - Smart contracts that can be made to release ether to arbitrary addresses.
What's common among these vulnerabilities? 
They are introduced to the smart contracts via code. It could be unintentional from the developer, but regardless, these vulnerabilities have the potential to cause unexpected loss in funds for users. 
That's why Vyper was built. It tries to eliminate this by letting users write secure code and making it difficult for programmers to write misleading or vulnerable code accidentally. 

# Conclusion
This article introduced you to smart contracts. You learned about languages used in writing smart contracts, comparing the two most adopted ones. Next, you see how contracts are written in both languages and what each beginning term stands for. 
Perhaps you concluded on a choice of language for authoring your smart contracts already; however, do put the findings from this article into consideration.


### Did you enjoy this article?
Follow me here and on [Twitter](twitter.com/ghostmac9).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>web3</category>
      <category>solidity</category>
      <category>blockchain</category>
      <category>smartcontracts</category>
    </item>
    <item>
      <title>Understanding and Building Authentication Sessions in Golang</title>
      <dc:creator>MacBobby Chibuzor</dc:creator>
      <pubDate>Sun, 06 Feb 2022 07:57:13 +0000</pubDate>
      <link>https://forem.com/theghostmac/understanding-and-building-authentication-sessions-in-golang-1c9k</link>
      <guid>https://forem.com/theghostmac/understanding-and-building-authentication-sessions-in-golang-1c9k</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The Authentication Session of a web app is the heart of it's defense against malicious threats. Hence, it is among the first point of recon for a security tester.&lt;br&gt;
In this article, the Go developer will be enlightened on the authentication sessions of a web app, vulnerabilities and design flaws in authentication sessions, the difference between Session-Based and Token-Based Authentication methods, and when to apply each. &lt;br&gt;
Example use cases for both methods are also given.  &lt;/p&gt;
&lt;h1&gt;
  
  
  Authentication Sessions
&lt;/h1&gt;

&lt;p&gt;A web application’s Authentication protocol is in sessions. The procedure follows like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A client sends an authentication request to the log in session of the web app&lt;/li&gt;
&lt;li&gt;The web app receives it and sends to the web server&lt;/li&gt;
&lt;li&gt;The web server matches it with existing credentials&lt;/li&gt;
&lt;li&gt;The web server returns a cookie if a match is found, and then the relevant REST API is called to the needed page. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When web developers build authentication mechanisms, they often rely on either of these methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using HTML forms&lt;/li&gt;
&lt;li&gt;Using Multifactor mechanisms&lt;/li&gt;
&lt;li&gt;Client SSL-Certificates&lt;/li&gt;
&lt;li&gt;HTTP authentication&lt;/li&gt;
&lt;li&gt;Authentication Services&lt;/li&gt;
&lt;li&gt;JSON Web Tokens&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's take a look at each of these methods and what they imply.&lt;/p&gt;
&lt;h2&gt;
  
  
  Using HTML Forms
&lt;/h2&gt;

&lt;p&gt;HTML forms are the most common methods of authenticating web applications, where username and password are collected and submitted to the application. This mechanism accounts for well over 90% of applications available on the internet.&lt;/p&gt;
&lt;h2&gt;
  
  
  Using Multifactor Mechanisms
&lt;/h2&gt;

&lt;p&gt;In platforms where more security is required, like in online payment systems, a multistage form filling session is initiated, and users are mandated to provide additional credentials. In banking apps, physical tokens are often required. These tokens typically produce a stream of one-time passcodes (OTPs) or provide challenges that require input from the user. &lt;br&gt;
The rule of thumb is to make use of OTPs for highly sensitive data.&lt;/p&gt;
&lt;h2&gt;
  
  
  Client SSL-Certificates
&lt;/h2&gt;

&lt;p&gt;Some web apps make use of SSL Certificates or cryptographic mechanism. The process involves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Purchasing and/or Generating a Client Authentication Certificate.&lt;/li&gt;
&lt;li&gt;Completing the Validation Process.&lt;/li&gt;
&lt;li&gt;Downloading or Exporting the User's Client Certificate.&lt;/li&gt;
&lt;li&gt;Importing the Client Authentication Certificate to OS &amp;amp; Browser Certificate Stores. &lt;/li&gt;
&lt;li&gt;Configuring the Server to Support Client Authentication.&lt;/li&gt;
&lt;li&gt;Testing the Certificate to Ensure It Works.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  HTTP Authentication
&lt;/h2&gt;

&lt;p&gt;HTTP based authentication is extremely rare in internet adoption. It is used more on intranet basis. It the most basic form of authentication. In HTTP authentication, client login credentials are sent in the request headers with each request like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Authorization: Basic &lt;span class="nv"&gt;YWxqY2U6cGE2NXdbcmQ&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Basic authentication doesn't use encryption on username and password. As such, it's application is limited to cases where there is low value data, and need for easy access. &lt;br&gt;
Even at that, it is advisable to use it:&lt;br&gt;
-On HTTPS connections&lt;br&gt;
-With really strong passwords&lt;br&gt;
-With rate limiting added to prevent brute forcing attacks&lt;/p&gt;
&lt;h2&gt;
  
  
  Authentication Services
&lt;/h2&gt;

&lt;p&gt;Authentication services are gaining weight in terms of application and credibility. A popular and widely used authentication and authorization service is the Auth0. &lt;a href="//auth0.com"&gt;Auth0&lt;/a&gt; is an easy to implement, adaptable authentication and authorization platform that has gain wide popularity and use among developers. &lt;/p&gt;
&lt;h2&gt;
  
  
  JSON Web Tokens
&lt;/h2&gt;

&lt;p&gt;JWT, or JSON Web Token, is an open standard authentication protocol used to share security information between two parties — a client and a server. The client credentials are not stored to the server in this case, but transferred back to the client for safekeeping and reuse.&lt;/p&gt;
&lt;h1&gt;
  
  
  Vulnerabilities in Authentication Sessions
&lt;/h1&gt;

&lt;p&gt;The vulnerabilities and attacks that are possible in HTML forms will most likely work in other methods of authentication, albeit with a little upgrade. &lt;br&gt;
Let's take a look at design flaws that can be exploited in an attack.&lt;/p&gt;
&lt;h2&gt;
  
  
  Design Flaws in Web Applications
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. Weak Passwords
&lt;/h3&gt;

&lt;p&gt;Weak Passwords are a thing in this era, still. They take the form of short passwords, predictable words, user’s name that can be easily gotten through social engineering, words or names with obvious symbols representing vowels, etc.&lt;/p&gt;
&lt;h3&gt;
  
  
  Exploitation:
&lt;/h3&gt;

&lt;p&gt;The first thing hackers do is to attempt logging into the web application and taking note of the rules specified by the software in filling password boxes. &lt;/p&gt;
&lt;h3&gt;
  
  
  2. Password Change Functionality
&lt;/h3&gt;

&lt;p&gt;Web developers often fail to provide password change Functionality in their apps. This feature is very important in web apps, though, for two especial reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For the user to quickly change their password when they detect malicious activity&lt;/li&gt;
&lt;li&gt;For periodic testing, and validation of a password change session&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The flaws in web apps that don't use a Password Change Functionality include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verbose error messages&lt;/li&gt;
&lt;li&gt;Allowing unrestricted guessing in the existing password field&lt;/li&gt;
&lt;li&gt;Matching “new password” and “confirm new password” fields only after validating the existing password&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Other design flaws in authentication sessions are present in the Forgotten Password Functionality, Remember Me Functionality, and Invalid Credentials Functionality&lt;br&gt;
Let's learn how to build authentication sessions in Go.&lt;/p&gt;
&lt;h2&gt;
  
  
  Basic HTTP Authentication in Golang
&lt;/h2&gt;

&lt;p&gt;As explained earlier, the basic HTTP authentication method is not the safest. However, it can be implemented with hashing in the following way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;basicAuth&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandlerFunc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandlerFunc&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandlerFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BasicAuth&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;usernameHash&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;sha256&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sum256&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="n"&gt;passwordHash&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;sha256&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sum256&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
              &lt;span class="n"&gt;expectedUsernameHash&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;sha256&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sum256&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
              &lt;span class="n"&gt;expectedPasswordHash&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;sha256&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sum256&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="n"&gt;usernameMatch&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;subtle&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ConstantTimeCompare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;usernameHash&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;expectedUsernameHash&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
              &lt;span class="n"&gt;passwordMatch&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;subtle&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ConstantTimeCompare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;passwordHash&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;expectedPasswordHash&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;usernameMatch&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;passwordMatch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ServeHTTP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"WWW-Authenticate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;`Basic realm="restricted", charset="UTF-8"`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Unauthorized"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusUnauthorized&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is important to emphasize that the username and password are not being hashed for the purpose of storage. They are hashed to get two equal-length byte slices that can be compared in constant-time. &lt;br&gt;
In using this method of HTTP Basic Authentication, the imported packages include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"crypto/sha256"&lt;/span&gt;
    &lt;span class="s"&gt;"crypto/subtle"&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"log"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
    &lt;span class="s"&gt;"os"&lt;/span&gt;
    &lt;span class="s"&gt;"time"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An application instance of struct type should be created to contain the username and password:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;application&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The main function will contain the entire operations and the server instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;webapp&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nb"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;webapp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"AUTH_USERNAME"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;webapp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"AUTH_PASSWORD"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;webapp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Illegal username provided"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;webapp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Illegal password provided"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;mux&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewServeMux&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;mux&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/unprotected"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;webapp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unprotectedHandler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;mux&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/protected"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;webapp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;basicAuth&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;protectedHandler&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="n"&gt;srv&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Server&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Addr&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;         &lt;span class="s"&gt;":8080"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Handler&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;      &lt;span class="n"&gt;mux&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;IdleTimeout&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;  &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Minute&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;ReadTimeout&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;  &lt;span class="m"&gt;10&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;WriteTimeout&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"starting server on %s"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;srv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Addr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;srv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ListenAndServeTLS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"./localhost.pem"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"./localhost-key.pem"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Fatal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Session-Based Authentication Session in Golang
&lt;/h1&gt;

&lt;p&gt;Session-Based authentication systems are often used in web apps that implement server side templating. OAuth and OpenID could be added to further secure the application.&lt;br&gt;
In Golang, the popular&lt;br&gt;
&lt;br&gt;
&lt;code&gt;Gorilla Mux&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 package has a&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 package that can be used to create authentication sessions.
Hence, the first step in creating an authentication session is to install the

 ```gorilla/mux```

 and

 ```gorilla/sessions```

 packages.



```Shell
go get github.com/gorilla/mux
go get github.com/gorilla/sessions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After this, create a local directory for the project. &lt;br&gt;
Next, import the&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 package as well as other important packages.



```Go
package main
import (
    "log"
    "net/http"
    "os"
    "time"
    "github.com/gorilla/mux"
    "github.com/gorilla/sessions"
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Seeing that we are creating session-based authentication for API endpoints, we will create a cookie store using the&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 method in the sessions package we imported.



```Go
var store =sessions.NewCookieStore([]byte(os.Getenv("SESSION_SECRET")))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Assuming we are logging into a dashboard, then the necessary API endpoints are:&lt;/p&gt;

&lt;p&gt;-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

-

 ```/dashboard```


-

 ```/logout```



There will be a list of users having their own dashboards, so the server must have a map it can search for yours in. Initializing an example user credentials:



```Go
var users = map[string]string{
    "Mac":   "username",
    "admin": "password"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A login handler function would be responsible for the client's request, credential matching, and return of the /dashboard endpoint.&lt;br&gt;
The function will initially parse the POST form. Then, it will retrieve the client's credentials.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;LoginHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ParseForm&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Please pass the data as URL form encoded"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusBadRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;PostForm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;PostForm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The function is also going to match the collected data with the ones stored in the server. The function will authenticate an existing match, and return error when there's no match.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;//continued in the LoginHandler function&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;originalPassword&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"session.id"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;originalPassword&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Values&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"authenticated"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
        &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Invalid Credentials"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusUnauthorized&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"User is not found"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StatusNotFound&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Logged In successfully"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The login either succeeds or not, depending on the availability of the client on the server’s credential store.&lt;br&gt;
The log out session, on the other hand, receives a GET request and turns the&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 method to false.



```Go
func LogoutHandler(w http.ResponseWriter, r *http.Request) {
    session, _ := store.Get(r, "session.id")
    session.Values["authenticated"] = false
    session.Save(r, w)
    w.Write([]byte(""))
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 method saves the cookie state after modification. 
Next, it is important to create the

 ```/dashboard```

 API endpoint. The

 ```/dashboard```

 function would return the time of login:



```Go
func DashboardHandler(w http.ResponseWriter, r *http.Request) {
    session, _ := store.Get(r, "session.id")
    if (session.Values["authenticated"] != nil) &amp;amp;&amp;amp; session.Values
    ["authenticated"] != false {
        w.Write([]byte(time.Now().String()))
    } else {
        http.Error(w, "Forbidden", http.StatusForbidden)
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After we finished writing the endpoints, the next step is to write the&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 function. This function will connect and start up all endpoints, and the server at an open port:



```Go
main() {
    server := mux.NewRouter().StrictSlash(True)
    server.HandleFunc("/login", LoginHandler)
    server.HandleFunc("/dashboard", DashboardHandler)
    server.HandleFunc("/logout", LogoutHandler)
    http.Handle("/", server)
    srv := &amp;amp;http.Server{
        Handler: server,
        Addr:    "127.0.0.1:8080",
        // Good practice: enforce timeouts for servers you create!
        WriteTimeout: 15 * time.Second,
        ReadTimeout:  15 * time.Second,
    }
    log.Fatal(srv.ListenAndServe())
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This completes the secure authentication session. Running the command&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;go run main.go&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 starts the server at &lt;em&gt;localhost:8080.&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Token-Based Authentication Session in Golang
&lt;/h1&gt;

&lt;p&gt;One of the downsides of this token- or session-based authentication system is that it stores credentials to the program memory or on a special server software like Redis.&lt;br&gt;
However, JWT poses a solution to this. What JWT does is to resend the login credentials to the client to store in a database. The entire procedure is explained below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client sends login credentials as a POST request to the login API endpoint&lt;/li&gt;
&lt;li&gt;The server authenticates the details and, if successful, it generates a JWT&lt;/li&gt;
&lt;li&gt;The server returns this to instead of creating a cookie. It becomes the client's responsibility to store this
token&lt;/li&gt;
&lt;li&gt;Since the client is in charge of the token, it needs to add this in the headers section to make subsequent REST API calls&lt;/li&gt;
&lt;li&gt;The server checks the JWT from the header and if it is successfully decoded, the server authenticates the client
For RESTful APIs, token-based authentication is the best and recommended approach given that it is stateless.
In creating a JWT Token-Based session with go, the

&lt;code&gt;jwt-go&lt;/code&gt;

package will be imported. It has a NewWithClaims method that accepts a signing method and a claims map. 
A great guide on implementing JWT with Go is available on &lt;a href="https://auth0.com/blog/authentication-in-golang/"&gt;Auth0 blog&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;At this point, the reader should be aware of what authentication sessions are under the covers, the kind of vulnerabilities possible in authentications, popular options in authenticating web apps, and the difference and ways to write session- and token-based authentication sessions.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A walk around the block: Blockchain and Web3.0</title>
      <dc:creator>MacBobby Chibuzor</dc:creator>
      <pubDate>Sat, 05 Feb 2022 21:42:33 +0000</pubDate>
      <link>https://forem.com/theghostmac/a-walk-around-the-block-blockchain-and-web30-4h94</link>
      <guid>https://forem.com/theghostmac/a-walk-around-the-block-blockchain-and-web30-4h94</guid>
      <description>&lt;h1&gt;
  
  
  introduction
&lt;/h1&gt;

&lt;p&gt;In the tech space, new technologies buzz now and then. Given the nature of developers, learning about these new trends is essential, mainly if you belong to a network of developer friends or are looking to transition into something new and more challenging.&lt;/p&gt;

&lt;p&gt;The rave of the moment is Web3 and Blockchain, and this article will put you in the know about these things. This writeup offers you a walk around the block, literally taking you from the meaning of important terms, through facts about Web3, to ways in which you can transition from wherever you are to Blockchain development.&lt;/p&gt;

&lt;p&gt;At the end of this article, you will know every neighborhood in and around the block - literally. You'll know enough to decide whether to get into blockchain development or not, whether you should adopt blockchain in your next project or not, and how to become a blockchain developer should you choose to enter the space.&lt;/p&gt;

&lt;h1&gt;
  
  
  blockchain, smart contracts, and the web3 - who are these guys?
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Web3.0
&lt;/h2&gt;

&lt;p&gt;Web 3.0 is the third generation of the internet featuring web apps that are able to process information in a smart human-like way through technologies like machine learning (ML), Big Data, decentralized ledger technology (DLT), etc. Web 3.0 was originally termed the Semantic Web by Tim Berners-Lee, and was portrayed to be an autonomous, intelligent, and open internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Blockchain
&lt;/h2&gt;

&lt;p&gt;A ledger is essentially a list of transactions. You could think of it as a database, but a database is different from a ledger. In a ledger, we can only append new transactions, whereas, in a database, we have the ability to append, modify, and delete transactions. A database can be used to implement a ledger, but it doesn't work the other way round.&lt;br&gt;
A blockchain is a data structure used to create a decentralized ledger.  A blockchain consists of blocks that are chained in a serial manner. A block contains: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a set of transactions&lt;/li&gt;
&lt;li&gt;a hash of the previous block&lt;/li&gt;
&lt;li&gt;timestamp indicating when the block was created&lt;/li&gt;
&lt;li&gt;block reward&lt;/li&gt;
&lt;li&gt;block number, and so on. 
Every block contains a hash of the previous block, thus making a chain of blocks linked with each other. Every node in the network holds a copy of the blockchain.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Smart Contracts
&lt;/h2&gt;

&lt;p&gt;Now, smart contracts aren't smart, no. And they aren't legal contracts either. Think of them as the Web3 version of your business logic or controller in Web2. Smart contracts are pieces of code that execute based on external input. They validate the input and run the business logic they were built for.&lt;/p&gt;

&lt;p&gt;The advantages of smart contracts over normal controllers is this: a smart contract runs exactly as programmed without any possibility of downtime, censorship, fraud, and third-party interference.&lt;/p&gt;

&lt;h1&gt;
  
  
  are they the rich kids?
&lt;/h1&gt;

&lt;p&gt;If, by rich kids, you mean whether blockchain development is lucrative, then yes, it is! On CNBC for example, Blockchain developers were estimated to have salaries between $150 000 - $175 000. &lt;br&gt;
A senior blockchain developer could make as much as $1 000 000 per year, as was proposed in a &lt;a href="https://www.linkedin.com/posts/josephmiscioscia_smartcontract-smartcontracts-defiprojects-activity-6894361825605955584-Z8LY/"&gt;viral LinkedIn job post.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In as much as money is a big factor in motivating virtually all developers to get into new niches, consideration for usefulness and passion for work must be reflected on. &lt;/p&gt;

&lt;h1&gt;
  
  
  wow, I want to be friends! how can I?
&lt;/h1&gt;

&lt;p&gt;Do you mean whether you too can become a blockchain developer? Sure, why not?! You need only to learn the tools and concepts, and you'll be fine. If you are curious whether it is worth venturing into Web3, you might want to consider these facts:&lt;br&gt;
The Internet is evolving, just like every other technology. From Web1.0, we saw the power and usefulness of Web2.0. The truth is Web2 will not always be the only way to build web applications. This is very much true for FinTechs. &lt;br&gt;
The whole Web3 space is buzzing at the time of this writing; if you are in any tech community, chances are you have come across the term or a developer in it.&lt;br&gt;
Blockchain has promising potential to be the future of the web. Well, why not? It has seen wild adoption in both new and old FinTechs companies alike and even tech giants like Google and Facebook are pioneers.&lt;br&gt;
&lt;em&gt;Pro tip:&lt;/em&gt; Since blockchain is still in its early stages and not older than ten years, give or take, you can pick up Web3 skills even faster than Web2 skills if you're just starting out. &lt;/p&gt;

&lt;h1&gt;
  
  
  where are the parks and malls?
&lt;/h1&gt;

&lt;p&gt;Well, in this block, the parks are fun/practical focused websites, and the malls are EdTech companies that offer free or paid tutorials and trainings on Web3 related technologies. Excellent points of call for upskilling include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="//app.buildspace.so"&gt;Buildspace&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="//web3.university"&gt;Web3 University&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="//moralis.io"&gt;Moralis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="//useweb3.xyz"&gt;UseWeb3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="//cryptozombies.io"&gt;CryptoZombies&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It doesn't matter which one you pick, just pick one and start learning. You most likely will end up Googling for more videos, books, tutorials, etc., depending on your best learning methods.&lt;/p&gt;

&lt;h1&gt;
  
  
  where's the bank at?
&lt;/h1&gt;

&lt;p&gt;Concerning where you can cash out on your blockvhsin skills, many companies are sourcing for blockchain talents - even Google recently moved into the neighborhood. In this block you can make money from either of the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hackathons&lt;/li&gt;
&lt;li&gt;Contract projects&lt;/li&gt;
&lt;li&gt;Full time roles
You can find cryptocurrency jobs &lt;a href="https://cryptocurrencyjobs.co/"&gt;here&lt;/a&gt;, on &lt;a href="https://consensys.net/open-roles/"&gt;Consensys&lt;/a&gt;, on &lt;a href="//angel.co"&gt;angelList&lt;/a&gt;, or on &lt;a href="https://jobs.lever.co/Uniswap"&gt;Uniswap&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  how do I keep up with the joneses?
&lt;/h1&gt;

&lt;p&gt;There are a rife of technologies and concepts to learn, but this shouldn't warrant worries in your mind. There are fantastic resources - both free and paid - that will get you up to speed in these technologies, leaving your self-discipline as the only unreliable factor in this block.&lt;br&gt;
The learning path and developmental process for web3 is different from the traditional web2&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In web2, an action in the form of HTTP requests is sent to a web server, but in web3, users send transactions to a blockchain. &lt;/li&gt;
&lt;li&gt;In web2, data is queried from a centralized data store, but in web3, the data store is a decentralized ledger called the blockchain.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Exemplary differences are not limited to these alone, but they should paint a clearcut picture in your mind. &lt;br&gt;
Technologies and neighborhood slangs you need to know about to get into blockchain development include:&lt;/p&gt;

&lt;h3&gt;
  
  
  Blockchain Basics
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Blockchain and types&lt;/li&gt;
&lt;li&gt;Consensus Mechanisms and types&lt;/li&gt;
&lt;li&gt;Smart Contracts and examples&lt;/li&gt;
&lt;li&gt;Gas and Transactions 
### Cryptography&lt;/li&gt;
&lt;li&gt;Encryption and Decryption&lt;/li&gt;
&lt;li&gt;Public and Private Key Encryption &lt;/li&gt;
&lt;li&gt;Hash functions&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Digital Signatures&lt;/p&gt;
&lt;h3&gt;
  
  
  Programming Languages
&lt;/h3&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Solidity:&lt;/em&gt; Solidity was modeled after JavaScript to promote ease of transition for JS developers. Solidity is used for Ethereum client dApps and smart contracts, and is the most in-demand skill in the Web3 space.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Rust:&lt;/em&gt; Rust is a C/C++-inspired language used for Solana client dApps and smart contracts. The Parity client was written in Rust.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;JavaScript:&lt;/em&gt; As the popular language of the web, JavaScript has libraries that are particularly tailored for Web3. Examples include Etheruem.js, Three.js, Ethers.js, Web3.js, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Golang:&lt;/em&gt; The powerful Go language has shown dexterity in the web3 niche also. For example, the Geth client was written in Go.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;.NET:&lt;/em&gt; The .NET framework is not left out. You can easily integrate Ethereum blockchain into your .NET applications using Nethereum.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;C++:&lt;/em&gt; C++ mainly qualifies for protocol development - you can never go wrong with the language.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Python:&lt;/em&gt; Given its popularity and ease of use, Python has also seen adoption in Web3. The pyethereum project is an example, as well as the web3.py project. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  conclusion - counting the costs
&lt;/h1&gt;

&lt;p&gt;At this point, you've seen and understood everything that's worth seeing and knowing to get started in Blockchain. Is it worth getting into this block? That's for you to decide. &lt;br&gt;
If you were in the FinTech space, you may find it somewhat enticing to settle down here. If you have the time and effort to learn a new set of tools and technologies that will prolly build the future of the internet, then, why not?&lt;br&gt;
As more companies declare their emergence into Web3, even more, will enter as a means of survival. What that means for developers is more money and opportunities in the space.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do you like this article?
&lt;/h3&gt;

&lt;p&gt;Consider following me here and on &lt;a href="//twitter.com/ghostmac9"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>web3</category>
      <category>blockchain</category>
      <category>solidity</category>
      <category>smartcontract</category>
    </item>
    <item>
      <title>Get Better At Technical Writing 3: Documentation as a Service</title>
      <dc:creator>MacBobby Chibuzor</dc:creator>
      <pubDate>Sat, 22 Jan 2022 18:09:39 +0000</pubDate>
      <link>https://forem.com/theghostmac/get-better-at-technical-writing-3-documentation-as-a-service-30cc</link>
      <guid>https://forem.com/theghostmac/get-better-at-technical-writing-3-documentation-as-a-service-30cc</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Open Source contributions are not restricted to just code, as is believed by most developers. &lt;strong&gt;Documentation is a recognized and valid means of contributing to open source projects.&lt;/strong&gt; In this article, documentation is treated as a service (DaaS), similar to Infrastructure (IaaS), Platforms (PaaS), etc.&lt;/p&gt;

&lt;p&gt;Technical writing is an important part of software development because it serves as a bridge between the developers and the users. &lt;strong&gt;The ability to write good documentations is a must-have skill for every engineer and researcher&lt;/strong&gt;; you should probably take a course on it if you often find yourself doing stuff other people need to know about. &lt;/p&gt;

&lt;p&gt;Writing documentation for a software is not just something you do to fulfil all righteousness. As stated in a previous issue in this series, &lt;strong&gt;it can be the defining difference between useful and useless software.&lt;/strong&gt; Best case scenario of a poorly documented software: hundreds of emails get shipped to support team. Worst case: it doesn't get used.&lt;/p&gt;

&lt;p&gt;Let's look at possible ways you can write or improve DaaS.&lt;/p&gt;

&lt;h2&gt;
  
  
  DaaS in Your Learning Journey
&lt;/h2&gt;

&lt;p&gt;In the tech ecosystem, everyone is plunged into an infinite loop of learning. Over the years, cognitive psychologists have proven to us that an effective technique to solidify knowledge of something learnt is to teach it. You can teach your pet, yes, but nothing stops you from teaching people who would find it useful.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cIvVy6tc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1642874000617/naVPn4d8L.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cIvVy6tc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1642874000617/naVPn4d8L.jpeg" alt="images (2).jpeg" width="400" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Looking for topics to write about while building your tech career? Write about your learning journey.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It could be in the form of daily or weekly entries for a personal learning challenge, or creation of content based on what you've learnt and sharing with people. It can also be writing end of year reviews and new year resolutions, as is common in the Nigerian Tech community.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chances are that you personally will sometimes have to refer to your own articles later in the future&lt;/strong&gt; — a very common thing to me and some of my friends. &lt;/p&gt;

&lt;p&gt;Furthermore, some recruiters would love to see these blog posts to confirm how long you have learnt a language or if you learnt it thoroughly. In these cases, some bootcamps like HNG Internship program has made it compulsory for enthusiasts to blog about their learning experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It can also be service to yourself in the form of a self-accountability system to continue learning.&lt;/strong&gt; A simple example is having to tweet everyday about your #100DaysofCode challenge.&lt;br&gt;
&lt;strong&gt;Experience gained through this means can help you land a passive income stream as a contract Technical Writer.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  DaaS in Open Source Contributions
&lt;/h2&gt;

&lt;p&gt;Technical writing is an open source experience in a sense. &lt;strong&gt;Providing documentation for software is a fine way to contribute to open source.&lt;/strong&gt;&lt;br&gt;
For example, during Hacktoberfest, you can contribute to documentation in the following ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Review and updating existing documentation&lt;/li&gt;
&lt;li&gt;Test company official SDK in some use-cases and add them to examples.md file in the repository (code required)&lt;/li&gt;
&lt;li&gt;Write documentation and provide examples for software built by coders during open source contributions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  DaaS in Product/Software Support
&lt;/h2&gt;

&lt;p&gt;Writing example use-cases for a software — as mentioned earlier —  is one means of providing support to potential users of that software.&lt;/p&gt;

&lt;h2&gt;
  
  
  DaaS in an Agile Team
&lt;/h2&gt;

&lt;p&gt;Working in a company as a technical writer, you will have to work hand in hand with the software team. In that case, your team may follow the Agile methodology, making use of a standard project tracking system like Jira. &lt;/p&gt;

&lt;p&gt;In this situation, you should &lt;strong&gt;make use of such project management software to keep track of your tasks, review your documentation, raise issues to developers and staff, assign tasks when possible, etc.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the dev team makes use of X, look for a way to make use of X also. In a future issue, I will expound on how to do this. &lt;br&gt;
Asides working in sync with the dev team, you also have side jobs like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reviewing published contents, updating and republishing them&lt;/li&gt;
&lt;li&gt;Discussing with the team and staff where needed&lt;/li&gt;
&lt;li&gt;Studying the software you're documenting through and through&lt;/li&gt;
&lt;li&gt;Checking customer support for complaints that your writing can fix&lt;/li&gt;
&lt;li&gt;Others&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  DaaS Tools
&lt;/h2&gt;

&lt;p&gt;In documenting, several tools are available to make the job easy for you. They are helpful for specific functions, like API documentation or Markdown writing. Some of these include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Postman&lt;/li&gt;
&lt;li&gt;Swagger UI&lt;/li&gt;
&lt;li&gt;Apiary&lt;/li&gt;
&lt;li&gt;Readme.io&lt;/li&gt;
&lt;li&gt;Docusaurus&lt;/li&gt;
&lt;li&gt;Gitbook&lt;/li&gt;
&lt;li&gt;Read the Docs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To better improve your writing, you may use softwares like Grammarly keyboard, a Thesaurus app, Notion etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, you learnt about different means you can write DaaS. &lt;br&gt;
When next you start writing, put in mind that &lt;strong&gt;you're writing for your future self, for others to learn that skill thoroughly, for recruiters to know you're adept in that technology, for users to enjoy the product, and for your importance to be acknowledged in the team.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Disclaimer!&lt;/strong&gt;&lt;br&gt;
A couple people reached out to me asking me to collaborate with them and make these write-ups a paid service. I'm open to collaboration or anything, but just not for this. &lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>technicalwriting</category>
      <category>documentation</category>
      <category>api</category>
    </item>
    <item>
      <title>Get Better At Technical Writing 2: Don't Start With Writing</title>
      <dc:creator>MacBobby Chibuzor</dc:creator>
      <pubDate>Thu, 13 Jan 2022 12:46:39 +0000</pubDate>
      <link>https://forem.com/theghostmac/get-better-at-technical-writing-2-dont-start-with-writing-3pd0</link>
      <guid>https://forem.com/theghostmac/get-better-at-technical-writing-2-dont-start-with-writing-3pd0</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Technical Writing is not just about writing. There are a whole lot to consider and do before writing even the first draft.&lt;/p&gt;

&lt;p&gt;A technical writer is, first of all, a researcher and tester. A huge amount of the writing process should involve research/learning, testing the product or a language's use case, before any writing should be done.&lt;/p&gt;

&lt;p&gt;A famous scientist once said, "If I have 1 hour to cut down a tree, I will spend the first 55 minutes sharpening my axe." Accordingly, it is healthy to say that 80% of the writing process should be spent &lt;em&gt;not&lt;/em&gt; writing, but researching and testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Typical Writing Processes
&lt;/h2&gt;

&lt;p&gt;If you work with a team of developers, your job may be limited to creating manuals or tutorials on softwares they developed, writing documentation of APIs or services they built, etc. In your case, a typical writing process may involve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Installing the software and it's dependencies on a platform. You may have to write step-by-step installation and setup guide as you do this. You may also have to test this guide on another platform, while writing the procedures. Not all your readers will be using Windows, or AWS, etc. The rule of thumb here is to carry out tests on as much widely used alternative as your product or company allows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Testing the software as much as possible, trying to understand how it works in every aspect. This is to reduce the amount of complaints that go to customer support, either by explaining obscure concepts in the official manual, or writing more FAQ articles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reporting bugs you found while testing. You don't have to solve them yourself, no. You're not a bug hunter.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Writing the content completely, then redrafting if need be. Check for grammar errors, punctuations misuses, and consistency. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;h3&gt;
  
  
  Read Now: &lt;a href="https://dev.to/theghostmac/get-better-at-technical-writing-the-beauty-of-consistency-194a"&gt;Get Better At Technical Writing: The Beauty of Consistency.&lt;/a&gt;
&lt;/h3&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Updating your write-ups as time goes on and technologies advance. In a future article, I will explain how to automate this process.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you do not work with a team, you are most likely a developer/engineer who found the beauty of Community as a Service (CaaS). You learn something new and want to teach it to the community through writing. If this screams you, then your writing process involves most of these steps, but a lot more coding.&lt;/p&gt;

&lt;p&gt;The following tips will explain how to improve your pre-writing phase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Define Your Audience:
&lt;/h2&gt;

&lt;p&gt;This is an important first step in pushing out a content. Who are you writing for? What is the bare minimum knowledge they need to have to completely understand your write-up?&lt;/p&gt;

&lt;p&gt;The foremost duty every technical writer has is to create content that their intended audiences will read and find useful. Any other duty is inferior to this.&lt;/p&gt;

&lt;p&gt;If your audience are experts, you have to tailor your write-up to suit experts, not beginners. This means you don't have to explain what every term mean, or put the reader through the process of installation and setup of a software.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do Your Own Research
&lt;/h2&gt;

&lt;p&gt;A common thing I noticed among the expert technical writers I know is that they create honest work. Producing unique, honest, and unplagiarized content means you know enough to write in your own words. You know enough to create your own use case.&lt;/p&gt;

&lt;p&gt;From experience, some companies would expect you to create and promote contents around their products, as a means of influencing their sales of those products. More often than not, you would have to learn how a particular product works, and technologies you would need to interact with the product to create your own use case.&lt;/p&gt;

&lt;p&gt;Research sparks up more curiosity in the technical writer. Some newbies in technical writing often ask questions like: how to find new topics to write about, how to write unique content for a topic already written on before. A great way to do either of these is to embrace research.&lt;/p&gt;

&lt;p&gt;Staying updated or learning new things about a tool or technology would definitely leave you asking, "What if I could use this tool to do X?" at some point.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Before Publishing
&lt;/h2&gt;

&lt;p&gt;Writing an article or manual for a product, a software, or a programming language means you are familiar with it through and through. You know your way around it enough to teach someone else how to use it. In this sense, testing does not mean improving performance, but increasing personal knowledge.&lt;/p&gt;

&lt;p&gt;This is mostly the case for writers who work in teams. If this is you, then you have the option of informing developers about the bugs and issues you find while testing.&lt;br&gt;
In another sense, testing means making sure your content is unfalsifiable. Put testing at the back of your mind and you're sure to produce great content that your readers can find useful.&lt;/p&gt;

&lt;p&gt;This is the case for CaaS writers. Before clicking the Publish button, make sure you have tested every piece of code you included in your write-up, in as much widely used platforms as possible for you.&lt;/p&gt;

&lt;p&gt;In software development, there is the concept of test-driven development (TDD). TDD entails not taking a software into production stage until it is thoroughly tested. &lt;br&gt;
For you, the technical writer, your software are docs and articles, and you have to test thoroughly before taking them to production.&lt;/p&gt;

&lt;p&gt;Finalize your writing process by testing everything you have written.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Researching and Testing
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You push out content that is absolutely useful to your reader - your ultimate goal for writing in the first place.&lt;/li&gt;
&lt;li&gt;It is not just useful, it is also easy to implement/reproduce by your readers. In other words, it works on other people's machine too.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2SrvAmOO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1642076820363/u3nIA8FF7.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2SrvAmOO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1642076820363/u3nIA8FF7.jpeg" alt="57d589565388f468c5de2946a1df2c2a.jpg" width="736" height="736"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It prevents hundreds of complaints/enquiry emails to customer support. &lt;em&gt;Pro tip: if you work with a team as a technical writer, find out what customers are saying about the software. Ask yourself if there's a way to better the situation by writing more.This might lead to an increase in your paycheck.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Drawing appreciation from readers, it inspires love for the software or language. For example, when generics came to Golang in November 2021, it didn't take long before a developer wrote an article on using generics in a Golang project. That discovery made me love the Golang Community, and developers' energy even more.&lt;/li&gt;
&lt;li&gt;During research, you will find potential topics to write next about, especially if your research entails learning new concepts or technologies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope you refer to these tips before you start writing your next awesome article! Also, check in next Thursday for another article in the series.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Using The FizzBuzz Problem to Explain the Goals of Algorithms</title>
      <dc:creator>MacBobby Chibuzor</dc:creator>
      <pubDate>Mon, 10 Jan 2022 20:50:36 +0000</pubDate>
      <link>https://forem.com/theghostmac/using-the-fizzbuzz-problem-to-explain-the-goals-of-algorithms-3cjh</link>
      <guid>https://forem.com/theghostmac/using-the-fizzbuzz-problem-to-explain-the-goals-of-algorithms-3cjh</guid>
      <description>&lt;p&gt;In this article, you will gain some insights required to write algorithms that ace job interviews.&lt;/p&gt;

&lt;p&gt;The major aim of the article is to explain the five common goals of an algorithm. &lt;br&gt;
In the course of the article, I will explain the simple FizzBuzz algorithm, and implement it in Golang. Additionally, I use two methods to explain the importance of writing clean, readable code.&lt;/p&gt;
&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Algorithms are mathematical and computational procedures in solving problems.&lt;br&gt;
Problems are binary relations of inputs and outputs. In a typical coding challenge or job interview, you have a set of input, and are looking to produce a set of possible output.&lt;/p&gt;

&lt;p&gt;An algorithmic or computational problem is specified by describing the complete set of instances it must work on and of its output after running on one of these instances.&lt;br&gt;
The first goal, therefore, of an algorithm is to &lt;strong&gt;Solve Problems.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Solving Fizz and Buzz with a Simple Sorting Algorithm
&lt;/h2&gt;

&lt;p&gt;You must have heard of the FizzBuzz algorithm before, especially if you have an experience in data structures and algorithms. It can be spelt as Fizz Buzz, FizzBuzz, or Fizz-Buzz. Whichever one you prefer, it remains a common question in technical job interviews.&lt;/p&gt;

&lt;p&gt;Imagine a set of numbers from 1 to 10.&lt;/p&gt;

&lt;p&gt;x = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}&lt;/p&gt;

&lt;p&gt;Fizz and Buzz refer to all number that's a multiple of 3 and 5 respectively. In other words, if a number is divisible by 3, it is categorized as fizz; if a number is divisible by 5, it is categorized as buzz. &lt;/p&gt;

&lt;p&gt;fizz(x)   = {3, 6, 9}&lt;br&gt;
buzz(x) = {5, 10}&lt;/p&gt;

&lt;p&gt;If a number is simultaneously a multiple of 3 AND 5, the number is replaced with "fizz buzz." In essence, it emulates the famous children game "fizz buzz."&lt;/p&gt;

&lt;p&gt;In writing the algorithm for solving this computational problem, iterate through the array and check which numbers are fizz and which are buzz. To do this, create a &lt;code&gt;for&lt;/code&gt; loop to iterate through the set of numbers from 1-10:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt;  &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Fizz"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Buzz"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
   &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can run this code in the  &lt;a href="https://go.dev/play/p/k9yq6FEtDF8"&gt;Go Playground&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You see the output as exactly the fizz(x) and buzz(x) values.&lt;/p&gt;

&lt;p&gt;It is not enough. FizzBuzz refer to cases where elements of the set are both divisors of fizz and buzz i.e., 3 and 5.&lt;br&gt;
What makes a computational solution an algorithm is if it can perform efficiently for both large and small area of data. Expert algorists will argue that an algorithm should perform better with larger data sets than smaller.&lt;br&gt;
The second goal of an algorithm is to &lt;strong&gt;Argue Efficiency.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The FizzBuzz (in Confusing Code)
&lt;/h2&gt;

&lt;p&gt;The FizzBuzz Algorithm can be improved to a series of if else statements: popular for sorting algorithms. This, however, requires a larger dataset.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="m"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"FizzBuzz at"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Fizz"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Buzz"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can run this code in the &lt;a href="https://go.dev/play/p/bt3qyMSNLVq"&gt;Go Playground&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You see the expected output, but there's a trade-off here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go’s motto is in favor of clean, readable code. Hence, avoid writing nested code of &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;else if&lt;/code&gt; and &lt;code&gt;else&lt;/code&gt; statements.&lt;/li&gt;
&lt;li&gt;The third goal of an algorithm is to &lt;strong&gt;Communicate Ideas.&lt;/strong&gt; I know an algorist who got his offer with only pseudocodes. If you ever get stuck in writing an algorithm, switch to pseudocode or draw a flowchart.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The FizzBuzz (in Clean Code)
&lt;/h2&gt;

&lt;p&gt;Instead of writing nested code that might confuse your interviewer, you can use &lt;code&gt;if&lt;/code&gt; and &lt;code&gt;continue&lt;/code&gt; to make code cleaner.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="m"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"FizzBuzz at"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Fizz"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Buzz"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can run this code in the &lt;a href="https://go.dev/play/p/X8JpLuzFF-J"&gt;Go Playground&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;continue&lt;/code&gt; keyword skips an iteration and moves to the next.&lt;br&gt;
The output confirms the fourth goal of an algorithm: to &lt;strong&gt;Prove Correctness.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8Mr4LMx9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1641847311084/DhCVe1aUn.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8Mr4LMx9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1641847311084/DhCVe1aUn.jpeg" alt="e88b262066175531a3c4282e452c52f0.jpg" width="500" height="641"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Algorithmic Thinking
&lt;/h2&gt;

&lt;p&gt;The fifth and grandest goal of an algorithm is to  correctly Optimize Runtime.&lt;br&gt;
As the range of the dataset increases to 1-100, you have to think carefully for ways to reduce the runtime. &lt;/p&gt;

&lt;p&gt;Given, the compiler will check each number to determine whether it is divisible by 3 or 5. It will then run through the numbers again to check if the numbers are divisible by 3 and 5. The code would essentially have to run through each number in the array twice — it would have to runs the numbers by 3 first and then run it by 5. This reduces the speed or time complexity of the algorithm in a sense.&lt;/p&gt;

&lt;p&gt;To speed up the process, you can simply divide the numbers by 15 directly, since the smallest FizzBuzz is the product of fizz and buzz i.e. 3 x 5 = 15.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="m"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="m"&gt;15&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"FizzBuzz at "&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Fizz"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Buzz"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can run this code in the &lt;a href="https://go.dev/play/p/nEKj-4vEvCx"&gt;Go Playground&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, you learned the definition of several concepts. Moreover, you saw use cases of control structures in Go. You also learned how nested loops make code confusing, and a good way to solve this.&lt;br&gt;
More importantly, you learnt about the five common goals of an algorithm and what they mean. You also leart how to use a simple sorting algorithm to solve the FizzBuzz problem. &lt;br&gt;
Finally, you learnt the need and benefits of thinking algorithmically i.e. of how to optimize the runtime of your algorithm. In a competitive setting, this gives you an edge.&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>go</category>
      <category>interview</category>
      <category>programming</category>
    </item>
    <item>
      <title>Get Better At Technical Writing: The Beauty of Consistency</title>
      <dc:creator>MacBobby Chibuzor</dc:creator>
      <pubDate>Thu, 06 Jan 2022 16:37:37 +0000</pubDate>
      <link>https://forem.com/theghostmac/get-better-at-technical-writing-the-beauty-of-consistency-194a</link>
      <guid>https://forem.com/theghostmac/get-better-at-technical-writing-the-beauty-of-consistency-194a</guid>
      <description>&lt;h3&gt;
  
  
  Disclaimer
&lt;/h3&gt;

&lt;p&gt;This is not a technical article, but a test article. If it proves helpful to you and you wish to see more like it, please drop a like and comment. I might be motivated to start a weekly newsletter on Getting Better At Technical Writing, or something similar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Consistency is the absence of contradiction. Whenever you conclude a write-up, it is imperative to go proofread it while checking for inconsistencies. In this article, I will give you tips on how to do this, based on the experience I've gained over years of commercial writing.&lt;/p&gt;

&lt;p&gt;In the next section, I take you through Grammar Consistency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Grammar Consistency
&lt;/h2&gt;

&lt;p&gt;Before starting a write-up, you should have in mind who your audiences are or what type of English you wish to express in.&lt;br&gt;
If you're writing for an English audience, you should use “recognise” and not “recognize.” Also, make sure to not mix British and American English in your write-up. Using “recognize” in Section 1 and “itemise” in Section 2 is an example.&lt;/p&gt;

&lt;p&gt;If you write with an MS Office product or a mobile phone with auto-prediction switched on, you should be extra careful with this mistake. Some softwares use your location - or theirs - to predict spellings.&lt;/p&gt;

&lt;p&gt;Sticking to a particular tone throughout your write-up is also important. When writing about personal experiences or opinionated contents, use “I.” When writing tutorial guides, use “You,” or “We” if you want the reader to feel held and guided. Technical documentations, manuals and some technical articles must be written without these pronouns.&lt;/p&gt;

&lt;p&gt;In the next section, I take you through Paragraph Consistency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Paragraph Consistency
&lt;/h2&gt;

&lt;p&gt;It is no new information that each paragraph in your write-up must have one tone. Its unprofessional to raise two points in one paragraph and another point in a third paragraph.&lt;/p&gt;

&lt;p&gt;A proper way I recently learnt to structure paragraphs is provided below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start with a sentence that introduces everything your paragraph is going to say.&lt;/li&gt;
&lt;li&gt;Keep sentences short, and free of unnecessary contents.&lt;/li&gt;
&lt;li&gt;Having 2 - 3  sentences or paragraph is great, although some paragraphs might be occasionally longer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
A serious Frontend developer must have ReactJS in their repertoire. Knowing HTML5, CSS3, and JavaScript is not enough to land a job as a Frontend developer. This is because virtually all talent recruiters are searching for developers who know and use the ReactJS framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  Style Consistency
&lt;/h2&gt;

&lt;p&gt;I ended every section of this article with an introduction to the next section, except for the previous one. This is purposely to explain style inconsistency to you. Another inconsistency is not using Consistency as the prefix in a consecutively related section, like I did in the next section.&lt;/p&gt;

&lt;p&gt;Whichever writing style you adopt, make sure to stick to it.&lt;/p&gt;

&lt;p&gt;If you connect words with an hyphen instead of indentation, stock to it. Don't say “hard-earned” in Section 1 and “easy going” in Section 3.&lt;/p&gt;

&lt;p&gt;If you bolden user interface elements (e.g. Click Save, then Exit), stick to it throughout.&lt;/p&gt;

&lt;p&gt;If you capitalise all the words in a heading, you should repeat that for every other heading, especially if they are related. That said, you obviously know very short words are not capitalized.&lt;/p&gt;

&lt;p&gt;If you use a comma, a period, or nothing at all at the end of an itemization, stick to this pattern throughout your write-up. For example, it's inconsistent having these two formats in one article:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1641486615678%2Fev7zPsdvU.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1641486615678%2Fev7zPsdvU.png" alt="Screenshot_20220106-153527.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1641486795275%2Fy5h0SQduA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1641486795275%2Fy5h0SQduA.png" alt="Screenshot_20220106-153556.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next section, I take you through Format Consistency.&lt;/p&gt;

&lt;h1&gt;
  
  
  Consistency in Formatting
&lt;/h1&gt;

&lt;p&gt;You must have observed that the heading above is a bit bigger than the others. This is purposely to explain to you that Markdown inconsistency is ugly. If you're familiar with Markdown - of course, every technical writer knows Markdown like the back of their hands - then you'd know I used an H1 tag here, and an H2 tag in the others.&lt;/p&gt;

&lt;p&gt;Preserve whichever formatting pattern you adopt throughout your write-up.&lt;br&gt;
If you use numbers for itemizing, don't switch to bullet points.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;These are not everything you must know about Consistency in writing, but I am pretty sure you will be able to detect inconsistency in any write-up. These aren't rules, also, but best practices; we are all striving to get better.&lt;/p&gt;

&lt;p&gt;You're getting better when your article ships on the first drafting, without any edits. Don't flatter yourself, this is subjective. If your message is technically perfect, it is sometimes a fair trade off for grammar and structure.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Is it too much to ask for both?”                                      - Tony Stark&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Let me know what you think about this article, as I am skeptical of writing more.
&lt;/h2&gt;

</description>
      <category>tutorial</category>
      <category>webdev</category>
      <category>career</category>
    </item>
  </channel>
</rss>
