<?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"><channel><title><![CDATA[30days-compass-challenge]]></title><description><![CDATA[30days-compass-challenge]]></description><link>https://30dayscompass.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 10 Nov 2026 12:09:45 GMT</lastBuildDate><atom:link href="https://30dayscompass.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Day 9 of 30 Days of Solidity: Building a Smart Calculator]]></title><description><![CDATA[Learn how to build a smart calculator in Solidity with contract-to-contract interaction and address casting in Day 9 of]]></description><link>https://30dayscompass.hashnode.dev/day-9-of-30-days-of-solidity-building-a-smart-calculator</link><guid isPermaLink="true">https://30dayscompass.hashnode.dev/day-9-of-30-days-of-solidity-building-a-smart-calculator</guid><category><![CDATA[Solidity]]></category><category><![CDATA[challenge]]></category><dc:creator><![CDATA[Joy Ogbonna]]></dc:creator><pubDate>Thu, 09 Oct 2025 20:29:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1760041571320/3126a111-0985-4384-ad80-ba2cb83c9215.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Day 9 of the #30DaysOfSolidity challenge introduces contract-to-contract interaction — a crucial concept in Solidity. Today, we built <strong>SmartCalculator.sol</strong>, a contract that calls functions from another contract to perform calculations.</p>
<h2 id="heading-concepts-youll-master">Concepts You’ll Master</h2>
<ul>
<li><p>Calling functions of another contract</p>
</li>
<li><p>Address casting (<code>address(contract).functionName</code>)</p>
</li>
<li><p>Using <code>import</code> statements to organize code</p>
</li>
</ul>
<h2 id="heading-example-application">Example Application</h2>
<p>Imagine having one contract ask another to do some math for you — that’s exactly what we’re doing here. By calling another contract, we can:</p>
<ul>
<li><p>Reuse code</p>
</li>
<li><p>Keep contracts modular</p>
</li>
<li><p>Interact safely across deployed contracts</p>
</li>
</ul>
<p>This mirrors real-world applications, like price oracles, DeFi contracts, or multi-contract systems where one contract depends on another for logic or data.</p>
<h2 id="heading-code-overview">Code Overview</h2>
<ul>
<li><p><strong>Calculator contract</strong>: Implements basic arithmetic functions.</p>
</li>
<li><p><strong>SmartCalculator contract</strong>: Calls the Calculator contract to compute results.</p>
</li>
<li><p><strong>Key Solidity patterns</strong>: Inter-contract calls, address casting, and imports.</p>
</li>
</ul>
<h2 id="heading-submission-and-code">Submission and Code</h2>
<p>Check out my GitHub submission here: <a target="_blank" href="https://github.com/The-Web3-Compass/30-days-of-solidity-submissions/pull/294">SmartCalculator.sol Day 9</a></p>
]]></content:encoded></item><item><title><![CDATA[Day 8 of 30 Days of Solidity — Building a Multi-Currency Tip Jar]]></title><description><![CDATA[Learn to build a multi-currency tip jar in Solidity with Ether payments, currency simulation, and contributor tracking on Day 8 of]]></description><link>https://30dayscompass.hashnode.dev/day-8-of-30-days-of-solidity-building-a-multi-currency-tip-jar</link><guid isPermaLink="true">https://30dayscompass.hashnode.dev/day-8-of-30-days-of-solidity-building-a-multi-currency-tip-jar</guid><category><![CDATA[Solidity]]></category><category><![CDATA[challenge]]></category><dc:creator><![CDATA[Joy Ogbonna]]></dc:creator><pubDate>Wed, 08 Oct 2025 20:33:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759955557491/66e21172-27df-4af5-8c14-bbd05eada44f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-introduction">Introduction</h3>
<p>Day 8 of the #30DaysOfSolidity challenge brings a fun and practical project <strong>TipJar.sol</strong>!<br />This contract is like a digital <em>“Buy Me a Coffee”</em> button, but smarter it supports multiple currencies and real Ether tips directly on-chain.</p>
<p>You’ll learn how to handle <strong>Ether payments</strong>, <strong>simulate currency conversions</strong>, and <strong>track who contributed</strong>, all within a Solidity smart contract.</p>
<hr />
<h3 id="heading-concepts-youll-master"><strong>Concepts You’ll Master</strong></h3>
<ul>
<li><p><strong>Payable functions</strong> — accepting Ether directly in a contract.</p>
</li>
<li><p><strong>Currency conversion logic</strong> — simulating tips in different denominations (like USD or EUR).</p>
</li>
<li><p><strong>msg.value</strong> — understanding how much Ether a user sends.</p>
</li>
<li><p><strong>Mapping contributors</strong> — storing and tracking who sent what.</p>
</li>
</ul>
<hr />
<h3 id="heading-example-application"><strong>Example Application</strong></h3>
<p>Imagine you’re a creator or developer who wants to receive tips in Ether.<br />Your friends or followers can:</p>
<ul>
<li><p>Send you ETH directly as a tip.</p>
</li>
<li><p>Choose a simulated “currency” like USD or EUR to represent the value.</p>
</li>
<li><p>View total contributions and who has tipped so far.</p>
</li>
</ul>
<p>This is similar to a decentralized version of <em>Buy Me a Coffee</em>, but powered entirely by <strong>Solidity</strong> and <strong>Ethereum</strong>.</p>
<hr />
<h3 id="heading-code-overview"><strong>Code Overview</strong></h3>
<p>Here’s what the contract does:</p>
<ul>
<li><p>Accepts Ether using a <code>payable</code> function.</p>
</li>
<li><p>Simulates multi-currency tips (e.g., converts “USD tips” to ETH).</p>
</li>
<li><p>Tracks each user’s total tip balance.</p>
</li>
<li><p>Allows the contract owner to withdraw the total funds.</p>
</li>
</ul>
<p>The contract’s logic demonstrates:</p>
<ul>
<li><p>Secure ETH transfers using <code>msg.sender</code> and <code>msg.value</code>.</p>
</li>
<li><p>Maintaining transparency in transactions.</p>
</li>
<li><p>Adding flexibility through simulated currency conversions.</p>
</li>
</ul>
<hr />
<h3 id="heading-real-world-insight"><strong>Real-World Insight</strong></h3>
<p>Tipping and micropayments are essential for supporting creators, developers, and open-source projects.<br />By learning how to implement an on-chain Tip Jar, you’re exploring the foundations of <strong>decentralized crowdfunding</strong>, <strong>content monetization</strong>, and <strong>Web3 patronage models</strong>.</p>
<hr />
<h3 id="heading-my-submission"><strong>My Submission</strong></h3>
<p>You can check out my full submission here 👇<br /><a target="_blank" href="https://github.com/The-Web3-Compass/30-days-of-solidity-submissions/pull/284">Day 8 GitHub Submission – TipJar.sol</a></p>
]]></content:encoded></item><item><title><![CDATA[Day 7 of 30 Days of Solidity — Building a Simple IOU Contract (SimpleIOU.sol)]]></title><description><![CDATA[Build an on-chain IOU contract using Solidity to manage debts and repayments among friends through secure Ether transactions and balance tracking]]></description><link>https://30dayscompass.hashnode.dev/day-7-of-30-days-of-solidity-building-a-simple-iou-contract-simpleiousol</link><guid isPermaLink="true">https://30dayscompass.hashnode.dev/day-7-of-30-days-of-solidity-building-a-simple-iou-contract-simpleiousol</guid><category><![CDATA[30daysoliditychallenge]]></category><category><![CDATA[Solidity]]></category><category><![CDATA[Web3]]></category><category><![CDATA[Smart Contracts]]></category><dc:creator><![CDATA[Joy Ogbonna]]></dc:creator><pubDate>Tue, 07 Oct 2025 20:01:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759867160596/0a234051-e2f9-45cf-bbed-138398768ba0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Today’s challenge was all about <strong>modeling real-world lending and borrowing on-chain</strong> — a system where friends can record, repay, and track debts using Ethereum smart contracts.<br />Sounds simple, right? But this challenge introduces some powerful Solidity concepts that make it all work seamlessly.</p>
<hr />
<h3 id="heading-challenge-overview">Challenge Overview</h3>
<p><strong>Contract Name:</strong> <code>SimpleIOU.sol</code><br /><strong>Concept:</strong> On-chain debt and repayment tracking among friends<br /><strong>Goal:</strong> Learn to handle Ether transfers, manage user balances, and ensure secure validation</p>
<p><strong>Challenge :</strong></p>
<blockquote>
<p>Build a simple IOU contract for a private group of friends. Each user can deposit ETH, track personal balances, log who owes who, and settle debts — all on-chain.</p>
</blockquote>
<hr />
<h3 id="heading-what-i-learned">What I Learned</h3>
<p>This challenge expanded my understanding of <strong>real-world financial modeling using Solidity</strong>. Here’s what I explored:</p>
<ul>
<li><p><strong>Addresses and Payable Functions:</strong><br />  I learned how to mark functions as <code>payable</code> to allow them to receive Ether.</p>
</li>
<li><p><strong>Ether Transfers:</strong><br />  Used <code>transfer()</code> and <code>call()</code> methods to move ETH securely between users.</p>
</li>
<li><p><strong>Nested Mappings:</strong><br />  Introduced a mapping structure like <code>mapping(address =&gt; mapping(address =&gt; uint))</code> to track <em>who owes who</em>.</p>
</li>
<li><p><strong>Validation with</strong> <code>require()</code>:<br />  Ensured that only valid transactions are allowed — for example, you can’t repay a debt you don’t owe!</p>
</li>
</ul>
<hr />
<h3 id="heading-how-the-contract-works">How the Contract Works</h3>
<ol>
<li><p><strong>Deposit Ether:</strong><br /> Users can deposit ETH into the contract and update their balances.</p>
</li>
<li><p><strong>Record Debt:</strong><br /> A user can record that they owe another user a certain amount.</p>
</li>
<li><p><strong>Repay Debt:</strong><br /> When repaying, the contract transfers ETH and updates both users’ balances.</p>
</li>
<li><p><strong>Transparency:</strong><br /> Anyone can view their current debts and check who owes them.</p>
</li>
</ol>
<h3 id="heading-example-code-snippet">Example Code Snippet</h3>
<pre><code class="lang-plaintext">pragma solidity ^0.8.0;

