<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Ayaz</title>
    <description>The latest articles on DEV Community by Muhammad Ayaz (@ayaz).</description>
    <link>https://dev.to/ayaz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F479442%2Fa9f86ae7-3d77-4e28-ab8d-5eb99bf33190.png</url>
      <title>DEV Community: Muhammad Ayaz</title>
      <link>https://dev.to/ayaz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ayaz"/>
    <language>en</language>
    <item>
      <title>Solidity Crash Course 🚀</title>
      <dc:creator>Muhammad Ayaz</dc:creator>
      <pubDate>Sun, 02 Feb 2025 10:42:36 +0000</pubDate>
      <link>https://dev.to/ayaz/-solidity-crash-course-series-4o4n</link>
      <guid>https://dev.to/ayaz/-solidity-crash-course-series-4o4n</guid>
      <description>&lt;p&gt;Welcome to the Solidity Crash Course series! This collection of tutorials will guide you through the basics of Solidity, from syntax to advanced concepts. Each part covers essential topics with examples to help you get started.  &lt;/p&gt;

&lt;h2&gt;
  
  
  📜 Crash Course List
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/ayaz/solidity-crash-course-part-1-basics-and-pre-requisite-1ghj"&gt;Solidity Crash Course - Part 01&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Introduction to Solidity and setting up your environment.&lt;/em&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/ayaz/solidity-crash-course-part-02-2f2l"&gt;Solidity Crash Course - Part 02&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Understanding Solidity contract syntax and writing your first smart contract.&lt;/em&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/ayaz/solidity-crash-course-part-03-variables-scopes-abstract-contracts-4mlp"&gt;Solidity Crash Course - Part 03&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Exploring variables, scopes, and abstract contracts.&lt;/em&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/ayaz/solidity-crash-course-part-4-comments-data-types-if-else-interface-31hd"&gt;Solidity Crash Course - Part 04&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Comments, data types, if-else statements, and interfaces.&lt;/em&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/ayaz/solidity-crash-course-part-05-whilefor-loop-event-arrays-and-struct-14p0"&gt;Solidity Crash Course - Part 05&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Loops, events, arrays, and struct usage.&lt;/em&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/ayaz/solidity-crash-course-part-06-mapping-ether-memory-and-storage-ho8"&gt;Solidity Crash Course - Part 06&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Mappings, memory vs storage, and handling Ether.&lt;/em&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🚀 How to Run Solidity in Remix IDE
&lt;/h2&gt;

