<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: MihaiHng</title>
    <description>The latest articles on Forem by MihaiHng (@mihaihng).</description>
    <link>https://forem.com/mihaihng</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%2F1591847%2Fb8ca609c-08b0-4337-8e4b-19e1db09c504.png</url>
      <title>Forem: MihaiHng</title>
      <link>https://forem.com/mihaihng</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mihaihng"/>
    <language>en</language>
    <item>
      <title>Ethereum-Solidity Quiz Q32: What transaction types are used in Ethereum?</title>
      <dc:creator>MihaiHng</dc:creator>
      <pubDate>Sat, 21 Feb 2026 12:57:19 +0000</pubDate>
      <link>https://forem.com/mihaihng/ethereum-solidity-quiz-q32-what-transaction-types-are-used-in-ethereum-ja4</link>
      <guid>https://forem.com/mihaihng/ethereum-solidity-quiz-q32-what-transaction-types-are-used-in-ethereum-ja4</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;────────────────────────────────────────────────────────────────────
                         TRANSACTION TYPES                                    
────────────────────────────────────────────────────────────────────

1. CREATE     - Deploy contract (address depends on deployer + nonce)
2. CREATE2    - Deploy contract (address is deterministic/predictable)
3. CALL       - Call a function on existing contract
4. DELEGATECALL - Call using caller's storage (used by proxies internally)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Transaction Types Explained
&lt;/h2&gt;

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



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Regular contract deployment
new MyContract(arg1, arg2);
json{
  "transactionType": "CREATE",
  "to": null,  // ◄── null means contract creation
  "contractAddress": "0x..."
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. CREATE2
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Deterministic deployment via factory
// Foundry does this automatically for libraries
json{
  "transactionType": "CREATE2",
  "to": "0x4e59b448...",  // ◄── Factory address
  "contractAddress": "0x..."
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Function call on existing contract
provider.setStablecoin(usdcAddress);
json{
  "transactionType": "CALL",
  "to": "0xa729b836...",  // ◄── Contract being called
  "function": "setStablecoin(address)",
  "arguments": ["0x1c7D4B19..."]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. DELEGATECALL (Internal, not in broadcast)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Used by proxies - executes code in caller's context
// You won't see this in transactions, it's internal
proxy.delegatecall(implementation, data);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ethereum</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Ethereum-Solidity Quiz Q31: What is the difference between CREATE and CREATE2 transaction types?</title>
      <dc:creator>MihaiHng</dc:creator>
      <pubDate>Thu, 19 Feb 2026 16:12:34 +0000</pubDate>
      <link>https://forem.com/mihaihng/ethereum-solidity-quiz-q31-what-is-the-difference-between-create-and-create2-transaction-types-1lk7</link>
      <guid>https://forem.com/mihaihng/ethereum-solidity-quiz-q31-what-is-the-difference-between-create-and-create2-transaction-types-1lk7</guid>
      <description>&lt;h2&gt;
  
  
  CREATE (Regular Deployment)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Address = keccak256(deployer, nonce)
new CreateContract(owner);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





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

Example:
  Deployer: 0x4f98e7507c578e2341B5b874E9a7C910aA8Db3e1
  Nonce: 234
  ──────────────────────────────────────────────────────
  Result: 0xa729B8363b472E8A3f20eF4E6210Cdd70C0cF5aB

Characteristics:
  ✅ Simple, default behavior
  ❌ Address changes if nonce changes
  ❌ Can't predict address before deployment
  ❌ Different address on each chain (different nonces)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  CREATE2 (Deterministic Deployment)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Address = keccak256(0xff, factory, salt, initCodeHash)
// Used automatically by Foundry for libraries
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





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

Example:
  Factory: 0x4f98e7507c578e2341B5b874E9a7C910aA8Db3e1 (Deterministic Deployer)
  Salt: 0x0000...0000
  InitCode: &amp;lt;bytecode of Library&amp;gt;
  ──────────────────────────────────────────────────────
  Result: 0xEdA41181EAB196E739140876C5fF35e2DFde188a

Characteristics:
  ✅ Same address on ALL chains (if same salt + bytecode)
  ✅ Predictable before deployment
  ✅ Great for libraries, factories, cross-chain deploys
  ❌ Slightly more complex
  ❌ Requires a factory contract
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Visual Comparison
&lt;/h2&gt;



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

Deployer (0x4f98...) ──► Deploy Contract
         │
         │  address = hash(deployer, nonce)
         │
         ▼
    Ethereum: 0xAAA...  (nonce = 100)
    Base:     0xBBB...  (nonce = 50)   ◄── Different addresses!
    Polygon:  0xCCC...  (nonce = 75)


CREATE2:
─────────────────────────────────────────────────────────────────

Deployer ──► Factory (0x4e59b448...) ──► Deploy Contract
                    │
                    │  address = hash(0xff, factory, salt, bytecodeHash)
                    │
                    ▼
    Ethereum: 0xEdA411...
    Base:     0xEdA411...  ◄── SAME address everywhere!
    Polygon:  0xEdA411...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ethereum</category>
      <category>solidity</category>
      <category>web3</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Ethereum-Solidity Quiz Q30: What does keccak256() do?</title>
      <dc:creator>MihaiHng</dc:creator>
      <pubDate>Sun, 08 Feb 2026 19:09:55 +0000</pubDate>
      <link>https://forem.com/mihaihng/ethereum-solidity-quiz-q29-what-does-keccak256-do-1mof</link>
      <guid>https://forem.com/mihaihng/ethereum-solidity-quiz-q29-what-does-keccak256-do-1mof</guid>
      <description>&lt;p&gt;&lt;strong&gt;keccak256()&lt;/strong&gt; is a cryptographic hash function, used for everything from generating addresses to verifying transaction integrity.&lt;/p&gt;

&lt;p&gt;In short, you feed it any amount of data, and it generates a unique, fixed-size 32-byte "fingerprint" that can never be reversed.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Characteristics
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Deterministic:&lt;/strong&gt; The same input will always produce the exact same hash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fixed Output:&lt;/strong&gt; No matter if you hash a single number or a 1GB file, the output is always 32 bytes (bytes32).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One-Way:&lt;/strong&gt; It is computationally impossible to reconstruct the original data from the hash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Collision Resistant:&lt;/strong&gt; It is practically impossible to find two different inputs that produce the same hash.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Practical Use Cases in Your Smart Contracts
&lt;/h2&gt;

&lt;h3&gt;
  
  
  A. Comparing Strings
&lt;/h3&gt;

&lt;p&gt;Solidity cannot compare strings directly using ==. Instead, we hash them and compare the results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function compare(string memory _a, string memory _b) public pure returns (bool) {
    return keccak256(abi.encodePacked(_a)) == keccak256(abi.encodePacked(_b));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  B. Creating Unique Identifiers
&lt;/h3&gt;

&lt;p&gt;You can combine multiple variables (like an address and a timestamp) to create a unique ID for a transaction or a user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bytes32 uniqueId = keccak256(abi.encodePacked(msg.sender, block.timestamp));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  C. Computing Function Selectors
&lt;/h3&gt;

&lt;p&gt;Ethereum uses keccak256 to identify which function to call. It takes the first 4 bytes of the hash of the function signature (e.g., transfer(address,uint256)).&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Important: abi.encodePacked vs abi.encode
&lt;/h2&gt;

&lt;p&gt;The keccak256 function only accepts a single bytes argument. To hash multiple values, you must "wrap" them first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;abi.encodePacked(...):&lt;/strong&gt; Most common. It’s cheaper on gas because it doesn't add padding.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;abi.encode(...):&lt;/strong&gt; Safer for dynamic types (like two strings). &lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>web3</category>
      <category>solidity</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Ethereum-Solidity Quiz Q29: What is an Overflow/Underflow?</title>
      <dc:creator>MihaiHng</dc:creator>
      <pubDate>Sat, 07 Feb 2026 17:41:48 +0000</pubDate>
      <link>https://forem.com/mihaihng/ethereum-solidity-quiz-q29-what-is-overflowunderflow-505a</link>
      <guid>https://forem.com/mihaihng/ethereum-solidity-quiz-q29-what-is-overflowunderflow-505a</guid>
      <description>&lt;p&gt;&lt;strong&gt;Overflow&lt;/strong&gt; and &lt;strong&gt;Underflow&lt;/strong&gt; are arithmetic errors that occur when a calculation results in a number that is outside the fixed range of the variable's data type.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Explanation
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Term&lt;/th&gt;
&lt;th&gt;What happens&lt;/th&gt;
&lt;th&gt;Example (uint8: range 0–255)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Overflow&lt;/td&gt;
&lt;td&gt;You exceed the maximum value and the number "wraps" to the bottom.&lt;/td&gt;
&lt;td&gt;255 + 1 --&amp;gt; 0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Underflow&lt;/td&gt;
&lt;td&gt;You go below the minimum value and the number "jumps" to the top.&lt;/td&gt;
&lt;td&gt;0 - 1 --&amp;gt; 255&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  2. Solidity 0.8.0
&lt;/h2&gt;

&lt;p&gt;Before version 0.8.0, Solidity did not check for these errors. You had to use a library called SafeMath to prevent them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Since 0.8.0:&lt;/strong&gt; The compiler includes built-in checks. If an overflow or underflow occurs, the transaction reverts (fails) automatically with a "Panic" error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The unchecked Block:&lt;/strong&gt; Sometimes, you know a calculation is safe and you want to save gas by skipping the check. You can wrap that code in an unchecked block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// This will NOT revert; it will wrap around to 0
unchecked {
    uint8 x = 255;
    x++; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Prevention
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Solidity &amp;gt;= 0.8.0:&lt;/strong&gt; This is the easiest and most important step.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Typecasting Caution:&lt;/strong&gt; Even in 0.8.0, casting a large type to a small type (e.g., uint256 to uint8) can still cause "silent" wrapping without a revert. Always check the range before casting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use uint256:&lt;/strong&gt; Unless you have a specific reason (like fitting data into a single storage slot/32 bytes), stick to uint256. It has such a massive range (2^256 - 1) that it is practically impossible to overflow in most financial applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ethereum</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Ethereum-Solidity Quiz Q28: What is the difference between libraries, interfaces and abstracts?</title>
      <dc:creator>MihaiHng</dc:creator>
      <pubDate>Wed, 04 Feb 2026 15:54:21 +0000</pubDate>
      <link>https://forem.com/mihaihng/ethereum-solidity-quiz-q28-what-is-the-difference-between-libraries-interfaces-and-abstracts-dbe</link>
      <guid>https://forem.com/mihaihng/ethereum-solidity-quiz-q28-what-is-the-difference-between-libraries-interfaces-and-abstracts-dbe</guid>
      <description>&lt;h2&gt;
  
  
  1. Interfaces
&lt;/h2&gt;

&lt;p&gt;An interface defines what a contract must do, but provides zero implementation. It’s a architectural blueprint.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Properties:&lt;/strong&gt; no state variables, no constructor, and all functions must be external.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Interaction. You use interfaces to talk to other contracts (like calling balanceOf on a USDC contract).&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Abstract Contracts
&lt;/h2&gt;

&lt;p&gt;An abstract contract contains some logic but leaves other parts for the "child" contract to implement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Properties:&lt;/strong&gt; Can have state variables, internal functions with logic, and constructors. If at least one function is missing its body or marked virtual, the contract must be declared abstract and can not be deployed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Templates. You use this when you have a "base" design  that can be specialized later.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Libraries
&lt;/h2&gt;

&lt;p&gt;Libraries are stateless and intended to be reused. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Properties:&lt;/strong&gt; no state variables, cannot receive Ether, and cannot be destroyed. They are meant to perform operations on the data you pass to them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Utility functions. Think of the SafeERC20 or SafeMath libraries. They provide "helper" logic that many contracts can use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Comparison Table:
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Library&lt;/th&gt;
&lt;th&gt;Abstract&lt;/th&gt;
&lt;th&gt;Interface&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Can have state&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can have implementation&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can be instantiated&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can be inherited&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Must implement all functions&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;td&gt;❌ (only abstract ones)&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Function visibility&lt;/td&gt;
&lt;td&gt;internal/external&lt;/td&gt;
&lt;td&gt;Any&lt;/td&gt;
&lt;td&gt;external only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Used for&lt;/td&gt;
&lt;td&gt;Utility functions&lt;/td&gt;
&lt;td&gt;Shared implementation&lt;/td&gt;
&lt;td&gt;Defining standards&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>ethereum</category>
      <category>solidity</category>
      <category>blockchain</category>
      <category>web3</category>
    </item>
    <item>
      <title>Ethereum-Solidity Quiz Q27: How are Layer 2 networks making transactions fees cheaper?</title>
      <dc:creator>MihaiHng</dc:creator>
      <pubDate>Mon, 02 Feb 2026 14:26:57 +0000</pubDate>
      <link>https://forem.com/mihaihng/ethereum-solidity-quiz-q27-how-are-layer-2-networks-making-transactions-fees-cheaper-1llc</link>
      <guid>https://forem.com/mihaihng/ethereum-solidity-quiz-q27-how-are-layer-2-networks-making-transactions-fees-cheaper-1llc</guid>
      <description>&lt;p&gt;Layer 2 networks make transactions cheaper by changing the &lt;strong&gt;location&lt;/strong&gt; and &lt;strong&gt;density&lt;/strong&gt; of where computation happens.&lt;/p&gt;

&lt;p&gt;If we think of Ethereum (Layer 1) as a busy highway where every car pays a high tax, a Layer 2 is like a &lt;strong&gt;giant bus&lt;/strong&gt;. It collects hundreds of passengers (transactions), drives them down the highway, and splits the single high tax among everyone on board.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The Rollup Mechanism
&lt;/h2&gt;

&lt;p&gt;L2s use a technology called &lt;strong&gt;Rollups&lt;/strong&gt;. They "roll up" hundreds of transactions into a single batch.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Execution (Off-chain):&lt;/strong&gt; The actual computation (e.g., token swap) happens on the L2's own servers. This is very cheap because it doesn't require thousands of global nodes to agree simultaneously.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Settlement (On-chain):&lt;/strong&gt; Instead of sending every detail to Ethereum, the L2 sends only a &lt;strong&gt;highly compressed summary&lt;/strong&gt; of all those transactions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. How the Fee is Calculated on L2
&lt;/h2&gt;

&lt;p&gt;On a Layer 2, the fee consists of two parts:&lt;/p&gt;

&lt;h3&gt;
  
  
  A. The L2 Execution Fee
&lt;/h3&gt;

&lt;p&gt;This is the cost of running the transaction on the L2's own network.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; Extremely low (fractions of a cent).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why:&lt;/strong&gt; L2s are designed for high throughput and don't have the massive decentralization overhead of Ethereum.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  B. The L1 Security Fee
&lt;/h3&gt;

&lt;p&gt;This is the most expensive part. To stay secure, the L2 must post its transaction data back to Ethereum Layer 1 so that anyone can verify the state.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost:&lt;/strong&gt; This depends on the current gas price of Ethereum.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Efficiency:&lt;/strong&gt; Because the data for 500 transactions is compressed into one "blob" or batch, you only pay for &lt;strong&gt;1/500th&lt;/strong&gt; of the Ethereum block space.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. The "Blob" Revolution (EIP-4844)
&lt;/h2&gt;

&lt;p&gt;In 2024, Ethereum introduced &lt;strong&gt;"Blobs"&lt;/strong&gt; (Binary Large Objects). Before this, L2s had to store their data in a part of the Ethereum block called &lt;code&gt;calldata&lt;/code&gt;, which was very expensive.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Blobs&lt;/strong&gt; are like "sidecars" attached to a block. They are temporary and deleted after about 18 days.&lt;/li&gt;
&lt;li&gt;Because they don't stay on the blockchain forever, Ethereum charges a &lt;strong&gt;significantly lower fee&lt;/strong&gt; for Blobs.&lt;/li&gt;
&lt;li&gt;This update dropped L2 fees by &lt;strong&gt;90% or more&lt;/strong&gt;, making transactions cost as little as &lt;strong&gt;$0.01&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Security
&lt;/h2&gt;

&lt;p&gt;The risk with L2s is Centralization. Most L2s currently use a "Sequencer" (a single server) to order transactions. If that server goes down, the network pauses. &lt;/p&gt;

&lt;h2&gt;
  
  
  5. Summary
&lt;/h2&gt;

&lt;p&gt;From a systems perspective, L2s move the State Transition logic off-chain and only use Layer 1 as a Data Availability layer. By treating the most expensive resource (Ethereum block space) as a shared cost through compression and blobs, they achieve a 10x–100x reduction in fees without sacrificing the underlying security of the Ethereum mainnet.&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>solidity</category>
      <category>blockchain</category>
      <category>web3</category>
    </item>
    <item>
      <title>Ethereum-Solidity Quiz Q26: How is the base fee(used in calculating the total gas fee) calculated by Ethereum?</title>
      <dc:creator>MihaiHng</dc:creator>
      <pubDate>Tue, 27 Jan 2026 19:37:11 +0000</pubDate>
      <link>https://forem.com/mihaihng/ethereum-solidity-quiz-q26-how-is-the-base-feeused-in-calculating-the-total-gas-fee-calculated-2caf</link>
      <guid>https://forem.com/mihaihng/ethereum-solidity-quiz-q26-how-is-the-base-feeused-in-calculating-the-total-gas-fee-calculated-2caf</guid>
      <description>&lt;p&gt;In the current Ethereum system (introduced by &lt;strong&gt;EIP-1559&lt;/strong&gt;), the &lt;strong&gt;Base Fee&lt;/strong&gt; is not set by users or miners/validators, it is automatically calculated by the network’s protocol itself based on block space demand. It's like a dynamic congestion tax that updates every block (~ 12 seconds).&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The Target Capacity (50% Rule)
&lt;/h2&gt;

&lt;p&gt;Ethereum has a &lt;strong&gt;Target&lt;/strong&gt; size for each block, currently set at &lt;strong&gt;15 million gas&lt;/strong&gt;, with the &lt;strong&gt;Hard Limit&lt;/strong&gt; at &lt;strong&gt;30 million gas&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The protocol calculates the next Base Fee based on how full the current block is compared to that 15 million target:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If the block is &amp;gt; 50% full: The Base Fee increases for the next block (the network is busy).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the block is &amp;lt; 50% full: The Base Fee decreases for the next block (the network has idle capacity).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the block is exactly 50% full: The Base Fee remains the same.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. The Mathematical Formula
&lt;/h2&gt;

&lt;p&gt;The maximum the Base Fee can change between two consecutive blocks is 12.5%.&lt;/p&gt;

&lt;p&gt;The simplified logic for the next block's Base Fee is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;New Base Fee = Current Base Fee + [Current Base Fee × (Actual Gas Used - Target Gas) / Target Gas × 0.125]

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

&lt;/div&gt;



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

&lt;p&gt;&lt;strong&gt;Maximum Congestion:&lt;/strong&gt; If a block is 100% full (30M gas), the Base Fee increases by exactly 12.5% for the next block.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Empty Network:&lt;/strong&gt; If a block is 0% full (0 gas), the Base Fee decreases by exactly 12.5% for the next block.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. What happens to the Base Fee? (The Burn)
&lt;/h2&gt;

&lt;p&gt;One of the most important aspects of the Base Fee is that it is &lt;strong&gt;burned&lt;/strong&gt;. Before this update, all fees went to the miners/validators. &lt;/p&gt;

&lt;p&gt;Now, the Base Fee is removed from the total supply of ETH. Only the &lt;strong&gt;Priority Fee&lt;/strong&gt; (Tip) goes to the validator. This creates &lt;strong&gt;deflationary pressure&lt;/strong&gt; — when the network is extremely busy, Ethereum actually destroys more ETH than it creates.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Why this change?
&lt;/h2&gt;

&lt;p&gt;Before this calculation method was introduced, users had to "guess" the right price in a blind auction. If you guessed too low, the transaction sat pending for hours.&lt;/p&gt;

&lt;p&gt;With the algorithmic Base Fee:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Predictability:&lt;/strong&gt; You know exactly what the minimum price is to get into the next block.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Efficiency:&lt;/strong&gt; Wallets (like MetaMask) can automatically calculate the "correct" fee without you having to look at gas trackers constantly.&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>web3</category>
      <category>solidity</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Ethereum-Solidity Quiz Q25: What is gas in Ethereum?</title>
      <dc:creator>MihaiHng</dc:creator>
      <pubDate>Sun, 25 Jan 2026 18:44:24 +0000</pubDate>
      <link>https://forem.com/mihaihng/ethereum-solidity-quiz-q25-what-is-gas-in-ethereum-5cae</link>
      <guid>https://forem.com/mihaihng/ethereum-solidity-quiz-q25-what-is-gas-in-ethereum-5cae</guid>
      <description>&lt;p&gt;&lt;strong&gt;Gas&lt;/strong&gt; is the unit used to measure the amount of computational effort required to execute operations on the network.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Why does Gas exist?
&lt;/h2&gt;

&lt;p&gt;Because every transaction must be processed by thousands of nodes globally, &lt;strong&gt;Gas&lt;/strong&gt; serves two vital purposes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Preventing Spam&lt;/strong&gt;: It ensures that users can't clog the network with infinite loops or millions of useless transactions for free.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource Allocation&lt;/strong&gt;: It compensates miners/validators for the electricity and hardware power they use to secure the network.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. How the Price is Calculated
&lt;/h2&gt;

&lt;p&gt;Calculation formula:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Total Fee = Gas Units * Gas Price &lt;br&gt;
Gas Price = (Base Fee + Priority Fee)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://etherscan.io/gastracker" rel="noopener noreferrer"&gt;https://etherscan.io/gastracker&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gas Units&lt;/strong&gt;: The "amount of work." A simple transfer usually costs 21,000 units, while complex smart contracts (like swapping on Uniswap) cost much more.&lt;br&gt;
&lt;strong&gt;Base Fee&lt;/strong&gt;: The minimum price per unit to get into a block (this is set by the network and is burned).&lt;br&gt;
&lt;strong&gt;Priority Fee (Tip)&lt;/strong&gt;: An optional extra payment to validators to "skip the line" and get your transaction processed faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Gwei:
&lt;/h2&gt;

&lt;p&gt;Gas prices are denoted in Gwei, which is a tiny fraction of 1 Ether. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;1 Gwei = 0.000000001 ETH(10^-9ETH).&lt;/code&gt;&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>solidity</category>
      <category>blockchain</category>
      <category>web3</category>
    </item>
    <item>
      <title>Ethereum-Solidity Quiz Q24: What is the role of "0x" prefix in data representations?</title>
      <dc:creator>MihaiHng</dc:creator>
      <pubDate>Tue, 20 Jan 2026 12:36:33 +0000</pubDate>
      <link>https://forem.com/mihaihng/ethereum-solidity-quiz-q24-what-is-the-role-of-0x-prefix-in-data-representations-4amk</link>
      <guid>https://forem.com/mihaihng/ethereum-solidity-quiz-q24-what-is-the-role-of-0x-prefix-in-data-representations-4amk</guid>
      <description>&lt;p&gt;In computer science and implicitly in Ethereum and Solidity, the &lt;strong&gt;0x&lt;/strong&gt; prefix serves the fundamental purpose of signifying that the following data is in hexadecimal (base-16).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is it used?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Without a prefix, many hexadecimal numbers would be&lt;br&gt;
indistinguishable from decimal numbers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scenario: You see the number 80.&lt;/li&gt;
&lt;li&gt;Problem: Is this "eighty" (decimal) or is it 8 * 16^1 + 0 = 128 (hexadecimal)?&lt;/li&gt;
&lt;li&gt;Solution: By writing 0x80, the ambiguity is removed. The compiler immediately knows the base is 16.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Ethereum and Solidity &lt;strong&gt;0x&lt;/strong&gt; is used for different types of data like addresses, opcodes, encoded data and hashes.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Exception&lt;/strong&gt; is &lt;strong&gt;hex Strings&lt;/strong&gt;, where &lt;strong&gt;hex&lt;/strong&gt; is a special keyword  in Solidity for long strings of raw data. In this format, you do not use the 0x prefix inside the quotes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt; hex"..." or hex'...'&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Ethereum-Solidity Quiz Q23: What is C3 Linearization in smart contract inheritance?</title>
      <dc:creator>MihaiHng</dc:creator>
      <pubDate>Mon, 19 Jan 2026 11:19:42 +0000</pubDate>
      <link>https://forem.com/mihaihng/ethereum-solidity-quiz-q23-what-is-c3-linearization-in-smart-contract-inheritance-4336</link>
      <guid>https://forem.com/mihaihng/ethereum-solidity-quiz-q23-what-is-c3-linearization-in-smart-contract-inheritance-4336</guid>
      <description>&lt;p&gt;&lt;strong&gt;C3 linearization&lt;/strong&gt; is an algorithm that determines the order in which parent contracts are searched when a derived contract inherits from multiple parents. It's also called the &lt;strong&gt;Method Resolution Order (MRO)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It solves the &lt;strong&gt;Diamond Problem&lt;/strong&gt;, where a contract inherits from two parents that both inherit from the same grandparent. Without C3, the compiler wouldn't know which version of a shared function to execute.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Fundamental Rule
&lt;/h2&gt;

&lt;p&gt;The most important thing to remember for Solidity is the direction of inheritance - from "most base-like" to "most derived."&lt;/p&gt;

&lt;p&gt;In the declaration contract Child is A, B, &lt;strong&gt;B&lt;/strong&gt; is considered "more derived" than A. If both have the same function, the version in B will be checked first.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. How the Search Order Works
&lt;/h2&gt;

&lt;p&gt;When you call a function or use the &lt;strong&gt;super&lt;/strong&gt; keyword, Solidity follows a flattened list generated by the C3 algorithm. The search follows these steps:&lt;/p&gt;

&lt;p&gt;Start at the Child: Check if the function is defined in the current contract.&lt;/p&gt;

&lt;p&gt;Move Right-to-Left: Check the parent contracts in the order they were listed, starting from the right-most one.&lt;/p&gt;

&lt;p&gt;Go Up the Hierarchy: Move up to the grandparents only after all immediate parents have been checked.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example: The "Diamond" Chain
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contract A {
    function foo() public virtual { /* Logic A */ }
}

contract B is A {
    function foo() public virtual override { super.foo(); }
}

contract C is A {
    function foo() public virtual override { super.foo(); }
}

// Order: A (base) -&amp;gt; B -&amp;gt; C (most derived)
contract D is B, C {
    function foo() public override(B, C) {
        super.foo(); 
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Linearization of D is: [D, C, B, A]&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;super.foo() in D calls C.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;super.foo() in C calls B.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;super.foo() in B calls A.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;C3 linearization prevents contract A function being called twice.&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>web3</category>
      <category>solidity</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Ethereum-Solidity Quiz Q22: How are functions overridden using the "super" keyword?</title>
      <dc:creator>MihaiHng</dc:creator>
      <pubDate>Sat, 17 Jan 2026 16:13:38 +0000</pubDate>
      <link>https://forem.com/mihaihng/ethereum-solidity-quiz-q22-how-are-functions-overridden-using-the-super-keyword-3128</link>
      <guid>https://forem.com/mihaihng/ethereum-solidity-quiz-q22-how-are-functions-overridden-using-the-super-keyword-3128</guid>
      <description>&lt;p&gt;In Solidity, the &lt;strong&gt;super&lt;/strong&gt; keyword is used to access the immediate parent’s implementation of a function that has been overridden. Instead of completely replacing the parent's logic, &lt;strong&gt;super&lt;/strong&gt; allows  to extend it by adding to it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Extending Logic Example:
&lt;/h2&gt;

&lt;p&gt;When you override a function, the original version in the parent contract is hidden. Using &lt;strong&gt;super.functionName()&lt;/strong&gt; brings that logic back into your execution flow.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contract Parent {
    uint public count;
    function increment() public virtual {
        count += 1;
    }
}

contract Child is Parent {
    function increment() public override {
        super.increment(); // Calls Parent.increment() first
        count *= 2;        // Then add custom logic (multiply by 2)
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Super&lt;/strong&gt; vs. Direct Contract Calls
&lt;/h2&gt;

&lt;p&gt;You can also call a parent directly by name (e.g., A.foo()), but there is a major difference:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;super.foo()&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Follows the entire inheritance chain. &lt;/li&gt;
&lt;li&gt;Standard way to ensure all parent logic is executed only once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;A.foo()&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Calls only the specific contract A.
&lt;/li&gt;
&lt;li&gt;Used when you want to bypass the inheritance order and trigger a specific parent.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ethereum</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Ethereum-Solidity Quiz Q21: How does function overriding work in Solidity?</title>
      <dc:creator>MihaiHng</dc:creator>
      <pubDate>Fri, 16 Jan 2026 07:27:50 +0000</pubDate>
      <link>https://forem.com/mihaihng/ethereum-solidity-quiz-q21-how-does-function-overriding-work-in-solidity-3h46</link>
      <guid>https://forem.com/mihaihng/ethereum-solidity-quiz-q21-how-does-function-overriding-work-in-solidity-3h46</guid>
      <description>&lt;p&gt;Function overriding in Solidity is the process by which a child contract provides a new implementation for a function already defined in its parent contract.&lt;/p&gt;

&lt;p&gt;Since Solidity 0.6.0, this process is explicit and requires the use of two specific keywords(&lt;strong&gt;virtual &amp;amp; override&lt;/strong&gt;) to prevent accidental overrides and improve code readability.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Process
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In the Parent Contract: Use the &lt;strong&gt;virtual&lt;/strong&gt; keyword. This signals that the function is "open" for modification.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the Child Contract: Use the &lt;strong&gt;override&lt;/strong&gt; keyword. This signals that you are "intentionally" replacing the parent's logic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Both &lt;strong&gt;virtual &amp;amp; override&lt;/strong&gt; can be used in the same function in a multi level inheritance&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Example:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contract Parent {
    // Marked virtual to allow overriding
    function message() public virtual pure returns (string memory) {
        return "Hello from Parent";
    }
}

contract Child is Parent {
    // Marked override to redefine logic
    // Marked virtual to allow overriding
    function message() public virtual override pure returns (string memory) {
        return "Hello from Child";
    }
}

contract Grandchild is Child {
    // Marked override to redefine logic
    function message() public override pure returns (string memory) {
        return "Hello from Grandchild";
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Constraints:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Visibility - Function visibility must be the same or more restrictive when overriding&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;State - State mutability can change to be more restrictive (but not less)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Interfaces - Functions in an interface are implicitly virtual. You only need the override keyword in the implementation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Private - private functions cannot be virtual, so they can never be overridden.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Note:
&lt;/h2&gt;

&lt;p&gt;Modifiers can also be overridden like functions, but starting with Solidity 0.9.0 release this will be deprecated.&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>web3</category>
      <category>blockchain</category>
      <category>solidity</category>
    </item>
  </channel>
</rss>
