<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Isaac Coffie on Medium]]></title>
        <description><![CDATA[Stories by Isaac Coffie on Medium]]></description>
        <link>https://medium.com/@isaac.p.coffie?source=rss-c0d493dcbf5f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Lks2zfGLP6g_li3G5d62yg.jpeg</url>
            <title>Stories by Isaac Coffie on Medium</title>
            <link>https://medium.com/@isaac.p.coffie?source=rss-c0d493dcbf5f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 01:38:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@isaac.p.coffie/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Ingesting Data from Gitlab CI Pipeline to Port]]></title>
            <link>https://medium.com/@isaac.p.coffie/ingesting-data-from-gitlab-ci-pipeline-to-port-91f8f9e01589?source=rss-c0d493dcbf5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/91f8f9e01589</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <dc:creator><![CDATA[Isaac Coffie]]></dc:creator>
            <pubDate>Fri, 31 Mar 2023 12:39:04 GMT</pubDate>
            <atom:updated>2023-03-31T12:39:04.519Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M65A2T-OzApWOah3CdnAuQ.png" /></figure><p>This tutorial will use Python and GitLab CI pipeline to ingest data to Port (<a href="https://app.getport.io/">https://app.getport.io/</a>)</p><h3>Overview</h3><p>Port is a platform that gives developers a holistic understanding of their development lifecycle and underlying architecture. The platform also reduces the cognitive load from complex architectures, tool proliferation and tribal knowledge.</p><p>The following step shall enable us to ingest/stream data from Gitlab CI to Port.</p><h4>Step 1: Create a Port CLIENT and SECRET keys</h4><p>The first thing you need to do is create a Port API key. You can do this by signing up and logging into your Port account. After a successful login, navigate to the “Help” tab. From here, click “Credentials” and follow the prompts to generate your client and secret keys.</p><p>Once you have your API keys, keep them safe and secure. You will need it in the following steps.</p><h4>Step 2: Create your Blueprint</h4><p>To build your software catalogue — one of the primary use cases of the Port platform–we need to define blueprint schemas. Blueprints represent assets that can be managed in Port, such as Microservice, Environments, Packages, Clusters, Databases, and many more.</p><p>In our example, we will define a blueprint representing Gitlab commit data. Use the following code snippet to create your Blueprint in the Port app.</p><pre>{<br>  &quot;identifier&quot;: &quot;gitlab_commit&quot;,<br>  &quot;title&quot;: &quot;Gitlab History&quot;,<br>  &quot;icon&quot;: &quot;Git&quot;,<br>  &quot;schema&quot;: {<br>    &quot;properties&quot;: {<br>      &quot;version&quot;: {<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;title&quot;: &quot;Version&quot;<br>      },<br>      &quot;committedBy&quot;: {<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;title&quot;: &quot;Committed By&quot;<br>      },<br>      &quot;commitHash&quot;: {<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;title&quot;: &quot;Commit Hash&quot;<br>      },<br>      &quot;actionJob&quot;: {<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;title&quot;: &quot;Action Job&quot;<br>      },<br>      &quot;repoPushedAt&quot;: {<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;format&quot;: &quot;date-time&quot;,<br>        &quot;title&quot;: &quot;Repository Pushed At&quot;<br>      },<br>      &quot;runLink&quot;: {<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;format&quot;: &quot;url&quot;,<br>        &quot;title&quot;: &quot;Action Run Link&quot;<br>      }<br>    },<br>    &quot;required&quot;: []<br>  },<br>  &quot;relations&quot;: {},<br>  &quot;calculationProperties&quot;: {}<br>}</pre><p>Once successful, you should see something similar to the image below on your Port dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*8OdjswBh1dcRHLRgsDOmIA.png" /></figure><p>With our blueprint created successfully, we can head to Gitlab to create a project and add entries.</p><h4>Step 3: Create a GitLab repository</h4><p>You need to create a new GitLab repository. This is where you will store your Python script and any other files to ingest data to Port.</p><p>To create a new GitLab repository, log into your <a href="https://gitlab.com/">GitLab account</a> and click on the “New project/repository” button. From here, follow the prompts to create a new repository.</p><h4>Step 4: Ingest Data using the Port API</h4><p>Port’s beautiful REST API enables developers to seamlessly ingest data to their blueprints and catalogue. We must install a few libraries using the python-pip command to achieve this. We will use requests and decouple for making HTTPS requests and accessing environment variables, respectively.</p><blockquote>pip install requests</blockquote><blockquote>pip install python-decouple</blockquote><p>Now, create a python file and name it main.py</p><p>Copy and paste the below content into it.</p><pre>## Import the needed libraries<br>import requests<br>import uuid<br>from decouple import config<br><br><br># Env vars passed by the config object<br>CLIENT_ID = config(&#39;CLIENT_ID&#39;)<br>CLIENT_SECRET = config(&#39;CLIENT_SECRET&#39;)<br>API_URL = &#39;https://api.getport.io/v1&#39;<br><br><br>## Get the Access Token from the Port API<br>credentials = {&#39;clientId&#39;: CLIENT_ID, &#39;clientSecret&#39;: CLIENT_SECRET}<br>token_response = requests.post(f&#39;{API_URL}/auth/access_token&#39;, json=credentials)<br>access_token = token_response.json()[&#39;accessToken&#39;]<br><br># We can now use the value in access_token to make further requests<br>headers = {<br> &#39;Authorization&#39;: f&#39;Bearer {access_token}&#39;<br>}<br><br>## Reference the blueprint<br>blueprint_id = &#39;gitlab_commit&#39;<br><br>## Get entity variables<br>COMMIT_BY = config(&#39;COMMIT_BY&#39;)<br>COMMIT_HASH = config(&#39;COMMIT_HASH&#39;)<br>ACTION_JOB= config(&#39;ACTION_JOB&#39;)<br>PUSHED_AT = config(&#39;PUSHED_AT&#39;)<br>RUN_LINK = config(&#39;RUN_LINK&#39;)<br><br>## create a unique ID<br>identifier_id = uuid.uuid4().hex<br><br>## Prepare the entity object<br>entity = {<br>  &quot;identifier&quot;: identifier_id,<br>  &quot;title&quot;: &quot;Stream Gitlab Commits&quot;,<br>  &quot;properties&quot;: {<br>    &quot;version&quot;: &quot;0.01&quot;,<br>    &quot;committedBy&quot;: COMMIT_BY,<br>    &quot;commitHash&quot;: COMMIT_HASH,<br>    &quot;actionJob&quot;: ACTION_JOB,<br>    &quot;repoPushedAt&quot;: PUSHED_AT,<br>    &quot;runLink&quot;: RUN_LINK<br>  },<br>  &quot;relations&quot;: {}<br>}<br><br>## Finally ingest the entity data to the blueprint<br>response = requests.post(f&#39;{API_URL}/blueprints/{blueprint_id}/entities?upsert=true&#39;, json=entity, headers=headers)<br>print(response.json())</pre><h4>Step 5: Setting up the Gitlab CI</h4><p>The final step is to set up GitLab CI to automatically run your Python script whenever you push changes to your repository.</p><p>The first thing we need to do is to configure Gitlab to access our Port API keys. To do so, head to your Gitlab repository and navigate to Settings &gt; CI/CD &gt; Variables. Add your client and secret key, as seen below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MLwIi2YcQoJJVl3VH8RPmQ.png" /></figure><p>Next, create a new file in your Python project called “.gitlab-ci.yml” and paste in the following code:</p><pre>image: python:3.8<br><br>variables:<br>  CLIENT_ID: $CLIENT_ID<br>  CLIENT_ID: $CLIENT_SECRET<br>  COMMIT_BY: $CI_COMMIT_AUTHOR<br>  COMMIT_HASH: $CI_COMMIT_SHA<br>  ACTION_JOB: $CI_JOB_NAME<br>  PUSHED_AT: $CI_COMMIT_TIMESTAMP<br>  RUN_LINK: $CI_PIPELINE_URL<br><br>stages:<br>  - build<br><br>ingest_data_to_port:<br>  stage: build<br>  before_script:<br>    - python --version<br>    - python -m pip install --upgrade pip<br>    - pip install --upgrade setuptools<br>    - pip install --no-cache-dir -r requirements.txt<br>  script:<br>    - python main.py</pre><p>This code tells GitLab to run your Python script using the “python:3.8” image. Whenever you push changes to your repository, GitLab will automatically run this script.</p><p>You can view the content of the ingested data on Port. See the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*go3BTNv3fe21Yhx9lMNFsQ.png" /></figure><p>And that’s it! You now have a fully functional GitLab CI pipeline that ingests data to Port using Python.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91f8f9e01589" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streaming Sentry Events to Port Using Webhooks]]></title>
            <link>https://medium.com/@isaac.p.coffie/streaming-sentry-events-to-port-using-webhooks-a254b17f2c2a?source=rss-c0d493dcbf5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a254b17f2c2a</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <dc:creator><![CDATA[Isaac Coffie]]></dc:creator>
            <pubDate>Fri, 31 Mar 2023 12:38:15 GMT</pubDate>
            <atom:updated>2023-04-02T18:53:24.421Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*la5CpdAI9iVKpsyyHrEeqg.png" /></figure><p>In this tutorial, we will learn how to stream events from Sentry to Port using webhooks. Specifically, we shall learn to ingest real-time comments data from Sentry to Port. This will help us track all comments about errors or issue alerts and build our software catalogue.</p><p>Webhooks are a simple and effective way to communicate data between two applications in real time. When an event occurs in Sentry.io, a payload is sent to the webhook URL defined in Port. This payload contains information about the event, such as the issue ID, the message, and other relevant data.</p><p>To create a webhook integration between Port and Sentry.io, follow these steps:</p><h3>Step 1: Create your Blueprint</h3><p>Blueprints are the building blocks of the software catalogue in Port. They allow you to define the asset you want to catalogue. In our case, we will create a blueprint for the comments events on Sentry.io. When you visit <a href="https://docs.sentry.io/product/integrations/integration-platform/webhooks/comments/">Sentry’s documentation</a>, you will realise that a comment object has the following schema:</p><pre>data[&quot;comment&quot;]<br>data[&quot;project slug&quot;]<br>data[&quot;comment_id&quot;]<br>data[&quot;issue_id&quot;]<br>data[&quot;timestamp&quot;]</pre><p>So, copy and paste the following blueprint JSON file into your Port dashboard.</p><pre>{<br>    &quot;identifier&quot;: &quot;SentryComments&quot;,<br>    &quot;description&quot;: &quot;This blueprint represents a Sentry comment webhook in our software catalog&quot;,<br>    &quot;title&quot;: &quot;Sentry Comments Issues&quot;,<br>    &quot;icon&quot;: &quot;Deployment&quot;,<br>    &quot;schema&quot;: {<br>      &quot;properties&quot;: {<br>        &quot;action&quot;: {<br>          &quot;type&quot;: &quot;string&quot;,<br>          &quot;title&quot;: &quot;action&quot;<br>        },<br>        &quot;comment&quot;: {<br>          &quot;type&quot;: &quot;string&quot;,<br>          &quot;title&quot;: &quot;comment&quot;<br>        },<br>        &quot;project&quot;: {<br>          &quot;type&quot;: &quot;string&quot;,<br>          &quot;title&quot;: &quot;project slug&quot;<br>        },<br>        &quot;comment_id&quot;: {<br>          &quot;type&quot;: &quot;string&quot;,<br>          &quot;title&quot;: &quot;comment id&quot;<br>        },<br>        &quot;issue_id&quot;: {<br>          &quot;type&quot;: &quot;string&quot;,<br>          &quot;title&quot;: &quot;ID of Issue&quot;<br>        },<br>        &quot;timestamp&quot;: {<br>          &quot;type&quot;: &quot;string&quot;,<br>          &quot;title&quot;: &quot;Timestamp of comment&quot;<br>        }<br>      },<br>      &quot;required&quot;: []<br>    },<br>    &quot;mirrorProperties&quot;: {},<br>    &quot;calculationProperties&quot;: {},<br>    &quot;relations&quot;: {}<br>  }</pre><h3>Step 2: Create Webhook Configuration Metadata</h3><p>The metadata configuration of the webhook includes all properties related to how your events and data will be displayed inside Port’s UI. Copy and paste the following metadata JSON file into your code environment. We shall use it in step 3. We must consider security and ensure the webhook requests come from Sentry.</p><pre>{<br>  &quot;identifier&quot;: &quot;SentryMapper&quot;,<br>  &quot;title&quot;: &quot;Sentry mapper&quot;,<br>  &quot;description&quot;: &quot;A webhook configuration to map Sentry Comments to Port&quot;,<br>  &quot;icon&quot;: &quot;Deployment&quot;,<br>  &quot;mappings&quot;: [<br>    {<br>      &quot;blueprint&quot;: &quot;SentryComments&quot;,<br>      &quot;entity&quot;: {<br>        &quot;identifier&quot;: &quot;.body.data.comment_id&quot;,<br>        &quot;title&quot;: &quot;Comment Event&quot;,<br>        &quot;properties&quot;: {<br>          &quot;action&quot;: &quot;.body.action&quot;,<br>          &quot;comment&quot;: &quot;.body.data.comment&quot;,<br>          &quot;project&quot;: &quot;.body.data.project_slug&quot;,<br>          &quot;comment_id&quot;: &quot;.body.data.comment_id&quot;,<br>          &quot;issue_id&quot;: &quot;.body.data.issue_id&quot;,<br>          &quot;timestamp&quot;: &quot;.body.data.timestamp&quot;<br>        }<br>      }<br>    }<br>  ],<br>  &quot;enabled&quot;: true,<br>  &quot;security&quot;: {<br>    <br>  }<br>}</pre><h3>Step 3: Getting Webhook URL</h3><p>The next step is to create the webhook URL that will be used to stream data from Sentry to Port. Open a POSTMAN or any REST client to request the Port API. Below is information about this API call.</p><p>METHOD: POST</p><p>Authentication: Bearer JWT TOKEN (which you can generate from your Port UI)</p><p>Body: Copy and paste the webhook metadata from step 2</p><p>Once successful, you will receive your webhook URL in the response body of this API call. It typically follows this format as shown below: <a href="https://ingest.getport.io/%7BwebhookKey%7D">https://ingest.getport.io/{webhookKey}</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dhpF_cIfyBMD9-Y8yDaEtA.png" /></figure><h3>Step 4: Connecting the Webhook URL with Sentry</h3><p>The final step is connecting the webhook URL obtained from step 3 into Sentry. Log in to sentry.io and go to “Settings” &gt; “Developer Settings” &gt; “Create Integration”.</p><p>You will be presented with a form to fill in the details of your webhook integration. There are 3 key things to note on this form.</p><ol><li>The webhook URL: Copy and paste the Port webhook URL</li><li>Events: You can select the type of events you want to stream. Make sure to select comment since that’s the focus of this tutorial.</li><li>Permission: Make sure to grant this integration the appropriate read/write permission.</li></ol><p>A screenshot of this process is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*znaTP4g5uur5MFiEvzmXUg.png" /></figure><h3>Step 5: Trigger Webhook Events</h3><p>To confirm that your webhook integration was successful, navigate to one of your issues or alerts in Sentry and comment on it. Here is a screenshot showing the comments happening in Sentry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1B8pHWEhnEsqkmvxY_uimA.png" /></figure><p>Let’s now turn to our Port UI and see the data ingested into our Sentry Comments blueprint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9DSIobvvX5n-PqhA0UB5cw.png" /></figure><h3>Step 6: Configure Secrets</h3><p>Since the integration is working correctly, let’s add another layer of security to it — by configuring secrets. This is one way of verifying the integrity of the incoming data. After we created the Sentry integration, we were presented with a client secret.</p><p>Now copy that secret key and update the content of your Webhook configuration in step 3. If you read the documentation on Sentry, you will also realize that the signature Algorithm is SHA256, passed to the request header as “sentry-hook-signature”. The documentation also does not mention anything about the signature prefix. Because of that, we will leave that part blank.</p><p>METHOD: PATCH</p><p>Authentication: Bearer JWT TOKEN (which you can generate from your Port UI)</p><p>Body:</p><pre>  &quot;security&quot;: {<br>    &quot;secret&quot;: &quot;YOUR_SENTRY_SECRET_TOKEN&quot;,<br>    &quot;signatureHeaderName&quot;: &quot;sentry-hook-signature&quot;,<br>    &quot;signatureAlgorithm&quot;: &quot;sha256&quot;,<br>    &quot;signaturePrefix&quot;: &quot;&quot;<br>  }</pre><p>Try commenting again in Sentry and watch it stream to Port in real-time.</p><p>And that’s it. We’ve finally created a webhook integration to stream live comments from Sentry to Port.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a254b17f2c2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding & Generating Ethereum Addresses]]></title>
            <link>https://medium.com/@isaac.p.coffie/understanding-generating-ethereum-addresses-a19ace1f62c5?source=rss-c0d493dcbf5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a19ace1f62c5</guid>
            <category><![CDATA[wallet]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[Isaac Coffie]]></dc:creator>
            <pubDate>Thu, 22 Dec 2022 14:11:23 GMT</pubDate>
            <atom:updated>2023-01-06T10:36:26.732Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eF4piiuC_awiF7tQ90sCUw.png" /></figure><p>Anyone who has traded or invested in cryptocurrencies may know about wallet addresses. When you set up a Metamask or a Trust wallet account, an address is automatically generated. Similarly, users who keep their crypto tokens on centralised exchanges such as Binance, Coinbase, and KuCoin also get wallet addresses.</p><p>This article aims to uncover the behind-the-scenes of generating a wallet address.</p><p>From a layman&#39;s perspective, an address is synonymous with your bank account or an email address. A crypto wallet address gives you a unique digital identity on the internet, specifically, a blockchain network. Your address enables you to sign transactions on the blockchain, receive funds, and send cryptocurrencies to other users.</p><h3><strong>A Closer Look at Ethereum Addresses</strong></h3><p>Ethereum is the second largest blockchain platform by market capitalisation, closely behind Bitcoin, the first ever built blockchain-based cryptocurrency. Ethereum is equally one of the highest used platforms with many use cases and projects ranging from decentralised finance, metaverse, NFTs, etc. That said, it makes sense to study how Ethereum addresses are generated by DApps such as Metamask.</p><p>By design (<a href="https://ethereum.github.io/yellowpaper/paper.pdf">from the yellow paper)</a>, Ethereum addresses are hexadecimal characters of 20 bytes or 40 characters long. They are typically prefixed with 0x, making them 42 characters long. An example address is <em>0x6B96f06B72D5A21d64b9D460534977799c332434</em>. These 42 long characters are generated using public key cryptography, also known as asymmetric cryptography. In an asymmetric cryptographic scheme, two keys (a public and a private key) are needed to provide secure encryption. It turns out that your address is the output of your public key.</p><h3><strong>Let&#39;s Get a Bit Technical</strong></h3><p>To generate an Ethereum address, you need</p><ol><li>A 256-bit (or 32-bytes) random private key. A private key can come in several formats: a binary string, a mnemonic, or a secret hexadecimal string.</li><li>You then pass your 256-bit private key through an <a href="https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm">Elliptic Curve Digital Signature Algorithm</a> (ECDSA), the same curve used in generating Bitcoin addresses. The ECDSA is a cryptographic algorithm that offers robust and secure encryption for communications.</li><li>The output of the ECDSA (public key) is then hashed using a hashing function, specifically <a href="https://keccak.team/keccak.html">Keccak-256</a>.</li><li>Your Ethereum address is the last 20 bytes or 40 characters of the hashed output, prefixed with 0x.</li></ol><h3><strong>Practical Implementation</strong></h3><p>We shall use one of the popular Ethereum crypto libraries. With this utility, we can perform cryptographic operations such as hashing, signing transactions, and generating public keys of different algorithms.</p><p>Let&#39;s start by initializing our project folder with node.js and installing the library.</p><blockquote>npm install ethereum-cryptography</blockquote><h4><strong>Part 1: Generating Private Key</strong></h4><p>We need to generate a random 256-bit or 32-byte (8 bits equals 1 byte) hexadecimal string using a cryptographic random number generator (RNG) function. See the code snippet below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*gJZmO4A0puHyABodN4pK0A.png" /><figcaption>Private key generation</figcaption></figure><p>Running the code (<strong>node index.js</strong>) gives you the below output — your private key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*wHOOf-5CTSAbzmtlCbvQKA.png" /><figcaption>Your private key</figcaption></figure><p><strong>Part 2: Generating Public Key using ECDSA</strong></p><p>In this part, we shall derive a public key for our private key using the secp256k1 curve. See the code below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eDXBiGinZg6rLnPSyucr-g.png" /><figcaption>Public key generation</figcaption></figure><p>The output is a 64-byte integer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_1wpLZ_8hWhMnAyITgVuYQ.png" /><figcaption>Your public key</figcaption></figure><p><strong>Part 3: Hashing the Public Key using Keccak-256</strong></p><p>The last technical part is hashing the output of the secp256k1 curve using the famous keccak-256 hashing algorithm. And finally, we take the last 40 characters from the hash (digest)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iCMXiDU1jnApO9StwtRUNg.png" /><figcaption>Keccak-256 of the public key</figcaption></figure><p>The output value (<strong><em>0xdf86c04b91b0d2711158d89bf62387f6bba0fb8b</em></strong>) is our Ethereum address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*oZCLUCXl-XML-1i313860g.png" /><figcaption>Final output (Ethereum address)</figcaption></figure><p>PS: I have successfully received 0.5 MATIC tokens on this address using the Polygon Test blockchain. See the screenshot below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Z7leO9LKK7wPgpUjqBRAg.png" /></figure><h4><strong>Conclusion</strong></h4><p>If you&#39;ve made it this far, I hope you now understand how wallet providers (such as Metamask) and crypto exchanges (such as Binance) provision new addresses for every crypto user. With these simple steps, anyone can generate their Ethereum addresses as there are 2^ 256 possible addresses to be owned. It is crucial to generate a powerful private key that is impossible to brute-force or hack.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a19ace1f62c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bitcoin Halving — The Endgame for Bitcoin Miners]]></title>
            <link>https://medium.com/thecapital/bitcoin-halving-the-endgame-for-bitcoin-miners-c06989e78a43?source=rss-c0d493dcbf5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c06989e78a43</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[halving]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Isaac Coffie]]></dc:creator>
            <pubDate>Thu, 28 May 2020 00:48:04 GMT</pubDate>
            <atom:updated>2020-05-28T00:48:04.756Z</atom:updated>
            <content:encoded><![CDATA[<h4>By <a href="https://medium.com/u/c0d493dcbf5f">Isaac Coffie</a> on The Capital</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hrn-PgA6kQH925HAWE5H8g.png" /><figcaption>Source: <a href="https://www.designevo.com/apps/logo/?name=bitcoin-with-shadow">https://www.designevo.com/apps/logo</a></figcaption></figure><p>Since its invention in 2008 by the pseudonymous creator, Satoshi Nakamoto, Bitcoin has remained one of the successful cryptocurrencies in present times. Just like any other crypto, Bitcoin is a digital currency that allows people to make payment for goods and services via digital channels. One key attribute that differentiates the crypto from fiat currency (e.g. USD) is the fact that Bitcoin is decentralized. Stated differently, Bitcoin is not regulated by any central authority, but by everyone on the internet who runs the software. You might wonder, “Since Bitcoin is a currency, and isn’t regulated by a central bank, how do the crypto control money supply and inflation?”. The short answer to this question is simple: Bitcoin has an inherent deflationary mechanism implemented in the software. More precisely, it does so by “regulating” the amount of Bitcoin that are released and circulated into the ecosystem every ten (10) minutes. The long answer can only be explained by a concept called Bitcoin Halving, which I shall explain below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*aU1Lc01D4CGoV1zbVU5lYA.jpeg" /><figcaption>Source: <a href="https://twitter.com/donsplen_/status/1259933678815281152?s=19">https://twitter.com/donsplen_/status/1259933678815281152?s=19</a></figcaption></figure><h4><strong>Bitcoin Halving</strong></h4><p>A Bitcoin halving event occurs when the amount of Bitcoin paid to miners as rewards are halved or cut in 2, approximately every four years. Perhaps, to be able to grasp this event, it helps to understand who Bitcoin miners are. Bitcoin miners are users whose work involves validating and assembling blocks of transactions on the Bitcoin blockchain. On average, about 3,500 transactions are assembled every 10 minutes as a block. Due to this tedious work of validating and processing transactions, miners are often incentivised with BTCs. In 2009, miners were rewarded 50 BTC per block. This amount was later halved to 25 in November 2012. By July 2016, it was further halved to 12.5. Yet another, on May 11th, 2020, this amount was also cut into 2, reducing the reward to 6.25 BTC currently. One crucial advantage of this halving event is to control inflation and the amount of BTC in circulation. While this mechanism has positive benefits, sadly, miners are heavily affected by this event since their revenue is equally halved.</p><p>But, hey, before we make any speculations about the impact of current halving on the price of Bitcoin, it will be beneficial that we learn one or two clues from the halving history.</p><p>The graph below shows the price of Bitcoin following the previous halving events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hy7IU731T8GLhkT6aLv6WA.png" /><figcaption>Source: <a href="https://www.longhash.com/en/news/3234?f=r">https://www.longhash.com/en/news/3234?f=r</a></figcaption></figure><p>The value of Bitcoin is relatively volatile compared to a stock price. However, the halving events in 2012 and 2016 have both proved that the price of Bitcoin can rise quickly following the event (see the graph above). For instance, when the reward for Bitcoin was halved in November 2012 from 50 to 25, the price of Bitcoin rose from $12 to $1,038 per BTC by November 2013 [1]. That’s about 600% rise within a year. Similarly, after the reward was halved to 12.5 in July 2016, we saw another rise in the price of Bitcoin from $650 to $2,526 in July 2017, before peaking in December 2017 at $20,000 per BTC [1].</p><h4><strong>So, Should I Invest in Bitcoin Now?</strong></h4><p>To make any investment decisions, it helps to interpret the above observation from an economic perspective. When the supply of a commodity decreases, with demand being constant, it is reasonable to observe an increase in price due to the shortage that will be created in the economy. This reasoning may hold true for Bitcoin, and we could infer that the price of Bitcoin can be correlated with the halving event. While this may be true in the past, there is no guarantee that history may repeat itself. For instance, Bitcoin was relatively new during the previous halving events. So, the interest in the new crypto in the market drove the price higher. More so, there are now competitions in the crypto market; hence the demand for bitcoins may not necessarily increase as buyers can find alternative cryptocurrencies to invest in. Based on these reasons, it will be risky to invest in Bitcoin merely on the assumption that history will repeat itself.</p><h4><strong>Could Miners Leave the Bitcoin Network?</strong></h4><p>Well, potentially! People are motivated by incentives, so are miners. Since the reward for miners is now 6.25 BTC instead of the previous 12.5, many miners may be discouraged as their revenues will be significantly affected. Some may shut down their mining operations. This event may also reduce the Bitcoin hash rate proportionately, creating delays in validating transactions. But there’s a piece of good news. Besides the reward earned from participating in the mining process, miners also get incentives from other means. One of such avenues is called a transaction fee. Similar to the charges paid for making credit card transactions, Bitcoin users may optionally include a transaction fee when making a transaction. This fee is particularly for users who want their request to be processed faster and included in the blockchain. The fee ranges from $2 to $20 depending on the size of the transaction. Since there is a limit on the mining pool (currently 1 MB per block), rational miners will only include transactions that have bigger fees attached to it. Besides the transaction fees, the difficulty level for mining Bitcoins may also be reduced to compensate for the lower reward.</p><h4><strong>In Conclusion</strong></h4><p>While the halving event may come in as bad news for Bitcoin miners, it, however, isn’t the end. Miners can still get some amount of money by participating in the network and validating transactions through transaction fees. Finally, it will be a haste decision to invest in Bitcoin on the assumption that the previous two halving events have both led to a surge in the price of Bitcoin. History may never repeat itself! So let’s trade cautiously!!!</p><h4><strong>References</strong></h4><p>[1] <a href="https://www.ig.com/en/bitcoin-btc/bitcoin-halving">https://www.ig.com/en/bitcoin-btc/bitcoin-halving</a></p><p>[2] <a href="https://www.longhash.com/en/news/3234?f=r">https://www.longhash.com/en/news/3234?f=r</a></p><p><a href="https://twitter.com/thecapital_io">JavaScript is not available.</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Ff%2F3c1144%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2F3c1144&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b6b127891c5c8711ad105e61d6cc81f/href">https://medium.com/media/3b6b127891c5c8711ad105e61d6cc81f/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c06989e78a43" width="1" height="1" alt=""><hr><p><a href="https://medium.com/thecapital/bitcoin-halving-the-endgame-for-bitcoin-miners-c06989e78a43">Bitcoin Halving — The Endgame for Bitcoin Miners</a> was originally published in <a href="https://medium.com/thecapital">The Capital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Digital Currency: A Cryptocurrency Approach]]></title>
            <link>https://medium.com/@isaac.p.coffie/creating-digital-currency-a-cryptocurrency-approach-6ac97f745dc5?source=rss-c0d493dcbf5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ac97f745dc5</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[africa]]></category>
            <dc:creator><![CDATA[Isaac Coffie]]></dc:creator>
            <pubDate>Wed, 26 Feb 2020 13:44:35 GMT</pubDate>
            <atom:updated>2020-02-26T19:04:45.621Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*pDoyYWn9tUlP78tjqkqH4g.jpeg" /><figcaption>Source: <a href="https://elevenews.com/2020/01/20/wax-cryptocurrency-the-future-of-digital-goods-and-trading/">https://elevenews.com/</a></figcaption></figure><p>For more than a decade, the heads of state of the Economic Community of West African State (ECOWAS) have made strides to introduce a unified currency, the Eco. Central to this initiative is the goal to foster seamless multilateral trade among member states. Since the conception of the Eco in 2003, the fifteen (15) member ECOWAS countries have held several meetings to discuss the implications of the proposed currency. Thankfully, in December 2019, the President of Ivory Coast, Alassane Ouattara, unveiled his intention to change the Francophone’s CFA currency to the new Eco [1].</p><p>Indeed, Ouattara’s recent news has, expectedly, received wide criticisms, with some critics being optimistic about the potential benefit the currency may have on the region. The President of Africa Development Bank (ADB), Mr Akinwunmi Adesina is one of them. In a recent press release in 2019, he labels the Eco as “one of the greatest ideas to ever happen to Africa” [2]. Sadly, other critics too, such as this post [3] has shared his concern, arguing that what <strong><em>West Africa really needs is Crypto and not Eco</em></strong>. While [3]’s bold-new criticisms could pave way for something revolutionary, this article will (1) point out the challenges that [3]’s Stablecoin and any other new cryptocurrency might face and (2) discuss potential solutions to these identified challenges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*65r82Jh0yBqprB8QK1xNdg.gif" /><figcaption>Map of ECOWAS</figcaption></figure><p><strong>History of Cryptocurrencies</strong></p><p>Our understanding of cryptocurrencies dates back to 1983, when the American computer scientist, David Chaum, first applied cryptography to digital cash. Chaum’s proposed cryptocurrency — the DigiCash — sought to address the problems identified in the earlier credit card systems [4]. His work gave birth to new crypto companies such as FirstVirtual, CyberCash, Mondex. However, all of these companies have gone bankrupt. You might wonder, “What went wrong?”, “Isn’t crypto secured enough?” Well, the answer is quite simple: these companies failed to provide solutions to the three most critical issue of any cryptocurrency:</p><p>1) Double spending of the same coin</p><p>2) Centralization of the cryptocurrency platform</p><p>3) Difficulty in guaranteeing anonymity.</p><p>Stated differently, cryptocurrencies like Bitcoin, Ethereum, LiteCoin are successful because they were able to address the technical challenges highlighted above. This goes to suggest that if ECOWAS <em>were</em> to introduce a cryptocurrency instead of the fiat Eco, these concerns must be equally addressed. In the following section of this article, <strong>I will show you how to overcome these challenges using three iterations of crypto.</strong> The analogy used here is adapted from chapter 2 of Princeton’s Bitcoin textbook [4].</p><p><strong>Crypto Version 1: PrimCoin</strong></p><p>Imagine a world where there exists one simple cryptocurrency called PrimCoin, named after Primerose (why not?). Just like any other fiat currency, Primerose has absolute control over the creation of new crypto. So, she creates a uniquely identified coin with some cryptographic function, signs it off using her <a href="https://en.wikipedia.org/wiki/Digital_signature">digital signature</a>. This way, everyone can verify that this coin was created by her and it’s valid, just like anyone identifying a 1000 “Bank of Rwanda” currency note.</p><p>Let’s assume Primerose wants to transfer her valid coin to Alice, her friend. To do so, she digitally signs her coin and broadcasts “<strong><em>transfer this coin to Alice</em></strong>” unto the cryptocurrency network using Alice’s <a href="https://en.wikipedia.org/wiki/Public_key_infrastructure">public key</a> or account address. After this operation, Primerose no longer has control over this coin. Alice does. Alice, in turn, transfers her coin to (guess who?) Bob (seller A) by issuing a “<strong><em>Pay this coin to Bob</em></strong>” statement using Bob’s public key. If Alice wants to double-spend her coin, she can decide to buy goods from Jane (seller B) and secretly transfers <strong><em>the same coin</em></strong> to Jane without letting anyone on the network know. If this transaction is successful, then there’s a serious problem! Alice would have double-spent her coin. This is one of the classical problems early cryptocurrencies grappled with. Due to the inadequate security measures associated with the PrimCoin, we all decide to abandon it and switch to a new crypto coin called PagesCoin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*Dbhclt49Bc1l_B8QeZzeFQ.jpeg" /><figcaption>Source: <a href="https://cryptalker.com/double-spending/">https://cryptalker.com/double-spending/</a></figcaption></figure><p><strong>Crypto Version 2: PagesCoin</strong></p><p>PagesCoin uses the same cryptographic infrastructure (public key, private key, digital signature) as PrimCoin. The only difference is the introduction of a central or third party (much like MasterCard) called Pages, who approves all transaction performed on the crypto platform. Pages uses a simple data structure (a hashed linked list, more technically) to create an append-only ledger (i.e. a blockchain) where he maintains a history of all transactions. In this way, we can prevent double-spending of a coin as Pages could easily go through his ledger and identify previously spent coins.</p><p>But who is Pages? Why does he have so much control over the network? What if he hates you and decides not to approve your transaction? Or what if he changes some records in a transaction? Well, we can use <a href="https://en.wikipedia.org/wiki/Hash_function">cryptographic hash functions</a> to address some of these questions. But remember the earlier versions of cryptocurrency failed because of the concerns of centralization. Pages, in this scenario, depicts a central authority who controls the network, much like a Superman of Metropolis. We don’t want our cryptocurrency blockchain to function in that manner. That said, we propose a new decentralized cryptocurrency, which we all want: the EcoCoin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*2ZhbGlCatA9ux5TAILdV_Q.jpeg" /><figcaption>Pages, the Superman</figcaption></figure><p><strong>Crypto Version 3: EcoCoin</strong></p><p>The functionality of EcoCoin is adapted from that of Satoshi’s Bitcoin. Instead of having a central node or third party (like Pages) to approve transactions, we rather allow everyone (or node) to participate in the approval and writing of valid transactions unto the public ledger. This is one step towards achieving decentralization. But wait? Why should I care to maintain the blockchain? “What do I get in return?” To motivate nodes to participate in the network, we provide them with incentives or rewards. This is one of the success stories of Bitcoin. Bitcoin rewarded miners to maintain the blockchain and achieved trust.</p><p>There arise another challenge! Since every node is motivated by this reward(currently 12.5 bitcoin (BTC) equivalent to $100,000. Do the maths!), who gets to receive the reward? Here’s the trick: All interested nodes are given a cryptographic puzzle to solve. And anyone who finishes it first gets the reward and writes the next block of transaction unto the public ledger. This is a process we often call “Bitcoin Mining”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XSriK9FXFH-oKaGG" /><figcaption>Source: <a href="https://www.bitpanda.com/">https://www.bitpanda.com/</a></figcaption></figure><p>While the above iterations seem perfect, we, however, have few challenges to address on our decentralized EcoCoin platform. See, in an attempt to solve the problems identified above in PrimCoin, we have introduced new problems and we must solve them! Some of these problems/questions are listed below.</p><p>(1) How do we create a system that keeps track of the order of transactions such that every node has a valid record, which is often used to solve the puzzle?</p><p>(2) How do all the nodes agree on the state of the blocks or transaction, a term called distributed consensus? And how is voting carried out on the network?</p><p>(3) How do we prevent dishonest nodes from cheating on the network? And finally,</p><p>(4) How do we design a crypto platform that is highly available and reliable even in the face of network latency?</p><p>In my next post, I shall discuss how some authors have approached these questions and concerns. I hope the concept of PrimCoin, PagesCoin and EcoCoin have served well to introduce you to how cryptocurrencies work at the very core. If it did, don’t forget to clap or give a comment below.</p><p><strong>References</strong></p><p>[1] <a href="https://www.dw.com/en/west-african-states-mired-in-controversy-over-eco-currency/a-52045052">https://www.dw.com/en/west-african-states-mired-in-controversy-over-eco-currency/a-52045052</a></p><p>[2] <a href="https://allafrica.com/stories/202001030519.html">https://allafrica.com/stories/202001030519.html</a></p><p>[3] <a href="https://medium.com/the-gps/west-africa-doesnt-need-eco-it-needs-crypto-2bc44d70dc84">https://medium.com/the-gps/west-africa-doesnt-need-eco-it-needs-crypto-2bc44d70dc84</a></p><p>[4] <a href="https://d28rh4a8wq0iu5.cloudfront.net/bitcointech/readings/princeton_bitcoin_book.pdf">the Princeton textbook on bitcoin</a></p><p>Credit: Instructor and coursemates taking blockchain and cryptocurrencies at CMU-Africa S2020</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ac97f745dc5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain and Cryptocurrencies for Beginners]]></title>
            <link>https://medium.com/@isaac.p.coffie/blockchain-and-cryptocurrencies-for-beginners-98bcf8714afb?source=rss-c0d493dcbf5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/98bcf8714afb</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Isaac Coffie]]></dc:creator>
            <pubDate>Tue, 28 Jan 2020 18:02:45 GMT</pubDate>
            <atom:updated>2020-01-28T19:16:24.105Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3hyWN8UhcrL7P0Opbu7IQg.jpeg" /><figcaption>Source: <a href="https://geospatialmedia.s3.amazonaws.com/wp-content/uploads/2017/07/blockchain.jpg">https://geospatialmedia.s3.amazonaws.com/wp-content/uploads/2017/07/blockchain.jpg</a></figcaption></figure><p>The first word that comes to mind when we hear of blockchain is probably Bitcoin. I too, used to think in a similar fashion until I took a course in Blockchain and Cryptocurrencies at Carnegie Mellon University Africa, a course taught by Professor Martin Saint (<a href="https://www.africa.engineering.cmu.edu/_files/archive-faculty-and-staff-bios/martin-saint.html">https://www.africa.engineering.cmu.edu/_files/archive-faculty-and-staff-bios/martin-saint.html</a>). But hey, don’t be embarrassed, for we were somewhat right, as Bitcoin was, and still is, one of the populous applications of the blockchain technology. However, blockchain transcends just Bitcoins: we can apply this technology in virtually every industry, including finance, government, education, health, among many others.</p><h3><strong>What is Blockchain?</strong></h3><p>Before we uncover the nitty-gritty of blockchain, it helps to understand what the technology is and what it isn’t. History has it that two researchers by name Stuart Haber and W. Scott Stornetta first introduced the blockchain technology in 1991. However, blockchain became only widespread in 2008 when the pseudonymous Satoshi Nakamoto published his (or their) seminal paper titled “Bitcoin: A Peer-to-Peer Electronic Cash System”.</p><p><strong>Blockchain can be defined as a chain of blocks stored on a distributed or decentralized public ledger such that it is practically infeasible to tamper with a record without being noticed.</strong> Easy peasy! This is too complicated, I know. Now let’s try to break these properties down.</p><p><strong>Blocks</strong>: Think of blocks as a container that holds batches of digital transactions. In each transaction, we can have information such as the entity performing the transaction (more on this later), the timestamp, amount of money involved, etc. Each block can contain more than 1MB of transaction data depending on how it is programmed. A combination of these blocks is then stored on some data structure (mainly a list or a tree) such that the previous block points to the current block in that fashion. This is what we often term as blockchain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MA-b0k8yFpJYKqVyPMVY6A.png" /><figcaption>Source: <a href="https://uploads-ssl.webflow.com/5dc87b3620589749198717e1/5dd58bb173bc293b8e0db371_how-does-ethereum-work-anyway-3.png">https://uploads-ssl.webflow.com/5dc87b3620589749198717e1/5dd58bb173bc293b8e0db371_how-does-ethereum-work-anyway-3.png</a></figcaption></figure><p><strong>Decentralized Public Ledger</strong>: A centralized system is any system that is managed and controlled by a single entity. A decentralized system, therefore, is entirely the opposite! Instead of saving all the records of transactions on one central database (as done in the banking sector), copies of every transaction recorded on the blockchain platform are duplicated across several computers. For instance, if Alice transacts business with Bob, copies of this transaction will be sent to all nodes or computers on the network. This property helps to mitigate the issue of a single point of failure as the records are on the public ledger, where everyone can write and read from. Why is this desirable though? One useful application of blockchain is to provide a permanent history of transactions. However, we can only achieve this feature if digital records are stored using a decentralized server as opposed to the traditional centralized servers. Imagine your 1GB data being lost because you use a centralized database. How catastrophic that event will be? So, to guard against data loss and proof of transaction, a decentralized system is rather prefered. Any application that achieves this feature is called a decentralized app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jOCY6cGdoZuj05dLppC1-g.png" /><figcaption>Source: <a href="https://s3.amazonaws.com/cbi-research-portal-uploads/2017/11/20155651/112017-Blockchain-4-V2.png">https://s3.amazonaws.com/cbi-research-portal-uploads/2017/11/20155651/112017-Blockchain-4-V2.png</a></figcaption></figure><p><strong>Permanent Records:</strong> This concept is often termed as immutability. Once records are saved on the public ledger, it cannot be modified or updated without being noticed. For example, when you upload your documents unto the cloud (say Google Drive) and download it back (say few days), how could you accurately tell if your files have not been modified? Can you? Certainly NOT! But on a blockchain network, we could quickly tell because of the cryptographic nature of the data structure used to store these transactions (mainly hash functions, which will be discussed later). This feature explains why financial institutions and other industries are embracing this technology.</p><p><strong>Prospects of Blockchain</strong></p><p>Blockchain is here to stay despite its low visibility. Following the Gartner’s Hype Cycle for Emerging Technologies in 2018, within the next 5 years, we expect to see an upsurge in blockchain-related applications. Currently, blockchain is in the “Trough of Disillusionment” stage of the cycle and will soon be on the “Plateau of Productivity” where the waves of blockchain-related projects will be felt. When that day comes, you’ll surely remember this article.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LwqSImd4aZpGGH60U4-RrQ.png" /><figcaption>Source: <a href="https://www.gartner.com/smarterwithgartner/5-trends-emerge-in-gartner-hype-cycle-for-emerging-technologies-2018/">https://www.gartner.com/smarterwithgartner/5-trends-emerge-in-gartner-hype-cycle-for-emerging-technologies-2018/</a></figcaption></figure><p>Remember we never mentioned anything about the use cases of blockchain: cryptocurrencies (such as Bitcoin and Ethereum), smart contracts, crowdfunding, supply chain auditing, cross-border money transfer, intellectual property protection etc. We shall discuss these terms more broadly in a later session. This article is only meant to be an introduction to blockchain, and I do hope it has served its purpose.</p><p><strong>References</strong></p><p><a href="https://www.investopedia.com/terms/b/blockchain.asp">https://www.investopedia.com/terms/b/blockchain.asp</a></p><p><a href="https://www.gartner.com/smarterwithgartner/5-trends-emerge-in-gartner-hype-cycle-for-emerging-technologies-2018/">https://www.gartner.com/smarterwithgartner/5-trends-emerge-in-gartner-hype-cycle-for-emerging-technologies-2018/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98bcf8714afb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building RESTful APIs with Node.js & MySQL — Part 3]]></title>
            <link>https://medium.com/@isaac.p.coffie/building-restful-apis-with-node-js-mysql-part-3-d05cb0ebfb87?source=rss-c0d493dcbf5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d05cb0ebfb87</guid>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[restful-api]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Isaac Coffie]]></dc:creator>
            <pubDate>Thu, 16 Jan 2020 10:20:53 GMT</pubDate>
            <atom:updated>2020-02-04T19:27:19.593Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building RESTful APIs with Node.js &amp; MySQL — Part 3</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*Qn3kJEvBD9w-DnASZ2EgIQ.png" /></figure><p>This article is part of an ongoing series on building RESTful APIs with Node.js and MySQL.</p><p><a href="https://medium.com/@isaac.p.coffie/building-restful-apis-with-node-js-mysql-part-1-4baec118dd7b">In part 1, we focused on setting up the project folder and the Node.js environment</a></p><p>We also delved deeper into <a href="https://medium.com/@isaac.p.coffie/building-restful-apis-with-node-js-mysql-part-2-ce38d3219224">implementing the REST API endpoints in part 2</a>.</p><p>In this tutorial, we shall verify or test the correctness of the API endpoints implemented in the previous article.</p><p><strong>Putting everything together</strong></p><p>We’ve basically covered all the necessary part of the project. We only need to put all the pieces of files together. To do so, open the index.js file and update it with the content below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bCPCcV09S8KqJI0ID6yJQQ.png" /><figcaption>index file</figcaption></figure><p><strong>Starting the server</strong></p><p>Start the Node server by running <strong>node index.js</strong> on your terminal, relative to your project folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*8J2cqxMrOVBT9BzZGS5b2Q.png" /><figcaption>Starting the Node server</figcaption></figure><p><strong>Testing the APIs using POSTMAN</strong></p><p>We’ll use Postman, an open-source tool to test our APIs. You can download and install it here: <a href="https://www.getpostman.com/downloads/">https://www.getpostman.com/downloads/</a></p><p>Once installed, open Postman and let’s begin with the following test cases</p><p><strong>Test case 1: Adding New Book</strong></p><p>To do this, we’ll make a call to our POST/book/ endpoint. Since our app is hosted locally on port 3000, we can access our RESTful APIs through <a href="http://localhost:3000/book">http://localhost:3000/book</a></p><p>For validation and verification purposes, I have truncated my table (i.e. deleted all the records in my books table) as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*pvexJ1f543KEnX2s9twgmg.png" /><figcaption>Truncated table</figcaption></figure><p>Let’s proceed to add new book via our REST endpoint</p><p>Copy and paste the URL (<a href="http://localhost:3000/book">http://localhost:3000/book</a>) into the address bar of POSTMAN</p><p>Change the HTTP method from GET to POST</p><p>This will make the <strong>body</strong> tab just below the address bar visible.</p><p>In the body, choose urlencoded as the data format</p><p>Enter the details of any favourite book using the key-value pairs. For example, you could try adding this book:</p><p><em>Title: Cryptography and Network Security</em></p><p><em>Year: 2017</em></p><p><em>Author: William Stallings</em></p><p>You then send the request by hitting the <strong>SEND</strong> button</p><p>The result is shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZviPzploHj3zGOuXLw1u5g.png" /><figcaption>Adding a new book entry</figcaption></figure><p>You can confirm this result with your phpMyAdmin database. As shown below, a new record has been inserted into our table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*HSkeBWNLvWTafBLe-MaNaQ.png" /><figcaption>Successful insertion operation</figcaption></figure><p>You may want to insert more records</p><p><strong>Test case 2: Retrieving all books</strong></p><p>Make a GET request to the URL <a href="http://localhost:3000/book">http://localhost:3000/book</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Yr-4puPu1S4w_e9WH8Qdg.png" /><figcaption>retrieving all books</figcaption></figure><p><strong>Test case 3: Fetch one book by ID</strong></p><p>Pick an ID of one of the books above and make a GET request</p><p>Be sure to include the book_id in the parameter of the request as shown below. In this test case, I used a book with id = 3</p><p>URL: <a href="http://localhost:3000/book">http://localhost:3000/book</a>/3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*a4VDJCKiKinGNQtUuAbB7Q.png" /><figcaption>Fetch one record</figcaption></figure><p><strong>Test case 4: Updating a book</strong></p><p>Let’s try updating the details of the book with ID = 4</p><p>Since this is an update request, we’ll make a PUT request to the URL <a href="http://localhost:3000/book/4">http://localhost:3000/book/4</a></p><p>In the body of the request, we’ll change the year from 2017 to 2018</p><p>As could be seen from the response text below, one row has been affected, indicating a successful update operation. You can run the “GET all books” API again to verify this change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*3kicnyDNxR9l1NbHENXfzg.png" /><figcaption>Update a book</figcaption></figure><p><strong>Test case 5: Deleting a book</strong></p><p>For some weird reason, you decided you delete the book with ID = 1, the very first book inserted.</p><p>Make a DELETE request to the <a href="http://localhost:3000/book/1">http://localhost:3000/book/1</a> endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*0J3V7t8BhWTgjm0eJhjA9g.png" /><figcaption>Deleting a book</figcaption></figure><p><strong>Final Remarks</strong></p><p>Congratulations for making it this far. You have successfully learned how to create a RESTful API using Node.js with a MySQL database. In part 4 of this series, we’ll look into API security.</p><p>In case you missed part 1 of this tutorial, you can look it up <a href="https://medium.com/@isaac.p.coffie/building-restful-apis-with-node-js-mysql-part-1-4baec118dd7b">here</a></p><p>Part 2 is also available <a href="https://medium.com/@isaac.p.coffie/building-restful-apis-with-node-js-mysql-part-2-ce38d3219224">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d05cb0ebfb87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building RESTful APIs with Node.js & MySQL — Part 2]]></title>
            <link>https://medium.com/@isaac.p.coffie/building-restful-apis-with-node-js-mysql-part-2-ce38d3219224?source=rss-c0d493dcbf5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce38d3219224</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[restful-api]]></category>
            <dc:creator><![CDATA[Isaac Coffie]]></dc:creator>
            <pubDate>Tue, 14 Jan 2020 13:56:23 GMT</pubDate>
            <atom:updated>2020-02-04T19:24:44.479Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building RESTful APIs with Node.js &amp; MySQL — Part 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*oOlLRL3X0hJqIcCWHdQ99Q.png" /></figure><p>In <a href="https://medium.com/@isaac.p.coffie/building-restful-apis-with-node-js-mysql-part-1-4baec118dd7b">part 1 of this series</a>, we discussed briefly, the concept of APIs and more importantly RESTful APIs. We, additionally, downloaded, installed and created a node server with limited functionalities. In this section, we’ll dive deeper into creating the REST API endpoints for our BIMS as shown below:</p><p>Retrieve all books: GET /book/</p><p>Find a book by ID: GET /book/:id?</p><p>Save a book: POST /book</p><p>Update a book: PUT /book/:id</p><p>Delete a book: DELETE /book/:id</p><p><strong>Setting up our database</strong></p><p>Since our server will interact with a data source, we will have to create a data storage. And in this case, we shall use a MySQL database. Download and install MySQL by following this link if you are yet to do so.</p><p>MySQL: <a href="https://www.mysql.com/downloads/">https://www.mysql.com/downloads/</a></p><p>You can also download XAMPP as it comes with MySQL: <a href="https://www.apachefriends.org/download.html">https://www.apachefriends.org/download.html</a></p><p>After installing XAMPP or MySQL Workbench, open the XAMPP Control Panel (we’re using XAMPP) and start the MySQL and Apache web server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*YAlbVeFoWnNcIOfFT6m1UA.png" /><figcaption>XAMPP Control Panel</figcaption></figure><p>XAMPP comes with a phpMyAdmin DBMS. You can access this DBMS by clicking on the MySQL Admin button as shown above. This will open the phpMyAdmin on your localhost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nUNBVvjm19o97fjT_UJnUA.png" /><figcaption>phpMyAdmin interface</figcaption></figure><p>To create a new database, click on the <strong>new</strong> button on the left vertical menu as seen above. The name of the database we shall use is “<strong>bims”</strong>. Inside the bims database, create a table called book having the following attributes or columns and data types:</p><blockquote>CREATE TABLE `book` (</blockquote><blockquote>`book_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,</blockquote><blockquote>`title` varchar(50) NOT NULL,</blockquote><blockquote>`year` int(11) NOT NULL,</blockquote><blockquote>`author` varchar(100) NOT NULL</blockquote><blockquote>)</blockquote><p>After this process, your table structure should be similar to the table below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ap4PQjQI8_s3J5ZLi7qvg.png" /><figcaption>Table structure</figcaption></figure><p>At this point, we’ve successfully created our data source in a MySQL database and now ready to link it to the Node.js server.</p><p><strong>Database Configuration Files</strong></p><p>One crucial element in any software development project is the concept of encapsulation: hiding details from the application layer. That said, we’ll hide the details of our database configuration details in a separate file named dbconnection.js. This file should be in the root directory of your project folder. You can look up the project folder in the previous tutorial.</p><p>The content of the dbconnection.js file is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvJBG4TOk2F_CkPk1DdPFA.png" /><figcaption>database connection file</figcaption></figure><p><strong>Code explanation:</strong></p><p>We imported the MySQL Node.js connector on line 1 using the required keyword. We then created and exported a MySQL pool with the connection details. Note that we’re using localhost as our web server. You can also update the connection details if you’re using a password or your database server is hosted on the cloud.</p><p><strong>Define the data model</strong></p><p>In this section, we’ll create functions that can communicate with the database layer. If you’re familiar with SQL, you should find the queries below self-explanatory.</p><p>So, in your model folder, create a file called book_model.js.</p><p>The content of the file is shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZ4x2Yz4MGi7AqWfOShFbA.png" /><figcaption>book model file</figcaption></figure><p>In the code snippet above, we created a Book module that helps us to manipulate the content of our database.</p><p><strong>Connecting the Model to the Controller</strong></p><p>We’ll now register the functions in the book_model.js with the routes in the book_controller.js.</p><p>Fire up your book_controller.js file (which is located in the controller folder) and include important header files as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9DI9Jayxo5KmvBaZ_93vQQ.png" /><figcaption>controller header file</figcaption></figure><p>Here, we first imported the express JS framework. From the express app, we called the router object, which acts as a middleware to route API calls based on the endpoints and the HTTP method used. We then finally included the book_model.js file on line 3.</p><p>Let’s now define our API endpoints with code implementation</p><p><strong>1)</strong> <strong>Insert a new book ==&gt; POST /book/</strong></p><p>Any book entry will be saved to our database through this endpoint. Using the body-parser module, this endpoint will parse and process the data (title, year and author) in the body of the request object using <em>req.body.</em> It will then call the createNewBook() function in the book_model.js. It finally sends a JSON object in response after insertion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sr0WU3CDUJ-xexncQfSbXQ.png" /><figcaption>create new book item</figcaption></figure><p><strong>2)</strong> <strong>Get all books ==&gt; GET /book/</strong></p><p>This API endpoint will return all books in the database. It simply calls the getAllBooks() function in the book_model.js</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qYUp176udZshJHUhPOHuZQ.png" /><figcaption>fetch all books</figcaption></figure><p><strong>3)</strong> <strong>Get a book by ID ==&gt; GET /book/:id?</strong></p><p>This endpoint is designed to return a book when given its ID. We will first check if there’s an id field in the request parameter. If it does exist, we will parse this value (with the help of body-parser library) and pass it to the getBookById() function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H28Ix1vfi4elCUVdn3JC0g.png" /><figcaption>fetch book by ID</figcaption></figure><p><strong>4)</strong> <strong>Update a book by ID ==&gt; PUT /book/:id</strong></p><p>An API endpoint for updating details of a book. It takes the book_id from the request parameter and the new book details from the request body. It returns a JSON response upon completion of the update operation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L999TvSXV1N9pBtX1G7Maw.png" /><figcaption>update a book</figcaption></figure><p><strong>5)</strong> <strong>Delete a book by ID ==&gt; DELETE /book/:id</strong></p><p>This route simply deletes a book when given an ID. It returns the number of affected rows afterwards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xybDGiLHaWGlFuEhP3qe2w.png" /><figcaption>delete a book</figcaption></figure><p>Don’t forget to export the router object so it can be accessible to other files when imported using the <strong><em>required</em></strong> keyword.</p><blockquote><em>module.exports = router;</em></blockquote><p>To this end, we have successfully created all the 5 REST API endpoints although we are yet to verify and validate their performance. We shall continue with the testing phase in <a href="https://medium.com/@isaac.p.coffie/building-restful-apis-with-node-js-mysql-part-3-d05cb0ebfb87">part 3</a> of this series.</p><p>In case you missed part 1, you can have a good read <a href="https://medium.com/@isaac.p.coffie/building-restful-apis-with-node-js-mysql-part-1-4baec118dd7b">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce38d3219224" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building RESTful APIs with Node.js & MySQL — Part 1]]></title>
            <link>https://medium.com/@isaac.p.coffie/building-restful-apis-with-node-js-mysql-part-1-4baec118dd7b?source=rss-c0d493dcbf5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4baec118dd7b</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Isaac Coffie]]></dc:creator>
            <pubDate>Mon, 06 Jan 2020 16:07:45 GMT</pubDate>
            <atom:updated>2020-01-16T13:09:51.569Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building RESTful APIs with Node.js &amp; MySQL — Part 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*Q3LqrmwudonRzmz-Os5JsQ.png" /></figure><p><strong>Overview</strong></p><p>The objective of this tutorial is to provide some basic guidelines on building RESTful APIs using Node.js and a MySQL database. To make this 5-minute tutorial fun, we shall use a practical case study: a bookshop inventory management system (herein BIMS). Since a BIMS involves developing complex modules, we shall only focus on the books module where we manage information/details about a book. By the end of this tutorial, it is my fervid hope that you get all the necessary skills required to create a RESTful API for your next project.</p><p><strong>But wait… What is an API anyway?</strong></p><p>In a layman’s perspective, an API (Application Programming Interface) is an intermediary platform where two or more applications communicate with each other. More technically, an API is an architectural approach that provides an interface or communication protocol for computer systems to exchange resources (in most cases, data). Examples of APIs include Google Maps API, Facebook’s social login API, Microsoft Cognitive Text-2-Speech API, among many others. You can, however, create custom ones.</p><p><strong>Okay, I get it! But why the name REST API?</strong></p><p>Before REST APIs, the architectural pattern used by developers to exchange data was the Simple Object Access Protocol (SOAP). You can read more on <a href="https://en.wikipedia.org/wiki/SOAP">SOAP here</a>. This architecture, however, consumes high bandwidth. So, in his 2000 influential PhD dissertation at UC Irvine, Roy Thomas Fielding introduced a new architecture which he called REST. The Representational State Transfer (REST) is a software architectural style that defines the protocols and standards for creating web services / APIs. It is known for its flexibility and high performance.</p><p><strong>Components of a RESTful API</strong></p><p>In a RESTful API, all documents or information to be shared are labelled as <strong><em>resources</em></strong>. A URL uniquely identifies these resources. By convention, REST URLs are created using an endpoint: a combination of <strong>HTTP</strong> method and path to the resource. The most used HTTP methods are POST, GET, PATCH, DELETE etc. and these are synonymous to our famous CRUD (Create, Read, Update and Delete) operations used at the database layer, with the following mapping:</p><p>Post — Create, GET — Read, Patch — Update and Delete simply being Delete.</p><p>RESTful APIs are known to provide scalability, reliability, and better performance as compared to SOAP since they can handle multiple calls and return different data format. More, the widely used data format is JSON (JavaScript Object Notation) and in some other cases XML (eXtensible Markup Language).</p><p><strong>Installation of Software Stack</strong></p><p>Now that we have a gist of what REST API means, let’s proceed to install the software needed for building our BIMS.</p><p>Download the latest version of Node.js for your OS from here: <a href="https://nodejs.org/en/">https://nodejs.org/en/</a></p><p>Download MySQL using this link: <a href="https://www.mysql.com/downloads/">https://www.mysql.com/downloads/</a></p><p>Alternatively, you can download XAMPP as it comes with MySQL: <a href="https://www.apachefriends.org/download.html">https://www.apachefriends.org/download.html</a></p><p>POSTMAN for testing the APIs: <a href="https://www.getpostman.com/downloads/">https://www.getpostman.com/downloads/</a></p><p>Git bash: <a href="https://git-scm.com/downloads">https://git-scm.com/downloads</a></p><p><strong>Setting up the project folder</strong></p><p>Create an empty folder and rename it after your favourite pet or high school teacher. Mine is simply “bims”. After creating the folder, right-click in it and select “Git Bash Here”.</p><p>Initialize the Node.js project by typing <strong>npm init</strong> as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/1*1SK6NTWGeNnz7C4npJRWzQ.png" /></figure><p>Follow through the prompt to set up your project. A successful walkthrough of this screen should create a package.json file on your project’s root folder.</p><p>Also, create an index.js file if you specified index.js as the main/entry point to your application.</p><p>Create a dbconnection.js file to keep your database configuration details</p><p>In addition to these files, create the following folders and files as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/272/1*bE2LgjYXujYeKic_SDmbgA.png" /><figcaption>project folder</figcaption></figure><p><strong>Install libraries and initialize project</strong></p><p>In this tutorial, we will need to install the following libraries</p><p><strong>Node Express:</strong> the web framework for creating the node server</p><p><strong>MySQL Connector</strong>: a MySQL connector for Node.js</p><p><strong>Body-parser:</strong> for parsing or extracting fields from API request</p><p>Run the following commands to install the libraries:</p><p><strong>npm install</strong></p><p><strong>npm install -g –S express body-parser mysql</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*m5DC7SbANNUluMm5swZ48w.png" /><figcaption>install libraries</figcaption></figure><p>You should have a folder named node_modules and a new package-lock.json file. Your project folder should look like the one below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2d66GxmH4D7PAu4zN_dHtA.png" /><figcaption>updated project folder</figcaption></figure><p><strong>Start the Express Server:</strong></p><p>Express JS is a popular framework for Node.js. Rather than creating the node HTTP server from scratch and managing the routes and other hard code node dependencies, Express JS simplifies this tedious process.</p><p>To start the Express framework, we follow these 5 steps:</p><p>1. Import the Express module using the <strong>require</strong> keyword as follows:</p><blockquote>var express = require(‘express’)</blockquote><p>2. Initialize the Express app using:</p><blockquote>var app = express();</blockquote><p>3. Create routes / endpoints</p><p>This is where we define our API endpoints to be consumed. For the purpose of this section, let’s simply create a gateway endpoint that returns “Welcome to BIMS” when a user hits our app.</p><blockquote>app.get(‘/’, (req, res) =&gt; res.send(‘Welcome to BIMS’));</blockquote><p>4. Listen on a port, in this case, port 3000</p><blockquote>app.listen(3000, function() {</blockquote><blockquote>console.log(‘Listening on port 3000…’)</blockquote><blockquote>});</blockquote><p>The content of your index.js file should be similar to the image below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*fNKFwcz1A9N26jcveahEIg.png" /><figcaption>index.js</figcaption></figure><p>5. Execute the index.js file locally by running <strong>node index.js</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*_bFrHxe4UNGVXe9eDTRefg.png" /><figcaption>execute code on cmd</figcaption></figure><p><strong>Testing API with POSTMAN</strong></p><p>We will use POSTMAN to test the API.</p><p>Since we created a GET endpoint, we will select the GET HTTP method from the list and enter the URL: <a href="http://localhost:3000/">http://localhost:3000/</a></p><p>The response is shown in the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ViGDrkfxrNbYBA1E6qsXmw.png" /><figcaption>API Testing with POSTMAN</figcaption></figure><p>You can achieve the same result on your local browser by typing <a href="http://localhost:3000/">http://localhost:3000/</a> into your address bar since this is a GET request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*Hx690RkVmZpx2ehLPX3p5Q.png" /><figcaption>API Testing on browser</figcaption></figure><p><strong>Final remarks</strong></p><p>This tutorial is only meant to introduce you to REST APIs and how to set up the tools and libraries needed for the “BIMS” project. We have also learned how we can create an Express API and interact with POSTMAN.</p><p>In the following section (<a href="https://medium.com/@isaac.p.coffie/building-restful-apis-with-node-js-mysql-part-2-ce38d3219224">Part 2</a>), we will learn how to create a modularized project using MVC architecture. We will also learn how to perform CRUD operations in Node.js using MySQL database. In <a href="https://medium.com/@isaac.p.coffie/building-restful-apis-with-node-js-mysql-part-3-d05cb0ebfb87">part 3</a> of this series, we will secure our REST APIs using Passport and other Auth techniques.</p><p>See you in the next tutorial!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4baec118dd7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Determinants of E-learning Adoption in African Higher Education Institutions]]></title>
            <link>https://medium.com/@isaac.p.coffie/determinants-of-e-learning-adoption-in-african-higher-education-institutions-d4a2e6f76a1?source=rss-c0d493dcbf5f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4a2e6f76a1</guid>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Isaac Coffie]]></dc:creator>
            <pubDate>Thu, 02 Jan 2020 17:03:29 GMT</pubDate>
            <atom:updated>2020-01-02T17:03:29.148Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*4jrZVlnj5CY8eJDLdOPk4w.jpeg" /><figcaption>Source: <a href="https://www.syspro.com/blog/owning-or-running-erp/e-learning-changing-the-landscape-of-education/">https://www.syspro.com/blog/owning-or-running-erp/e-learning-changing-the-landscape-of-education/</a></figcaption></figure><p><strong>Background Information and Research Topic</strong></p><p>The advancement in teaching methodologies, particularly in higher education, has received recognition in academia. Until the introduction of information technologies (IT) in the early 2000s, the approaches to teaching and learning has mainly been limited by geographical locations. However, the advent of electronic learning (e-learning) technologies has transformed the educational landscape, thereby overcoming this location barrier. E-learning, which is defined as the use of information technologies to support teaching and learning in an online platform has allowed students to learn at their own space and access teaching materials anywhere (Owuor, Kogeda, Anele &amp; Osuri, 2013). Despite the enormous benefits that come with this technology, many African universities are yet to implement e-learning in their institutions. This paper seeks to shed light on the factors that influence an institution to adopt e-learning technologies in this region. Previous studies have focused on technological factors such as availability of IT infrastructure, perceived ease of use, and environmental factors such as educational partnerships and competition. However, there is limited research on how competition from neighbouring universities could influence an institution to adopt e-learning technologies. Overall, this paper will discuss some of these factors including technological and environmental factors. Areas of further research will equally be addressed in the concluding section of this paper.</p><p><strong>Determinant 1: IT Infrastructure Availability</strong></p><p>One crucial determinant of e-learning adoption in African universities is the availability of IT infrastructures. This is because IT infrastructure such as stable internet connectivity and uninterrupted supply of electricity are the key components of most information technologies, and thus, e-learning systems cannot function in the absence of these infrastructures. For instance, in their investigation into the factors that prevent public universities in Uganda from adopting e-learning systems, Nyeko &amp; Moya (2017) found that the availability of reliable network infrastructure has a significant positive correlation (at 0.01 p-value) with e-learning adoption. This result has been mirrored by Ansong et. al (2017) who also found IT infrastructure, particularly internet connection as the most important variable that influences the adoption of e-learning technologies in Ghanaian universities. More emphatically, about 81% of the managers at the University of Ghana believe that their access to a stable internet connection has been instrumental in their e-learning implementation (Awidi &amp; Cooper, 2015). Besides internet connectivity, the supply of electricity is one of the crippling factors disrupting e-learning adoption in Nigeria as the lack of electricity makes the devices needed for e-learning unavailable for use (Atanda &amp; Ahlan, 2014). Similarly, Makokha &amp; Mutisya (2016) found electricity power interruptions as one of the major challenges impeding e-learning implementation in Kenyan universities. These researches suggest that having adequate IT infrastructure such as internet connection and supply of electricity are likely to influence an institution to adopt e-learning systems.</p><p><strong>Determinant 2: Perceived Ease of Use</strong></p><p>Another technological factor that influences the adoption of e-learning technologies is the perceived ease of use (EOU) of the systems. This perceived EOU could be linked to a broad range of factors such as the cultural and educational background of the users and in some other cases, the general attitude towards use. For example, Boateng et. al (2016) analyzed the response from 337 university students in Ghana and concluded that the perceived ease of use of the e-learning system had a direct relationship with the attitude towards use. Regarding the cultural background, (Wong &amp; Sixl-Daniell, 2017; Owuor, Kogeda, Anele &amp; Osuri, 2013) have discussed the need for educational institutions to consider the cultural and psychographic variables such as language proficiency of the users. Since English is predominantly used on e-learning platforms, it will be appropriate to consider the language proficiency of students as failure to do so may hinder effective communication (Owuor, Kogeda, Anele &amp; Osuri, 2013). In addition to language proficiency, Wong and Sixl-Daniell (2017) have highlighted that any institution that seeks to adopt e-learning must consider the computer literacy of the users. That is, the users of the system should be comfortable using it with limited assistance in order to conserve resources that would be channelled into training students or employees on how to use the system. For this reason, African universities are encouraged to consider the language and computing proficiency of the users of e-learning system in order to save cost on training.</p><p><strong>Determinant 3: Support From Educational Partners</strong></p><p>Moreover, having support from an external educational partner accelerates the adoption of e-learning technologies. Due to the resources needed to install e-learning systems, having external partners may help support an organization to acquire the infrastructures needed to set up the technology. To cite, in their study, Ansong et. al (2017) found that the availability of support from educational partners contributes to the adoption of e-learning, citing that the partnership between Ghana and the Chinese government, for instance, led to a successful enrollment of e-learning systems in Ghana’s public universities. Similar result has been highlighted by Awidi and Cooper (2015) who found that the Chinese government provided capital to revamp the University of Ghana’s IT infrastructure into a world-class standard. Besides the provision of capital, the support from educational partners could also be provided in the form of core services. For example, Nyeko and Moya (2017) discovered that public universities in Uganda that receive telecommunication support from telecommunication service providers in the country towards the implementation of e-learning systems are more likely to be successful. One may infer from these studies that having educational partners who could provide not only capital, but core services may influence an organization to adopt e-learning technologies.</p><p><strong>Determinant 4: Competition</strong></p><p>Furthermore, there exist discrepancies on whether competition among universities may influence an institution to adopt e-learning system. Studies that argue in favour of this factor cite that some institutions implement e-learning technologies to gain reputation and competitive advantage among universities in an area. Ansong et. al (2017), for instance, reported that the desire to gain dominance and reputation in a competitive environment forces an institution to adopt e-learning technologies. Likewise, the introduction of e-learning in an institution may enable one school to be recognized as being better in delivering high-quality education, leading to gaining of good reputation over others (Raouf, Naser &amp; Jassim, 2012). These findings assume that an institution using the e-learning system may attract more students into their school. Moreover, Noh et. al (2012) have discovered that the implementation of e-learning systems in one public university in Malaysia has influenced University Teknologi MARA (UiTM) to equally adopt the technology. Overall, this study suggests that the competitive nature of a school’s market segment may often compel an institution to adopt e-learning technologies to gain dominance and reputation.</p><p>Although the previous paragraph has identified competitive pressure as a significant factor that influences the adoption of e-learning systems, other studies have, nonetheless, found no evidence on competition as a determining factor of e-learning adoption. In particular, Nyeko and Meyo (2017) have shown that there is no statistically significant relationship between the adoption of e-learning and competition. The result from Nyeko’s study implies that school administrators do not consider the use of e-learning systems as a differentiating factor to gain academic prestige. Based on this discrepancy, further studies that shed light on the relationship between competition and e-learning adoption is highly recommended. Such studies may investigate the dynamics of urban and rural universities. Results between competition and e-learning adoption among public and private universities may equally be of use.</p><p><strong>Conclusion</strong></p><p>This paper has discussed the factors that influence institutions to adopt e-learning technologies. In particular, the factors highlighted are broadly classified under technological and environmental factors. The review of the literature, as discussed above, have identified technological factors such as availability of IT infrastructure and perceived ease of use as the most significant factor that determines the adoption and implementation of e-learning technologies. Regarding the environmental factors, this review has shown that having education partners could support an institution to acquire the resources needed to set up an e-learning system. This paper, however, found discrepancy regarding competition and e-learning adoption. As a result of this disparity, further research needs to be conducted in public and private universities in Africa to ascertain the validity on whether competition between institutions could influence an organization to adopt e-learning system.</p><p><strong>References</strong></p><p>Ansong, E., Lovia Boateng, S., &amp; Boateng, R. (2017). Determinants of E-Learning Adoption in Universities: Evidence From a Developing Country. <em>Journal of Educational Technology Systems</em>, 30–60.</p><p>Atanda, B. N., &amp; Ahlan, A. R. (2014). Issues of e-learning in developing countries: A Nigerian perspective. <em>The 5th International Conference on Information and Communication Technology for The Muslim World (ICT4M)</em>, (pp. 1–4). Malaysia.</p><p>Awidi, I. T., &amp; Cooper, M. (2015). Using management procedure gaps to enhance e-learning implementation in Africa. <em>Computers &amp; Education</em>, 64–79.</p><p>Boateng, R., Mbrokoh, A. S., Boateng, L., Senyo, P., &amp; Ansong, E. (2016). Determinants of e-learning adoption among students of developing countries. <em>The International Journal of Information and Learning Technology</em>, 248–262.</p><p>Lwoga, E. (2012). Making learning and Web 2.0 technologies work for higher learning institutions in Africa. <em>Campus-Wide Information Systems</em>, 90–107.</p><p>Makokha, G. L., &amp; Mutisya, D. N. (2016). Status of E-Learning in Public Universities in Kenya. <em>International Review of Research in Open and Distributed Learning</em>, 341–361.</p><p>Noh, N., Isa, P., Samah, S., &amp; Isa, M. (2012). Establishing an organisational e-learning culture to motivate lecturers to engage in e-learning in UiTM. <em>Procedia — Social and Behavioral Sciences, 67</em>, 436–443.</p><p>Nyeko, S., &amp; Moya, S. (2017). Determinants of eLearning adoption among instructors in Ugandan public universities. <em>2017 IST-Africa Week Conference (IST-Africa)</em>, (pp. 1–10).</p><p>Owuor, D., Kogeda, P., Anele, A., &amp; Osuri, S. (2013). Factors affecting E-learning implementation in Southern Africa. <em>2013 Africon</em>, (pp. 1–5).</p><p>Patel, N. M., Kadyamatimba, A., &amp; Madzvamuse, S. (2018). E-Learning Adoption in Rural-Based Higher Education Institutions in South Africa. <em>2018 Open Innovations Conference (OI)</em> (pp. 320–324). South Africa: IEEE.</p><p>Raouf, J. B., Naser, I. S., &amp; Jassim, B. K. (2012). Determinants of E-Learning Implementation Success In The Iraqi MoHE. <em>Eng &amp; Tech Journal </em>, 659–671.</p><p>Wong, A. O., &amp; Sixl-Daniell, K. (2017). The Importance of e-Learning as a Teaching and Learning Approach in Emerging Markets. <em>iJAC</em>, 45–54.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4a2e6f76a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>