&lt;p&gt;Remix is an online Solidity compiler and IDE that allows you to write, deploy, and test smart contracts easily. Follow these steps to get started:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Open Remix IDE&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Visit &lt;a href="https://remix.ethereum.org/" rel="noopener noreferrer"&gt;Remix IDE&lt;/a&gt; in your web browser.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create a New Solidity File&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;File Explorer&lt;/strong&gt;, create a new file. (Start with Blank Project)&lt;/li&gt;
&lt;li&gt;Name it with &lt;code&gt;.sol&lt;/code&gt; extension (e.g., &lt;code&gt;MyContract.sol&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Write Your Solidity Code&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy and paste your Solidity code into the newly created file.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compile the Contract&lt;/strong&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Click on Play button at the TOP.
OR&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Solidity Compiler&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Select the Solidity version that matches your contract (usually defined in &lt;code&gt;pragma solidity&lt;/code&gt; at the top of the file).&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Compile&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stay tuned for more Solidity tutorials! Let me know if you have any questions or topics you'd like to see covered. 😊  &lt;/p&gt;

</description>
      <category>solidity</category>
      <category>web</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Solidity Crash Course Series 🚀</title>
      <dc:creator>Muhammad Ayaz</dc:creator>
      <pubDate>Sun, 02 Feb 2025 10:42:36 +0000</pubDate>
      <link>https://dev.to/ayaz/-solidity-crash-course-series-3ohi</link>
      <guid>https://dev.to/ayaz/-solidity-crash-course-series-3ohi</guid>
      <description>&lt;p&gt;Welcome to the Solidity Crash Course series! This collection of tutorials will guide you through the basics of Solidity, from syntax to advanced concepts. Each part covers essential topics with examples to help you get started.  &lt;/p&gt;

&lt;h2&gt;
  
  
  📜 Crash Course List
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/ayaz/solidity-crash-course-part-1-basics-and-pre-requisite-1ghj"&gt;Solidity Crash Course - Part 01&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Introduction to Solidity and setting up your environment.&lt;/em&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/ayaz/solidity-crash-course-part-02-2f2l"&gt;Solidity Crash Course - Part 02&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Understanding Solidity contract syntax and writing your first smart contract.&lt;/em&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/ayaz/solidity-crash-course-part-03-variables-scopes-abstract-contracts-4mlp"&gt;Solidity Crash Course - Part 03&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Exploring variables, scopes, and abstract contracts.&lt;/em&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/ayaz/solidity-crash-course-part-4-comments-data-types-if-else-interface-31hd"&gt;Solidity Crash Course - Part 04&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Comments, data types, if-else statements, and interfaces.&lt;/em&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/ayaz/solidity-crash-course-part-05-whilefor-loop-event-arrays-and-struct-14p0"&gt;Solidity Crash Course - Part 05&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Loops, events, arrays, and struct usage.&lt;/em&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/ayaz/solidity-crash-course-part-06-mapping-ether-memory-and-storage-ho8"&gt;Solidity Crash Course - Part 06&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Mappings, memory vs storage, and handling Ether.&lt;/em&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🚀 How to Run Solidity in Remix IDE
&lt;/h2&gt;

&lt;p&gt;Remix is an online Solidity compiler and IDE that allows you to write, deploy, and test smart contracts easily. Follow these steps to get started:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Open Remix IDE&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Visit &lt;a href="https://remix.ethereum.org/" rel="noopener noreferrer"&gt;Remix IDE&lt;/a&gt; in your web browser.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create a New Solidity File&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;File Explorer&lt;/strong&gt;, create a new file. (Start with Blank Project)&lt;/li&gt;
&lt;li&gt;Name it with &lt;code&gt;.sol&lt;/code&gt; extension (e.g., &lt;code&gt;MyContract.sol&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Write Your Solidity Code&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy and paste your Solidity code into the newly created file.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compile the Contract&lt;/strong&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Click on Play button at the TOP.
OR&lt;/li&gt;
&lt;li&gt;Go to the &lt;strong&gt;Solidity Compiler&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Select the Solidity version that matches your contract (usually defined in &lt;code&gt;pragma solidity&lt;/code&gt; at the top of the file).&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Compile&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stay tuned for more Solidity tutorials! Let me know if you have any questions or topics you'd like to see covered. 😊  &lt;/p&gt;

</description>
      <category>solidity</category>
      <category>web</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Solidity Crash Course - Part 06: Mapping, Ether, Memory and Storage</title>
      <dc:creator>Muhammad Ayaz</dc:creator>
      <pubDate>Sat, 01 Feb 2025 13:40:38 +0000</pubDate>
      <link>https://dev.to/ayaz/solidity-crash-course-part-06-mapping-ether-memory-and-storage-ho8</link>
      <guid>https://dev.to/ayaz/solidity-crash-course-part-06-mapping-ether-memory-and-storage-ho8</guid>
      <description>&lt;h2&gt;
  
  
  Solidity Crash Course - Part 06 🚀
&lt;/h2&gt;

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

&lt;p&gt;Welcome to part 06 of our Solidity crash course! In this section, we will explore some fundamental concepts in Solidity that will help you build more advanced smart contracts. We will cover:&lt;/p&gt;

&lt;p&gt;✅ Solidity - Mapping&lt;br&gt;
✅ Solidity - Memory vs Storage&lt;br&gt;
✅ Solidity - Ether&lt;/p&gt;

&lt;p&gt;By the end of this lesson, you’ll understand why these concepts are crucial and how to use them effectively. Let’s dive in! 🏊‍♂️&lt;/p&gt;




&lt;h2&gt;
  
  
  Solidity - Mapping 🗺️
&lt;/h2&gt;

&lt;p&gt;Mappings in Solidity are like hash tables or dictionaries in other programming languages. They allow you to store key-value pairs efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Use Mappings?
&lt;/h3&gt;

&lt;p&gt;Mappings are great for storing data that needs fast lookup, such as token balances or user permissions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract UserBalance {
    mapping(address =&amp;gt; uint) public balances;

    function setBalance(uint _amount) public {
        balances[msg.sender] = _amount;
    }

    function getBalance(address _user) public view returns (uint) {
        return balances[_user];
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Best Use Case ✅
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Storing user balances in a token contract&lt;/li&gt;
&lt;li&gt;Keeping track of ownership or permissions&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Solidity - Memory vs Storage 💾
&lt;/h2&gt;

&lt;p&gt;In Solidity, &lt;code&gt;memory&lt;/code&gt; and &lt;code&gt;storage&lt;/code&gt; are used to manage data. But what’s the difference? 🤔&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;storage&lt;/code&gt; 📦 (Permanent)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Stored on the blockchain&lt;/li&gt;
&lt;li&gt;Costs gas to modify&lt;/li&gt;
&lt;li&gt;Used for persistent state variables&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;memory&lt;/code&gt; 🏃‍♂️ (Temporary)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Exists only during function execution&lt;/li&gt;
&lt;li&gt;No gas cost for reading (only for writing)&lt;/li&gt;
&lt;li&gt;Used for function arguments and temporary variables&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contract DataExample {
    string[] public storageArray; // Stored on the blockchain

    function addToStorage(string memory _text) public {
        storageArray.push(_text); // Modifies state variable (costs gas)
    }

    function processMemory(string memory _text) public pure returns (string memory) {
        return _text; // Exists only during function execution
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Best Use Case ✅
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;storage&lt;/code&gt; for data that needs to persist (like user balances)&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;memory&lt;/code&gt; for temporary data (like function inputs)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Solidity - Ether 💰
&lt;/h2&gt;

&lt;p&gt;Ether (ETH) is the native cryptocurrency of the Ethereum blockchain, and smart contracts can send, receive, and store Ether.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sending &amp;amp; Receiving Ether
&lt;/h3&gt;

&lt;p&gt;Smart contracts use special functions to handle Ether transactions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contract EtherWallet {
    address payable public owner;

    constructor() {
        owner = payable(msg.sender);
    }

    // Receive Ether
    receive() external payable {}

    // Get contract balance
    function getBalance() public view returns (uint) {
        return address(this).balance;
    }

    // Withdraw Ether
    function withdraw(uint _amount) public {
        require(msg.sender == owner, "Not the owner");
        payable(msg.sender).transfer(_amount);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Best Use Case ✅
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Smart contracts that hold funds (like a wallet or crowdfunding contract)&lt;/li&gt;
&lt;li&gt;Decentralized finance (DeFi) applications&lt;/li&gt;
&lt;/ul&gt;




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

&lt;p&gt;In this part, we covered:&lt;br&gt;
✅ Mappings and their importance in Solidity&lt;br&gt;
✅ The difference between &lt;code&gt;memory&lt;/code&gt; and &lt;code&gt;storage&lt;/code&gt;&lt;br&gt;
✅ How smart contracts handle Ether transactions&lt;/p&gt;

&lt;p&gt;Let me know if you have any questions, comments, or feedback! 😊&lt;/p&gt;

&lt;p&gt;Would love to help you out! 🚀&lt;/p&gt;

</description>
      <category>web3</category>
      <category>web</category>
      <category>javascript</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Solidity Crash Course - Part 05: While,For loop, Event, Arrays and Struct</title>
      <dc:creator>Muhammad Ayaz</dc:creator>
      <pubDate>Sat, 01 Feb 2025 13:28:58 +0000</pubDate>
      <link>https://dev.to/ayaz/solidity-crash-course-part-05-whilefor-loop-event-arrays-and-struct-14p0</link>
      <guid>https://dev.to/ayaz/solidity-crash-course-part-05-whilefor-loop-event-arrays-and-struct-14p0</guid>
      <description>&lt;h2&gt;
  
  
  Solidity Crash Course - Part 05 🚀
&lt;/h2&gt;

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

&lt;p&gt;Welcome back to our Solidity crash course! In this part, we'll cover some essential concepts to help you write more efficient and structured smart contracts. Let's dive in! 🏊‍♂️&lt;/p&gt;




&lt;h2&gt;
  
  
  Solidity - While Loops 🔄
&lt;/h2&gt;

&lt;p&gt;Loops are used to execute a block of code multiple times based on a condition. A &lt;strong&gt;while loop&lt;/strong&gt; continues to execute as long as the condition remains &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



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

contract WhileLoopExample {
    uint public count;

    function countUp(uint _limit) public {
        while (count &amp;lt; _limit) {
            count++;
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ &lt;strong&gt;Why use while loops?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Great for situations where you don’t know the exact number of iterations beforehand.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚠️ &lt;strong&gt;Best Practice:&lt;/strong&gt; Be cautious of infinite loops as they can waste gas and cause transactions to fail.&lt;/p&gt;




&lt;h2&gt;
  
  
  Solidity - Events 📢
&lt;/h2&gt;

&lt;p&gt;Events allow smart contracts to communicate with external applications like dApps. They help log important actions that occur on the blockchain.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



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

contract EventExample {
    event NumberChanged(uint oldValue, uint newValue);
    uint public number;

    function updateNumber(uint _newValue) public {
        emit NumberChanged(number, _newValue);
        number = _newValue;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ &lt;strong&gt;Why use events?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Efficiently store data without consuming unnecessary gas.&lt;/li&gt;
&lt;li&gt;Helps external applications listen to changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚠️ &lt;strong&gt;Best Practice:&lt;/strong&gt; Use events to log only important updates to reduce gas costs.&lt;/p&gt;




&lt;h2&gt;
  
  
  Solidity - For Loops 🔁
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;for loop&lt;/strong&gt; is used when you know the number of iterations beforehand.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



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

contract ForLoopExample {
    uint[] public numbers;

    function fillArray(uint _limit) public {
        for (uint i = 0; i &amp;lt; _limit; i++) {
            numbers.push(i);
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ &lt;strong&gt;Why use for loops?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ideal when you need to iterate a known number of times.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚠️ &lt;strong&gt;Best Practice:&lt;/strong&gt; Avoid looping through large arrays to prevent exceeding gas limits.&lt;/p&gt;




&lt;h2&gt;
  
  
  Solidity - Arrays 📦
&lt;/h2&gt;

&lt;p&gt;Arrays store multiple values in a single variable, allowing efficient data management.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



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

contract ArrayExample {
    uint[] public numbers;

    function addNumber(uint _num) public {
        numbers.push(_num);
    }

    function getNumber(uint index) public view returns (uint) {
        return numbers[index];
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ &lt;strong&gt;Why use arrays?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Efficient storage and retrieval of multiple data points.&lt;/li&gt;
&lt;li&gt;Useful for managing lists like registered users or transaction records.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚠️ &lt;strong&gt;Best Practice:&lt;/strong&gt; Use mappings instead of arrays when searching for values frequently.&lt;/p&gt;




&lt;h2&gt;
  
  
  Solidity - Struct 🏗️
&lt;/h2&gt;

&lt;p&gt;Structs allow you to create custom data types, grouping multiple properties together.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



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

contract StructExample {
    struct Person {
        string name;
        uint age;
    }

    Person public user;

    function setUser(string memory _name, uint _age) public {
        user = Person(_name, _age);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ &lt;strong&gt;Why use structs?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Helps organize related data efficiently.&lt;/li&gt;
&lt;li&gt;Useful for defining complex objects like user profiles or product details.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚠️ &lt;strong&gt;Best Practice:&lt;/strong&gt; Keep struct sizes minimal to optimize gas usage.&lt;/p&gt;




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

&lt;p&gt;We covered essential Solidity concepts like loops, events, arrays, and structs. These are fundamental for writing more structured and efficient smart contracts.&lt;/p&gt;

&lt;p&gt;Let me know if you have any questions, comments, or feedback! Would love to help you out! 😊&lt;/p&gt;

</description>
      <category>web</category>
      <category>web3</category>
      <category>javascript</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Solidity Crash Course - Part 4: Comments, Data Types, If-else, Interface</title>
      <dc:creator>Muhammad Ayaz</dc:creator>
      <pubDate>Sat, 01 Feb 2025 13:15:18 +0000</pubDate>
      <link>https://dev.to/ayaz/solidity-crash-course-part-4-comments-data-types-if-else-interface-31hd</link>
      <guid>https://dev.to/ayaz/solidity-crash-course-part-4-comments-data-types-if-else-interface-31hd</guid>
      <description>&lt;h1&gt;
  
  
  Solidity Crash Course - Part 04 🚀
&lt;/h1&gt;

&lt;p&gt;Welcome to Part 04 of our Solidity Crash Course! In this section, we will cover essential Solidity concepts, including comments, data types, the classic "Hello World" contract, conditional statements, and interfaces. Let's dive in! 🎉&lt;/p&gt;




&lt;h2&gt;
  
  
  📝 Solidity - Comments
&lt;/h2&gt;

&lt;p&gt;Comments are essential in programming to make your code more readable and maintainable. Solidity supports two types of comments:&lt;/p&gt;

&lt;h3&gt;
  
  
  📌 Single-line comments
&lt;/h3&gt;

&lt;p&gt;Use &lt;code&gt;//&lt;/code&gt; to write a single-line comment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// This is a single-line comment
uint public myNumber = 10; // Variable declaration
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📌 Multi-line comments
&lt;/h3&gt;

&lt;p&gt;Use &lt;code&gt;/* ... */&lt;/code&gt; for multi-line comments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*
This is a multi-line comment.
It can span multiple lines.
*/
contract MyContract {
    // Your code here
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why use comments?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Explain complex logic.&lt;/li&gt;
&lt;li&gt;Improve code readability.&lt;/li&gt;
&lt;li&gt;Help future developers understand the purpose of the code.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔢 Solidity - Data Types
&lt;/h2&gt;

&lt;p&gt;Solidity provides various data types to store different types of information.&lt;/p&gt;

&lt;h3&gt;
  
  
  📌 Integer Types (uint, int)
&lt;/h3&gt;

&lt;p&gt;Used for storing numbers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;uint256 public positiveNumber = 100; // Unsigned integer (0 and above)
int256 public negativeNumber = -50;  // Signed integer (can be negative)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📌 Boolean
&lt;/h3&gt;

&lt;p&gt;Stores &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt; values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bool public isActive = true;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📌 Address
&lt;/h3&gt;

&lt;p&gt;Stores Ethereum addresses.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;address public owner = msg.sender; // Stores the address of the contract deployer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📌 String
&lt;/h3&gt;

&lt;p&gt;Used for storing text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;string public message = "Hello, Blockchain!";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  📌 Arrays
&lt;/h3&gt;

&lt;p&gt;Stores multiple values of the same type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;uint[] public numbers = [1, 2, 3, 4, 5];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Best Use Cases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integers for calculations.&lt;/li&gt;
&lt;li&gt;Booleans for conditional logic.&lt;/li&gt;
&lt;li&gt;Addresses for storing Ethereum users.&lt;/li&gt;
&lt;li&gt;Strings for storing messages.&lt;/li&gt;
&lt;li&gt;Arrays for lists of data.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔄 Solidity - if-else
&lt;/h2&gt;

&lt;p&gt;Conditional statements help in decision-making.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contract ConditionCheck {
    function checkNumber(uint _num) public pure returns (string memory) {
        if (_num &amp;gt; 10) {
            return "Greater than 10";
        } else if (_num == 10) {
            return "Equal to 10";
        } else {
            return "Less than 10";
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Best Use Cases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Validating inputs.&lt;/li&gt;
&lt;li&gt;Implementing game rules.&lt;/li&gt;
&lt;li&gt;Controlling smart contract logic.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔌 Solidity - Interface
&lt;/h2&gt;

&lt;p&gt;Interfaces allow interaction with other contracts without accessing their full code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;interface IExample {
    function getValue() external view returns (uint);
}

contract Caller {
    function fetchValue(address _contract) public view returns (uint) {
        return IExample(_contract).getValue();
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why use interfaces?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enables modularity.&lt;/li&gt;
&lt;li&gt;Allows interaction with external contracts.&lt;/li&gt;
&lt;li&gt;Reduces dependency on contract implementation.&lt;/li&gt;
&lt;/ul&gt;




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

&lt;p&gt;In this part, we covered:&lt;br&gt;
✅ Comments to improve code readability.&lt;br&gt;
✅ Data types to store values.&lt;br&gt;
✅ If-else for decision-making.&lt;br&gt;
✅ Interfaces for interacting with other contracts.&lt;/p&gt;

&lt;p&gt;Stay tuned for Part 05! 🚀&lt;/p&gt;

&lt;p&gt;Let me know if you have any questions, comments or feedback!&lt;/p&gt;

&lt;p&gt;Would love to help you out!&lt;/p&gt;

</description>
      <category>web3</category>
      <category>javascript</category>
      <category>web</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Solidity Crash Course - Part 03 : Variables, Scopes, Abstract contracts</title>
      <dc:creator>Muhammad Ayaz</dc:creator>
      <pubDate>Sat, 01 Feb 2025 12:46:23 +0000</pubDate>
      <link>https://dev.to/ayaz/solidity-crash-course-part-03-variables-scopes-abstract-contracts-4mlp</link>
      <guid>https://dev.to/ayaz/solidity-crash-course-part-03-variables-scopes-abstract-contracts-4mlp</guid>
      <description>&lt;h2&gt;
  
  
  Solidity Crash Course - Part 03 🚀
&lt;/h2&gt;

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

&lt;p&gt;Welcome back to our Solidity crash course! In this part, we’ll explore &lt;strong&gt;variables, variable scopes, and abstract contracts&lt;/strong&gt;. Understanding these concepts will help you write more efficient and secure smart contracts. Let’s dive in! 😃&lt;/p&gt;




&lt;h2&gt;
  
  
  Solidity - Variables 📌
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What are Variables?
&lt;/h3&gt;

&lt;p&gt;Variables in Solidity are used to store data on the blockchain or within a smart contract’s execution context. Solidity provides different types of variables to handle various data efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example of Variables
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract VariablesExample {
    uint256 public myNumber = 42; // State variable
    string public myText = "Hello, Solidity!";
    bool public isActive = true;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why do we need variables?
&lt;/h3&gt;

&lt;p&gt;🔹 &lt;strong&gt;Store information&lt;/strong&gt; like user balances, contract state, or configurations.&lt;br&gt;
🔹 &lt;strong&gt;Improve code reusability&lt;/strong&gt; by using values dynamically instead of hardcoding.&lt;br&gt;
🔹 &lt;strong&gt;Enable contract interactions&lt;/strong&gt; by letting users modify and retrieve stored data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Best Use Case
&lt;/h3&gt;

&lt;p&gt;Use variables to store important contract data like &lt;strong&gt;token balances, user addresses, or contract states&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Solidity - Variable Scopes 🌍
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is Variable Scope?
&lt;/h3&gt;

&lt;p&gt;Variable scope determines where a variable can be accessed within a contract. Solidity has three main types of variable scopes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;State Variables&lt;/strong&gt; – Stored permanently on the blockchain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local Variables&lt;/strong&gt; – Exist only within a function and disappear after execution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global Variables&lt;/strong&gt; – Provide blockchain-related information (e.g., sender address, block timestamp).&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Example of Variable Scopes
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract ScopeExample {
    uint256 public stateVar = 100; // State Variable

    function localExample() public pure returns (uint256) {
        uint256 localVar = 50; // Local Variable
        return localVar;
    }

    function globalExample() public view returns (address) {
        return msg.sender; // Global Variable
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why do we need variable scopes?
&lt;/h3&gt;

&lt;p&gt;🔹 &lt;strong&gt;Security &amp;amp; Optimization&lt;/strong&gt; – Limiting access to variables prevents accidental or malicious modifications.&lt;br&gt;
🔹 &lt;strong&gt;Gas Efficiency&lt;/strong&gt; – Local variables use less gas than state variables since they are not stored on-chain.&lt;br&gt;
🔹 &lt;strong&gt;Better Code Structure&lt;/strong&gt; – Proper scoping improves code readability and maintainability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Best Use Case
&lt;/h3&gt;

&lt;p&gt;Use &lt;strong&gt;state variables&lt;/strong&gt; for permanent data storage, &lt;strong&gt;local variables&lt;/strong&gt; for temporary calculations, and &lt;strong&gt;global variables&lt;/strong&gt; for retrieving blockchain-specific details.&lt;/p&gt;




&lt;h2&gt;
  
  
  Solidity - Abstract Contracts 🎭
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is an Abstract Contract?
&lt;/h3&gt;

&lt;p&gt;An abstract contract is a contract that contains at least one function without an implementation. It &lt;strong&gt;cannot be deployed on its own&lt;/strong&gt; but acts as a blueprint for other contracts to inherit from.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example of an Abstract Contract
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

abstract contract Animal {
    function makeSound() public virtual returns (string memory);
}

contract Dog is Animal {
    function makeSound() public pure override returns (string memory) {
        return "Woof!";
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why do we need abstract contracts?
&lt;/h3&gt;

&lt;p&gt;🔹 &lt;strong&gt;Code Reusability&lt;/strong&gt; – Define a common structure for multiple contracts.&lt;br&gt;
🔹 &lt;strong&gt;Enforcement of Standards&lt;/strong&gt; – Ensures child contracts implement necessary functions.&lt;br&gt;
🔹 &lt;strong&gt;Better Organization&lt;/strong&gt; – Keeps smart contract development modular and clean.&lt;/p&gt;

&lt;h3&gt;
  
  
  Best Use Case
&lt;/h3&gt;

&lt;p&gt;Use abstract contracts when &lt;strong&gt;you want different contracts to follow a common interface&lt;/strong&gt; but allow them to implement their own logic.&lt;/p&gt;




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

&lt;p&gt;In this part, we covered:&lt;br&gt;
✅ Variables and how they store data.&lt;br&gt;
✅ Variable scopes and their importance.&lt;br&gt;
✅ Abstract contracts for defining contract templates.&lt;/p&gt;

&lt;p&gt;Stay tuned for more Solidity learning! 🚀&lt;/p&gt;

</description>
      <category>web3</category>
      <category>javascript</category>
      <category>web</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Solidity Crash Course - Part 02: Smart Contracts</title>
      <dc:creator>Muhammad Ayaz</dc:creator>
      <pubDate>Wed, 29 Jan 2025 13:46:19 +0000</pubDate>
      <link>https://dev.to/ayaz/solidity-crash-course-part-02-2f2l</link>
      <guid>https://dev.to/ayaz/solidity-crash-course-part-02-2f2l</guid>
      <description>&lt;h1&gt;
  
  
  Solidity Crash Course - Part 02
&lt;/h1&gt;

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

&lt;p&gt;Solidity is a high-level programming language used for writing smart contracts on the Ethereum blockchain. It is influenced by JavaScript, Python, and C++. In this part of the crash course, we will cover the basic syntax of Solidity contracts and how to write a smart contract.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to Compile your Code
&lt;/h2&gt;

&lt;p&gt;For compiling, easiest way is to goto &lt;a href="https://remix.ethereum.org/" rel="noopener noreferrer"&gt;Remix IDE&lt;/a&gt;, and paste your code and compile it. It comes with build in features for compiling and other useful tools. It also has templates if you want to experiment with different smart contracts.&lt;/p&gt;




&lt;h2&gt;
  
  
  Solidity - Contract Syntax
&lt;/h2&gt;

&lt;p&gt;A Solidity contract is a collection of code (functions) and data (state) that resides at a specific address on the Ethereum blockchain. Every Solidity contract starts with a version pragma, which specifies the compiler version.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Basic Structure of a Solidity Contract
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract MyFirstContract {
    // State variables
    uint public myNumber;
    string public myString;

    // Constructor - Runs only once when the contract is deployed
    constructor(uint _myNumber, string memory _myString) {
        myNumber = _myNumber;
        myString = _myString;
    }

    // Function to update number
    function setNumber(uint _newNumber) public {
        myNumber = _newNumber;
    }

    // Function to update string
    function setString(string memory _newString) public {
        myString = _newString;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Breakdown of Code
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;SPDX-License-Identifier&lt;/strong&gt; - This specifies the license for the contract.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pragma directive&lt;/strong&gt; - It ensures that the contract compiles with Solidity version 0.8.0 or later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contract declaration&lt;/strong&gt; - The &lt;code&gt;contract MyFirstContract {}&lt;/code&gt; defines the contract.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State Variables&lt;/strong&gt; - &lt;code&gt;uint&lt;/code&gt; and &lt;code&gt;string&lt;/code&gt; variables store persistent data on the blockchain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Constructor&lt;/strong&gt; - Initializes the contract's state when deployed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public Functions&lt;/strong&gt; - Functions &lt;code&gt;setNumber&lt;/code&gt; and &lt;code&gt;setString&lt;/code&gt; modify the contract's state.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Solidity - Smart Contract
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;smart contract&lt;/strong&gt; is a self-executing contract with predefined rules. Once deployed, it interacts with users and other contracts.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Writing a Simple Smart Contract
&lt;/h3&gt;

&lt;p&gt;Below is an example of a smart contract that allows users to store and retrieve their favorite number.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract FavoriteNumber {
    uint private favoriteNumber;

    // Event to notify when a number is changed
    event NumberUpdated(uint newNumber);

    // Function to set favorite number
    function setFavoriteNumber(uint _number) public {
        favoriteNumber = _number;
        emit NumberUpdated(_number);
    }

    // Function to get favorite number
    function getFavoriteNumber() public view returns (uint) {
        return favoriteNumber;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Explanation
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Events&lt;/strong&gt; - Used to log contract interactions on the blockchain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public Function &lt;code&gt;setFavoriteNumber&lt;/code&gt;&lt;/strong&gt; - Allows users to store a number.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;View Function &lt;code&gt;getFavoriteNumber&lt;/code&gt;&lt;/strong&gt; - Retrieves stored number without modifying the blockchain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Emit Statement&lt;/strong&gt; - Logs an event when the number is updated.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Deploying the Contract
&lt;/h2&gt;

&lt;p&gt;To deploy the contract, you can use &lt;strong&gt;Remix IDE&lt;/strong&gt; or &lt;strong&gt;Hardhat&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploying Using Remix IDE
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="https://remix.ethereum.org/" rel="noopener noreferrer"&gt;Remix IDE&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Copy and paste the Solidity contract into a new file (&lt;code&gt;FavoriteNumber.sol&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Compile the contract using the Solidity compiler.&lt;/li&gt;
&lt;li&gt;Deploy it using the Injected Web3 environment (MetaMask required).&lt;/li&gt;
&lt;li&gt;Interact with the contract using the deployed functions.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  If you need any help with deployment, let me know!
&lt;/h3&gt;




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

&lt;p&gt;In this part, we covered the basic Solidity contract syntax and created a simple smart contract.&lt;/p&gt;

&lt;p&gt;Stay tuned for Part 03!&lt;/p&gt;

</description>
      <category>web3</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Solidity Crash Course - Part 1: Basics and Pre Requisite</title>
      <dc:creator>Muhammad Ayaz</dc:creator>
      <pubDate>Wed, 29 Jan 2025 11:13:02 +0000</pubDate>
      <link>https://dev.to/ayaz/solidity-crash-course-part-1-basics-and-pre-requisite-1ghj</link>
      <guid>https://dev.to/ayaz/solidity-crash-course-part-1-basics-and-pre-requisite-1ghj</guid>
      <description>&lt;h2&gt;
  
  
  Solidity Crash Course - Part 1: Basics
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;🚀 Welcome to Part 1 of the Solidity Crash Course!&lt;/strong&gt; This guide covers the fundamentals of Solidity, Blockchain, Transactions, Gas, and the Ethereum Virtual Machine (EVM).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  📌 What is Blockchain?
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;blockchain&lt;/strong&gt; is a decentralized, immutable ledger that records transactions securely. It consists of blocks, each containing a list of transactions, linked together to form a chain.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔹 Key Features of Blockchain:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Decentralization&lt;/strong&gt; → No central authority controls it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Immutability&lt;/strong&gt; → Transactions cannot be altered once recorded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transparency&lt;/strong&gt; → Anyone can verify transactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt; → Cryptographic techniques ensure data integrity.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  💳 Transactions in Blockchain
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;transaction&lt;/strong&gt; is a transfer of value or data on the blockchain. In Ethereum, transactions can be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ether Transfers&lt;/strong&gt; → Sending ETH between accounts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contract Interactions&lt;/strong&gt; → Calling functions in smart contracts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ✨ Example: Basic Transaction Structure
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"from"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0xSenderAddress"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"to"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0xReceiverAddress"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1000000000000000000"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;ETH&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Wei&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"gas"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"21000"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"gasPrice"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"5000000000"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔍 Transaction Components:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;From &amp;amp; To&lt;/strong&gt; → Sender and recipient addresses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Value&lt;/strong&gt; → Amount of Ether sent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gas &amp;amp; Gas Price&lt;/strong&gt; → Cost of execution.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ⛽ Understanding Gas in Ethereum
&lt;/h2&gt;

&lt;p&gt;Ethereum requires &lt;strong&gt;gas&lt;/strong&gt; to execute transactions and smart contracts. Gas is a measure of computational effort.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔥 Why Gas is Important:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Prevents spam&lt;/strong&gt; → Users must pay to use the network.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compensates miners&lt;/strong&gt; → Incentivizes validation of transactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manages network load&lt;/strong&gt; → More complex operations require more gas.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🏷️ Example: Estimating Gas
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract GasExample {
    uint256 public value;

    function setValue(uint256 _value) public {
        value = _value; // Simple operation → Low gas cost
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🖥️ Ethereum Virtual Machine (EVM) Basics
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Ethereum Virtual Machine (EVM)&lt;/strong&gt; is the runtime environment for executing smart contracts. It ensures security and decentralization.&lt;/p&gt;

&lt;h3&gt;
  
  
  🛠 Key Features of EVM:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Isolation&lt;/strong&gt; → Contracts run independently from each other.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State Management&lt;/strong&gt; → Keeps track of all accounts and balances.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart Contract Execution&lt;/strong&gt; → Runs Solidity bytecode efficiently.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🎯 Summary
&lt;/h2&gt;

&lt;p&gt;✅ Blockchain is a &lt;strong&gt;decentralized ledger&lt;/strong&gt; for recording transactions.&lt;br&gt;
✅ Transactions involve &lt;strong&gt;sending ETH&lt;/strong&gt; or &lt;strong&gt;calling smart contracts&lt;/strong&gt;.&lt;br&gt;
✅ Gas is used to &lt;strong&gt;pay for computation and secure the network&lt;/strong&gt;.&lt;br&gt;
✅ EVM enables &lt;strong&gt;smart contract execution&lt;/strong&gt; in a secure environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔥 Next Steps
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;Part #2&lt;/strong&gt;, we’ll cover &lt;strong&gt;Smart Contracts&lt;/strong&gt;. Stay tuned! 🚀&lt;/p&gt;




&lt;p&gt;💬 &lt;strong&gt;Found this helpful? Drop a comment and share your first transaction experience!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>solidity</category>
      <category>web3</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Making forms easier with react-hook-form</title>
      <dc:creator>Muhammad Ayaz</dc:creator>
      <pubDate>Sun, 02 Jan 2022 03:55:34 +0000</pubDate>
      <link>https://dev.to/ayaz/making-forms-easier-with-react-hook-form-o49</link>
      <guid>https://dev.to/ayaz/making-forms-easier-with-react-hook-form-o49</guid>
      <description>&lt;p&gt;In this article, we will see how we can improve our developer experience and time while working with forms by using &lt;a href="https://react-hook-form.com/" rel="noopener noreferrer"&gt;react-hook-form&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There are many libraries that facilitate working with forms making it easier to write and validate inputs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { register, handleSubmit, watch, formState: { errors } } = useForm();

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

&lt;/div&gt;



&lt;p&gt;In order to use it, we have to call useForm hook. This will give properties that can we use in our code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;register&lt;/strong&gt; will register your input element for validation and management&lt;br&gt;
&lt;strong&gt;handleSubmit&lt;/strong&gt; will handle your form submission&lt;br&gt;
&lt;strong&gt;watch&lt;/strong&gt; will constantly watch an element change&lt;br&gt;
&lt;strong&gt;formState&lt;/strong&gt; will give you the state of the form&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form onSubmit={handleSubmit(onSubmit)}&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;handleSubmit&lt;/strong&gt; will submit your form. Before submitting your form it will check for errors. If errors are found it will not proceed until all of the errors have been resolved.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;input placeholder="Jhon Doe" {...register('name')} /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have defined the input element and registered it as &lt;strong&gt;name&lt;/strong&gt; for validation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;input
          placeholder="25"
          {...register('age', { required: true })}
          type="number"
        /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With registering we have also applied validation that this input is required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;input
          type="number"
          {...register('experience', { min: 4 })}
          placeholder="4"
        /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;input will not accept values that are under 4&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;input
          type="number"
          {...register('experience', { max: 4 })}
          placeholder="4"
        /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly, input will not accept values above 4&lt;/p&gt;

&lt;p&gt;Suppose if you want to limit user for text length, you would do by&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;textarea rows="4" cols="20" {...register('bio', {
          maxLength: 200
        })}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It will limit users to a maximum of 200 characters&lt;/p&gt;

&lt;p&gt;Ok! Now we know how validation works but what is &lt;strong&gt;watch&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;watch&lt;/em&gt; will constantly check for input values&lt;br&gt;
Suppose if you want to monitor textarea in real-time, you might need to watch it and inform users that they have entered a certain words.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  let bio = watch('bio');
  console.log(bio);

  if (bio &amp;amp;&amp;amp; bio.includes('ice')) {
    alert('You have written ice');
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;.includes&lt;/em&gt; is a method on string. It will check if characters are involved in string&lt;/p&gt;

&lt;p&gt;In order to inform users about the errors, we would have to refer to the errors object.&lt;/p&gt;

&lt;p&gt;Let's recall&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div&amp;gt;
        &amp;lt;label htmlFor="bio"&amp;gt;Bio&amp;lt;/label&amp;gt;
        &amp;lt;br /&amp;gt;
        &amp;lt;textarea
          rows="4"
          cols="20"
          {...register('bio', {
            maxLength: 30,
          })}
        /&amp;gt;
        {errors.bio &amp;amp;&amp;amp; &amp;lt;h4&amp;gt;Your bio have exceeded beyond 30 characters&amp;lt;/h4&amp;gt;}
      &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the maximum length of textarea exceeds 30 characters, it will give an error.&lt;/p&gt;

&lt;p&gt;I hope you liked this article, if you have any questions/feedback feel free to ask me!&lt;/p&gt;

&lt;p&gt;You can find the code here!&lt;br&gt;
Code: &lt;a href="https://stackblitz.com/edit/react-mpegjv?file=src/App.js" rel="noopener noreferrer"&gt;https://stackblitz.com/edit/react-mpegjv?file=src/App.js&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>react</category>
    </item>
  </channel>
</rss>