contract SimpleIOU {
    mapping(address =&gt; mapping(address =&gt; uint)) public debts;
    mapping(address =&gt; uint) public balances;

    function deposit() external payable {
        balances[msg.sender] += msg.value;
    }

    function recordDebt(address _to, uint _amount) external {
        require(balances[msg.sender] &gt;= _amount, "Insufficient balance");
        debts[msg.sender][_to] += _amount;
    }

    function repayDebt(address _to, uint _amount) external payable {
        require(debts[msg.sender][_to] &gt;= _amount, "No such debt");
        debts[msg.sender][_to] -= _amount;
        payable(_to).transfer(_amount);
    }
}
</code></pre>
<hr />
<h3 id="heading-submission">Submission</h3>
<p><strong>My GitHub Submission:</strong><br /><a target="_blank" href="https://github.com/The-Web3-Compass/30-days-of-solidity-submissions/pull/274">Day 7 – SimpleIOU.sol</a></p>
<hr />
<h3 id="heading-key-takeaway">Key Takeaway</h3>
<p>This challenge felt like building a <strong>mini decentralized Venmo</strong>, but on-chain.<br />I learned how to combine <strong>state management, Ether transfers, and validation</strong> to simulate real financial relationships between users.</p>
<p>Every line of code taught me more about how <strong>Solidity handles money securely</strong>.</p>
]]></content:encoded></item><item><title><![CDATA[Day 6 of 30 Days of Solidity — Building an Ether Piggy Bank]]></title><description><![CDATA[Learn how to build an Ether Piggy Bank with Solidity by mastering deposits, withdrawals, and payable functions on the blockchain]]></description><link>https://30dayscompass.hashnode.dev/day-6-of-30-days-of-solidity-building-an-ether-piggy-bank</link><guid isPermaLink="true">https://30dayscompass.hashnode.dev/day-6-of-30-days-of-solidity-building-an-ether-piggy-bank</guid><category><![CDATA[Day6]]></category><category><![CDATA[Solidity]]></category><category><![CDATA[challenge]]></category><dc:creator><![CDATA[Joy Ogbonna]]></dc:creator><pubDate>Mon, 06 Oct 2025 23:05:21 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759791848528/26f6a877-8384-42c5-9c4f-d984fe8c284a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-introduction">Introduction</h3>
<p>Day 6 of the 30DaysOfSolidity challenge introduces a fun and practical concept <strong>building a digital piggy bank</strong> on the blockchain!<br />This contract allows users to <strong>deposit</strong> and <strong>withdraw Ether</strong>, helping you understand how to manage balances, handle payable functions, and track ownership using <code>msg.sender</code>.</p>
<p>It’s like creating your own decentralized savings account — transparent, secure, and completely on-chain.</p>
<hr />
<h3 id="heading-concepts-youll-master">Concepts You’ll Master</h3>
<ul>
<li><p><strong>Payable Functions</strong> — Allow contracts to receive Ether.</p>
</li>
<li><p><strong>Deposits &amp; Withdrawals</strong> — Managing Ether safely on the blockchain.</p>
</li>
<li><p><strong>Mappings</strong> — Tracking user balances (<code>address =&gt; uint</code>).</p>
</li>
<li><p><strong>msg.sender</strong> — Identifying who is sending or withdrawing Ether.</p>
</li>
</ul>
<h3 id="heading-code-breakdown">Code Breakdown</h3>
<p>Here’s what the contract does step-by-step:</p>
<ol>
<li><p><strong>Deposit Ether</strong>:<br /> Users can send Ether to the contract using a <code>deposit()</code> function marked as <code>payable</code>.<br /> Their deposit amount is stored in a mapping that keeps track of all user balances.</p>
</li>
<li><p><strong>Withdraw Ether</strong>:<br /> Users can withdraw any amount they’ve deposited — but only up to their available balance.<br /> The contract checks using a <code>require()</code> statement to prevent overdrawing.</p>
</li>
<li><p><strong>Check Balance</strong>:<br /> Each user can view how much Ether they’ve saved in their personal piggy bank.</p>
</li>
<li><p><strong>Security</strong>:<br /> The logic ensures users can’t withdraw more than they own, maintaining fairness and safety.</p>
</li>
</ol>
<hr />
<h3 id="heading-real-world-insight">Real-World Insight</h3>
<p>This simple “Piggy Bank” concept forms the foundation of <strong>many DeFi applications</strong> — from staking systems to lending platforms.<br />Understanding <strong>payable functions</strong> and <strong>Ether transfers</strong> is crucial for any Solidity developer aiming to build secure, value-driven dApps.</p>
<hr />
<h3 id="heading-my-submission">My Submission</h3>
<p><a target="_blank" href="https://github.com/The-Web3-Compass/30-days-of-solidity-submissions/pull/265">Day 6 GitHub Submission – EtherPiggyBank.sol</a></p>
<hr />
<h3 id="heading-conclusion">Conclusion</h3>
<p>This challenge proves how even simple concepts in Solidity can model <strong>real-world financial behavior</strong>.<br />You’ve just built your first on-chain savings system one deposit at a time!</p>
]]></content:encoded></item><item><title><![CDATA[🧭 Day 5 of 30 Days of Solidity — Mastering Access Control with AdminOnly.sol]]></title><description><![CDATA[Learn how to master access control with Solidity's AdminOnly contract, exploring ownership, permissions, and secure function restrictions]]></description><link>https://30dayscompass.hashnode.dev/day-5-of-30-days-of-solidity-mastering-access-control-with-adminonlysol</link><guid isPermaLink="true">https://30dayscompass.hashnode.dev/day-5-of-30-days-of-solidity-mastering-access-control-with-adminonlysol</guid><category><![CDATA[Day5]]></category><category><![CDATA[challenge]]></category><category><![CDATA[Solidity]]></category><dc:creator><![CDATA[Joy Ogbonna]]></dc:creator><pubDate>Sun, 05 Oct 2025 22:40:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759703914951/af69f2ad-c352-49ba-acc7-28bdbecb3773.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Today’s challenge takes us into one of the most powerful concepts in Solidity <strong>access control</strong>.<br />In this lesson, we’ll build an <code>AdminOnly</code> contract that introduces ownership, permissions, and restricted functions just like an admin dashboard in a Web2 app, but on-chain.</p>
<p>🔗 <strong>My Submission:</strong> <a target="_blank" href="https://github.com/The-Web3-Compass/30-days-of-solidity-submissions/pull/255">Day 5 — AdminOnly.sol on GitHub</a></p>
<hr />
<h3 id="heading-concepts-youll-master">Concepts You’ll Master</h3>
<ul>
<li><p><strong>Modifiers</strong> — reusable pieces of logic that restrict or validate function calls.</p>
</li>
<li><p><strong>msg.sender</strong> — identifies who is calling the function (the user’s wallet address).</p>
</li>
<li><p><strong>Basic Access Control</strong> — allows only the owner to perform certain actions.</p>
</li>
</ul>
<hr />
<h3 id="heading-example-application">Example Application</h3>
<p>Imagine a <strong>Treasure Chest</strong> controlled by an owner:</p>
<ul>
<li><p>The <strong>owner</strong> can add treasures.</p>
</li>
<li><p>The <strong>owner</strong> can approve withdrawals for specific users.</p>
</li>
<li><p><strong>Users</strong> can withdraw only if approved and haven’t withdrawn before.</p>
</li>
<li><p>The <strong>owner</strong> can also transfer ownership or reset withdrawal statuses.</p>
</li>
</ul>
<p>This setup is just like having admin privileges in a game or platform — you decide who gets access and what they can do.</p>
<hr />
<h3 id="heading-code-overview">Code Overview</h3>
<p>Here’s what the <code>AdminOnly.sol</code> contract demonstrates:</p>
<ul>
<li><p><strong>Ownership Initialization:</strong> The deployer automatically becomes the contract owner.</p>
</li>
<li><p><strong>Restricted Functions:</strong> Using a custom <code>onlyOwner</code> modifier to secure certain functions.</p>
</li>
<li><p><strong>Controlled Withdrawals:</strong> Ensures users can only withdraw if permitted.</p>
</li>
<li><p><strong>Ownership Transfer:</strong> Admin can pass control to another address.</p>
</li>
</ul>
<p>These concepts lay the foundation for more complex smart contracts such as <strong>NFT marketplaces</strong>, <strong>DAOs</strong>, and <strong>DeFi platforms</strong>, where admin permissions are essential.</p>
<hr />
<h3 id="heading-real-world-insight">Real-World Insight</h3>
<p>Access control is one of the most fundamental design patterns in blockchain development.<br />From <strong>governance contracts</strong> to <strong>treasury systems</strong>, being able to restrict functions to trusted entities is vital for maintaining security and trust in decentralized systems.</p>
<hr />
<h3 id="heading-reflection">Reflection</h3>
<p>Today’s challenge reminded me that even though blockchain is decentralized, <strong>controlled permissions</strong> are key to order and security.<br />Learning how to manage ownership and access is an important step toward building secure and scalable dApps.</p>
]]></content:encoded></item><item><title><![CDATA[Day 4 of 30 Days of Solidity — Building a Simple Auction Contract]]></title><description><![CDATA[Learn to build a simple auction contract using Solidity's decision-making and time handling features in this 30-day challenge]]></description><link>https://30dayscompass.hashnode.dev/day-4-of-30-days-of-solidity-building-a-simple-auction-contract</link><guid isPermaLink="true">https://30dayscompass.hashnode.dev/day-4-of-30-days-of-solidity-building-a-simple-auction-contract</guid><category><![CDATA[Day4]]></category><category><![CDATA[challenge]]></category><dc:creator><![CDATA[Joy Ogbonna]]></dc:creator><pubDate>Sun, 05 Oct 2025 00:31:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759624229517/65d81609-8d8b-4b9e-9847-d2be36c4e89a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-intro">Intro</h3>
<p>Day 4 of the <strong>30 Days of Solidity</strong> challenge takes us deeper into real-world smart contract logic — this time, we’re building a simple <strong>auction house!</strong></p>
<p>We’ll use Solidity features like <strong>if/else statements</strong>, <strong>time tracking (</strong><code>block.timestamp</code>), and <strong>basic bidding logic</strong> to simulate an on-chain auction where users compete to be the highest bidder before time runs out.</p>
<hr />
<h3 id="heading-concepts-youll-master">Concepts You’ll Master</h3>
<ul>
<li><p>Using <strong>if/else statements</strong> for decision-making</p>
</li>
<li><p>Handling <strong>time on the blockchain</strong> using <code>block.timestamp</code></p>
</li>
<li><p>Implementing <strong>bidding logic</strong> and updating highest bids dynamically</p>
</li>
</ul>
<hr />
<h3 id="heading-example-application">Example Application</h3>
<p>We’ll create a simple auction where:</p>
<ul>
<li><p>Users can place bids on an item.</p>
</li>
<li><p>The <strong>highest bidder wins</strong> once the auction timer expires.</p>
</li>
<li><p>Solidity’s <code>block.timestamp</code> helps track when the auction should end.</p>
</li>
</ul>
<p>This is like building a <strong>decentralized eBay</strong>, showing how logic and time control interact in smart contracts.</p>
<hr />
<h3 id="heading-code-overview">Code Overview</h3>
<p>Here’s what the contract handles:</p>
<ul>
<li><p><strong>Auction creation</strong> — defining an item, starting price, and end time.</p>
</li>
<li><p><strong>Bidding system</strong> — users can place higher bids as long as time hasn’t run out.</p>
</li>
<li><p><strong>Winner logic</strong> — once the auction ends, the contract determines the highest bidder and closes the auction.</p>
</li>
</ul>
<p>You’ll rely on <strong>if/else checks</strong> to ensure:</p>
<ul>
<li><p>The auction hasn’t ended.</p>
</li>
<li><p>The new bid is higher than the previous one.</p>
</li>
<li><p>Only valid bids are accepted.</p>
</li>
</ul>
<hr />
<h3 id="heading-real-world-insight">Real-World Insight</h3>
<p>Auctions are at the core of many blockchain applications — from <strong>NFT marketplaces</strong> to <strong>token sales</strong> and <strong>governance proposals</strong>.<br />Understanding how to handle conditional logic and timestamps prepares you for writing more complex decentralized applications.</p>
<hr />
<h3 id="heading-github-submission">🔗 GitHub Submission</h3>
<p>Here’s my official submission for <strong>Day 4: AuctionHouse.sol</strong><br />👉 <a target="_blank" href="https://github.com/The-Web3-Compass/30-days-of-solidity-submissions/pull/241">View Pull Request</a></p>
]]></content:encoded></item><item><title><![CDATA[Day 3 of 30 Days of Solidity: Building a Simple Polling Contract]]></title><description><![CDATA[Learn to build a simple poll contract with Solidity, using arrays, mappings, events, and require statements to manage votes on the blockchain]]></description><link>https://30dayscompass.hashnode.dev/day-3-of-30-days-of-solidity-building-a-simple-polling-contract</link><guid isPermaLink="true">https://30dayscompass.hashnode.dev/day-3-of-30-days-of-solidity-building-a-simple-polling-contract</guid><category><![CDATA[Solidity]]></category><category><![CDATA[solidity challenge]]></category><category><![CDATA[web3.0]]></category><dc:creator><![CDATA[Joy Ogbonna]]></dc:creator><pubDate>Fri, 03 Oct 2025 03:43:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759462945168/ede6a3cb-024f-485d-90de-0e5bc8b7c7b3.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Today, we’re creating a <strong>digital polling station</strong>!</p>
<ul>
<li><p>Users can vote for their favorite candidates.</p>
</li>
<li><p>The contract remembers who voted, so each address can vote only once.</p>
</li>
<li><p>Votes for each candidate are stored on the blockchain.</p>
</li>
</ul>
<p>This teaches how to manage <strong>arrays</strong>, <strong>mappings</strong>, and <strong>basic voting logic</strong> in Solidity.</p>
<hr />
<h3 id="heading-key-concepts-learned">Key Concepts Learned</h3>
<ol>
<li><p><strong>Arrays</strong> – storing a list of candidates.</p>
</li>
<li><p><strong>Mappings</strong> – linking voters to their chosen candidate.</p>
</li>
<li><p><strong>Events</strong> – notifying the blockchain when someone votes.</p>
</li>
<li><p><strong>Require statements</strong> – ensuring valid candidate selection and preventing double voting.</p>
</li>
</ol>
<hr />
<h3 id="heading-pollstationsol-overview">PollStation.sol Overview</h3>
<p>Here’s what the contract does:</p>
<pre><code class="lang-plaintext">// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract PollStation {
    string[] public candidates; // list of candidates
    mapping(uint =&gt; uint) public votes; // candidateId =&gt; vote count
    mapping(address =&gt; bool) public hasVoted; // check if an address voted

    event Voted(address voter, uint candidateId);

    constructor(string[] memory _candidates) {
        candidates = _candidates; // add candidates when deploying
    }

    function vote(uint candidateId) public {
        require(candidateId &lt; candidates.length, "Invalid candidate");
        require(!hasVoted[msg.sender], "You have already voted");

        votes[candidateId] += 1;
        hasVoted[msg.sender] = true;

        emit Voted(msg.sender, candidateId);
    }

    function getCandidatesCount() public view returns (uint) {
        return candidates.length;
    }

    function getCandidate(uint candidateId) public view returns (string memory, uint) {
        require(candidateId &lt; candidates.length, "Invalid candidate");
        return (candidates[candidateId], votes[candidateId]);
    }
}
</code></pre>
<hr />
<h3 id="heading-how-it-works">How It Works</h3>
<ol>
<li><p><strong>Adding candidates:</strong> When deploying, you pass an array of candidate names, e.g., <code>["Alice","Bob","Charlie"]</code>.</p>
</li>
<li><p><strong>Voting:</strong> Users call <code>vote(candidateId)</code>. The contract:</p>
<ul>
<li><p>Checks the candidate exists</p>
</li>
<li><p>Ensures the voter hasn’t voted before</p>
</li>
<li><p>Adds a vote and marks the address as voted</p>
</li>
<li><p>Emits a <code>Voted</code> event</p>
</li>
</ul>
</li>
<li><p><strong>Checking results:</strong></p>
<ul>
<li><p><code>getCandidatesCount()</code> → total candidates</p>
</li>
<li><p><code>getCandidate(id)</code> → returns candidate name and vote count</p>
</li>
</ul>
</li>
</ol>
<hr />
<h3 id="heading-key-takeaways">Key Takeaways</h3>
<ul>
<li><p>Arrays and mappings are essential for structured data on-chain.</p>
</li>
<li><p>Events help track activity transparently.</p>
</li>
<li><p>Smart contracts can enforce rules (like “one vote per address”) automatically.</p>
</li>
</ul>
<hr />
<h3 id="heading-links">🔗 Links</h3>
<ul>
<li><p><strong>GitHub Submission:</strong> <a target="_blank" href="https://github.com/The-Web3-Compass/30-days-of-solidity-submissions/pull/217">PollStation.sol</a></p>
</li>
<li><p><strong>Full Challenge Calendar:</strong> <a target="_blank" href="https://www.web3compass.xyz/challenge-calendar">Web3 Compass</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Day 2 of 30 Days of Solidity: Building a Profile Contract]]></title><description><![CDATA[Learn to build a Solidity smart contract storing names and bios on-chain. Explore state variables, storage, and retrieval using `SaveMyName.sol`]]></description><link>https://30dayscompass.hashnode.dev/day-2-of-30-days-of-solidity-building-a-profile-contract</link><guid isPermaLink="true">https://30dayscompass.hashnode.dev/day-2-of-30-days-of-solidity-building-a-profile-contract</guid><category><![CDATA[Day02]]></category><category><![CDATA[Solidity]]></category><category><![CDATA[solidity basics]]></category><category><![CDATA[solidity challenge]]></category><category><![CDATA[Web3]]></category><dc:creator><![CDATA[Joy Ogbonna]]></dc:creator><pubDate>Thu, 02 Oct 2025 01:01:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759366828313/1600d39a-0597-4be8-ba86-f471a722f4a4.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Yesterday, in <strong>Day 1</strong>, I built a simple counter contract that could increment or decrement a stored number. Today, we’re taking another step forward into Solidity fundamentals by learning how to <strong>store and retrieve text data</strong> on the blockchain.</p>
<hr />
<h2 id="heading-the-challenge">The Challenge</h2>
<p>The task for Day 2 was to build a contract called <code>SaveMyName.sol</code>.<br />The idea is simple: let users save their <strong>name</strong> and a <strong>short bio</strong> on-chain, then be able to retrieve it whenever needed.</p>
<p>This introduces the use of <strong>strings</strong> in Solidity and teaches how to store data in <strong>state variables</strong>.</p>
<hr />
<h2 id="heading-concepts-covered">Concepts Covered</h2>
<ul>
<li><p><strong>State variables</strong> → using <code>string</code> to hold data.</p>
</li>
<li><p><strong>Storage and retrieval</strong> → functions to save and return values.</p>
</li>
<li><p><strong>Function parameters &amp; returns</strong> → passing user input and getting it back.</p>
</li>
</ul>
<hr />
<h2 id="heading-the-code">The Code</h2>
<pre><code class="lang-plaintext">// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract SaveMyName {
    // State variables
    string public name;
    string public bio;

    // Function to save name and bio
    function saveProfile(string memory _name, string memory _bio) public {
        name = _name;
        bio = _bio;
    }

    // Function to retrieve both at once
    function getProfile() public view returns (string memory, string memory) {
        return (name, bio);
    }
}
</code></pre>
<hr />
<h2 id="heading-how-it-works">🔎 How It Works</h2>
<ol>
<li><p>Deploy the contract on Remix.</p>
</li>
<li><p>Call <code>saveProfile("Alice", "I build dApps")</code>.</p>
</li>
<li><p>Use <code>getProfile()</code> → it will return both the name and the bio stored on-chain.</p>
</li>
</ol>
<p>This simple contract demonstrates how blockchain can be used for <strong>basic identity and profile storage</strong>.</p>
<hr />
<h2 id="heading-my-submission">🚀 My Submission</h2>
<ul>
<li><p>📝 <strong>Code</strong>: <a target="_blank" href="https://github.com/JoyDTechGirl/30-days-of-solidity-submissions">Day 02 on GitHub</a></p>
</li>
<li><p>🔗 <strong>PR</strong>: <a target="_blank" href="https://github.com/The-Web3-Compass/30-days-of-solidity-submissions/pull/199?utm_source=chatgpt.com">Day 02 Submission PR</a></p>
</li>
</ul>
<hr />
<h2 id="heading-reflection">Reflection</h2>
<p>Compared to Day 1, today’s challenge made me think more about <strong>data types</strong>. Storing numbers was straightforward, but handling text (<code>string</code>) gave me a better understanding of how Solidity manages different forms of data.</p>
<p>Building something as simple as a profile reminds me how real-world applications like decentralized social media or identity systems begin with these small building blocks.</p>
<hr />
<p>Tomorrow, I’ll continue with <strong>Day 3</strong> and keep building step by step.</p>
]]></content:encoded></item><item><title><![CDATA[Day 1 of 30 Days of Solidity: Building My First Counter Smart Contract 🚀]]></title><description><![CDATA[Learn to build your first counter smart contract with Solidity, focusing on state variables, function interactions, and contract security essentials]]></description><link>https://30dayscompass.hashnode.dev/day-1-of-30-days-of-solidity-building-my-first-counter-smart-contract</link><guid isPermaLink="true">https://30dayscompass.hashnode.dev/day-1-of-30-days-of-solidity-building-my-first-counter-smart-contract</guid><category><![CDATA[Solidity]]></category><category><![CDATA[challenge]]></category><category><![CDATA[Web3]]></category><category><![CDATA[web3.0]]></category><dc:creator><![CDATA[Joy Ogbonna]]></dc:creator><pubDate>Wed, 01 Oct 2025 23:52:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759362650804/6852bbef-affe-4b4d-9acc-60e0dca06f7a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Welcome to my journey through the <strong>30 Days of Solidity</strong> challenge by Web3Compass! Today’s goal was simple but foundational: build a digital counter contract. Each “click” should increment a number stored on-chain. This is how real smart contracts begin to <em>interact</em> and <em>store state</em>.</p>
<p>I submitted my solution here:<br /><a target="_blank" href="https://github.com/The-Web3-Compass/30-days-of-solidity-submissions/pull/199?utm_source=chatgpt.com">Day 01: My first Solidity contract PR</a></p>
<hr />
<h3 id="heading-what-i-built">What I Built</h3>
<ul>
<li><p>A <strong>state variable</strong> (<code>uint count</code>) to hold the current count</p>
</li>
<li><p>A <code>click()</code> function that <em>increments</em> the counter</p>
</li>
<li><p>A <code>decrement()</code> (or <code>unclick()</code>) function to <em>decrease</em> the counter (with checks so it doesn’t go negative)</p>
</li>
<li><p>(Optional) A <code>reset()</code> function to bring the counter back to zero</p>
</li>
</ul>
<p>This contract teaches how to declare variables, modify them via functions, and manage state—one of the core powers of smart contracts.</p>
<hr />
<h3 id="heading-key-learnings">Key Learnings</h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Concept</td><td>Why It Matters</td></tr>
</thead>
<tbody>
<tr>
<td><strong>State Variables</strong></td><td>Enable data to persist on the blockchain</td></tr>
<tr>
<td><strong>Functions Changing State</strong></td><td>Allow users to interact and change contract data</td></tr>
<tr>
<td><strong>Input Validations / Safety</strong></td><td>Prevent invalid states (e.g. not going below zero)</td></tr>
<tr>
<td><strong>Reset Logic / Edge Cases</strong></td><td>Considering how the contract behaves in all scenarios</td></tr>
</tbody>
</table>
</div><p>Even a small counter helps internalize how data lives and changes on-chain.</p>
<hr />
<h3 id="heading-how-i-did-it-simplified-steps">How I Did It (Simplified Steps)</h3>
<ol>
<li><p>Built the contract in Remix</p>
</li>
<li><p>Downloaded or copied the <code>.sol</code> file</p>
</li>
<li><p>Placed it in my local forked repo under <code>Day01/</code></p>
</li>
<li><p>Committed &amp; pushed changes</p>
</li>
<li><p>Created a Pull Request</p>
</li>
<li><p>Submitted the PR link in Telegram to register my submission</p>
</li>
</ol>
<hr />
<h3 id="heading-reflections">Reflections</h3>
<p>Day 1 felt approachable yet powerful. It confirmed that even the simplest contracts teach core Solidity principles: state, functions, and contract logic.</p>
<p>I’m excited to continue this 30-day challenge and share what I learn along the way.</p>
]]></content:encoded></item></channel></rss>