<?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 Dustin Hurt on Medium]]></title>
        <description><![CDATA[Stories by Dustin Hurt on Medium]]></description>
        <link>https://medium.com/@dustin.aad?source=rss-45d2a7858705------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hcSJvz664WGVl5QvWUhcFg.png</url>
            <title>Stories by Dustin Hurt on Medium</title>
            <link>https://medium.com/@dustin.aad?source=rss-45d2a7858705------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:19:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dustin.aad/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[Building a Robust CI/CD Pipeline for Terraform on AWS Using GitHub Actions]]></title>
            <link>https://medium.com/@dustin.aad/building-a-robust-ci-cd-pipeline-for-terraform-on-aws-using-github-actions-4afe52cb4263?source=rss-45d2a7858705------2</link>
            <guid isPermaLink="false">https://medium.com/p/4afe52cb4263</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <dc:creator><![CDATA[Dustin Hurt]]></dc:creator>
            <pubDate>Sun, 08 Dec 2024 12:21:46 GMT</pubDate>
            <atom:updated>2024-12-08T12:21:46.698Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4UZhcP62FsXixFKb9QYa9A.png" /></figure><h3>Introduction</h3><p>In today’s fast-paced DevOps landscape, setting up a stable and repeatable CI/CD pipeline isn’t just a nice-to-have — it’s a critical component of modern software delivery. When I recently worked with a talented team of engineers to build a fully-functional Food Delivery App, we deployed feature after feature without a proper CI/CD pipeline in place. Looking back, I realize just how much time, effort, and operational overhead we could have saved by automating our infrastructure deployments. Now that I’ve gained a clearer understanding of Infrastructure as Code (IaC) and the power of combining Terraform with GitHub Actions, it’s clear that an automated CI/CD workflow would have streamlined the entire process — cutting down on human error, speeding up releases, and improving the overall developer experience.</p><p>In this article, I’ll walk you through configuring a CI/CD pipeline for Terraform on AWS, all triggered through GitHub Actions. We’ll dig into the initial setup steps, best practices for keeping your pipeline both robust and flexible, and how to tackle common pitfalls — such as provider versioning issues — that often crop up in these workflows. Whether you’re a DevOps engineer, site reliability engineer, or simply someone looking to optimize their Terraform deployments and speed up continuous integration and continuous delivery, this guide aims to give you the practical know-how you need. Let’s dive in and transform the way you manage, scale, and secure your AWS infrastructure.</p><h3>Summary of Foundational DevOps Learnings from the Cloud Engineer Academy</h3><p>During the Cloud Engineer Academy DevOps module, I delved deep into the principles and practices that define modern DevOps workflows, continuous integration, continuous delivery (CI/CD), and infrastructure automation. The training emphasized the transformative shift from siloed development and operations teams to an integrated culture that streamlines software delivery, enhances collaboration, and shortens release cycles.</p><p>Key takeaways included understanding how DevOps bridges communication gaps, reduces the “throw it over the wall” mentality, and eliminates the sluggish, risky release cycles that once plagued traditional IT environments. By embracing cultural changes, automation, and continuous improvement, DevOps promotes transparency, speed, and reliability — benefits that directly translate into competitive advantages, improved product quality, and elevated customer satisfaction.</p><p>The course also highlighted the importance of Infrastructure as Code (IaC) tools like Terraform, as well as the critical role CI/CD pipelines play in delivering value faster. From learning how GitHub Actions can seamlessly integrate testing, building, and deploying code, to exploring popular CI/CD tools like Jenkins and GitLab CI, I gained insights into the best practices for managing dependencies, running automated tests, and using version-controlled repositories. Additionally, the concept of automated, repeatable deployments — coupled with robust testing and reliable rollback strategies — underscored the key principles behind continuous delivery and deployment.</p><p>Ultimately, this foundational knowledge from Cloud Academy lays the groundwork for implementing smooth, efficient DevOps pipelines. It integrates everything from initial planning and development to production deployment, while ensuring that infrastructure changes remain consistent, secure, and easy to maintain. With a clear understanding of DevOps fundamentals, CI/CD best practices, and the mechanics behind tools like Terraform and GitHub Actions, I’m now equipped to apply these principles to real-world projects, enabling faster releases, stable infrastructures, and higher customer satisfaction.</p><h3>Setting Up the GitHub Actions Workflow</h3><p>When it comes to streamlining your DevOps process, having a well-structured CI/CD pipeline is everything. After working on projects without these automated workflows, I’ve learned firsthand just how much time and hassle a proper setup can save. With GitHub Actions, we can integrate Terraform and AWS seamlessly — allowing us to get code from repository to cloud infrastructure without a manual headache.</p><p><strong>Project Structure</strong><br>First, you’ll need to create a dedicated directory in your repo to house all workflow configuration files. Here’s how:</p><ul><li><strong>New Directory</strong>: In the root of your repository, create a folder named .github/workflows.</li><li><strong>Workflow File</strong>: Inside this new directory, add a file called cicd_pipline.yml. This file will define all the steps and triggers of your CI/CD pipeline, from initialization to deployment.</li></ul><p><strong>Configuring GitHub Secrets</strong><br>Before we can fully leverage GitHub Actions for AWS deployments, we need to set up secure credentials. Rather than hard-coding sensitive information (which is a big no-no in any environment), we’ll use GitHub Secrets to keep things locked down:</p><p><strong>Path</strong>: Go to your repository in GitHub, then navigate to <strong>Settings &gt; Secrets and Variables &gt; Actions</strong>.</p><p><strong>Add AWS Credentials</strong>:</p><ul><li>AWS_ACCESS_KEY_ID</li><li>AWS_SECRET_ACCESS_KEY</li></ul><p>By adding these values, you’re essentially granting GitHub Actions the secure access it needs to interact with your AWS environment. This ensures that the CI/CD pipeline can run terraform init, terraform plan, and terraform apply steps without exposing sensitive information in the codebase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oP9lAZKUP6C9NjuIHDAqhA.png" /></figure><p>Once you’ve got this basic setup in place, you’re ready to start defining your CI/CD pipeline logic and bringing your automated deployment process to life.</p><h3>The CI/CD Pipeline Configuration</h3><p>Now that we have our CI/CD pipeline file set up, let’s break down exactly what’s happening and why we structured things this way. As someone who’s been elbows-deep in last-minute, manual deployments (trust me, not fun), using this automated Terraform workflow with GitHub Actions is a game-changer. It saves time, reduces human error, and gives you a crystal-clear view of infrastructure changes before anything hits production.</p><p><strong>Why Separate the Apply Job From Init and Plan?</strong><br>The init and plan steps are designed to run automatically whenever code is pushed or a pull request is opened. This gives you immediate feedback on what will happen if you choose to move forward—helping you catch errors, misconfigurations, or unintended changes early. On the other hand, the apply step is intentionally left out of this automated loop. Instead, it’s triggered only on workflow_dispatch, which means you must manually approve it.</p><p>This separation is crucial because it prevents unintentional deployments. By requiring human intervention to kick off the apply job, you maintain control over when and how your infrastructure changes roll out. In other words, you get the best of both worlds: fully automated checks and balances for planning, plus a human safeguard before anything hits the live environment.</p><pre>name: CI/CD Pipeline for FlowStream</pre><pre>on:<br>  push:<br>    branches:<br>      - main<br>  pull_request:<br>    branches:<br>      - main<br>  workflow_dispatch:</pre><pre>jobs:<br>  terraform-init-plan:<br>    name: Terraform Init and Plan<br>    runs-on: ubuntu-latest</pre><pre>    steps:<br>      - name: Checkout Repository<br>        uses: actions/checkout@v3</pre><pre>      - name: Configure AWS Credentials<br>        uses: aws-actions/configure-aws-credentials@v1<br>        with:<br>          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}<br>          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}<br>          aws-region: us-east-1</pre><pre>      - name: Setup Terraform<br>        uses: hashicorp/setup-terraform@v2<br>        with:<br>          terraform_version: 1.10.1</pre><pre>      - name: Cache Terraform Modules<br>        uses: actions/cache@v3<br>        with:<br>          path: .terraform<br>          key: ${{ runner.os }}-terraform-${{ hashFiles(&#39;**/*.tf&#39;) }}<br>          restore-keys: |<br>            ${{ runner.os }}-terraform-</pre><pre>      - name: Initialize Terraform<br>        run: terraform init -upgrade</pre><pre>      - name: List Current Directory and Files<br>        run: ls -al</pre><pre>      - name: Terraform Version Debug<br>        run: terraform version</pre><pre>      - name: Terraform Plan<br>        run: terraform plan -out=tfplan</pre><pre>      - name: Upload Plan<br>        uses: actions/upload-artifact@v4<br>        with:<br>          name: terraform-plan<br>          path: tfplan</pre><pre>  terraform-apply:<br>    name: Terraform Apply<br>    runs-on: ubuntu-latest<br>    needs: terraform-init-plan<br>    if: github.event_name == &#39;workflow_dispatch&#39;</pre><pre>    steps:<br>      - name: Checkout Repository<br>        uses: actions/checkout@v2</pre><pre>      - name: Setup Terraform<br>        uses: hashicorp/setup-terraform@v2<br>        with:<br>          terraform_version: 1.10.1</pre><pre>      - name: Download Plan<br>        uses: actions/download-artifact@v4<br>        with:<br>          name: terraform-plan<br>          path: .</pre><pre>      - name: Configure AWS Credentials<br>        uses: aws-actions/configure-aws-credentials@v1<br>        with:<br>          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}<br>          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}<br>          aws-region: us-east-1</pre><pre>      - name: Cache Terraform Modules<br>        uses: actions/cache@v3<br>        with:<br>          path: .terraform<br>          key: ${{ runner.os }}-terraform-${{ hashFiles(&#39;**/*.tf&#39;) }}<br>          restore-keys: |<br>            ${{ runner.os }}-terraform-</pre><pre>      - name: Initialize Terraform<br>        run: terraform init -upgrade</pre><pre>      - name: Terraform Apply<br>        run: terraform apply -auto-approve tfplan</pre><h4>Workflow Explained</h4><p><strong>Triggers:</strong></p><ul><li><strong>push to </strong><strong>main</strong>: Automatically kicks off Terraform init and plan steps, giving you a quick insight into any infrastructure changes triggered by the latest code push.</li><li><strong>pull_request to </strong><strong>main</strong>: Ensures that any proposed changes are safe and sound before merging. This protects the main branch and keeps everyone on the same page.</li><li><strong>workflow_dispatch</strong>: The manual trigger for running apply. This ensures that actual changes aren’t made to your AWS infrastructure without explicit approval.</li></ul><h4>Job 1: Terraform Init and Plan</h4><ul><li><strong>Checkout Repo</strong>: Pulls in the latest code.</li><li><strong>Configure AWS Credentials</strong>: Authenticates with AWS so Terraform can query and manage cloud resources.</li><li><strong>Setup Terraform</strong>: Gets the correct Terraform version ready.</li><li><strong>Cache Terraform Modules</strong>: Speeds things up by keeping provider files cached.</li><li><strong>Terraform Init</strong>: Sets up your working directory with the necessary providers.</li><li><strong>Terraform Plan</strong>: Generates and uploads a blueprint of changes, giving you full visibility into what’s about to happen.</li></ul><h4>Job 2: Terraform Apply</h4><ul><li><strong>Trigger</strong>: Only runs when you say so. Manual approval lets you double-check before actually making changes.</li><li><strong>Checkout Repo &amp; Setup Terraform</strong>: Same as before, ensuring we’re working with the correct code and Terraform version.</li><li><strong>Download Plan</strong>: Pulls down the exact plan that was generated earlier. No surprises.</li><li><strong>Configure AWS Credentials &amp; Cache Modules</strong>: Maintains consistency, so the apply job matches the plan environment.</li><li><strong>Initialize Terraform</strong>: Re-initializes with cached modules, ensuring everything’s consistent.</li><li><strong>Terraform Apply</strong>: Implements the changes from the saved plan, giving you a reliable, no-prompt application of your infrastructure updates.</li></ul><p>By splitting these steps into two jobs, you’re essentially placing a safety net between planning and applying changes. This approach gives you peace of mind, knowing that before a single resource is created or modified, you’ve had a chance to review and confirm everything’s good to go. It’s a must-have safeguard in any serious Terraform-based CI/CD pipeline.</p><h3>Debugging a Missing AWS Provider</h3><p>I’ll be the first to admit it: I spent three straight days banging my head against the wall on this one. If you’ve ever wrestled with Terraform providers not showing up where they should be, I feel your pain. That dreaded &quot;No Package Cached in .terraform/providers&quot; error had me chasing my tail—until the fix finally clicked, and everything just fell into place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OnsxVkT3DnG-aihvE1T2gg.png" /></figure><p><strong>Symptom:</strong><br>You run the terraform apply step, and Terraform complains it can’t find the required AWS provider (in this case, version 5.80.0). Not exactly a fun surprise when you’re trying to keep your pipeline humming along smoothly.</p><p><strong>Root Cause:</strong></p><ol><li><strong>Deleting the </strong><strong>.terraform Directory (A Well-Intentioned but Misguided Debug Attempt):</strong><br>In a frantic attempt to solve the issue, I decided to delete the .terraform and .terraform.lock.hcl files before the apply step, thinking a “clean slate” would fix the problem. Instead, this forced Terraform to re-download providers each run, introducing mismatches between plan and apply.</li><li><strong>Lack of Consistent Caching:</strong><br>Without reliable caching, Terraform ended up scrambling to fetch providers from scratch each time. As a result, what got planned and what actually got applied didn’t always align.</li></ol><p><strong>The Fix:</strong></p><ol><li><strong>Add Caching:</strong><br>Introduce actions/cache@v3 to store and restore the .terraform directory across jobs. This ensures that the provider versions Terraform grabbed during the plan stage stick around for the apply stage.</li><li><strong>Stop Deleting </strong><strong>.terraform:</strong><br>Ditch the “clean slate” strategy. By keeping .terraform and .terraform.lock.hcl intact between jobs, you maintain a stable, consistent environment that matches what Terraform expects.</li><li><strong>Reinitialize in Apply Step:</strong><br>Run terraform init -upgrade before apply. This reconfirms the provider references from the cached .terraform directory, ensuring that everything’s in sync.</li></ol><p><strong>Result:</strong></p><ul><li><strong>Consistency:</strong> With proper caching and stable .terraform directories, you’re no longer dealing with provider version mismatches. Plan and apply finally march to the same beat.</li><li><strong>Efficiency:</strong> By not re-downloading providers every run, you cut down on job times and complexity, making your CI/CD pipeline more reliable and less stressful.</li></ul><p><strong>Final Outcome:</strong><br>After implementing these changes, my pipeline went from chronic headaches to smooth sailing. The entire run completes successfully, and I can see all the Terraform-provisioned resources neatly displayed in the AWS console — no last-minute surprises.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SovNS3BtmFolNOmTbDPAsw.png" /></figure><p>If you’ve been stuck on this issue (like I was), trust me, these fixes are going to feel like a breath of fresh air. This was my most satisfying debugging achievement thus far in my tech journey.</p><h3>Conclusion</h3><p>Let’s face it: when it comes to infrastructure, the last thing you want is a surprise waiting for you right before pushing to production. By leveraging Terraform’s IaC capabilities alongside the automation muscle of GitHub Actions, you can build a CI/CD pipeline that practically runs itself. With proper caching, stable directory structures, and a solid handle on provider configurations, you’re setting yourself up for repeatable, predictable, and downright smooth deployments every time.</p><p>This approach doesn’t just eliminate headaches — it also frees up your time to focus on delivering value, not firefighting unexpected issues. As your infrastructure grows and your DevOps practices mature, these best practices and configurations will help you scale confidently. From shorter feedback loops to safer rollouts, you’ll have the assurance that every new change you ship is rock-solid, fast, and fully backed by a pipeline you can trust.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4afe52cb4263" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RoyaltyDistribution Smart Contract]]></title>
            <link>https://medium.com/@dustin.aad/royaltydistribution-smart-contract-13fe700f3b45?source=rss-45d2a7858705------2</link>
            <guid isPermaLink="false">https://medium.com/p/13fe700f3b45</guid>
            <category><![CDATA[entertainment-industry]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Dustin Hurt]]></dc:creator>
            <pubDate>Sun, 17 Nov 2024 17:01:45 GMT</pubDate>
            <atom:updated>2024-12-14T16:43:19.202Z</atom:updated>
            <content:encoded><![CDATA[<h4>Simplifying Fair Payouts for Creatives</h4><p>In the ever-evolving world of the creative economy, one thing hasn’t changed: <strong>royalty distribution is a pain in the wallet</strong> — and not just metaphorically. From artists and producers to collaborators and content creators, managing royalties often feels like wading through a swamp of spreadsheets, middlemen, and late payments. Sound familiar?</p><p>The <strong>RoyaltyDistribution</strong> smart contract is here to change the game. As part of my larger <strong>FlowStream </strong>project, this contract is one step toward building a complete solution to revolutionize how creators manage, track, and monetize their work. While the full FlowStream platform is still in development, this smart contract is fully functional and addresses a critical need: ensuring collaborators get paid transparently, on time, and fairly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*ydD4jCD6XJjzMviQbQsnGw.png" /></figure><h3>Sharing the Journey</h3><p>As the developer behind this project, I’m not just building this for creators — I’m sharing the process with creators. In this article, I’ll break down <strong>how I built this contract step by step</strong>, from the initial idea to deployment. Whether you’re a creator, developer, or blockchain enthusiast, you’ll gain insights into:</p><ul><li>Structuring smart contracts for real-world problems.</li><li>Leveraging Solidity to ensure security and efficiency.</li><li>Debugging and testing in a blockchain environment.</li></ul><h3>A Vision for the Creative Economy</h3><p>FlowStream is my vision for a future where creators don’t just split revenue — they track it, manage collaborations seamlessly, and maintain full control over their projects, all on a decentralized platform. This contract is just the first step, designed to tackle one of the biggest frustrations for creators today: <strong>fair and transparent royalty distribution</strong>.</p><p>While the larger FlowStream platform is a work in progress, this component is ready for action, allowing creators to:</p><ul><li>Automate royalty payments.</li><li>Build trust through transparency.</li><li>Simplify collaboration, no matter the size of the team.</li></ul><h3>Why Share This Now?</h3><p>As a solo developer, I’ve chosen to release this piece of the project early for three key reasons:</p><ol><li><strong>Showcase Progress</strong>: This is a glimpse of the larger vision I’m building.</li><li><strong>Gather Feedback</strong>: Your input as a creator or developer can help refine this and future components.</li><li><strong>Provide Immediate Value</strong>: Even in its current form, the <strong>RoyaltyDistribution</strong> contract can solve real-world problems for creators like you.</li></ol><h3>Step 1: Basic Contract Setup</h3><p>To build the <strong>RoyaltyDistribution</strong> contract, I started by laying the foundation for compliance, compatibility, and functionality. Here’s how I structured the essential setup:</p><p><strong>SPDX License Identifier</strong>:</p><ul><li>Declares the contract under the <strong>MIT License</strong> for open-source compliance and clarity of use.</li></ul><p><strong>Pragma Directive</strong>:</p><ul><li>Locks the contract to <strong>Solidity 0.8.0 or newer</strong>, ensuring compatibility with newer features like overflow protection.</li></ul><p><strong>Contract Declaration</strong>:</p><ul><li>Defines the contract with its name, RoyaltyDistribution, as the entry point for all logic and features.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D-6FO6DbyYoDkxb7k0n_8w.png" /></figure><p>With this foundational setup in place, I was ready to dive into building the core features of the contract.</p><h3>Step 2: Defining the Participant Struct</h3><p>To manage participants efficiently within the contract, I created a <strong>struct</strong> to define the core attributes of each participant. This modular approach ensures clarity and simplifies the management of participant data.</p><h4>The Participant Struct</h4><p>The struct contains three attributes, each serving a specific purpose:</p><p><strong>wallet</strong>:</p><ul><li>A <strong>payable address</strong> for sending ETH directly to the participant.</li><li>Enables automated royalty distribution.</li></ul><p><strong>role</strong>:</p><ul><li>A descriptive <strong>string</strong> representing the participant’s role (e.g., “artist,” “producer,” or “collaborator”).</li><li>Adds context to the participant’s involvement in the project.</li></ul><p><strong>share</strong>:</p><ul><li>Specifies the participant’s share of royalties in <strong>basis points</strong> (e.g., 250 = 2.5%).</li><li>Ensures precise calculation and proportional distribution of payments.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nWPRRNJfCjBH0iQVsgpFvw.png" /></figure><h3>Step 3: Creating a Mapping for Quick Lookups</h3><p>To enable efficient management of participants, I added a <strong>mapping</strong> called getParticipantByWallet. This mapping links wallet addresses to their respective <strong>Participant</strong> struct, allowing for fast and direct lookups of participant details.</p><h4>Why Use a Mapping?</h4><ul><li><strong>Efficiency</strong>: Provides constant-time lookups to retrieve participant information directly using their wallet address.</li><li><strong>Flexibility</strong>: Allows the contract to easily query participant details without iterating over an array.</li><li><strong>Integration</strong>: Works seamlessly with the Participant struct to access attributes like wallet, role, and share.</li></ul><p>When distributing royalties, the mapping ensures that participant details can be retrieved instantly by their wallet address, avoiding costly loops over the array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UDaSkR7pK1IbxY41aqfZNA.png" /></figure><h3>Step 4: Implementing the addParticipant Function</h3><p>At this stage of development, the focus was on enabling the addition of participants into the contract. The addParticipant function provided a simple yet powerful way to define participants, assign roles, and specify their royalty shares.</p><h4>Key Features in This Stage</h4><p><strong>Adding Participants</strong>:</p><ul><li>Created a new participant with wallet, role, and share attributes.</li><li>Stored the participant in a dynamic array for tracking.</li></ul><p><strong>Quick Lookup Mapping</strong>:</p><ul><li>Mapped the participant’s wallet address to their struct for efficient retrieval.</li></ul><p><strong>Streamlined Process</strong>:</p><ul><li>Focused on creating a clear, minimal implementation without validations for simplicity during development.</li></ul><h4>What This Achieved</h4><ul><li><strong>Core Functionality</strong>: Established the ability to add participants with their roles and royalty shares.</li><li><strong>Foundation for Validation</strong>: Laid the groundwork for adding safeguards like duplicate prevention and share limits later.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xooO6ZUrUBF5fQSirnWlyQ.png" /></figure><h3>Test One: Deployment and Adding Participants</h3><h4>Deployment Success</h4><ul><li>The <strong>RoyaltyDistribution</strong> contract was successfully compiled and deployed on <strong>Remix</strong> using the <strong>Remix VM Environment</strong>.</li><li>Deployment logs confirmed no errors, ensuring that the contract was ready for interaction.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*QUbL34VFD3v_z7ImWdDDdg.png" /></figure><h4>Adding and Retrieving Participants</h4><p><strong>Objective</strong>:<br>Test the ability to add participants and verify their details can be retrieved correctly.</p><p><strong>Actions</strong>:</p><p><strong>Adding Participants</strong>:</p><p>Used the addParticipant function to add participants by specifying:</p><ul><li><strong>Wallet address</strong></li><li><strong>Role</strong> (e.g., “Artist”, “Producer”)</li><li><strong>Royalty share</strong> in basis points.</li></ul><p><strong>Verifying Participant Details</strong>:</p><ul><li>Used the getParticipantByWallet mapping to retrieve participant data by their wallet address.</li><li>Queried the participants array to retrieve participants based on their index.</li></ul><p><strong>Results</strong>: The following participants were successfully added and verified:</p><p><strong>Participant 1</strong>:</p><ul><li><strong>Wallet</strong>: Address added successfully.</li><li><strong>Role</strong>: Properly recorded as per input.</li><li><strong>Share</strong>: Royalty share correctly reflected.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*ChqMkfHUzB3DXd__Ps6aSA.png" /></figure><p><strong>Participant 2</strong>:</p><ul><li><strong>Wallet</strong>: Address added successfully.</li><li><strong>Role</strong>: Properly recorded as per input.</li><li><strong>Share</strong>: Royalty share correctly reflected.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*qL0bgkCLWskw11xQPB6hYw.png" /></figure><p><strong>Participant 3</strong>:</p><ul><li><strong>Wallet</strong>: Address added successfully.</li><li><strong>Role</strong>: Properly recorded as per input.</li><li><strong>Share</strong>: Royalty share correctly reflected.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*whGF6AP6OggyjwXDsKU-Kg.png" /></figure><p><strong>Participant 4</strong>:</p><ul><li><strong>Wallet</strong>: Address added successfully.</li><li><strong>Role</strong>: Properly recorded as per input.</li><li><strong>Share</strong>: Royalty share correctly reflected.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*1T39skDTJg6BBsvfQ_5klw.png" /></figure><p><strong>Key Takeaways</strong>:</p><ul><li><strong>Functionality Verified</strong>: The addParticipant function worked as expected, successfully recording participant data.</li><li><strong>Data Retrieval</strong>: Both getParticipantByWallet and participants array provided accurate participant details.</li></ul><p>The contract’s core functionality for adding and retrieving participants is operational and ready for further testing or enhancements.</p><h3>Balancing Functionality and Privacy</h3><p>During the development of the <strong>RoyaltyDistribution</strong> contract, I initially considered adding a name attribute to the <strong>Participant</strong> struct to store each participant&#39;s name directly on-chain. However, after further consideration, I decided against this approach due to potential privacy and security concerns.</p><h4>Why Exclude the name Attribute?</h4><p><strong>Privacy Risks</strong>:</p><ul><li>Storing participant names on-chain would make them publicly visible, as blockchain data is immutable and accessible to anyone.</li><li>This could inadvertently expose sensitive information, potentially compromising participant confidentiality.</li></ul><p><strong>Security Concerns</strong>:</p><ul><li>Associating names directly with wallet addresses on-chain could increase the risk of phishing or other targeted attacks.</li></ul><p><strong>Gas Efficiency</strong>:</p><ul><li>Storing strings (like names) on-chain would increase gas costs, making the contract less efficient, especially with a large number of participants.</li></ul><h4>Off-Chain Solution</h4><p>To address these concerns, I decided to store names associated with wallet addresses in <strong>off-chain storage</strong>. This ensures:</p><ul><li>The <strong>contract remains lightweight and efficient</strong>, focusing only on managing roles and royalty shares.</li><li><strong>Participant confidentiality is preserved</strong>, with names stored securely off-chain.</li><li>Names can still be referenced or linked to participants through external applications that interact with the contract.</li></ul><p>This decision aligns with best practices for managing sensitive data in blockchain applications, striking a balance between functionality, privacy, and security. The contract now focuses solely on roles, shares, and wallet addresses while leaving additional metadata to off-chain systems.</p><h3>Step 5: Adding and Validating the totalShares Variable</h3><p>To enhance the contract’s reliability and enforce proper share allocation, I added the <strong>totalShares</strong> state variable and updated the addParticipant function with comprehensive validation checks. These updates ensure transparency and safeguard the functionality of the royalty distribution system.</p><h4>Adding the totalShares Variable</h4><p>The <strong>totalShares</strong> variable tracks the cumulative shares allocated to participants and ensures that the total never exceeds 10,000 basis points (100%).</p><p><strong>Key Points</strong>:</p><ul><li>Declared as public, so anyone can query the total allocated shares.</li><li>Acts as a central tracker for ensuring share limits are respected.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*SfkL3KnxclLuBMxnjAESuQ.png" /></figure><h4>Updating the addParticipant Function</h4><p>The addParticipant function was enhanced with <strong>validation checks</strong> to prevent potential errors and maintain contract integrity. Here&#39;s a breakdown of the key updates:</p><p><strong>Validating Wallet Address</strong></p><ul><li><strong>Purpose</strong>: Ensures the wallet address is not the zero address (0x000...), which is invalid and would lead to lost funds if used.</li><li><strong>Why</strong>: Prevents undefined behavior and ensures every participant has a valid Ethereum address.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*_f5vGXGs3q_9BSXDJ4QLCw.png" /></figure><p><strong>Preventing Duplicate Participants</strong></p><ul><li><strong>Purpose</strong>: Checks if the wallet address already exists in the getParticipantByWallet mapping.</li><li><strong>Why</strong>: Prevents duplicate entries and ensures each participant is unique in the contract.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*z9yw-eTPPbW_fgwcc0LMgQ.png" /></figure><p><strong>3. Checking Share Value</strong></p><ul><li><strong>Purpose</strong>: Ensures the share value is greater than zero.</li><li><strong>Why</strong>: Adding a participant with no share has no practical purpose and could indicate an error in the input data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*r3fWLr_M1G_eswl_q7HFzQ.png" /></figure><p><strong>4. Ensuring Total Shares Don’t Exceed 100%</strong></p><ul><li><strong>Purpose</strong>: Prevents the total allocated shares from exceeding 10,000 basis points (100%).</li><li><strong>Why</strong>: Maintains the proper distribution of royalties and prevents oversubscription of shares.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*EELp21_O5ruPAxzK0Zh3HQ.png" /></figure><p><strong>5. Updating </strong><strong>totalShares</strong></p><ul><li><strong>Purpose</strong>: Adds the newly allocated share to the cumulative totalShares variable.</li><li><strong>Why</strong>: Keeps track of all allocated shares in real-time to enforce share limits.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*R84CN2Yiwvi54LHUAKkw2g.png" /></figure><h4>Verifying the Updates</h4><p>After compiling and deploying the updated codebase:</p><ul><li>The contract successfully included a new <strong>call button</strong> for the totalShares variable.</li><li>Initial value: <strong>0</strong> (no participants added yet), ensuring the system initializes correctly.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*7KpiB7Mqmb1wwtyrfjDAuQ.png" /></figure><p>With the addition of totalShares and validation checks, the contract now:</p><ul><li>Tracks the cumulative share allocation in real-time.</li><li>Prevents invalid or duplicate entries.</li><li>Safeguards against oversubscription of shares, maintaining fairness and accuracy in royalty distribution.</li></ul><p>These updates mark a significant step toward ensuring the contract’s integrity and scalability for real-world use.</p><h3>Test Two: Adding Participants and Handling Edge Cases</h3><p>This series of tests verifies the <strong>addParticipant</strong> function’s behavior under valid and invalid conditions. Below are the scenarios tested and the results observed.</p><h4>1. Add a Valid Participant</h4><p><strong>Scenario</strong>:</p><ul><li>Added a participant with a valid wallet address, role, and share value.</li></ul><p><strong>Expected Outcome</strong>:</p><ul><li>The participant is successfully added to the contract.</li><li>The participant can be retrieved using both getParticipantByWallet (by wallet address) and the participants array (by index).</li><li>The totalShares variable is updated correctly to <strong>5,000</strong> basis points.</li></ul><p><strong>Results</strong>:</p><ul><li><strong>Passed</strong>: The participant was added successfully, and totalShares reflected the update.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*pOsn0MXNy-JlkxPSAiJoAw.png" /></figure><h4>2. Attempt to Add a Participant with an Invalid Wallet Address</h4><p><strong>Scenario</strong>:</p><ul><li>Tried to add a participant with the invalid wallet address address(0).</li></ul><p><strong>Expected Outcome</strong>:</p><ul><li>The transaction is reverted with the error message: &quot;Invalid wallet address&quot;.</li></ul><p><strong>Results</strong>:</p><ul><li><strong>Passed</strong>: The transaction reverted as expected.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*SvrcOQK1uUzwPgjCbJa2BQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*-gPOSNsOy-ZIHnOdIJx7wQ.png" /></figure><h4>3. Attempt to Add a Duplicate Wallet</h4><p><strong>Scenario</strong>:</p><ul><li>Tried to add a participant using a wallet address that was already added.</li></ul><p><strong>Expected Outcome</strong>:</p><ul><li>The transaction is reverted with the error message: &quot;Participant already exists&quot;.</li></ul><p><strong>Results</strong>:</p><ul><li><strong>Passed</strong>: The contract correctly prevented duplicate entries.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*HSXCp3i25KJlkezn9nXi9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*zc4bcPUyHHTIJwRlHp1Q0g.png" /></figure><h4>4. Attempt to Add a Participant with 0 Share</h4><p><strong>Scenario</strong>:</p><ul><li>Tried to add a participant with a royalty share of 0.</li></ul><p><strong>Expected Outcome</strong>:</p><ul><li>The transaction is reverted with the error message: &quot;Share must be greater than 0&quot;.</li></ul><p><strong>Results</strong>:</p><ul><li><strong>Passed</strong>: The contract correctly rejected participants with invalid share values.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*IfX-lYQ3opU5srQVzvoVRw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*gRMTonYepTWp8Ebw6HsFEA.png" /></figure><h4>5. Attempt to Add Total Shares that Exceed 10,000 Basis Points</h4><p><strong>Scenario</strong>:</p><ul><li>Attempted to add a participant whose share would cause the totalShares to exceed <strong>10,000 basis points</strong>.</li></ul><p><strong>Expected Outcome</strong>:</p><ul><li>The transaction is reverted with the error message: &quot;Total shares cannot exceed 100%&quot;.</li><li>The totalShares variable remains unchanged.</li></ul><p><strong>Results</strong>:</p><ul><li><strong>Passed</strong>: The contract prevented share allocations that exceed the maximum limit, and the totalShares value was unaffected.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*U0YTfaWUJW62H29QQEadSA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*TzqeFrMoN6bgkgtO-ZJDYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*ABm-lyStv6yYCLbcTttv3A.png" /></figure><p>The <strong>addParticipant</strong> function passed all tests with the following validations:</p><ol><li>Successfully added valid participants and updated totalShares.</li><li>Rejected invalid wallet addresses.</li><li>Prevented duplicate wallet entries.</li><li>Ensured share values greater than 0.</li><li>Enforced the 10,000 basis point limit on total shares.</li></ol><p>The contract’s validation logic performed as expected, ensuring data integrity and robustness.</p><h3>What Are Events in Solidity?</h3><p>Events in Solidity are a powerful tool that enables smart contracts to <strong>communicate and log information</strong> that can be accessed off-chain by users, applications, and tools. They serve as a bridge between the blockchain and external systems, allowing for transparency and interaction without affecting the contract’s on-chain state.</p><h4>Key Features of Events</h4><p><strong>Logging Information</strong>:</p><ul><li>Events are recorded in the <strong>transaction logs</strong> on the blockchain.</li><li>These logs are immutable and stored permanently, providing a transparent record of what occurred during the execution of a contract.</li></ul><p><strong>Off-Chain Accessibility</strong>:</p><ul><li>Other contracts <strong>cannot access logs or events</strong>, but external applications and tools (e.g., blockchain explorers, web3.js) can.</li><li>This makes events ideal for interacting with the off-chain world.</li></ul><p><strong>Efficiency</strong>:</p><ul><li>Events are cheaper to store than state variables because they are written to logs, not the contract’s storage.</li><li>They do not affect the contract’s state on-chain.</li></ul><h4>Use Cases for Events</h4><p><strong>Tracking Transactions</strong>:</p><ul><li>Log details like payments, state changes, or function calls.</li><li>Example: Recording royalty distributions or participant additions in your smart contract.</li></ul><p><strong>Debugging</strong>:</p><ul><li>Events provide visibility into contract behavior during execution, making it easier to troubleshoot issues.</li></ul><p><strong>Notifying Off-Chain Applications</strong>:</p><ul><li>External applications (e.g., frontends, analytics tools) can <strong>subscribe to events</strong> and react to them.</li><li>Example: Automatically updating a user interface when royalties are distributed.</li></ul><h4>How Events Work</h4><p>Think of events as <strong>push notifications</strong> for your smart contract:</p><ol><li>The smart contract executes a function, such as distributing royalties.</li><li>The event is <strong>emitted</strong>, logging details about what happened (e.g., who was paid, how much, and for what role).</li><li>Off-chain applications can <strong>subscribe</strong> to these events and take action, such as:</li></ol><ul><li>Displaying real-time updates to users.</li><li>Triggering automated processes like sending notifications or running scripts.</li></ul><h4>Benefits of Using Events</h4><ul><li><strong>Transparency</strong>: Events provide a clear, traceable record of actions taken by the contract.</li><li><strong>Integration</strong>: External systems can easily monitor and respond to events, enabling rich interactions with smart contracts.</li><li><strong>Cost Efficiency</strong>: Events are less expensive to log compared to storing data in state variables.</li></ul><p><strong>In Summary</strong>: Events in Solidity are like a smart contract’s <strong>megaphone</strong>, broadcasting important information to the outside world. They don’t directly affect the contract’s state, but they are indispensable for:</p><ul><li><strong>Tracking what happens on-chain.</strong></li><li><strong>Debugging contract behavior.</strong></li><li><strong>Integrating with off-chain applications.</strong></li></ul><p>Think of them as the glue connecting your blockchain logic to real-world applications!</p><h3>Step Six: Adding Events</h3><p>To enhance the transparency and functionality of the <strong>RoyaltyDistribution</strong> contract, I added two key events: <strong>PaymentSent</strong> and <strong>RoyaltiesDistributed</strong>. These events log critical information about individual payments and overall royalty distributions, providing visibility into the contract&#39;s operations.</p><h4>PaymentSent Event</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*wUopMctZuIo8dfDtCqazCA.png" /></figure><p><strong>Purpose</strong>:<br>This event is emitted every time a payment is made to a participant during the royalty distribution process. It tracks individual transactions and logs relevant details for transparency and off-chain use.</p><p><strong>Parameters</strong>:</p><p><strong>address indexed wallet</strong>:</p><ul><li>The wallet address of the participant receiving the payment.</li><li>NOTE: <strong>indexed</strong> enables external applications to filter and query logs by wallet address, making it easy to find all payments sent to a specific participant.</li></ul><p><strong>uint256 amount</strong>:</p><ul><li>The amount of ETH transferred to the participant.</li><li>Helps track how much each participant receives in royalties.</li></ul><p><strong>string role</strong>:</p><ul><li>Describes the participant’s role in the project (e.g., “artist”, “producer”).</li></ul><p><strong>Use Case</strong>:</p><ul><li><strong>Transparency</strong>: Tracks individual payouts to ensure participants receive their correct share.</li><li><strong>Off-Chain Record Keeping</strong>: Allows external tools or systems to log participant-specific payment details.</li><li><strong>Debugging</strong>: Verifies that each payment matches the expected amount and role.</li></ul><h4>RoyaltiesDistributed Event</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*eTS1yKRFspLaB-LkUKRydQ.png" /></figure><p><strong>Purpose</strong>:<br>This event is emitted once all payments are processed in the distributeRoyalties function. It provides a high-level summary of the royalty distribution.</p><p><strong>uint256 totalAmount</strong>:</p><ul><li>The total amount of ETH distributed in the current transaction.</li><li>Matches the value of msg.value sent to the contract.</li></ul><p><strong>uint256 participantCount</strong>:</p><ul><li>The total number of participants involved in the distribution.</li><li>Reflects the length of the participants array during execution.</li></ul><p><strong>Use Case</strong>:</p><ul><li><strong>Tracking Distributions</strong>: Logs the total ETH distributed and the number of recipients in a single transaction.</li><li><strong>Auditing</strong>: Provides a summary of the distribution for external monitoring.</li><li><strong>Debugging</strong>: Ensures the total amount sent matches the intended distribution.</li></ul><h4>Events Summary</h4><p>Together, the <strong>PaymentSent</strong> and <strong>RoyaltiesDistributed</strong> events enable:</p><p><strong>Transparency</strong>:</p><ul><li>Every transaction and payout is logged, making it easy to audit royalty distributions.</li></ul><p><strong>Off-Chain Integration</strong>:</p><ul><li>External applications can subscribe to these events to display real-time updates, trigger workflows, or store logs.</li></ul><p><strong>Debugging and Validation</strong>:</p><ul><li>Clear event logs provide insight into the contract’s behavior during execution.</li></ul><p>By incorporating these events, the contract achieves a higher level of visibility and interoperability, ensuring trust and efficiency for all participants.</p><h3>Step Seven: Implementing the distributeRoyalties Function</h3><p>The distributeRoyalties function automates the process of dividing and transferring ETH among participants based on their assigned shares. It ensures accurate, secure, and transparent distribution while emitting logs to track each transaction.</p><h4>Overview</h4><p>The distributeRoyalties function:</p><ul><li>Accepts incoming ETH to be distributed among participants.</li><li>Iterates through the participants, calculates each participant’s share, and transfers the amount securely.</li><li>Logs individual payments and a summary of the entire distribution for transparency and auditing.</li></ul><h4>Key Components</h4><p><strong>Function Declaration</strong></p><p>Declares a <strong>public payable</strong> function, allowing it to:</p><ul><li>Be accessed externally.</li><li>Accept ETH (msg.value) for distribution.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*V-04Achh_qrzRT_OV_9WUg.png" /></figure><p><strong>Require ETH to Be Sent</strong></p><ul><li>Ensures that the function is only executed when ETH is sent with the transaction.</li><li>Prevents accidental execution without funds, avoiding errors and wasted gas.</li><li>NOTE: msg.value represents the amount of ETH (in wei) sent with the transaction.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*Oc7yej1jHwMB1mCdNU6bAQ.png" /></figure><p><strong>Track Distributed ETH</strong></p><ul><li>Initializes a counter to track the cumulative ETH distributed during the loop. This ensures transparency and provides validation at the end of the function.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*J5ya72ue4pO7YXk-E4QU3A.png" /></figure><p><strong>Iterate Through Participants</strong></p><ul><li>A for loop iterates through the participants array:</li><li><strong>Initialization</strong>: Starts with i = 0.</li><li><strong>Condition</strong>: Continues as long as i &lt; participants.length.</li><li><strong>Increment</strong>: Increments i by 1 after each iteration.</li></ul><p>This ensures each participant is processed exactly once.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*2YRTZFwzn9ABnoT0oM7Lig.png" /></figure><p><strong>Calculate Participant’s Share</strong></p><ul><li>Calculates the ETH each participant is entitled to based on their <strong>share in basis points</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*LUlpVUCeDXUPp2TF3l9tFg.png" /></figure><p><strong>Transfer ETH</strong></p><ul><li>Sends the calculated amount to the participant’s wallet directly.</li><li>Utilizes .transfer() for simplicity and safety.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*cREifuS6Te_MWleYoZQ7Bg.png" /></figure><p><strong>Update Total Distributed</strong></p><ul><li>Updates the totalDistributed tracker after each payment.</li><li>Ensures the total amount distributed is consistent with the ETH received (msg.value).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*Nh4TsNasZDHufsH_38xJvQ.png" /></figure><p><strong>Emit a Payment Event</strong></p><ul><li>Logs a detailed event for off-chain tracking, including:</li><li>The recipient’s wallet address.</li><li>The amount transferred.</li><li>The participant’s role.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*lNzAFz9h3uMwP8mwHkfLYg.png" /></figure><p><strong>Verify Total Distribution</strong></p><ul><li>Ensures the total ETH distributed does not exceed the ETH received (msg.value).</li><li>Validates that every participant received their correct share and no excess ETH was transferred.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*dGIO9bTaAGksTn1bbNISwg.png" /></figure><p><strong>Emit a Distribution Summary Event</strong></p><ul><li>Logs a summary of the royalty distribution, including:</li><li>The total ETH distributed (msg.value).</li><li>The total number of participants involved.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*MNHFaz7pKTUFjUpr5Oot-A.png" /></figure><h4>Key Takeaways</h4><ol><li><strong>Accurate Distribution</strong>: Ensures each participant is paid according to their defined share.</li><li><strong>Transparency</strong>: Logs detailed and summary events for off-chain tracking and auditing.</li><li><strong>Error Prevention</strong>: Validates inputs (ETH sent) and ensures total distributed ETH aligns with expectations.</li><li><strong>Efficiency</strong>: Processes participants in a single loop for minimal gas usage.</li></ol><p>The distributeRoyalties function encapsulates the core functionality of the contract, providing a secure, efficient, and transparent method for royalty payments.</p><h3>Test Three: Verifying distributeRoyalties Function</h3><p>This test verifies the proper functionality of the <strong>distributeRoyalties</strong> function, ensuring ETH is distributed accurately and events are emitted for transparency. Below are the steps and observations from the test.</p><h4>1. Compile and Deploy the Contract</h4><ul><li>The contract compiled and deployed successfully.</li><li>A new button labeled <strong>distributeRoyalties</strong> appeared, confirming the function is accessible and ready for testing.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*QI_ktAbK3Ru8c5vpwaHvaA.png" /></figure><h4>2. Verify Initial State</h4><p><strong>Participants Added</strong>:</p><ul><li>Three participants were successfully added, with their details retrievable via the getParticipantByWallet function and participants array.</li><li>Participant details (wallet, role, share) matched the input data.</li></ul><p>Participant 1:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*uIkSnBfFl_PZRLsA57SMfg.png" /></figure><p>Participant 2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*v4z3F9DRWjiVH3MUFWb0kw.png" /></figure><p>Participant 3:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*pXcwieYQO6cmxEwUxI6wKQ.png" /></figure><p><strong>totalShares Value</strong>:</p><ul><li>The totalShares variable accurately reflected the cumulative percentage of royalties assigned to participants.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*6wuzxBFcjB8fqIBaxwtoVQ.png" /></figure><h4>3. Test Scenarios for distributeRoyalties</h4><p><strong>Transaction Success</strong></p><ul><li>Sent <strong>5 ETH</strong> to the contract for distribution.</li><li>The transaction executed successfully, triggering the distributeRoyalties function.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*rPn9Byxo40BWafoq3ojDow.png" /></figure><p><strong>Event Emission</strong></p><ul><li><strong>Individual Payment Events</strong>:</li><li>Wallet addresses in the logs matched the participants’ wallets.</li><li>Amounts reflected each participant’s share of the total ETH sent.</li><li>Roles accurately matched participants’ assigned roles.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*7IODDMqTBp2MwHyPYP3snQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*5y2xKkGxvkFp9F4VluGMfA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*VJhfwdnGscB5jEOb8H5MkA.png" /></figure><p><strong>Summary Event</strong>:</p><ul><li>The RoyaltiesDistributed event emitted successfully.</li><li><strong>totalAmount</strong> matched the msg.value sent to the function (5 ETH).</li><li><strong>participantCount</strong> matched the number of participants in the array.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*XDkPNU1FfT-S4MK_p8FknQ.png" /></figure><p><strong>Balance Changes</strong></p><ul><li>Verified that each participant’s wallet received ETH proportional to their assigned share.</li></ul><p><strong>Participant 1 — Artist</strong>:</p><ul><li>Initial Balance:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*atJRCxvpGCARAQ7iCPe6gQ.png" /></figure><ul><li>New Balance:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*GCTeUrMCTQZeUluvTU3ULQ.png" /></figure><p><strong>Participant 2 — Producer</strong>:</p><ul><li>Initial Balance:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*WpgIbSc1Ao3G2CQSqAVTuw.png" /></figure><ul><li>New Balance:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*3oaL_6yTT4sSXrS3Fa1LGA.png" /></figure><p><strong>Participant 3 — Collaborator</strong>:</p><ul><li>Initial Balance:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*5iSRtWgFev1QPMrJNL9foA.png" /></figure><ul><li>New Balance:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*Cb7fe_nFjn8yWKJrK35Lnw.png" /></figure><p>The <strong>distributeRoyalties</strong> function performed as expected:</p><ul><li><strong>Accurate ETH Distribution</strong>:</li><li>Each participant received the correct amount based on their share.</li><li><strong>Event Logging</strong>:</li><li>Both individual payments and summary events were emitted successfully, providing complete transparency.</li><li><strong>Balance Verification</strong>:</li><li>Participants’ wallet balances were updated correctly after the transaction.</li></ul><p>The function is now fully tested and ready for real-world deployment, ensuring secure and transparent royalty distribution.</p><h3>Step Eight: Adding the ParticipantAdded Event</h3><p>The <strong>ParticipantAdded</strong> event was introduced to log the addition of new participants to the <strong>RoyaltyDistribution</strong> contract. This event ensures transparency and allows off-chain systems to track participant additions in real time.</p><h4>Event Declaration</h4><p><strong>Parameters</strong>:</p><p><strong>address indexed wallet</strong>:</p><ul><li>The wallet address of the new participant.</li><li><strong>Indexed</strong> for efficient querying and filtering by external applications.</li></ul><p><strong>string role</strong>:</p><ul><li>A descriptive label for the participant’s role (e.g., “artist,” “producer”).</li></ul><p><strong>uint256 share</strong>:</p><ul><li>The royalty share assigned to the participant, expressed in basis points.</li></ul><p><strong>Purpose</strong>:</p><ul><li>Logs detailed information about newly added participants.</li><li>Allows off-chain tools to monitor and respond to participant additions.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*GubDAKLKSoJFQp_RilvGMQ.png" /></figure><h4>Emitting the Event</h4><p>The ParticipantAdded event is emitted after a participant is successfully added via the <strong>addParticipant</strong> function.</p><p><strong>Placement</strong>:</p><ul><li>Added at the end of the <strong>addParticipant</strong> function to confirm the participant&#39;s successful addition.</li><li>Ensures no event is emitted if any validation (e.g., duplicate wallet, invalid share) fails.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*KXsBJvhAo5u3Nd_3eRGNug.png" /></figure><h4>Testing the Event</h4><p><strong>Test Scenario</strong>:</p><ul><li>Added a participant with valid inputs:</li><li>Wallet Address</li><li>Role</li><li>Royalty Share</li></ul><p><strong>Expected Outcome</strong>:</p><ul><li>The <strong>ParticipantAdded</strong> event is emitted with the correct details.</li></ul><p><strong>Result</strong>:</p><ul><li>Event delivered the expected outcome, logging the participant’s wallet, role, and share accurately.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*XXPGPDw3pPu156tT4HCfTA.png" /></figure><ul><li>The <strong>ParticipantAdded</strong> event ensures transparency and provides a detailed log of participant additions.</li><li><strong>Indexed wallet addresses</strong> make it easy to track and query new participants off-chain.</li><li>The emitted event successfully captured all required details, confirming the function’s reliability and readiness for production use.</li></ul><h3>Step Nine: Implementing the removeParticipant Function</h3><p>The <strong>removeParticipant</strong> function allows the contract owner to dynamically manage participants by removing them from the <strong>RoyaltyDistribution</strong> system. The addition of an event ensures transparency for this action, enabling off-chain monitoring.</p><h4>1. Event Declaration</h4><p><strong>Parameters</strong>:</p><p><strong>address indexed wallet</strong>:</p><ul><li>The wallet address of the participant being removed. The indexed keyword allows external systems to filter and query logs based on the wallet address.</li><li>Provides transparency by logging the removal of a participant.</li><li>Facilitates off-chain systems to track participant removals in real-time.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*8ZOlYMpWeYJaGS723z0mLQ.png" /></figure><h4>2. Function Implementation</h4><p><strong>Features</strong>:</p><p><strong>Validation</strong>:</p><ul><li>Ensures the wallet address exists in the mapping:</li></ul><p><strong>Efficient Array Management</strong>:</p><ul><li>Replaces the participant being removed with the last element in the array.</li><li>Reduces the array size by calling .pop() to remove the last participant.</li></ul><p><strong>Mapping Cleanup</strong>:</p><ul><li>Deletes the removed participant from the getParticipantByWallet mapping.</li></ul><p><strong>Event Emission</strong>:</p><ul><li>Emits the ParticipantRemoved event to log the removal for transparency.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*Vr2QyL_rA629h8zUAilq8g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*7mq0Q1jr0DQQymv3d_qRFw.png" /></figure><h4>3. Testing the removeParticipant Function</h4><p><strong>Test Scenario</strong>:</p><ul><li>Removed an existing participant by providing their wallet address.</li></ul><p><strong>Expected Outcomes</strong></p><p><strong>Participant Removed</strong>:</p><ul><li>Participant no longer exists in the participants array or the getParticipantByWallet mapping.</li><li>totalShares is updated to reflect the removal.</li></ul><p><strong>Event Emission</strong>:</p><ul><li>The ParticipantRemoved event is logged with the correct wallet address.</li></ul><p><strong>Results</strong></p><p><strong>Participant Removal</strong>:</p><ul><li>Participant successfully removed as confirmed by:</li><li>Updated participants array.</li><li>Updated totalShares value.</li></ul><p><strong>Event Emission</strong>:</p><ul><li>The ParticipantRemoved event was logged with the participant&#39;s wallet address.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*tYZUY2xRttaS4ueK5SZBvA.png" /></figure><ul><li>The <strong>removeParticipant</strong> function ensures efficient and transparent participant management.</li><li>The <strong>ParticipantRemoved</strong> event provides an immutable log of removals for auditing and monitoring.</li><li>Testing confirms that the function works as intended, updating the system state and emitting the expected event.</li></ul><h3>Step Ten: Adding Ownership Control</h3><p>Ownership control is a critical feature that restricts certain sensitive functions (like adding or removing participants) to the contract owner, ensuring the security and integrity of the <strong>RoyaltyDistribution</strong> system. Below are the steps implemented to establish ownership control in the contract.</p><h4>1. Add Owner State Variable</h4><p><strong>Purpose</strong>:</p><ul><li>Stores the wallet address of the contract owner.</li><li>Allows external users to verify the current owner of the contract.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*quWWf_0FaVmpbiK6mWoCmg.png" /></figure><h4>2. Initialize Ownership in the Constructor</h4><p><strong>Purpose</strong>:</p><ul><li>The constructor runs only once, at deployment, and sets the owner to the wallet address of the person deploying the contract (msg.sender).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*XJ1MPG0ztHlkL3VaPobzxg.png" /></figure><h4>3. Add onlyOwner Modifier</h4><p><strong>Purpose</strong>:</p><ul><li>Restricts access to certain functions, allowing only the owner to execute them.</li></ul><p><strong>How It Works</strong>:</p><ul><li>Checks if the msg.sender (the caller of the function) matches the owner.</li><li>Reverts with an error message if the caller is not the owner.</li><li>Executes the restricted function (_) if the check passes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*8cf2R4GOtYrnlC_oOhscfw.png" /></figure><h4>4. Apply onlyOwner to Sensitive Functions</h4><p>The onlyOwner modifier was added to the <strong>addParticipant</strong> and <strong>removeParticipant</strong> functions, restricting these critical operations to the contract owner.</p><p><strong>addParticipant</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*g0-Ek1WBn3CzHXful717FQ.png" /></figure><p><strong>removeParticipant</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*xaSNYDVoiW2f3aeEEaqHDA.png" /></figure><h4>5. Add transferOwnership Function</h4><p><strong>Purpose</strong>:</p><ul><li>Allows the current owner to appoint a new owner for the contract.</li><li>Adds flexibility for ownership transfer while ensuring security.</li></ul><p><strong>Validations</strong>:</p><ul><li>The newOwner address must not be the zero address (0x0), which would make the contract ownerless.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*lS6leGBcSAIi56ZxEF7m6w.png" /></figure><p><strong>Security</strong>:</p><ul><li>Ownership control ensures that only the owner can execute critical operations, protecting the contract from unauthorized changes.</li></ul><p><strong>Flexibility</strong>:</p><ul><li>The transferOwnership function allows seamless ownership transition when needed.</li></ul><p><strong>Transparency</strong>:</p><ul><li>The public owner variable allows users to verify who currently controls the contract.</li></ul><p><strong>Best Practices</strong>:</p><ul><li>Using a modifier (onlyOwner) keeps the code DRY (Don&#39;t Repeat Yourself) and enforces consistent access control.</li></ul><p>The ownership control implementation successfully secures sensitive functions and provides a reliable mechanism for managing ownership.</p><h3>Test Four: Ownership Control</h3><p>This test verifies the proper implementation and functionality of ownership control mechanisms in the <strong>RoyaltyDistribution</strong> contract. Below are the test scenarios and observations.</p><h4>1. Deployment Test</h4><p><strong>Scenario</strong>:</p><ul><li>The contract was compiled and deployed successfully.</li><li>Verified that the owner call button reflected the correct address of the contract deployer.</li></ul><p><strong>Expected Outcome</strong>:</p><ul><li>The owner address matches the wallet address used to deploy the contract.</li></ul><p><strong>Results</strong>:</p><ul><li><strong>Passed</strong>: The owner call button displayed the deployer’s address correctly.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*q5xE9ILAMckcqhqvfnSaoQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*oGn15l3I5U5-Ye9XHEIQew.png" /></figure><h4>2. Test Authorized Access</h4><p><strong>Scenario</strong>:</p><ul><li>The deployer (contract owner) called the addParticipant and removeParticipant functions.</li></ul><p><strong>Expected Outcome</strong>:</p><ul><li>The owner should be able to call these functions without restrictions.</li></ul><p><strong>Results</strong>:</p><ul><li><strong>Passed</strong>: The owner successfully added and removed participants.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*__0HE0-Q8EgPU8AED6TjyQ.png" /></figure><h4>3. Test Unauthorized Access</h4><p><strong>Scenario</strong>:</p><ul><li>An unauthorized address (not the owner) attempted to call the addParticipant and removeParticipant functions.</li></ul><p><strong>Expected Outcome</strong>:</p><ul><li>The functions should revert with the message: &quot;Caller is not the owner&quot;.</li></ul><p><strong>Results</strong>:</p><ul><li><strong>Passed</strong>: Unauthorized addresses were restricted, and the error message was displayed as expected.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*pnDPWe3neEzzERZ1Rlc7Mw.png" /></figure><h4>4. Test Ownership Transfer</h4><p><strong>Scenario</strong>:</p><ul><li>The owner transferred ownership to a new address using the transferOwnership function.</li></ul><p><strong>Verified that:</strong></p><ol><li>The new owner could call the onlyOwner functions.</li><li>The old owner was restricted from calling the onlyOwner functions.</li><li>Ownership could not be transferred to the zero address (0x0).</li></ol><p><strong>Expected Outcome</strong>:</p><ol><li>Ownership is successfully transferred to the new address.</li><li>The new owner can call restricted functions.</li><li>The old owner is restricted from calling restricted functions.</li><li>Ownership transfer to the zero address is restricted with an error message.</li></ol><p><strong>Results</strong>:</p><ul><li><strong>Ownership Transferred</strong>: The owner address was updated successfully.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*O_Eb3ZKgGT9eTjsnYs74oQ.png" /></figure><ul><li><strong>New Owner Access</strong>: The new owner successfully called restricted functions.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*HRxlOtaT-NCO70aA9F5-gw.png" /></figure><ul><li><strong>Old Owner Restricted</strong>: The old owner was restricted with the message &quot;Caller is not the owner&quot;.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*wsHbUOyx7z_PuRTkIQo8FA.png" /></figure><ul><li><strong>Zero Address Restriction</strong>: Ownership transfer to the zero address was blocked with the message &quot;New owner cannot be the zero address&quot;.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*WmLQzyBZFsWjFhLTtJhwFQ.png" /></figure><p><strong>Ownership Control</strong>:</p><ul><li>Functions restricted by the onlyOwner modifier were correctly limited to the contract owner.</li></ul><p><strong>Unauthorized Access</strong>:</p><ul><li>Non-owners were unable to execute restricted functions, maintaining contract security.</li></ul><p><strong>Ownership Transfer</strong>:</p><ul><li>Ownership transfer functionality worked as intended, ensuring flexibility while maintaining security.</li></ul><p>Ownership control mechanisms are thoroughly tested and successfully implemented, ensuring a secure and robust contract.</p><h3>Step Eleven: Adding receive and fallback Functions</h3><p>To enhance the functionality of the <strong>RoyaltyDistribution</strong> contract, receive and fallback functions were added to handle ETH sent to the contract, ensuring that any ETH received is automatically distributed among participants.</p><h4>1. receive Function</h4><p><strong>Purpose</strong>:</p><ul><li>The receive function is triggered automatically when the contract receives ETH <strong>without accompanying data</strong>.</li><li>It calls the distributeRoyalties function to immediately distribute the received ETH among participants.</li></ul><p><strong>Key Points</strong>:</p><ul><li><strong>external</strong>: Specifies that the function can be called from outside the contract.</li><li><strong>payable</strong>: Allows the function to accept ETH.</li><li>Calls distributeRoyalties to ensure ETH is allocated to participants as intended.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*avjx3BK8zF7Rw9SMXxAuEw.png" /></figure><h4>2. fallback Function</h4><p><strong>Purpose</strong>:</p><p>The fallback function is triggered when:</p><ul><li>ETH is sent to the contract <strong>with accompanying data</strong>.</li><li>A non-existent function is called on the contract.</li><li>Like the receive function, it ensures that any ETH sent is distributed by calling distributeRoyalties.</li></ul><p><strong>Key Points</strong>:</p><ul><li><strong>external</strong>: Indicates that the function can only be called from outside the contract.</li><li><strong>payable</strong>: Enables the function to accept ETH.</li><li>Ensures that even fallback calls result in the proper allocation of received funds.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*ZPK9IOeRIDpSpHFKYyrZwA.png" /></figure><h3>Test Five: Verifying receive and fallback Functions</h3><p>This test ensures the <strong>receive</strong> and <strong>fallback</strong> functions work as expected by automatically triggering the <strong>distributeRoyalties</strong> function when the contract receives ETH.</p><h4>1. Deploy the Contract</h4><p><strong>Scenario</strong>:</p><ul><li>The contract was compiled and deployed successfully.</li></ul><p><strong>Expected Outcome</strong>:</p><ul><li>The deployment completes without errors.</li><li>The contract is ready to handle ETH transactions.</li></ul><p><strong>Result</strong>:</p><ul><li><strong>Passed</strong>: The contract was deployed successfully.</li></ul><h4>2. Prepare Participants</h4><p><strong>Scenario</strong>:</p><ul><li>Added three participants to the contract with valid wallet addresses, roles, and shares.</li></ul><p><strong>Expected Outcome</strong>:</p><ul><li>Participants are added successfully.</li><li>Their details are stored in the contract’s state variables.</li></ul><p><strong>Result</strong>:</p><ul><li><strong>Passed</strong>: All three participants were added successfully.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*oeeE2-JMoHctOe3ZQDUf3A.png" /></figure><h4>3. Test the receive() Function</h4><p><strong>Scenario</strong>:</p><ul><li>Sent <strong>5 ETH</strong> to the contract without any accompanying data.</li></ul><p><strong>Expected Outcome</strong>:</p><ol><li>The <strong>receive</strong> function is triggered.</li><li>The <strong>distributeRoyalties</strong> function is called automatically.</li><li>Each participant receives their proportional share of the ETH.</li><li>The <strong>PaymentSent</strong> event logs each payment.</li><li>The <strong>RoyaltiesDistributed</strong> event logs the total ETH distributed and participant count.</li></ol><p><strong>Results</strong>:</p><ul><li><strong>Passed</strong>: <strong>Triggered Functionality</strong>: The receive function triggered distributeRoyalties() as expected.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*XQDVySfpx9JXiK0WbuIJPw.png" /></figure><p><strong>Event Emission</strong>:</p><ul><li>PaymentSent events showed each participant received their proportional share of ETH.</li></ul><p>Participant 1:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*OOlxw_pRsdlEgFlIkcQ6qQ.png" /></figure><p>Participant 2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*B7T-cdvei26iZQVYIwQPHQ.png" /></figure><p>Participant 3:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*ikPetQlYcUrlEXpPyP18lw.png" /></figure><ul><li>RoyaltiesDistributed event showed the total ETH and participant count.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*i8M8yaZDxRUWUBNvIDVqdQ.png" /></figure><h4>4. Test the fallback() Function</h4><p><strong>Scenario</strong>:</p><ul><li>Sent <strong>5 ETH</strong> to the contract with arbitrary data (0x1234).</li></ul><p><strong>Expected Outcome</strong>:</p><ol><li>The <strong>fallback</strong> function is triggered.</li><li>The <strong>distributeRoyalties</strong> function is called automatically.</li><li>Each participant receives their proportional share of the ETH.</li><li>The <strong>PaymentSent</strong> event logs each payment.</li><li>The <strong>RoyaltiesDistributed</strong> event logs the total ETH distributed and participant count.</li></ol><p><strong>Results</strong>:</p><ul><li><strong>Passed</strong>: <strong>Triggered Functionality</strong>: The fallback function triggered distributeRoyalties() as expected.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*4j1D9r1HoHWIqPjxH8Brcg.png" /></figure><p><strong>Event Emission</strong>:</p><ul><li>PaymentSent events showed each participant received their proportional share of ETH.</li></ul><p>Participant 1:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*xXqMUIIyCr-HCS_Chhuu0g.png" /></figure><p>Participant 2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*ChUXNcEZsRTzyC7JlJq_rQ.png" /></figure><p>Participant 3:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*ipEEX6LJiVFzdwgXJZBbtQ.png" /></figure><ul><li>RoyaltiesDistributed event showed the total ETH and participant count.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*Wd91ElJDhw4Sr-eS5LkRlQ.png" /></figure><p><strong>receive Functionality</strong>:</p><ul><li>Automatically handles ETH sent to the contract without accompanying data.</li><li>Triggers distributeRoyalties for immediate ETH distribution.</li></ul><p><strong>fallback Functionality</strong>:</p><ul><li>Ensures ETH sent with data or fallback calls are handled correctly.</li><li>Triggers distributeRoyalties for consistent ETH distribution.</li></ul><p><strong>Event Logging</strong>:</p><ul><li>The PaymentSent and RoyaltiesDistributed events provide complete transparency, logging individual payments and the overall distribution.</li></ul><p><strong>Robustness</strong>:</p><ul><li>Both functions ensure the contract handles ETH transactions reliably, even under unexpected scenarios.</li></ul><p>The receive and fallback functions were successfully tested and confirmed to perform as intended.</p><h3>Step Twelve: Adding getParticipantCount Function</h3><p>To simplify the process of querying the total number of participants in the contract, the <strong>getParticipantCount</strong> function was added.</p><h4>Function Implementation</h4><p><strong>Purpose</strong>:</p><ul><li>Provides a quick way to check the total number of participants in the contract.</li></ul><p><strong>Modifiers</strong>:</p><ul><li><strong>public</strong>: The function is accessible both externally and internally.</li><li><strong>view</strong>: Indicates that the function does not modify the contract’s state.</li></ul><p><strong>Returns</strong>:</p><ul><li>A uint256 value representing the length of the participants array (i.e., the number of participants).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*c_N4lghOIFCTzZJdfPSDPg.png" /></figure><h4>Testing the Function</h4><p><strong>Test Scenario</strong>:</p><ol><li>Added three participants to the contract.</li><li>Called the <strong>getParticipantCount</strong> function to retrieve the total number of participants.</li></ol><p><strong>Expected Outcome</strong>:</p><ul><li>The function returns the correct count of participants in the participants array.</li></ul><p><strong>Results</strong>:</p><ul><li><strong>Passed</strong>:</li><li>A new call button labeled <strong>getParticipantCount</strong> was added to the contract interface.</li><li>The function correctly returned the value <strong>3</strong>, matching the number of participants added to the contract.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*i0ge2mU8Zt564FySxDEhdQ.png" /></figure><h3>Step Thirteen: Security Enhancement: Reentrancy Protection</h3><p>Reentrancy protection ensures the <strong>RoyaltyDistribution</strong> contract is secure from reentrancy attacks, which can exploit vulnerable functions by repeatedly calling them before the previous execution is completed. Here’s how this enhancement was implemented:</p><h4>1. Add locked State Variable</h4><p><strong>Purpose</strong>:</p><ul><li>Tracks whether a function is currently being executed.</li><li>Prevents reentrant calls to functions that could lead to vulnerabilities.</li></ul><p><strong>Modifiers</strong>:</p><ul><li><strong>private</strong>: Limits access to the locked variable, ensuring it can only be modified internally by the contract.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*me2UXU6KS9GpxkkJcKwvdw.png" /></figure><h4>2. Define the noReentrancy Modifier</h4><p><strong>Purpose</strong>:</p><ul><li>Ensures that a function cannot be reentered while it is still being executed.<strong>Key Steps</strong>:</li></ul><p><strong>Check State</strong>:</p><ul><li>Verifies that locked is false (function is not currently executing).</li></ul><p><strong>Update State</strong>:</p><ul><li>Sets locked to true to block further calls.</li></ul><p><strong>Execute Function</strong>:</p><ul><li>Allows the function’s logic to proceed (_).</li></ul><p><strong>Reset State</strong>:</p><ul><li>Resets locked to false after the function completes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*fxlLPKBQiBgx42eJAg8WFQ.png" /></figure><h4>3. Apply the noReentrancy Modifier to Functions</h4><p>The <strong>noReentrancy</strong> modifier was applied to the <strong>distributeRoyalties</strong> function, which involves ETH transfers and is therefore most vulnerable to reentrancy attacks.</p><p><strong>Protected Function</strong>:</p><p><strong>distributeRoyalties</strong>:</p><ul><li>Transfers ETH to participants based on their shares.</li><li>Vulnerable to reentrancy attacks without protection.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*mtZPnIi2PSC2CUrrhWsOzg.png" /></figure><p><strong>Protection Against Reentrancy</strong>:</p><ul><li>The noReentrancy modifier ensures that sensitive functions cannot be exploited by malicious reentrant calls.</li></ul><p><strong>Efficient Implementation</strong>:</p><ul><li>Minimal changes to the codebase with significant security improvements.</li></ul><p>This enhancement strengthens the contract’s resilience against one of the most common Ethereum security vulnerabilities.</p><h3>In Conclusion</h3><p>The <strong>RoyaltyDistribution</strong> contract is just the first step in revolutionizing how creators manage royalties in a transparent and efficient way. While this marks the foundation of the larger <strong>FlowStream</strong> vision, the journey is far from over.</p><p>Your insights and feedback as a creator or developer are invaluable in shaping what comes next. Are there features you’d like to see? Improvements that would make this even more impactful? Let’s collaborate to ensure this tool continues to meet real-world needs and push the boundaries of what’s possible for creators everywhere.</p><p>Feel free to connect with me — your thoughts could help shape the future of the creative economy!</p><p>LinkedIn: linkedin.com/in/dustinhurt/</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13fe700f3b45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying My First Solidity Smart Contract]]></title>
            <link>https://medium.com/@dustin.aad/deploying-my-first-solidity-smart-contract-9a16c91c9a47?source=rss-45d2a7858705------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a16c91c9a47</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Dustin Hurt]]></dc:creator>
            <pubDate>Sun, 10 Nov 2024 17:20:32 GMT</pubDate>
            <atom:updated>2024-11-10T17:28:16.229Z</atom:updated>
            <content:encoded><![CDATA[<p>What a satisfying journey this has been so far. When I first heard about Bitcoin back in 2013, I was still a senior in high school. I knew nothing about blockchain, or smart contracts, or any of the other underlying technology… only that Bitcoin had the potential to make people a lot of money. I still poke at my parents for not making an investment back then when I first told them about it (it also still makes us all sick to our stomach).</p><p>But today is a new day, and I’m excited to be learning about blockchain technology — stacking it with my growing skills in security, AWS, and AI.</p><p>This past week, I celebrated a significant milestone: the deployment of my first smart contract.</p><p>In this article, I’ll walk you through how I did it, step by step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*oquf-E3pplQfMhUXdwZZig.png" /></figure><h4>Getting Started with Solidity in Remix</h4><p>I began by using Remix, a browser-based IDE tailored for Solidity development. Its familiar interface made it an easy transition for someone used to VSCode.</p><p>The official Solidity documentation, available at <a href="https://docs.soliditylang.org/">https://docs.soliditylang.org/</a>, is a valuable resource for reference.</p><h4>Setting Up My Workspace</h4><p>I first navigated to remix.ethereum.org.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_OWg2vJy41RMCl7vFCiBUA.png" /></figure><p>In the <strong>File Explorer</strong>, I deleted the default files to start fresh.</p><p>I created a new file named SimpleStorage.sol, using the .sol extension to signal that it’s a Solidity file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bn-PZ_I5xWbeMXQ3VXjCLw.png" /></figure><p>On the right-hand side is the <strong>Editor Pane</strong>, where I write the Solidity code. Below is the <strong>Terminal</strong>, similar to the layout in VSCode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rp9P0iKKa1krfiU2-2ekVw.png" /></figure><p>As I began coding, I first had to choose which version of Solidity to use. Although there are many versions to explore, I started with version 0.8.18, as that’s what my instructor was using. To set it up, I did the following:</p><ul><li>Set the compiler version in Remix to 0.8.18.</li><li>Added a license comment using // SPDX-License-Identifier: MIT (or another appropriate license).</li><li>Wrote the pragma directive pragma solidity ^0.8.18; to specify the Solidity version.</li><li>The ^ symbol in ^0.8.18 allowed the compiler to accept any version higher than 0.8.18, ensuring compatibility with future updates.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aVbx1YeE723-AWPcjQBNPQ.png" /></figure><p>Compiling code is the process of converting human-readable Solidity code into computer-readable code that the Ethereum Virtual Machine (EVM) can execute. To compile, I clicked <strong>“Compile SimpleStorage.sol”</strong> in the <strong>Solidity Compiler</strong> tab on the left menu. Alternatively, I could use the shortcut cmd+s (or ctrl+s on PC). Regularly compiling is considered a best practice to ensure the code is up to date and avoid potential loss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AVgftCg9m5doYKs5J5oEjA.png" /></figure><p>The message “No Contract Compiled Yet” indicates that no code has been compiled during the current session. To begin writing the contract, I used the contract keyword, which signifies the creation of a new smart contract. Following the contract keyword, I assigned it a name—SimpleStorage in this case. The contract name is followed by curly brackets {}, where the functionality of the contract is defined, including variables and functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NsFETZQNTMZULyz87QvXyA.png" /></figure><p>After compiling the updated code, “No Contract Compiled Yet” is replaced with the contract name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*zh_3j8IgZEFJSkalbTohSA.png" /></figure><h4>Recap Checkpoint</h4><ol><li>EVM is short for Ethereum Virtal Machine.</li><li>Solidity is the programming language primarily used for EVM-based smart contract development.</li><li>The keyword pragma specifies the version of the Solidity compiler that should be used.</li><li>Compiling a contract is when Solidity code is converted into bytecode and ABI that can be understood and executed by the EVM.</li></ol><h4>Basic Variable Types</h4><ol><li><strong>boolean</strong>: Represents a true or false value.</li><li><strong>uint</strong>: An unsigned integer, a whole number with no decimals or negative values.</li><li><strong>int</strong>: A signed integer, a whole number that can be positive or negative.</li><li><strong>address</strong>: A 20-byte value representing an Ethereum address (e.g., similar to a MetaMask address).</li><li><strong>bytes</strong>: A sequence of raw bytes.</li></ol><p>These types are used to define variables, which act as placeholders for storing different values in a smart contract.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P0W9xZyuJxEM-IoWv69kwg.png" /></figure><h4>Functions</h4><p>Functions are reusable blocks of code designed to perform specific tasks. They allow you to update, modify, or interact with different parts of a codebase, making the code more organized and efficient. They are identified by the keyword function. In this case, I called the function store.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5a6Aet8_cKobmFXSTQ7niQ.png" /></figure><p>This function will be responsible for updating, or storing, favoriteNumber.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ybpFnIfE_Oh-qOcTrYWr9Q.png" /></figure><p>In the code above:</p><ul><li><strong>uint256 _favoriteNumber</strong>: Represents an input parameter (an unsigned integer) temporarily named _favoriteNumber for use within the function.</li><li><strong>public</strong>: A visibility modifier that allows the function to be called externally and internally.</li><li><strong>favoriteNumber = _favoriteNumber;</strong>: Assigns the value of _favoriteNumber to the state variable favoriteNumber, effectively updating its value.</li></ul><p>This function behaves similarly to passing an input to update a state variable, much like setting a variable in a Terraform module.</p><p>At this point, the code is sufficient to test what the smart contract can do and check if the store function works correctly:</p><ol><li>Compile the code and ensure a green checkmark appears on the <strong>compiler tab icon</strong>.</li><li>Open the <strong>Deploy &amp; Run Transactions</strong> tab, located directly below the compiler tab in the left menu.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*VAzFjCxjxpZawkds36CFKA.png" /></figure><p>This contract will be deployed to a simulated virtual environment using Remix VM:</p><ul><li>In the <strong>Environment</strong> dropdown, ensure that <strong>Remix VM</strong> is selected. This is a simulated local blockchain that eliminates deployment wait times.</li><li>A fake account is provided with a predefined balance of Ether (e.g., 100 Ether in this case).</li><li>Verify that the correct contract is selected; for this example, I selected <strong>SimpleStorage</strong>.</li><li>Click the <strong>Deploy</strong> button to deploy the contract.</li><li>Once deployed, a new <strong>Deployed Contracts</strong> section appears at the bottom of the tab, displaying the deployment details for <strong>SimpleStorage</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*RgdOc0vJYWTctN-85FbiwA.png" /></figure><p>From the screenshot above, the <strong>Balance</strong> was displayed as 0 ETH, indicating that no Ether was currently stored at the contract&#39;s address. The text starting with <strong>AT 0xD9</strong> referred to the <strong>address</strong> of the deployed smart contract. I clicked the copy icon next to the address to copy it and paste it wherever needed. In this example, the full address was: 0xd9145CCE52D386f254917e481eB44e9943F39138.</p><p>When I opened the terminal at the bottom of the screen, I saw a notation indicating that a transaction had been sent to deploy the contract, along with the transaction details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iUX3uyDsGxxUXyPe_HfZOw.png" /></figure><p>In the <strong>Deployed Contracts</strong> section, I can see the store function displayed with an input field next to it. This input bar allws me to enter a value and call the function directly.</p><p>In this example, I’ll input and store 222 and 333. After doing so, these transactions can be seen in the terminal as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PEhK2WezpQEBz5-3r2Kj-w.png" /></figure><p>It’s important to remember that any transaction on the blockchain results in gas fees. When I look at my fake account, I can see that those fees have been deducted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*as6mzSbQEar75LaUpzGWWA.png" /></figure><p>Although I had changed favoriteNumber using the store function, it was not visible in the contract itself. To make it visible, I updated the code by adding public after uint256 for the variable&#39;s visibility and recompiled the contract.</p><p>Next, I deleted the previously deployed contract and re-deployed it. After redeployment, the <strong>Deployed Contracts</strong> section displayed a new blue button labeled “favoriteNumber.” When I clicked it, it returned 0, which is the default value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eq9DUHbvtzk1uREnilGJ1Q.png" /></figure><p>When I put 222 into the input field and press store followed by the blue favoriteNumber button, it returns 222.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ysujpJ2Bzp-qUaOil8i-cQ.png" /></figure><h4>Visibility Specifiers and Scope in Solidity</h4><p>Functions and variables in Solidity can have one of four visibility specifiers, which determine where they can be accessed:</p><p><strong>Public</strong>:</p><ul><li>Visible externally and internally.</li><li>Automatically generates a getter function for state variables.</li><li><strong>This means</strong> anyone, both inside and outside the contract, can access or call it.</li></ul><p><strong>Private</strong>:</p><ul><li>Only visible within the current contract.</li><li><strong>This means</strong> it cannot be accessed or called by derived contracts (contracts that inherit from it) or external sources.</li></ul><p><strong>External</strong>:</p><ul><li>Visible only externally and used exclusively for functions.</li><li><strong>This means</strong> it can only be called from outside the contract using a message call (e.g., this.func()), not from within the same contract.</li></ul><p><strong>Internal</strong>:</p><ul><li>Visible internally, within the same contract, and in contracts that inherit from it.</li><li><strong>This means</strong> it cannot be accessed by external sources.</li></ul><blockquote><strong><em>Note</em></strong><em>: If no visibility specifier is set, it defaults to </em><strong><em>internal</em></strong><em>.</em></blockquote><h4>Understanding Scope</h4><p>In Solidity, <strong>scope</strong> defines where a variable or function can be accessed within the code. The scope depends on where the variable or function is declared:</p><p><strong>State Variables</strong>:</p><ul><li>Declared outside of functions, typically within the first set of {} in the contract.</li><li>Their scope is the entire contract, and they are stored persistently on the blockchain.</li></ul><p><strong>Local Variables</strong>:</p><ul><li>Declared inside functions or within specific code blocks (e.g., loops or if-statements).</li><li>Their scope is limited to the function or block they are declared in, and they are temporary (not stored on the blockchain).</li></ul><h4>Using view Functions</h4><p>The view keyword is used for functions that only read data from the blockchain without modifying it. These functions do not require a transaction and therefore do not incur gas costs unless called by another function that modifies state.</p><p><strong>Example</strong>:<br>Using a view function to retrieve the value of favoriteNumber:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*a4fVF8yqHmoyzhWIkADvew.png" /></figure><p>This function allowed me to read the current value of favoriteNumber directly from the blockchain without making any changes.</p><h4>Arrays and Structs</h4><p>At that point, the contract allowed me to store, update, and view the favoriteNumber variable.</p><ul><li><strong>Note</strong>: I switched favoriteNumber to an internal variable by removing public after the uint256 state variable. This variable was considered a state variable because it was declared outside of any function.</li></ul><p>I also explored arrays in Solidity, which function like lists in most other programming languages. Within this contract, I set it up to store not just a single favorite number but a list of favorite numbers.</p><p>This was achieved by adding a dynamic array to the code using uint256[]. An example can be seen in line 7 of the following screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NyEyDOYHdcs2Ix8IVxGpDQ.png" /></figure><p>An array started by indexing at 0. For example, in the array [33, 45, 8, 2]:</p><ul><li>33 was at index 0</li><li>45 was at index 1</li><li>8 was at index 2</li><li>2 was at index 3</li></ul><p>This indexing allowed me to access elements directly by their position in the array.</p><p>To associate a person with a favorite number, rather than just storing random values, I used the struct keyword to define a custom data type. For example struct Person {}.</p><p>Within the curly brackets {}, I defined variables to represent the properties of a Person. Each Person had:</p><ul><li><strong>uint256 theirFavoriteNumber</strong>: A favorite number specific to the person.</li><li><strong>string name</strong>: The person’s name.</li></ul><p>I made sure to name the struct variable theirFavoriteNumber instead of favoriteNumber to avoid conflicts with the favoriteNumber state variable already defined in the contract.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h-vwKBrpXk9m4ZN5yMP0qA.png" /></figure><p>A variable can be made of Person just as it was for favoriteNumber.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XvAVGU1MLoIxVzQqUA9_AA.png" /></figure><p>Line 14 above declares a state variable named myFriend of type Person. It is publicly accessible, meaning anyone can query it, and it is assigned an instance of the Person struct with the following properties:</p><ul><li><strong>theirFavoriteNumber</strong> is set to 444.</li><li><strong>name</strong> is set to &quot;Aaron&quot;.</li></ul><p>This means the contract now stores a Person object with these specific properties. By querying the myFriend variable, anyone can retrieve these details.</p><p>The use of {} allows for <strong>key-value pair initialization</strong>, explicitly associating each property with its corresponding value in the struct.</p><p>After deploying the updated contract, a call button for the myFriend variable appeared in the <strong>Deployed Contracts</strong> section. When clicked, it displayed the favorite number associated with Aaron, as defined in the Person struct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NUO-g6d1if6z73Vc4ezpYQ.png" /></figure><p>Since I want to make a list of multiple friends and their favorite numbers, I used an array as discussed earlier.</p><ul><li>A dynamic array can grow or shrink to any size.</li><li>A static array can only go up to the amount set within the brackets [].</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vsbd82MRSPqNLILAxDRHgQ.png" /></figure><p>For this contract, I will use a dynamic array.</p><p>An empty set of brackets in a dynamic array defaults to 0. Therefore, I will create a function so that I can update and store people in my list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CFI9OufGJ7z-XBRk_D9dhg.png" /></figure><p>The <strong>function addPerson</strong> declares a function named addPerson that allows adding a new Person to the listOfPeople array.</p><p><strong>Parameters</strong>:</p><ul><li><strong>string memory _name</strong>: A temporary string that represents the person&#39;s name.</li><li><strong>uint256 _favoriteNumber</strong>: An unsigned integer that represents the person&#39;s favorite number.</li><li><strong>public</strong>: Specifies that the function can be called from outside the contract.</li><li><strong>listOfPeople.push(...)</strong>: Appends a new Person struct to the listOfPeople array.</li><li><strong>Person(_favoriteNumber, _name)</strong>: Creates a new instance of the Person struct using the provided _favoriteNumber and _name.</li></ul><p>After compiling and deploying the updated contract, a new button labeled <strong>“addPerson”</strong> appears in the <strong>Deployed Contracts</strong> section. By entering a name (as a string) and a favorite number (as a uint256) and clicking the <strong>addPerson</strong> button, the function adds the new Person to the listOfPeople array.</p><p>To verify, I entered 0 in the <strong>listOfPeople</strong> input field and clicked the <strong>listOfPeople</strong> button, which displayed the details of the first person in the array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iJs57LrHOTyAnUI45H9YDA.png" /></figure><p>I then added another person, changed the index to 1, and saw the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bfG7QOKoAvo8ydf1CFoeOQ.png" /></figure><h4>Errors and Warnings</h4><p>Errors are signified by a red box that is usually the result of a syntax or structural error. This prevents code compiling and therefore deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*Nx5r5TIvaomTFzkfQRBOkw.png" /></figure><p>Warnings are signified by an orange box when code isn’t prevented from being compiled or deployed but may result in unintended behavior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*CuivvPd0Yge9N_kcHV6lxA.png" /></figure><h4>Memory, Calldata, and Storage</h4><p>In Solidity, the memory and calldata keywords specify the <strong>temporary storage location</strong> of variables, which only exist during the execution of the function they are called in:</p><p><strong>memory</strong>:</p><ul><li>Indicates that the variable is stored in a temporary location called memory.</li><li>Variables stored in memory can be modified within the function.</li><li>Commonly used for strings, arrays, and structs that are passed or declared inside a function.</li></ul><p><strong>calldata</strong>:</p><ul><li>Indicates that the variable is stored in a read-only, temporary location.</li><li>Commonly used for external function parameters.</li><li>Variables in calldata cannot be modified within the function.</li></ul><p>Any variable declared outside of a function is automatically a <strong>state variable</strong> and is stored in <strong>storage</strong>, the contract’s persistent memory on the blockchain.</p><h4>Mappings</h4><p>As the contract was initially written, retrieving specific entries from the listOfPeople array required me to manually input the index number into the listOfPeople call button. There was no functionality to retrieve or search for a person by their name or favorite number without adding additional functions. This is where mappings became useful.</p><p>A mapping in Solidity functions like a dictionary, allowing me to use a key to search for and retrieve its corresponding value. However, unlike dictionaries in other programming languages, mappings in Solidity are not iterable. This meant I couldn’t loop through or list all the keys and values stored in the mapping. I had to know the specific key to access its associated value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wsththYadk-Gcyus6x73PQ.png" /></figure><p>In the line of code above, it shows that I’m mapping a string to uint256, this mapping will be public and named nameToFavoriteNumber.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lWScqTSIPeqyb845_wILzA.png" /></figure><p>In the highlighted line of code above, which I added to the addPerson function, _name was mapped to _favoriteNumber.</p><p>After compiling and deploying the updated code, a new call button labeled <strong>“nameToFavoriteNumber”</strong> appeared. By entering the name of a person into this button, I could retrieve their favorite number directly, without needing to reference an index in the listOfPeople array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vnTyAtEIzK3qRA5wRZbapA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qLQhvIMKB6LrvbDb_3bDfg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mpK8hL4gqJof5t75WYVOyg.png" /></figure><p>If there is a key that hasn’t been added, it defaults to 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bmW7fs1D1t3x9p00OT9K2w.png" /></figure><h4>Deploying My First Contract</h4><p>In usual circumstances, this contract would need to be tested and audited before it’s deployed, but, since this is a dummy contract on a local testnet, it’s not necessary this time.</p><p>First, under the <strong>Deploy &amp; Run Transactions</strong> tab, I’ve changed the <strong>Environment</strong> from <strong>Remix VM </strong>to <strong>Injected Provider — MetaMask.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lwYKrxSPfYT4H2XDQVsR0A.png" /></figure><p>A popup appears asking which MetaMask accounts I’d like to connect to. I selected <strong>Account 1.</strong></p><p>I could then see in MetaMask that my account is connected to Remix.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8FmCwz4C4G6h1SFrIpykGA.png" /></figure><p>My actual amount of Sepolia ETH is is now reflected under <strong>Account</strong> in the <strong>Deploy &amp; Run Transactions</strong> tab on Remix.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Np6ZFpCSg2tHGrJr538WUw.png" /></figure><p>Then, when I clicked the orange <strong>Deploy </strong>button, MetaMask pops up to confirm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*GOcJ4t5fPozRLbBoKbWX7w.png" /></figure><p>When I looked at the Terminal, I could see that the contract was deployed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*xL0a9ceGB6HPJhD_rz-45g.png" /></figure><p>I clicked the <strong>“view on etherscan”</strong> button to get even more transaction details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nx4kO5lYZk6i9AGJJx3VfQ.png" /></figure><p>The contract is now deployed on the Sepolia Ethereum testnet. All the same functions that were available in the Remix VM environment are now live and accessible on the testnet.</p><p>It’s important to note the gas fees associated with transactions on the blockchain. Gas fees are required to execute functions or deploy contracts, as they compensate miners or validators for the computational resources used.</p><ul><li>Remember: The more complex the contract (e.g., the more functions, loops, or storage operations it contains), the higher the gas fees will be, because it requires more computational effort to execute.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nVSjgWCTq-OirWYTgvK4uA.png" /></figure><p>Now, when I use the addPerson function under the<strong> Deployed Contracts</strong> section, MetaMask pops up asking me to confirm the transaction Request. I can also see in the terminal that a transact to SimpleStorage.addPerson is pending.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ENpX0Zf6LODuq1WHX5PJcA.png" /></figure><p>Using nameToFavoriteNumber for Person Dustin, I can see 333 as their favorite number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*0KVxnMULN6fIMa-ovCijwA.png" /></figure><p>On Etherscan, I pasted my account address to see that the contract has been deployed AND I’ve successfully added a person.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w9GNFmrskE5bjlknFRmmsg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zG4IgvF3oCh-Q9kjmQO3rw.png" /></figure><h3>Conclusion</h3><p>And there you have it — my first Solidity smart contract, successfully deployed on the Ethereum testnet! This process has been both challenging and rewarding, solidifying my growing understanding of blockchain development.</p><p>If you’re exploring Solidity or blockchain development, I hope this breakdown inspires you to take the leap. Let me know if you have any questions or insights to share!</p><p>Feel free to connect with me on LinkedIn: <a href="https://www.linkedin.com/in/dustinhurt/">Dustin Hurt</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a16c91c9a47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Layer 2 Scaling Solutions: A Continued Journey into zkSync]]></title>
            <link>https://medium.com/@dustin.aad/exploring-layer-2-scaling-solutions-a-continued-journey-into-zksync-9e4f96e1c5ef?source=rss-45d2a7858705------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e4f96e1c5ef</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[zksync]]></category>
            <dc:creator><![CDATA[Dustin Hurt]]></dc:creator>
            <pubDate>Sun, 03 Nov 2024 12:24:44 GMT</pubDate>
            <atom:updated>2024-11-03T12:24:44.999Z</atom:updated>
            <content:encoded><![CDATA[<p>As I continue my exploration into the world of blockchain scaling solutions, this week has been all about peeling back the layers (pun intended) of Layer 1s, Layer 2s, and the fascinating mechanisms that make them tick. Join me as I delve into Optimistic Rollups, zkSync, and the practical steps of making my first transaction on zkSync Sepolia Testnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*Nx9CPhPlrx9_nHfeSCy_lA.png" /></figure><h3>Understanding L1s, L2s, and Rollups</h3><h3>Optimistic Rollups</h3><p>Optimistic Rollups are a type of Layer 2 scaling solution that assumes off-chain transactions are valid by default. They operate under the optimistic assumption that all participants play by the rules.</p><ul><li><strong>Fraud Proofs</strong>: In the event of a dispute, operators can use fraud proofs during a challenge period to verify the correctness of transactions. This mechanism ensures security without the need for immediate verification of every transaction.</li></ul><h3>Zero-Knowledge (ZK) Rollups</h3><p>ZK Rollups, on the other hand, use validity proofs (zk proofs) to verify transaction correctness from the get-go.</p><ul><li><strong>Zero-Knowledge Proofs</strong>: These are algorithms that allow a “prover” to demonstrate to a “verifier” that they know something without revealing the actual information. In the ZK world, the answer to a problem is known as a <strong>witness</strong>.</li></ul><h3>Centralized Sequencers</h3><p>Sequencers are operators responsible for ordering transactions. Often, they are centralized, which can lead to potential issues:</p><ul><li><strong>Censorship</strong>: Centralization can result in censorship or manipulation of transaction order.</li><li><strong>Single Point of Failure</strong>: If the sequencer goes down, users might be prevented from making transactions.</li></ul><h3>The Rollup Stages According to L2BEAT</h3><p><strong>L2BEAT</strong> is a data-driven analytics and research platform focusing on Layer 2 scaling solutions for Ethereum. It provides transparency and insight into the Layer 2 ecosystem, helping users track adoption and evaluate security and performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*i_JIDFw6xQcmxX-DW7MEgQ.png" /><figcaption>L2Beat</figcaption></figure><p>L2BEAT incentivizes projects to work toward decentralization by rating them in three stages:</p><h3>Stage 0: Full Training Wheels</h3><ol><li><strong>Centralized Management</strong></li><li><strong>Security Council Makes Decisions</strong></li><li><strong>Open Source Software for Data Availability</strong></li></ol><h3>Stage 1: Enhanced Rollup Governance</h3><ol><li><strong>Governed by Smart Contracts</strong></li><li><strong>Security Council for Bug Resolution</strong></li><li><strong>Decentralized Fraud/Validity Proof System</strong></li><li><strong>Users Have &lt;7 Days to Exit in Case of Unwanted Upgrades</strong></li></ol><h3>Stage 2: No Training Wheels</h3><ol><li><strong>Completely Decentralized</strong></li><li><strong>Smart Contracts Manage the Rollup</strong></li><li><strong>Ample Time to Exit System in Case of Upgrades</strong></li><li><strong>Security Council Addresses Errors Adjudicated On-Chain</strong></li><li><strong>User Protection Against Governance Attacks</strong></li></ol><h3>Making My First Transaction on zkSync</h3><p>After getting a grasp on the theory, it’s time to get hands-on. Here’s how I made my first transaction on the zkSync Sepolia Testnet.</p><h3>Adding zkSync Sepolia to MetaMask</h3><p><strong>Access Chainlist</strong>: Go to <a href="https://chainlist.org/">chainlist.org</a>.</p><p><strong>Search for zkSync Sepolia Testnet</strong>: Ensure the “Include Testnets” option is checked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*pjIXVm4IWmKRTPj1xO7BMg.png" /><figcaption>Chainlist</figcaption></figure><p><strong>Connect Wallet</strong>: Click “Connect Wallet” and follow the prompts until you can click “Switch Network.”</p><p><strong>Verify Network in MetaMask</strong>: zkSync Sepolia Testnet should now be selected as the current network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*KQfzPZLHL6FyN82GZ2nMDw.png" /><figcaption>zkSync Sepolia Testnet Selected</figcaption></figure><h3>Exploring Transactions with zkSync Explorer</h3><ul><li>Navigate to <a href="https://explorer.zksync.io/">zkSync Explorer</a>.</li><li>Switch the network to zkSync Era Testnet.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*QhdtUArevMXrR11DGwi-iQ.png" /><figcaption>Switching Networks</figcaption></figure><ul><li>Paste your wallet address into the search bar to view your account summary.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*1x-anUoE8P-5rVc0nZDlwA.png" /><figcaption>Account Summary</figcaption></figure><h3>Bridging Funds</h3><p>Bridging funds is the act of transferring assets from one chain to another. There are two primary methods:</p><ol><li><strong>Locking and Unlocking</strong>: Tokens are locked on the source chain within a smart contract, then released on the destination chain.</li><li><strong>Minting and Burning</strong>: Tokens are burned on the source chain and minted on the destination chain.</li></ol><h3>Steps to Bridge Funds</h3><ol><li><strong>Fund Sepolia Wallet</strong>: I funded my Sepolia wallet with more Sepolia ETH using the Google Cloud faucet.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*Vi5JVYuQ2J87JOhdIWqNqg.png" /><figcaption>Faucet</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*vZAI1pVq9H-R6RLIAoJTpg.png" /><figcaption>Completed Drip</figcaption></figure><p><strong>Access zkSync Bridge</strong>: Go to <a href="https://portal.zksync.io/bridge/">zkSync Bridge</a>, connect your wallet, and switch the network to zkSync Sepolia Testnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*D7QkC_MSoAWJ6aErt-nLlQ.png" /></figure><p><strong>Initiate the Bridge</strong>:</p><ul><li>Specify the amount to bridge (I chose 0.025 Sepolia ETH).</li><li>Note the transaction fee (approximately 0.0008 ETH).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*DJQCIltqSDfuxakXxAPSkA.png" /><figcaption>Entering Transaction Amount and Determining Fee</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*fWsZFOlhamMCNGQSxMix5Q.png" /><figcaption>Confirm Transaction</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*RH95yvjZOb8Wl_zU8SSAIg.png" /><figcaption>Confirmation in MetaMask</figcaption></figure><p>After submitting, I was informed it would take about 15 minutes, but it completed in just about 4 minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*VaHcs75-Ltj1apUvyr0rLg.png" /><figcaption>Transaction Submitted</figcaption></figure><p>To verify the transaction, go to <a href="https://sepolia.explorer.zksync.io/">zkSync Sepolia Explorer</a>, paste your address, and view the transaction details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*s3Q68bgml9JfziivLkA_UA.png" /><figcaption>Account Details</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*TG0Vl3MpD6BMg2l2JTJxNg.png" /><figcaption>Transaction Details</figcaption></figure><h3>Why zkSync is My Recommended Chain</h3><p>After this hands-on experience, here’s why I recommend zkSync:</p><ul><li><strong>Security</strong>: zkSync’s security is directly correlated to Ethereum, ensuring robust protection.</li><li><strong>EVM Compatibility</strong>: It can compile and understand Solidity, making it developer-friendly.</li><li><strong>User-Friendly</strong>: You can use MetaMask with the same address for Ethereum and zkSync.</li><li><strong>Cost-Efficient and Scalable</strong>: Low transaction costs and high scalability make it practical for everyday use.</li></ul><p><em>Stay tuned for more as I continue this journey into blockchain scaling solutions and share my experiences along the way.</em></p><p>Also, let’s connect on LinkedIn: <a href="https://www.linkedin.com/in/dustinhurt/">https://www.linkedin.com/in/dustinhurt/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e4f96e1c5ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Deep Dive into Gas, Transactions, and Consensus Mechanisms]]></title>
            <link>https://medium.com/@dustin.aad/a-deep-dive-into-gas-transactions-and-consensus-mechanisms-e80728005b18?source=rss-45d2a7858705------2</link>
            <guid isPermaLink="false">https://medium.com/p/e80728005b18</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Dustin Hurt]]></dc:creator>
            <pubDate>Sun, 20 Oct 2024 14:04:01 GMT</pubDate>
            <atom:updated>2024-10-20T14:04:01.241Z</atom:updated>
            <content:encoded><![CDATA[<h4>Week 2: 10/14/24–10/19/24</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_xT6cvZ1ARBo5enoaqinQg.png" /></figure><p>Blockchain technology has been a buzzword for quite some time now, but understanding its inner workings can still feel like navigating a labyrinth. In this article, we’ll peel back the layers of complexity and explore the foundational elements of blockchain — gas fees, transaction signing, consensus mechanisms, and the nuances between Layer 1 and Layer 2 solutions. Whether you’re a seasoned crypto enthusiast or a curious newcomer, this deep dive aims to clarify how blockchains function and why they matter.</p><h3>Understanding Gas in Blockchain Transactions</h3><h3>What Is Gas?</h3><p>Before we jump into transactions, it’s crucial to grasp the concept of <strong>gas</strong> in the blockchain ecosystem:</p><ul><li><strong>Compensation for Validators</strong>: Validators are essential to the Ethereum network, validating and processing transactions. They are compensated with ETH for their services.</li><li><strong>Unit of Computational Effort</strong>: Gas measures the computational effort required to execute operations on the network. More complex transactions consume more gas.</li><li><strong>Calculating Fees</strong>: The transaction fee is calculated based on the gas used and the gas price, factoring in the base fee and priority fee introduced by EIP-1559.</li></ul><h3>A Hands-On Example: Sending ETH with MetaMask</h3><p>To get a practical understanding of how gas works, let’s walk through sending Ether (ETH) using MetaMask.</p><p><strong>Step 1: Starting the Transaction</strong></p><p>Suppose we have 0.05 ETH in our MetaMask wallet. We decide to send 0.025 ETH to another one of our accounts to familiarize ourselves with transaction fees.</p><p><strong>Step 2: Initiating the Transfer</strong></p><p>Click the “Send” button in MetaMask and specify the amount (0.025 ETH) and the recipient’s address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*_3yCt2bfsVGn1eu5pVg8PQ.png" /><figcaption>MetaMask’s “Send” Interface</figcaption></figure><p><strong>Step 3: Reviewing Gas Fees</strong></p><p>After entering the transaction details, MetaMask displays the estimated gas fee and the maximum fee. These fees can fluctuate based on network congestion — the more people transacting, the higher the fees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*N7ieFWd3sKKGXfz85nQukA.png" /><figcaption>Estimated Gas Fee and Max Fee in MetaMask</figcaption></figure><p><strong>Step 4: Customizing Gas Fees</strong></p><p>By clicking the pencil icon next to “Estimated Gas Fee,” we can choose between different gas options:</p><ul><li><strong>Low</strong>: Cheaper but slower transaction confirmation.</li><li><strong>Market</strong>: Balanced option based on current network conditions.</li><li><strong>Aggressive</strong>: Higher fee for faster confirmation.</li></ul><p>For this example, we’ll stick with the “Market” option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*5G0fPyvrw9yROKBLk4NTmw.png" /><figcaption>Gas Fee Customization Options</figcaption></figure><p><strong>Step 5: Confirming the Transaction</strong></p><p>After reviewing the details, click “Confirm” to proceed. You’ll notice that the remaining balance is less than 0.025 ETH subtracted from your initial balance. This is because the gas fee is also deducted to compensate the validators.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*MLupK1GNfUXjmkEJmQZkcQ.png" /><figcaption>Account 1 After Transfer</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*mdb-QAnLvFMMyhHdkKeIPQ.png" /><figcaption>Account 2 After Transfer</figcaption></figure><p><strong>Step 6: Viewing Transaction Details</strong></p><p>By clicking on the confirmed transaction and selecting “View on block explorer,” we can see a detailed breakdown, including the exact gas fee paid — approximately 0.005 ETH in this case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*aScYi0NSSli6Ihhr7CspDQ.png" /><figcaption>Transaction Details on Etherscan</figcaption></figure><h3>Key Takeaways</h3><ul><li>Gas fees are essential for compensating miners and ensuring the network runs smoothly.</li><li>Fees can vary based on network congestion.</li><li>Tools like MetaMask make it easy to adjust gas fees according to your needs.</li></ul><h3>How Do Blockchains Work?</h3><p>Understanding the mechanics of blockchains involves diving into concepts like hashes, blocks, and how data integrity is maintained across a distributed network.</p><h3>The Role of Hashes</h3><p><strong>Definition</strong>: A hash is a unique, fixed-length string generated by a hash function, serving as a digital fingerprint for data.</p><ul><li><strong>Hash Functions in Ethereum</strong>: Ethereum uses the <strong>Keccak-256</strong> hash function.</li><li><strong>Immutable Fingerprints</strong>: Any change in the input data, even a single character, produces a drastically different hash, while the length remains constant.</li></ul><p>For example:</p><ul><li>The hash for “Smart” and “Smart Contract” are entirely different, illustrating how sensitive hashes are to input data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*BHvN7ARekqPzLfUQIqojqg.png" /><figcaption>“Smart” Hash</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*slFKk1YoHREUYTB5y-Zx8A.png" /><figcaption>“Smart Contract” Hash</figcaption></figure><h3>Exploring Blocks</h3><p>Using tools like <a href="https://andersbrownworth.com/blockchain/">Anders Brownworth’s</a> blockchain demo, we can visualize how blocks function.</p><p><strong>Block Components</strong>:</p><ul><li><strong>Block Number</strong>: Identifies the position of the block in the chain.</li><li><strong>Nonce</strong>: A number that miners adjust to solve the cryptographic puzzle.</li><li><strong>Data</strong>: The transactions or information contained in the block.</li><li><strong>Hash</strong>: Generated from the Block Number, Nonce, and Data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*BSIx2zBIUSY-idw7b8w0Hw.png" /><figcaption>Block Structure</figcaption></figure><p><strong>Mining a Block</strong>:</p><ul><li>When data within a block is altered, the block turns red, indicating it’s unmined.</li><li>Clicking “Mine” adjusts the Nonce until a hash meeting the network’s difficulty criteria (e.g., starting with four zeros) is found, turning the block green.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*ftNB_D-_U1EAOQdqWmA27w.png" /><figcaption>Unmined Block</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*IyOU1dYs21S5fW6NXWPBHQ.png" /><figcaption>Mined Block</figcaption></figure><h3>The Blockchain Structure</h3><p><strong>Chain of Blocks</strong>:</p><ul><li>Each block contains the hash of the previous block, linking them together.</li><li>The first block is known as the <strong>Genesis Block</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*I_UN-pKrQVy1kKrO-NnG5g.png" /><figcaption>Simple Blockchain Showing Previous Hash References</figcaption></figure><p><strong>Ensuring Data Integrity</strong>:</p><ul><li>Altering the data in any block affects the hashes of all subsequent blocks, breaking the chain.</li><li>This interdependency ensures that data within the blockchain remains tamper-evident.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*FPqNIdthZW5fTUJBE4okxA.png" /><figcaption>Chain Break After Data Alteration</figcaption></figure><h3>Distributed Networks and Consensus</h3><p>In a distributed blockchain network:</p><ul><li><strong>Full Copies</strong>: Each peer (node) holds a complete copy of the blockchain.</li><li><strong>Verification</strong>: Nodes continuously verify their copies against others, ensuring consensus.</li><li><strong>Handling Alterations</strong>: If a node’s blockchain differs due to tampering, it’s rejected by the network.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*MnpHOr8VMJtYRP6dhxTYkQ.png" /><figcaption>Peers A and B</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*DMPfcwVDPBcMoKDJwZWoAg.png" /><figcaption>Peers B and C</figcaption></figure><h3>Introducing Transactions and Tokens</h3><p>Switching to the “Tokens” tool in the demo:</p><ul><li><strong>Transactions Replace Data</strong>: Blocks now contain transactions instead of arbitrary data.</li><li><strong>Maintaining Integrity</strong>: The same principles apply — altering a transaction invalidates the block and the chain beyond it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*DDHh5gDQ4QNwCHd4JjRhRw.png" /><figcaption>Transactions on Chain</figcaption></figure><h3>Understanding the Nonce</h3><ul><li><strong>Transaction Nonce</strong>: In Ethereum, each account has a transaction nonce that increments with every transaction, ensuring they are processed in the correct order and preventing replay attacks.</li><li><strong>Block Nonce</strong>: Relevant in PoW systems for mining but not used in Ethereum’s current PoS system.</li></ul><h3>Signing Transactions</h3><p>Security in blockchain transactions hinges on cryptographic principles involving public and private keys.</p><h3>Public and Private Key Pairs</h3><ul><li><strong>Private Keys</strong>:</li><li>Randomly generated and kept secret.</li><li>Used to sign transactions, providing proof of ownership.</li><li><strong>Public Keys</strong>:</li><li>Derived from private keys.</li><li>Shared openly to allow others to verify signatures.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*XTrIrZZb70rUwwp76II_FA.png" /><figcaption>Public / Private Key Pairs</figcaption></figure><h3>The Signing Process</h3><ul><li><strong>Creating a Message Signature</strong>:</li><li>The private key signs a transaction, producing a unique signature.</li><li>This signature cannot be reverse-engineered to reveal the private key.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*AMAH9YguqyhrFKkzTzd5ww.png" /><figcaption>Message Being Signed with a Private Key</figcaption></figure><h3>Verifying Signatures</h3><ul><li><strong>Using the Public Key</strong>:</li><li>Anyone can use the public key to verify the transaction’s authenticity.</li><li>Ensures the transaction hasn’t been tampered with and was authorized by the rightful owner.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*nEgxp7C9JUQ-nx7LRj6vng.png" /><figcaption>Verification of a Message Signature with a Public Key</figcaption></figure><h3>Practical Application in Transactions</h3><ul><li><strong>Integrity Check</strong>:</li><li>If any transaction details are altered — be it the amount or the recipient address — the signature verification fails.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*ykkkfPJtR2G_7jqYbrGVdw.png" /><figcaption>Genesis Transaction</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*QCwhdnr0UBAw9JCbEU230g.png" /><figcaption>Transaction Verified</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*9446OMVRD_zFONw754-ZTA.png" /><figcaption>Altered Amont</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*o-k1ecS2Vm9KMYG629h_tQ.png" /><figcaption>Altered From Address</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*9paivn-f80Op0CnhAWOkHQ.png" /><figcaption>Altered To Address</figcaption></figure><p>Managing Keys in MetaMask</p><ul><li><strong>Viewing Private Keys</strong>:</li><li>In MetaMask, navigate to Account Details &gt; Export Private Key (after entering your password) to view your private key.</li><li><strong>Hierarchy of Keys</strong>:</li><li><strong>Secret Phrase (Seed Phrase)</strong>: Generates your wallet and all associated accounts.</li><li><strong>Private Key</strong>: Derived from the secret phrase for each account.</li><li><strong>Public Key and Address</strong>: Derived from the private key.</li></ul><p><strong>Security Note</strong>: Never share your secret phrase or private keys. The secret phrase provides access to your entire wallet, while the private key grants control over a specific account.</p><h3>Diving Deeper into Gas</h3><p>Understanding the components of gas fees can help optimize your transactions.</p><h3>Components of Gas Fees</h3><ul><li><strong>Base Fee</strong>: A mandatory fee burned and removed from circulation, dynamically adjusted based on network demand.</li><li><strong>Priority Fee (Tip)</strong>: An optional fee to incentivize validators to prioritize your transaction.</li><li><strong>Max Fee</strong>: The maximum amount you’re willing to pay per unit of gas, covering both the base fee and the priority fee.</li></ul><h3>Ether Denominations</h3><ul><li><strong>Wei</strong>: The smallest unit of Ether.</li><li><strong>Gwei</strong>: Commonly used for gas prices.</li><li><strong>Conversions</strong>:</li><li>1 ETH = 1,000,000,000 Gwei</li><li>1 Gwei = 1,000,000,000 Wei</li></ul><h3>The Concept of Burning Ether</h3><ul><li><strong>Definition</strong>: Burning removes Ether from circulation, sending it to an address that nobody can access.</li><li><strong>Impact on Supply</strong>: Can make Ether deflationary if the burn rate exceeds the creation rate.</li></ul><h3>Blockchain Overview</h3><p>Understanding the broader blockchain ecosystem helps contextualize these technical details.</p><h3>Open Participation and Data Integrity</h3><ul><li><strong>Inclusivity</strong>: Blockchains are decentralized networks open to anyone.</li><li><strong>Immutable Records</strong>: Once data is recorded and the network reaches consensus, it’s nearly impossible to alter.</li></ul><h3>Consensus Mechanisms</h3><h4>Proof of Work (PoW)</h4><ul><li><strong>Sybil Resistance</strong>: Prevents a single entity from overtaking the network by requiring computational effort.</li><li><strong>Mechanism</strong>:</li><li>Miners solve complex mathematical puzzles.</li><li>The first to solve adds the next block to the chain and earns a reward.</li><li><strong>Drawbacks</strong>:</li><li>Energy-intensive, leading to environmental concerns.</li></ul><h4>Proof of Stake (PoS)</h4><ul><li><strong>Energy Efficiency</strong>: PoS significantly reduces energy consumption compared to PoW.</li><li><strong>Mechanism</strong>:</li><li>Validators stake ETH to participate in block validation.</li><li>They are selected to propose and validate blocks based on their stake and other factors.</li><li>Misbehavior can lead to slashing of their staked ETH.</li></ul><h3>Security and Attacks</h3><ul><li><strong>51% Attack</strong>:</li><li>Occurs when an entity controls over 50% of the network’s mining power or staked coins.</li><li>Allows for double-spending and transaction manipulation.</li><li><strong>Network Resilience</strong>:</li><li>Larger, more decentralized networks are less susceptible to such attacks.</li></ul><h3>Incentives for Nodes</h3><ul><li><strong>Rewards</strong>:</li><li>Nodes (or validators) receive transaction fees and block rewards.</li><li><strong>Purpose</strong>:</li><li>Incentivizes participants to maintain network integrity and security.</li></ul><h3>Layers and Scaling Solutions</h3><p>As blockchain adoption grows, scaling solutions become essential to handle increased demand.</p><h3>Layer 1 (L1) vs. Layer 2 (L2)</h3><ul><li><strong>Layer 1</strong>:</li><li>The base layer of the blockchain (e.g., Ethereum, Bitcoin).</li><li>Handles the main network and consensus mechanisms.</li><li><strong>Layer 2</strong>:</li><li>Built on top of Layer 1 to improve scalability.</li><li>Processes transactions off-chain and submits results to Layer 1.</li></ul><h3>Rollups: A Layer 2 Solution</h3><ul><li><strong>Definition</strong>:</li><li>Rollups bundle multiple transactions into a single batch processed off-chain.</li><li>The batch is then submitted to Layer 1, reducing congestion.</li><li><strong>Types of Rollups</strong>:</li><li><strong>Optimistic Rollups</strong>: Assume transactions are valid and provide a challenge period for disputes.</li><li><strong>Zero-Knowledge Rollups</strong>: Use cryptographic proofs to validate transactions without revealing details.</li></ul><h3>Addressing the Blockchain Trilemma</h3><ul><li><strong>The Trilemma</strong>:</li><li><strong>Decentralization</strong>: Ensuring the network isn’t controlled by a central entity.</li><li><strong>Security</strong>: Protecting the network against attacks.</li><li><strong>Scalability</strong>: Ability to handle a high volume of transactions.</li><li><strong>Rollups’ Role</strong>:</li><li>Aim to enhance scalability without compromising security and decentralization inherent in Layer 1.</li></ul><h3>Conclusion</h3><p>Blockchain technology is complex, but breaking it down into its core components — like gas fees, transaction signing, and consensus mechanisms — makes it more approachable. As we’ve seen, understanding how these pieces fit together not only demystifies the technology but also empowers you to navigate and utilize blockchain networks more effectively.</p><p>Whether you’re transacting on Ethereum, exploring new Layer 2 solutions, or simply curious about how decentralization works, knowledge is your most valuable asset. As the blockchain landscape continues to evolve, staying informed will ensure you remain at the forefront of this exciting technological frontier.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e80728005b18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Diving into Smart Contracts]]></title>
            <link>https://medium.com/@dustin.aad/diving-into-blockchain-week-1-483155782903?source=rss-45d2a7858705------2</link>
            <guid isPermaLink="false">https://medium.com/p/483155782903</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Dustin Hurt]]></dc:creator>
            <pubDate>Sat, 12 Oct 2024 19:11:34 GMT</pubDate>
            <atom:updated>2024-10-12T19:25:44.164Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>2024–10–06 to 2024–10–12</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8GQW1_wyJGNS-Xvd6KkkoQ.png" /></figure><h3>Introduction</h3><p>After completing my <a href="https://github.com/Dustin-AD/CGdubP">first AWS project</a>, I’ve decided to build upon those fundamentals with new skills in blockchain, specifically smart contracts.</p><p>I’m excited about the potential of this additional skillset as it will help me build products and services that are used to help decentralize traditional practices, transforming industries by promoting transparency, security, and empowering users in systems that have historically relied on centralized authorities.</p><p>My next project will leverage AWS cloud infrastructure and blockchain technology to develop a Minimal Viable Product (MVP) that streamlines how creators manage and monetize their work. The platform aims to simplify complex processes, enhance scalability, and provide tools that empower artists to achieve sustainable success.</p><h4><strong>Understanding Decentralization: The Backbone of Blockchain</strong></h4><p>At the heart of blockchain technology is decentralization. Instead of relying on a single, central authority (like a bank or a government) to oversee and manage transactions, blockchain spreads that power across a network of participants. This means that no one entity has control over the system, making it more secure, transparent, and resistant to tampering. In the context of smart contracts, decentralization ensures that agreements are carried out exactly as written, without interference or the need for a middleman. It’s about creating systems that work for the people, by the people, without any central choke points or gatekeepers.</p><h4>Accessing Learning Resources</h4><p>The first step was gaining access to the <a href="https://github.com/Cyfrin/foundry-full-course-cu">GitHub repository</a> associated with the course I’m taking via <a href="https://updraft.cyfrin.io/">Cyfrin Updraft</a>. This repository is a goldmine for asking questions and engaging in discussions that deepen understanding. I also joined the <a href="https://discord.com/invite/cyfrin">Discord community</a>, which has already proven invaluable for networking and real-time support.</p><h4>Ethereum and the Power of Smart Contracts</h4><p>Ethereum, released in 2014, is more than just a cryptocurrency — it’s a platform for creating smart contracts.</p><ul><li><strong>Smart Contracts:</strong> These are sets of instructions that automatically execute actions without needing a middleman, like a bank or lawyer, to oversee them. Imagine them as digital agreements written in computer code and stored securely on the blockchain, which is a type of digital ledger. They carry out tasks (like transferring money or verifying ownership) based on the rules set in the code, ensuring everything happens exactly as programmed, without relying on a central authority.</li></ul><h4>The Oracle Problem</h4><p>One fascinating challenge I learned about is the Oracle Problem: blockchains are like walled gardens, isolated from real-world data. They need external information to function effectively.</p><ul><li><strong>Oracles:</strong> Devices or entities that connect blockchains with off-chain data. However, to maintain decentralization, these oracles must also be decentralized.</li><li><strong>Chainlink:</strong> This is where Chainlink comes into play — a modular, decentralized oracle network that bridges external data and computation with smart contracts, creating what’s known as Hybrid Smart Contracts.</li></ul><h4>Key Concepts</h4><ul><li><strong>Smart Contract Platforms:</strong> Learning Ethereum provides a solid foundation for other blockchain platforms.</li><li><strong>Layer 2 Solutions:</strong> To address scaling issues, technologies like Optimistic Rollups and Zero-Knowledge Rollups are used.</li><li><strong>DApp:</strong> Decentralized Application, essentially a smart contract.</li><li><strong>Web 3:</strong> The permissionless web with dynamic content, where users own a part of the ecosystems they interact with.</li></ul><h4>Trust-Minimized Agreements</h4><p>Smart contracts create trust-minimized agreements, or as I like to call them, hard-coded promises.</p><ul><li><strong>Immutable:</strong> Once deployed, the contract cannot be altered.</li><li><strong>Decentralized:</strong> No central authority controls it.</li><li><strong>Transparent:</strong> Everyone can see the terms of the contract.</li></ul><h3>Exploring the Current Smart Contract Landscape</h3><h4>DeFi (Decentralized Finance)</h4><p>DeFi is revolutionizing traditional finance by removing intermediaries from financial transactions.</p><h4>DAOs (Decentralized Autonomous Organizations)</h4><ul><li><strong>Definition:</strong> Groups governed by a set of instructions or smart contracts on-chain.</li><li><strong>Function:</strong> They operate autonomously and are transparent.</li></ul><h4>NFTs (Non-Fungible Tokens)</h4><ul><li><strong>Explanation:</strong> Unique digital assets representing ownership of items like art, music, and more.</li><li><strong>Significance:</strong> They cannot be exchanged on a like-for-like basis, adding uniqueness to digital assets.</li></ul><h3>Setting Up Your Wallet and Making Your First Transaction</h3><h4>Creating a Metamask Wallet</h4><p>I set up a practice wallet using Metamask, a popular browser extension that serves as a cryptocurrency wallet.</p><ul><li><strong>Security Tip:</strong> Always safeguard your recovery phrase; it’s crucial for accessing your wallet if you lose your password.</li></ul><h4>Switching to a Test Network</h4><p>To practice without risking real money, I switched to the Sepolia test network.</p><ul><li><strong>Test Nets:</strong> These are networks where you can test transactions freely. They’re maintained by volunteers out of the goodness of their hearts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZIzJXNd0kNkmTKfz_cI13w.png" /><figcaption>Sepolia Test Network</figcaption></figure><h4>Using Etherscan</h4><ul><li><strong>Sepolia Etherscan:</strong> A tool to view wallet activity and transaction details by pasting your wallet address.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HE4UvZ0zlgdWFFE9MZdsZg.png" /><figcaption>Etherscan Search Bar on Home Screen</figcaption></figure><h3>Obtaining Test ETH</h3><h4><strong>Faucets and Drip: Getting Started with Test Tokens</strong></h4><p>When you’re working on blockchain projects, especially in the early stages, you don’t want to risk using real money. That’s where faucets come in. A faucet is a tool that gives you free test tokens — think of it like a digital drip that slowly “pours” tokens into your wallet.</p><p>These tokens, often used on test networks like Sepolia, let you practice making transactions and interacting with smart contracts without spending actual currency. It’s a safe, no-risk way to get hands-on experience and test your blockchain setups in real-time. You’re essentially being “dripped” the resources you need to build, test, and iterate.</p><h4>Attempting to Use Chainlink Faucet</h4><p>I tried to use the <a href="https://faucets.chain.link/">Chainlink faucet</a> to obtain free SepoliaETH but encountered a rate limit error, prompting me to wait 11 hours.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FGrPoJJe0LL0sIoO7vwznQ.png" /><figcaption>Chainlink Faucet Error Message</figcaption></figure><h4>Alternative Solution: Google Cloud Faucet</h4><p>Not one to be easily deterred, I switched to the <a href="https://cloud.google.com/application/web3/faucet/ethereum/sepolia">Google Cloud faucet</a> and successfully sent myself test tokens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XdDZOH4fgE-2lRnp_knvsA.png" /><figcaption>Successful Transaction via Google Cloud Faucet</figcaption></figure><h3>Reviewing Transactions</h3><p>By clicking the transaction hash, I was directed to Etherscan, where all the details of my transaction were documented.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xHGmldoGvRxFLgayulQH4w.png" /><figcaption>Transcation Details on Etherscan</figcaption></figure><p>My Metamask wallet now reflected the updated balance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xrq2iCV4UJizYPku1H7WvQ.png" /><figcaption>Updated Metamask Wallet Balance</figcaption></figure><p><strong>Key Learnings:</strong></p><ul><li>Assets are network-specific. The ETH in Sepolia doesn’t exist on other networks.</li><li>It’s essential to explore different tools and resources when you encounter obstacles.</li></ul><h3>Additional Key Points</h3><h4>Role of Gas in Blockchain Transactions</h4><ul><li><strong>Purpose:</strong> Gas compensates miners or validators for processing and verifying transactions.</li><li><strong>Function:</strong> Users pay gas to ensure their transactions are included in the next block.</li></ul><h4>Significance of Gas Price</h4><ul><li><strong>Definition:</strong> It sets the cost per unit of gas for a transaction.</li><li><strong>Impact:</strong> Higher gas prices can prioritize your transaction but at a higher cost.</li></ul><h4>Security of Private Keys</h4><ul><li><strong>Risk:</strong> If your private key is compromised, the attacker gains full control over your wallet and assets.</li><li><strong>Advice:</strong> Protect your private keys diligently.</li></ul><h3>Author’s Note</h3><p>By integrating my expertise in blockchain, security, and AWS, I’m equipped to create secure, scalable, and innovative solutions that empower both users and businesses. This synergy enables me to develop decentralized applications that not only streamline operations but also enhance transparency and trust in industries that have long depended on centralized control. My vision is to harness the power of cloud infrastructure, security best practices, and blockchain technology to build user-driven ecosystems that promote autonomy, collaboration, and fairness. Ultimately, I strive to contribute to a future where individuals have full control over their data and transactions, fostering a more decentralized and equitable digital landscape.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=483155782903" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EQ in the Cloud]]></title>
            <link>https://medium.com/@dustin.aad/eq-in-the-cloud-8fdeef0428b5?source=rss-45d2a7858705------2</link>
            <guid isPermaLink="false">https://medium.com/p/8fdeef0428b5</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[emotional-intelligence]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Dustin Hurt]]></dc:creator>
            <pubDate>Wed, 31 Jul 2024 01:06:50 GMT</pubDate>
            <atom:updated>2024-07-31T01:17:51.120Z</atom:updated>
            <content:encoded><![CDATA[<h4>Bridging Technology and Humanity through Version Control and Infrastructure</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3n4HgjmkjKepD8_yCUg8Rw.png" /></figure><h4>Introduction</h4><p>In the rapidly evolving landscape of software development and cloud computing, version control systems (VCS) are indispensable tools. They not only help developers track changes to code but also facilitate collaboration across teams. However, the technical aspects of these systems are only part of the story. As an advocate for emotional intelligence (EQ), I believe that the human element plays a crucial role in the success of any technical project. In this comprehensive guide, we’ll explore the intersection of version control, cloud infrastructure, and emotional intelligence, highlighting how these components work together to create a seamless and productive environment.</p><h4>Understanding Version Control Systems (VCS)</h4><p><strong>Key Components of a VCS</strong></p><p>Version control systems are designed to manage changes to code over time, providing a historical record of who made changes, when, and why. This is essential for debugging and understanding the evolution of a project. A VCS allows multiple people to collaborate on a project simultaneously without overwriting each other’s work. There are three key components to a VCS:</p><ul><li><strong>Repository:</strong> A database storing the full history of project files and revisions. This is where code for infrastructure, pipelines, and AWS is stored.</li><li><strong>Commit:</strong> A snapshot of files at a particular point in time, along with messages that detail the changes.</li><li><strong>Branch:</strong> A parallel version of the repository, created to develop features, fix bugs, and experiment with new ideas.</li></ul><p><strong>Types of Version Control Systems</strong></p><p>There are three main types of VCS:</p><ul><li><strong>Local Version Control System (LVCS):</strong> The simplest form, where all version control tasks are performed on a single machine. An example is storing file copies in different directories.</li><li><strong>Centralized Version Control System (CVCS):</strong> A single server repository that contains all version files. Clients check out files from this central place, making collaboration easier.</li><li><strong>Distributed Version Control System (DVCS):</strong> The most popular type, allowing each user to have a server repository on their local machine instead of just a working copy of the files. There is no central repository, and various working copies can act as a central repository. Git is the most well-known example.</li></ul><p><strong>Best Practices in Version Control</strong></p><p>To ensure smooth collaboration and project management, it’s crucial to follow best practices in version control:</p><ul><li><strong>Writing Clear and Descriptive Commit Messages:</strong> Explain what has changed and why. This helps others understand the context of changes.</li><li><strong>Committing Frequently:</strong> Committing code as often as possible avoids large, complicated changes all at once.</li><li><strong>Using Branches Effectively:</strong> Branches are essential for feature development, bug fixes, and experimentation without affecting the main codebase.</li></ul><p><strong>Reflection on VCS</strong></p><p>Version control is absolutely essential in modern software development. With the exponential pace of ideation, creation, and iteration in today’s technical landscape, version control is indispensable for keeping track of changes in code throughout the Software Development Lifecycle (SDLC). It allows developers to track who changed the code, when it was changed, and why, which is critical for debugging, understanding project evolution, and ensuring smooth collaboration. Additionally, version control supports continuous integration and continuous development (CI/CD) practices, which are fundamental to cloud computing.</p><p>A specific scenario in cloud computing where not using version control could lead to significant problems is during the modification of code responsible for auto-scaling a cloud environment in a global corporation. If a fault in the code causes an outage, and there is no record of who changed the code, when it was changed, or why, developers and engineers could be left scrambling to find prompt solutions. This lack of traceability could result in prolonged downtime, causing the corporation significant financial losses and damage to its reputation. This scenario underscores the crucial role of version control in preventing and mitigating such risks by providing a comprehensive history of code changes and facilitating quick rollbacks to stable versions.</p><h4>Emotional Intelligence in Version Control</h4><p><strong>Clarity of Commit Messages and Team Morale</strong></p><p>The clarity of communication in commit messages significantly affects team morale and collaboration. When there is a fault in the code that causes an outage, it is essential that developers can effectively and efficiently check the commit messages to understand who committed the change, when, and why. If the commit message doesn’t state this clearly, it can cause prolonged downtime while developers search for the issue. This lack of clarity and understanding can lead to stress and frustration, causing team members to pass blame and build resentment. A team that has a constant bubbling of internal conflict tends not to be as innovative and productive, ultimately leading to a degradation of project quality. To help ensure that the development team is able to maintain high morale and collaborate effectively, it is crucial that commit messages clearly state who changed the code, when, and why.</p><p><strong>Resolving Conflicts with EQ</strong></p><p>Being able to effectively utilize commands like git log, git diff, git revert, and git reset is essential for resolving conflicts within a development team as they facilitate a seamless workflow, ensure code integrity, and foster effective collaboration. Git log is used to view the commit history, allowing developers to trace the origin of changes and understand the sequence of contributions. Git diff is important for comparing changes between commits, branches, or the working directory. It highlights the exact differences in code, enabling developers to pinpoint conflicting lines and understand the nature of the conflict. Git revert allows developers to undo changes safely by creating a new commit that reverses previous changes. It allows rolling back problematic commits without losing the project&#39;s history. Git reset provides more powerful ways to undo changes by moving the HEAD to a specific commit. It’s useful for situations where a developer needs to discard local changes or reset the state of the repository.</p><p>Having a solid grasp of these skills not only resolves conflicts in code but also enhances team dynamics by reducing misunderstandings and ensuring everyone is on the same page. For example, when there is a conflict in code, git log will allow developers to track and recognize any faults quickly and then use git revert to undo the changes while maintaining the conflict in the git log for future reference. Having the ability to use these skills promotes an environment where developers can work without the fear of making permanent mistakes, helping them trust themselves and others, which leads to greater innovation, productivity, and higher-quality projects.</p><h4>Practical Applications and Real-world Scenarios</h4><p><strong>Using Version Control for Infrastructure as Code (IaC)</strong></p><p>Infrastructure as Code (IaC) refers to the process of managing and provisioning computing infrastructure through machine-readable definition files, rather than through physical hardware configuration or interactive configuration tools. Tools like Terraform and AWS CloudFormation allow developers to define infrastructure configurations in code, which can then be versioned, tested, and deployed just like application code. IaC automates the deployment and management of infrastructure, reducing the risk of human error and increasing efficiency.</p><p>By storing the infrastructure configuration in version control systems like Git, teams can track changes, roll back to previous states, and collaborate more effectively. IaC ensures the environments can be consistently recreated, which is crucial for testing, development, and production environments. It also makes it easier to scale infrastructure up or down by modifying the code, allowing for dynamic scaling based on demand. With IaC, teams can work together on infrastructure configurations, just as they would with application code, improving collaboration and knowledge sharing.</p><p>I would use version control to manage my IaC by committing to best practices such as writing clear commit messages, committing code frequently, and using branches effectively. For instance, while working on a project with other cloud engineers in the Cloud Engineer Academy, I might find that a team member committed code to enhance an automatic provisioning feature. By checking the Git records for who committed the code, when, and why, I can learn from their work and ask any questions I may have. Using version control in this way ensures the project remains organized and manageable, ultimately supporting the team’s success.</p><p><strong>GitHub and Collaborative Development</strong></p><p>GitHub is a web-based platform that uses DVCS for developers and engineers to collaborate on projects. It’s the largest platform for hosting both open-source and private software projects. I remember several months back, I kept hearing about GitHub and how important it was for building a tech portfolio, but when I went to check it out, I was like, “What in the heck is all this?” and left immediately. Now, I have a pretty solid understanding of what it is, what it’s used for, and how to use it. Hooray for growth, yeah?</p><p>GitHub facilitates collaboration among developers from diverse backgrounds by providing a centralized platform for sharing code, tracking changes, and managing projects. Effective collaboration on GitHub can enhance EQ within a team by fostering open communication, empathy, and mutual respect. Developers can review each other’s code, provide constructive feedback, and learn from one another, creating a supportive and inclusive environment. This collaborative approach not only improves the quality of the code but also strengthens team dynamics and promotes a culture of continuous learning and improvement.</p><p>GitHub hosts a vast array of open-source projects that anyone can contribute to, creating an open and collaborative environment that can drive social and technological innovation. For example, many significant contributions to global challenges have been enabled by GitHub, such as community-driven initiatives to develop COVID-19 tracking apps, tools for disaster response, and projects aimed at improving accessibility for people with disabilities. By enabling collaboration on a global scale, GitHub empowers developers to work together on projects that have a meaningful impact on society.</p><h4>Cloud Infrastructure Components and Management</h4><p><strong>Main Components of Cloud Infrastructure</strong></p><p>Cloud infrastructure consists of four main components:</p><ul><li><strong>Frontend:</strong> User interfaces and applications that interact with the backend.</li><li><strong>Backend:</strong> Servers, data storage, and algorithms that process and manage data.</li><li><strong>Cloud:</strong> Cloud services that provide scalable and on-demand resources.</li><li><strong>Network:</strong> Internet connections that ensure communication between different components.</li></ul><p>Each component plays a critical role in ensuring a well-functioning cloud infrastructure. The most challenging component to manage is often the backend because it involves maintaining servers, databases, and complex algorithms that need to be scalable, reliable, and secure.</p><p><strong>Applying Emotional Intelligence to Cloud Infrastructure Management</strong></p><p>Emotional intelligence can be applied to managing a cloud infrastructure project by fostering empathy, self-awareness, and social skills within the team. For example, empathy can play a significant role in designing user-friendly frontend applications. By understanding the needs and preferences of end-users, developers can create interfaces that are intuitive and accessible. Effective communication and collaboration within the team ensure that all components of the infrastructure work seamlessly together, leading to a more cohesive and efficient project.</p><p><strong>Best Practices in Cloud Infrastructure</strong></p><p>Scalability, security, reliability, performance, and cost are critical factors in cloud infrastructure management. Balancing these factors is essential for a successful cloud project. For instance, high availability and fault tolerance are crucial practices that ensure business continuity and reliability. High availability involves setting up redundant systems that can take over in case of a failure, while fault tolerance aims to prevent downtime by distributing resources geographically.</p><p>A real-world example of the importance of these practices is the use of high availability clusters and load balancers in a global e-commerce platform. By implementing these practices, the platform can handle high traffic volumes, ensure minimal downtime, and provide a seamless user experience, thereby maintaining its reputation and customer trust.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gFZjMG81cfJs6ABpXx2b_g.png" /></figure><h4>The Role of the Affective Filter</h4><p><strong>Understanding the Affective Filter</strong></p><p>The affective filter is a concept I borrowed from language learning, referring to the emotional barrier that can impede learning and performance. In the context of cloud computing and version control, the affective filter represents the anxiety, frustration, and stress that can hinder one’s ability to learn and apply new technical skills. High levels of stress can block effective learning, while a positive, low-stress environment can enhance it.</p><p><strong>Managing the Affective Filter in Technical Learning</strong></p><p>Reflecting on my own experiences, managing the affective filter has been crucial in my journey through cloud computing. For example, while setting up SSH keys for GitHub, I encountered several challenges that initially caused frustration. However, by reminding myself that the solution existed and maintaining a calm approach, I was able to reduce my stress levels and successfully overcome the hurdles. This positive mindset not only helped me resolve the technical issues but also boosted my confidence and competence.</p><p><strong>Strategies for Reducing the Affective Filter</strong></p><ul><li><strong>Positive Reinforcement:</strong> Celebrating small victories and progress helps build confidence and reduce anxiety.</li><li><strong>Supportive Learning Environment:</strong> Collaborating with peers and mentors who provide constructive feedback and encouragement can significantly lower stress.</li><li><strong>Mindfulness and Stress Management:</strong> Practices such as mindfulness, regular breaks, and healthy work habits can help manage stress levels.</li><li><strong>Clear Goals and Incremental Steps:</strong> Breaking down complex tasks into smaller, manageable steps can make learning more approachable and less overwhelming.</li></ul><p>By keeping the affective filter low, I’ve been able to learn more effectively, stay motivated, and tackle more complex challenges in cloud computing.</p><h4>Reflecting on Your Learning Journey</h4><p><strong>Hands-on Experience with AWS CLI and IAM User Management</strong></p><p>Setting up the AWS CLI and managing IAM users are essential tasks for any cloud engineer. These tasks not only enhance technical skills but also build confidence in using cloud tools and managing cloud resources. For instance, creating a new IAM user and attaching policies using the AWS CLI helps ensure proper access management and security in an AWS environment.</p><p><strong>Managing Challenges with Emotional Intelligence</strong></p><p>Throughout my journey in learning cloud computing, I have encountered various challenges, such as setting up SSH keys for GitHub and configuring the AWS CLI. These experiences have taught me the importance of managing stress and maintaining a positive mindset. Emotional intelligence plays a crucial role in overcoming technical challenges. By staying calm, seeking help when needed, and learning from mistakes, I have been able to build resilience and grow as a cloud engineer.</p><p><strong>Applying the Affective Filter Concept</strong></p><p>Understanding and managing the affective filter has been transformative in my learning process. By fostering a positive and low-stress learning environment, I have been able to enhance my technical skills, stay motivated, and build confidence. This approach can be applied to any technical learning journey, helping others overcome challenges and achieve their goals.</p><h4>Conclusion</h4><p>Version control systems and cloud infrastructure are fundamental components of modern software development. Integrating emotional intelligence with technical skills is essential for creating a productive and harmonious work environment. By emphasizing the human element, fostering empathy, and promoting effective communication, we can enhance collaboration and drive innovation in cloud computing. As we continue to explore the intersection of technology and emotional intelligence, let’s remember to consider the human element in all our technical endeavors. And by managing the affective filter, we can ensure that our learning and growth in the technical field are as seamless and effective as possible.</p><p><strong>Hey! Also… Let’s connect: </strong><a href="https://www.linkedin.com/in/dustinhurt/">https://www.linkedin.com/in/dustinhurt/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8fdeef0428b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deployment Models and the SDLC]]></title>
            <link>https://medium.com/@dustin.aad/deployment-models-and-the-sdlc-a3ed87abfdd3?source=rss-45d2a7858705------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3ed87abfdd3</guid>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Dustin Hurt]]></dc:creator>
            <pubDate>Wed, 24 Jul 2024 00:08:39 GMT</pubDate>
            <atom:updated>2024-07-24T00:08:39.174Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uDOHKKF3pTSqMuEgE0stTQ.png" /></figure><h3>Into the Fray</h3><p>As technological progress marches triumphantly through our post-modern era, the battle to eliminate costly and cumbersome on-premise infrastructure wages on. With cloud services arrayed in their formidable formations — Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS) — let’s push forward into the fray. Each method of cloud deployment stands as a strategic maneuver in the quest for efficiency, security, and scalability.</p><h3>Cloud Deployment Models</h3><p>Cloud deployment models define the type of access customers have to the cloud environment based on ownership. These models are crucial in determining how data is managed, level of control over resources, cost implications, and scalability. In this post we’ll be discussing three different deployment models: public cloud, private cloud, and hybrid cloud.</p><h3>Public Cloud</h3><p>With the public cloud, services are provided over the internet and available to anyone who wants to purchase them. Ownership and management of the infrastructure belongs to the cloud service provider (CSP) and customers share the pooled resources within the infrastructure.</p><p>The benefits of this cloud model are cost-effectiveness, no maintenance for customers, scalability, and reliability. However, because the cloud services are available to anyone on the internet, public clouds are generally considered less secure. Also, customers have less control over the management and governance of their cloud environment.</p><h3>Private Cloud</h3><p>Whether the private cloud is hosted within an organization’s own data center or externally by a third-party provider, the cloud environment is only used by a single organization. This model allows the organization to more easily control their data, customize the infrastructure to meet their unique regulatory requirements, and maintain higher levels of security. While the private cloud does offer these advantages, it loses out on cost-effectiveness and scalability due to significant investment in hardware and infrastructure management.</p><p>An example of a organizations that might choose a private cloud over a public cloud are healthcare providers. Due to their sensitive patient data and their strict regulations like HIPAA, giving up cost-effectiveness and scalability is worth the data control, customization, and higher security.</p><h3>Hybrid Cloud</h3><p>Just like in Adam Wingard’s “Godzilla x Kong,” the hybrid cloud offers the best of both worlds. It allows an organization to use public cloud for some services that need to be scalable, reliable, and cost-effective while using the private cloud for services that require customization and high security. With this combined approach, an organization can move data between public and private cloud environments seamlessly, maximizing their advantages.</p><p>An example of an organization that uses the hybrid cloud is Adobe. They use private clouds for storing sensitive data like customer payment information and intellectual property while using the public cloud to deliver its Creative Cloud services to millions of users.</p><h3>Marching On</h3><p>While we’ve made strides in our battle, the war doesn’t end with deployment. Now that our cloud resources are in place, we need a disciplined approach to building and delivering software projects that maximize their potential. Enter the Software Delivery Lifecycle (SDLC), a methodology that ensures our software evolves from mere concepts to fully operational tools, effectively and efficiently.</p><h3>Software Delivery Lifecycle (SDLC)</h3><p>While the cloud deployment models are methods for delivering cloud services, the SDLC is a methodology for building and delivering software projects.</p><p>According to <a href="https://www.youtube.com/@techwithsoleyman">Soleyman Shahir</a>, “Any software idea, project, or feature needs to go through a development process where it is conceptualized, designed, developed, tested, and launched.” Then even after launch, that software must be updated and maintained. This methodology helps to develop software and get it to customers at the shortest time and at the lowest cost possible.</p><h3>SDLC Stages and the Cloud Engineer’s Role</h3><p>The SDLC Stages are as follows:<br>1) Planning<br>2) Requirement Analysis<br>3) Design<br>4) Implementation/Development<br>5) Testing<br>6) Deployment<br>7) Maintenance<br>Let’s take some time to explore each stage in greater detail and the cloud engineer’s role in it.</p><p><strong>Planning</strong><br>This first stage is where developers define the scope, objectives, and high-level plan for the project. The action steps for implementation inlcude identifying stakeholders, gathering initial requirements, performing feasibility analysis, and creating the plan itself.</p><p>Cloud engineers play a pivotal role in the planning stage in a few different ways:</p><ul><li>Assessment of Cloud Resources:<em> </em>Evaluating how cloud services can best support the project’s requirements.</li><li>Cost Estimation: Estimating the cost of using cloud resources, including computing power, storage, and data transfer.</li><li>Infrastructure Planning: Confirming that the cloud infrastructure meets scalability, performance, and security needs.</li></ul><p><strong>Requirement Analysis</strong><br>The second stage is when developers get a detailed understanding of user needs and requirements. The action steps for implementation include gathering and documenting functional and non-functional requirements (functional requirements might include specific features the software must have, while non-functional requirements could involve performance standards or security protocols), creating use cases, and developing a requirement specification document.</p><p>The duties of cloud engineers at this stage are:</p><ul><li>Technical Requirement Analysis: Translating business requirements into technical specifications for cloud infrastructure.</li><li>Service Selection: Identifying and selecting the appropriate cloud services that meet the functional and non-functional requirements.</li><li>Security Compliance: Ensure that the chosen cloud solutions comply with relevant security standards and regulations.</li></ul><p><strong>Design</strong><br>The design stage is when developers define how the software will be build. The action steps for implementation include creating system architecture, designing database schemas, designing user interfaces, and preparing detailed design documentation.</p><p>Cloud engineers contribute at this stage by:</p><ul><li>Cloud Architecture Design: Designing the cloud architecture, including network topology, data storage solutions, and compute resources.</li><li>Scalability and Performance: Ensuring the architecture is scalable, performant, and resilient through load balancing, auto-scaling, and failover mechanisms.</li><li>Security Design: Designing security measures, including encryption, access controls, and network security.</li></ul><p><strong>Implementation/Development</strong><br>The implementation and development stage is for building the software according to design specifications. Action steps include code development, integration of different modules, and version control.</p><p>For the cloud engineer, their duties at this stage are:</p><ul><li>Environment Setup: Setting up and configuring cloud environments for development and testing.</li><li>Continuous Integration/Continuous Deployment (CI/CD): Implementing CI/CD pipelines to automate the build, test, and deployment process.</li><li>Resource Management: Ensuring consistent and efficient use of cloud resources across different stages of development.</li></ul><p><strong>Testing</strong><br>Testing, testing… is this thing working? At this stage, developers ensure the software is free of defects and meets requirements. Action steps include conducting various tests (unit, integration, system, user acceptance), identifying and fixing bugs, and ensuring quality assurance.</p><p>In the testing stage cloud engineers are responsible for:</p><ul><li>Testing Environment: Preparing and maintaining cloud environments for testing while ensuring they replicate the production environment as closely as possible.</li><li>Performance Testing: Conducting performance and load testing using cloud-based tools to ensure the system can handle expected traffic.</li><li>Security Testing: Performing security testing to identify and mitigate vulnerabilities.</li></ul><p><strong>Deployment</strong><br>The deployment stage is when the developers finally send their labor of love (or hate) out into the world. The action steps for implementation include deploying the software, configuring the production environment, and ensuring the system is operational.</p><p>Here is when the cloud engineers take care of:</p><ul><li>Deployment Management: Managing and monitoring the deployment process.</li><li>Scalability and Resource Management: Ensuring the deployment aligns with scalability requirements and efficiently utilizes cloud resources.</li><li>Monitoring and Logging: Implementing monitoring and logging to track the performance and health of the deployed application.</li></ul><p><strong>Maintenance</strong><br>Last, but most certainly not least, the maintenance stage is when developers ensure the software continues to function well and meet user needs. Action steps include monitoring performance, fixing issues, and making improvements.</p><p>Cloud engineers play their part in this final, yet continuous, act by:</p><ul><li>Performance Monitoring: Continuously monitoring the performance and availability of the application.</li><li>Resource Management: Managing cloud resources to optimize cost and performance.</li><li>Security Updates: Regularly applying security patches and updates to keep the system secure.</li></ul><h3>The Battle is Over, But the War — naah.</h3><p>The word deployment is what made me really lean into this whole “war” theme but, truly, I’m much more of a peace, love, and advocate for emotional intelligence kind of guy.</p><p>In upcoming posts, I’ll be leaning more into how the human element plays into the technical aspects I’m learning. After all, this technology is meant to be made by humans, for humans.</p><p>Until then, the journey continues, and my quest for cloud mastery is inevitable… but far from over. I look forward to sharing even more of my insights from the Cloud Engineer Academy with you, I hope you continue to tag along!</p><p><strong>By the way…</strong><br>Have you connected with me on LinkedIn yet? If not, you’d make my day if you did: <a href="https://www.linkedin.com/in/dustinhurt/](https://www.linkedin.com/in/dustinhurt/)">https://www.linkedin.com/in/dustinhurt/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3ed87abfdd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Cloud Journey: Installment 1]]></title>
            <link>https://medium.com/@dustin.aad/dustins-cloud-journey-installment-1-2a279de1f1d5?source=rss-45d2a7858705------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a279de1f1d5</guid>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Dustin Hurt]]></dc:creator>
            <pubDate>Sun, 21 Jul 2024 01:56:02 GMT</pubDate>
            <atom:updated>2024-07-21T11:22:43.038Z</atom:updated>
            <content:encoded><![CDATA[<h4>The Basics and the Benefits</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aqVOjh1PSRhrYo0HJ_1kBQ.png" /></figure><h3>Hello, and Welcome</h3><p>Welcome, me. I’m Dustin. Myself says hello.</p><p>Insincere apologies. Wonka reference. I’ve been studying all day and I don’t have it in me to be serious right now. Brain’s fried. I saved the introduction for last and with all the technical stuff in the meat and potatoes of this post I wanted to have a little fun. So, anyway, I say welcome to myself because I’m new to the world of cloud computing.</p><p>Recently — actually, about three days ago, as I’m writing now — I joined the <a href="https://www.cloudengineeracademy.io/">Cloud Engineer Academy</a> brought forth by <a href="https://www.linkedin.com/in/soleyman-shahir-702a24b8/">Soleyman Shahir</a>.</p><p>I know how important documentation is in the cloud industry, and I love writing, so I’m going to be sharing my journey via this blog as I learn and grow and unfold into ever greater cloud computing mastery.</p><p>If the intro hasn’t scared you off, welcome to you! Now, let’s get into it.</p><h3>So… what exactly is “the cloud”?</h3><p>Cloud computing can most easily be defined as the delivery of computing services over the internet. These services include servers, storage, databases, networking, software, analytics, and artificial intelligence. While traditional IT infrastructure relies heavily on hardware to deliver these services, cloud infrastructure pools these resources and delivers these services virtually. Let’s look at some real world examples for each:</p><ul><li>Servers: Netflix uses cloud servers to provide a massive amount of processing power for its globally transmitted streaming traffic. Using servers within the cloud allows Netflix to scale their resources based on demand.</li><li>Storage: Dropbox allows millions of users to share and access their files over the internet regardless of device or location. This cloud storage service also provides data redundancy and backup through decentralization.</li><li>Databases: Airbnb uses cloud databases to collect, store, manage, analyze, and distribute its data across its platform. This data includes everything from user profiles to home listings, making cloud databases absolutely essential to their business model.</li><li>Networking: Slack is a tool used for real-time collaboration across the internet. Cloud networking services ensures that collaborative data is effectively and efficiently transmitted between users worldwide.</li><li>Software: Salesforce provides a cloud-based Customer Relationship Manager (CRM) software that allows businesses to manage their customer data from anywhere with internet connection.</li><li>Analytics: Spotify uses cloud analytics services to track and analyze consumer listening habits so that they can personalize music recommendations.</li><li>Artificial Intelligence: Amazon uses AI/ML services on the cloud to provide voice recognition and natural language processing capabilities via their Amazon Alexa devices. This allows Alexa to be more effective as it collects more data with time and use.</li></ul><p>Each of these examples provides great insight into what the cloud is and how we utilize it in our day-to-day lives.</p><h3>Three Cloud Computing Models:</h3><p>Cloud Computing is made up of three primary models: Infrastructure as a Service (Iaas), Platform as a Service (PaaS), and Software as a Service (SaaS).</p><p><strong>IaaS</strong><br>IaaS is made up of the foundational components of computing: servers, storage space, and networks. In this model, the cloud service provider (CSP) handles the hardware needed for these components while the customer can focus on more strategic operations.</p><p>IaaS also allows business to take advantage of the CSP’s scalability and flexibility services. These services scale resource usage up and down automatically based on demand, which ultimately contributes to higher performance and lower costs.</p><p>With on-premise infrastructure, the business has to account for initial investment, maintenance staff, and the possibility of over- or under-provisioning, which can lead to inconsistent performance and higher costs.</p><p>Examples of IaaS include Amazon EC2, Microsoft Azure, and Google Compute Engine.</p><p><strong>PaaS</strong><br>PaaS provides a platform for developers to build, test, and deploy features and applications. While developers focus on these strategic projects, CSPs handle everything from scaling, to maintenance and patching.</p><p>Another advantage that developers gain from PaaS is enhanced development speed. This is due to the instant creation of development and testing environments that reduce setup time compare to traditional IT methods. It also streamlines workflows, offers one-click deployment to production, provides immediate feedback on code changes and much more.</p><p>An example of PaaS is AWS Elastic Beanstalk, a fully managed service that simplifies the deployment and scaling of web applications and services.</p><p><strong>SaaS</strong><br>SaaS is a model that delivers software applications over the internet on a subscription basis. This allows businesses like Netflix and Hulu to pay for software, in their case multimedia content, on a subscription basis rather than purchasing licensing rights. Ultimately, this allows them to update their content on a more regular basis rather than being stuck with static catalogues.</p><h3>History and Evolution of Cloud Computing</h3><p>The concept of “time-sharing”, which is the sharing of processing power on a single mainframe computer amongst several users, goes back to the 1960s and laid the foundation for what cloud computing is today.</p><p>In the 1990s, telecommunication companies began offering virtual private networks and by the 2000s the term “cloud computing” was coined and popularized.</p><p>Amazon Web Services (AWS) was the first cloud service provider launched in 2006. They started off with storage through AWS S3 and virtual servers through AWS EC2.</p><p>Today, serverless architecture, AI/ML, Internet of Things (IoT), and edge computings are pushing the boundaries of cloud computing as we know it.</p><h3>Cloud Computing Benefits</h3><p>Cloud computing offers major benefits through four major characteristics: on-demand self-service, resource pooling, rapid elasticity and scalability, and measured service.</p><p><strong>On-Demand Self-Service</strong><br>On-demand self-service allows businesses to rapidly provision resources and overcomes the challenges of traditional on-premise infrastructure that requires costly and time-consuming manual processes to provision new resources. This reduces the time to market for new features and applications, which allows the company to evolve quickly with market needs.</p><p><strong>Resource Pooling</strong><br>Resource pooling is a term used in cloud computing to describe when resources like storage, processing, memory, and network bandwidth are aggregated and assigned to multiple customers based on demand. This gives businesses the benefits of efficient resource utilization, cost savings, scalability and flexibility, improved performance, and simplified management.</p><p><strong>Rapid Elasticity and Scalability</strong><br>Rapid elasticity is the ability of a cloud service to expand or contract resources efficiently and automatically based on demand. Scalability is the system’s ability to handle increased loads by adding resources as needed. This allows for business to handle fluctuating demand, maintain performance, stay cost efficient, remain reliable and available, and hold a competitive edge.</p><p>Some examples of services for implementation are Auto Scaling, Elastic Load Balancing, AWS Lambda, and Amazon RDS/Aurora.</p><p><strong>Measured Service</strong><br>The measured service model in cloud computing is the ability to monitor, control, and optimize the exact amount of resources used. These resources include storage space, processing power, internet bandwidth, and active user accounts. Cloud customers are then billed based on their actual usage rather than the potential over-provisioning sometimes faced with traditional on-premises infrastructure.</p><p>Some of the benefits the measured service model offers businesses are pay-as-you-go pricing, cost visibility and transparency, scalability without financial risk, and budgeting/forecasting.</p><p>Some examples of services for implementation are AWS Cost Explorer, AWS Budgets, AWS Trusted Advisor, AWS Auto Scaling, and AWS Lambda.</p><h3><strong>Conclusion</strong></h3><p>In working through the first two lessons of the Cloud Engineering Academy, my eyes have been opened wide to the use-cases and benefits of cloud computing. In today’s fast-paced world, it’s clearly an ideal infrastructure for businesses spanning from global corporations all the way down to mom-and-pop shops.</p><p>People, policies, and technology are constantly changing and evolving, making a business model based on traditional on-premise IT hardware cumbersome and costly. The cloud, and all of its amazing benefits, takes away this burden and allows businesses to focus on what’s most important to them and their customers.</p><h4>Psst…</h4><p>Let’s connect on LinkedIn: <a href="https://www.linkedin.com/in/dustinhurt/">https://www.linkedin.com/in/dustinhurt/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a279de1f1d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>