<?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: Mahima Thacker</title>
    <description>The latest articles on DEV Community by Mahima Thacker (@mahima_thacker).</description>
    <link>https://dev.to/mahima_thacker</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%2F2605656%2F57b2ab50-a45f-4f1d-997f-a58a2a31c986.jpeg</url>
      <title>DEV Community: Mahima Thacker</title>
      <link>https://dev.to/mahima_thacker</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mahima_thacker"/>
    <language>en</language>
    <item>
      <title>Are u still confused about how swapping works on Uniswap or other DEXs?</title>
      <dc:creator>Mahima Thacker</dc:creator>
      <pubDate>Sat, 29 Mar 2025 05:13:50 +0000</pubDate>
      <link>https://dev.to/mahima_thacker/are-u-still-confused-about-how-swapping-works-on-uniswap-or-other-dexs-4c18</link>
      <guid>https://dev.to/mahima_thacker/are-u-still-confused-about-how-swapping-works-on-uniswap-or-other-dexs-4c18</guid>
      <description>&lt;p&gt;Not anymore 💁‍♀️ &lt;br&gt;
This might seem long, but trust me it’s worth every scroll 😉 &lt;br&gt;
Let’s break it down in simple terms — no advanced math, no technical fluff.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1/ What is AMM?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An AMM (Automated Market Maker) is like a robot that lets you swap tokens without needing a buyer or seller.&lt;/li&gt;
&lt;li&gt;Instead of matching orders like an order book used in a centralised exchange. 
it uses a liquidity pool (a jar of tokens) and a formula to decide the price.
So, &lt;/li&gt;
&lt;li&gt;No order books&lt;/li&gt;
&lt;li&gt;No middlemen&lt;/li&gt;
&lt;li&gt;Just a smart contract doing the job &lt;/li&gt;
&lt;li&gt;The formula calculated the price -&amp;gt;X * Y = K &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2/ What’s in the Liquidity Pool?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each pool holds two tokens, say: Token 1 = ETH (e.g., 50 ETH)
Token 2 = DAI (e.g., 10,000 DAI)&lt;/li&gt;
&lt;li&gt;This pool is created by users (called liquidity providers) who deposit equal value of both tokens.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3/ The Magic Formula: X * Y = K&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;This is the core logic of how prices are determined.&lt;br&gt;
X = Amount of Token 1 (ETH)&lt;br&gt;
Y = Amount of Token 2 (DAI)&lt;br&gt;
K = Constant value that should never change&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As you trade, the values of X and Y shift, but K always remains the same. That’s what keeps everything balanced!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4/ Let’s Understand With an Example:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Before Trade:
ETH in pool = 50
DAI in pool = 10,000
Constant K = 50 * 10,000 = 500,000&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now let's say you want to buy 1 ETH using DAI.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After the Trade:
ETH left = 49 (because you took out 1 ETH)&lt;/li&gt;
&lt;li&gt;To maintain K = 500,000, the pool must now hold more DAI.
49 * Y = 500,000 
Y = 500,000 / 49 ≈ 10,204.08 DAI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the pool needs 10,204.08 DAI after your trade. That means you have to add ~204.08 DAI to buy 1 ETH &lt;/p&gt;

&lt;p&gt;That’s how price is automatically calculated — by using the formula, not a person 🫣 &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl1vnpwf7nykb4khiaweu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl1vnpwf7nykb4khiaweu.png" alt=" " width="800" height="813"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5/  Why Price Increases as You Trade?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;The more ETH you try to buy, the more DAI you must add to keep K constant.&lt;br&gt;
This makes ETH more expensive with each purchase. That’s slippage — and it’s normal in AMMs&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6/ Order Book vs AMM&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In an order book, trades are matched between buyers and sellers at the same price.&lt;br&gt;
In an AMM, the price is calculated automatically based on how much is in the pool&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7/ Final Takeaway&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You’re trading with math, not a person.&lt;/li&gt;
&lt;li&gt;The pool keeps everything balanced using X * Y = K.&lt;/li&gt;
&lt;li&gt;More buying = price goes up (and vice versa).&lt;/li&gt;
&lt;li&gt;No need for someone on the other side — you just interact with the 
pool! &lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Reentrancy Attacks - The Hidden Threat in Smart Contracts 😵‍💫</title>
      <dc:creator>Mahima Thacker</dc:creator>
      <pubDate>Mon, 03 Feb 2025 16:29:35 +0000</pubDate>
      <link>https://dev.to/mahima_thacker/reentrancy-attacks-the-hidden-threat-in-smart-contracts-2i5l</link>
      <guid>https://dev.to/mahima_thacker/reentrancy-attacks-the-hidden-threat-in-smart-contracts-2i5l</guid>
      <description>&lt;p&gt;What is a Reentrancy Attack?&lt;/p&gt;

&lt;p&gt;A reentrancy attack happens when a smart contract lets an attacker call the same function again and again before the contract finishes updating its data. This means the attacker can steal ETH, tokens, or change how the contract works. &lt;/p&gt;

&lt;p&gt;Why Does It Happen?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;State updates after external calls: If you transfer ETH or call another contract first and then update your balance, it leaves room for repeated attacks&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Trusting User-Controlled Parameters: Relying on inputs from external users or  contracts without proper checks&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;How Contracts Receive ETH?  &lt;/p&gt;

&lt;p&gt;Smart contracts can receive ETH in three ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Payable Functions: Functions marked payable allow ETH to be sent directly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fallback Functions: Triggered when no function matches or when data is sent with ETH.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Receive Functions: Special functions for receiving ETH without data (msg.data is empty).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These methods can be exploited if state updates happen after sending ETH, enabling reentrancy attacks. &lt;/p&gt;

&lt;p&gt;What You SHOULD Do &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use the “Checks-Effects-Interactions” Pattern&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Check: Validate conditions (e.g., “Does the user have enough balance?”).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Effect: Update the contract’s state (e.g., “Deduct the balance”).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Interact: Only then, send ETH or call another contract.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6pl6lrdzpq9mea45d5yp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6pl6lrdzpq9mea45d5yp.png" alt=" " width="800" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.Use a Lock (Reentrancy Guard)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a “locked” variable to stop reentering the same function. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feb4f77zuehh56meqgga1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feb4f77zuehh56meqgga1.png" alt=" " width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3.Or use OpenZeppelin’s ReentrancyGuard library to make this easier.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllqcbgtyoumdtozrkum3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fllqcbgtyoumdtozrkum3.png" alt=" " width="800" height="290"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Hence, &lt;/p&gt;

&lt;p&gt;Avoid: Updating contract state after external calls.&lt;/p&gt;

&lt;p&gt;Do: Validate, update, and then interact.&lt;/p&gt;

&lt;p&gt;Extra Layer: Use a reentrancy guard for critical functions.&lt;/p&gt;

&lt;p&gt;A small change in how you write functions can save your contract from huge losses. Let’s build secure and reliable smart contracts! 💪  &lt;/p&gt;

</description>
    </item>
    <item>
      <title>tx.origin vs msg.sender: Which to Use?</title>
      <dc:creator>Mahima Thacker</dc:creator>
      <pubDate>Sun, 26 Jan 2025 16:16:43 +0000</pubDate>
      <link>https://dev.to/mahima_thacker/txorigin-vs-msgsender-which-to-use-5627</link>
      <guid>https://dev.to/mahima_thacker/txorigin-vs-msgsender-which-to-use-5627</guid>
      <description>&lt;p&gt;When writing Solidity smart contracts, you often come across tx.origin and msg.sender so what’s the difference Between tx.origin and msg.sender?&lt;/p&gt;

&lt;p&gt;msg.sender: This is the last caller. It tells you who directly called the contract.&lt;/p&gt;

&lt;p&gt;tx.origin: This is the first sender. It tells you who started the transaction, always an external wallet (like MetaMask).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fube89tqfdpqj79ygn9ft.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fube89tqfdpqj79ygn9ft.png" alt=" " width="800" height="275"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;If a wallet sends a transaction to Contract A, and Contract A calls Contract B:&lt;/p&gt;

&lt;p&gt;In Contract B:&lt;/p&gt;

&lt;p&gt;msg.sender is Contract A (the most recent caller).&lt;/p&gt;

&lt;p&gt;tx.origin is the wallet(EOA)  (the original transaction starter).&lt;/p&gt;

&lt;p&gt;Using tx.origin for things like security checks can be dangerous. It can make your contract vulnerable to attacks. For better security, rely on msg.sender.&lt;/p&gt;

&lt;p&gt;A small detail, but it can make a big difference in your contract's security.&lt;/p&gt;

</description>
      <category>solidity</category>
      <category>ethereum</category>
      <category>smartcontract</category>
      <category>security</category>
    </item>
    <item>
      <title>Have You Fallen for a Phishing Scam? Let’s Talk About It 👀</title>
      <dc:creator>Mahima Thacker</dc:creator>
      <pubDate>Mon, 13 Jan 2025 10:49:43 +0000</pubDate>
      <link>https://dev.to/mahima_thacker/have-you-fallen-for-a-phishing-scam-lets-talk-about-it-1bi2</link>
      <guid>https://dev.to/mahima_thacker/have-you-fallen-for-a-phishing-scam-lets-talk-about-it-1bi2</guid>
      <description>&lt;p&gt;Phishing attacks are tricks used to fool people into doing things that can harm them, like sharing personal details or losing money. It’s a common type of scam.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Phishing&lt;/strong&gt;: General scams target many people, while spear phishing focuses on specific individuals or groups.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Did You Know?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In 2024, phishing attacks increased by 58%, making them one of the fastest-growing cyber threats.&lt;/p&gt;

&lt;p&gt;Cybercriminals send an estimated 3.4 billion phishing emails per day, making it the single most common form of cybercrime.&lt;/p&gt;

&lt;p&gt;In the first half of 2024, phishing attacks in the cryptocurrency sector led to losses exceeding $800 million.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web2 Example:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fake emails pretending to be from Netflix, asking you to update your subscription.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Web3 Examples:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Fake MetaMask emails asking for your seed phrase.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Websites that look real but steal your wallet details.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Allowing access to your NFTs (ERC721 tokens) through fake approvals. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Have you ever seen or fallen for something like this? Share your experience in the comments to help others stay alert and informed! Your story might help someone else to avoid it. &lt;/p&gt;

</description>
      <category>solidity</category>
      <category>ethereum</category>
      <category>smartcontract</category>
      <category>web3</category>
    </item>
    <item>
      <title>OverFlow and UnderFlow causes in Solidity</title>
      <dc:creator>Mahima Thacker</dc:creator>
      <pubDate>Mon, 06 Jan 2025 16:42:34 +0000</pubDate>
      <link>https://dev.to/mahima_thacker/overflow-and-underflow-causes-in-solidity-3bae</link>
      <guid>https://dev.to/mahima_thacker/overflow-and-underflow-causes-in-solidity-3bae</guid>
      <description>&lt;p&gt;In Solidity, arithmetic overflow and underflow were common issues before version 0.8.0.&lt;/p&gt;

&lt;p&gt;Here's a quick overview of UnderFlow and OverFlow:&lt;/p&gt;

&lt;p&gt;What is Overflow and Underflow?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Overflow:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you add 1 to the maximum value of a uint8 (255), it exceeds the range (0-255). Solidity doesn't store values beyond 255, so it wraps back to 0.&lt;/p&gt;

&lt;p&gt;Have a look at a function called overflow from the attached image, and the result you will get is 0&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fud90gcacvdi6gxxqtt13.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fud90gcacvdi6gxxqtt13.png" alt=" " width="800" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Underflow:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you subtract 1 from the minimum value of a uint8 (0), it goes below the range (negative values aren't allowed). Solidity wraps back to 255.&lt;/p&gt;

&lt;p&gt;so this is what we get when we call the function underflow from an image&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs4imo8q2vu2a8hl9hx27.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs4imo8q2vu2a8hl9hx27.png" alt=" " width="800" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But in Solidity 0.8.0 or Above it reverts with an error (overflow/underflow checks are enabled).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Does This Matter?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Overflow and underflow could lead to severe vulnerabilities in smart contracts, especially in financial calculations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Prevent This? 🕵‍♀️&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Solidity 0.8.0 or above, where overflow/underflow checks are built-in.&lt;/li&gt;
&lt;li&gt;For older versions, use libraries like OpenZeppelin’s SafeMath.&lt;/li&gt;
&lt;li&gt;Test edge cases to ensure safety in arithmetic operations.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>solidity</category>
      <category>ethereum</category>
      <category>smartcontract</category>
      <category>security</category>
    </item>
    <item>
      <title>OverFlow and UnderFlow causes in Solidity</title>
      <dc:creator>Mahima Thacker</dc:creator>
      <pubDate>Mon, 06 Jan 2025 16:42:34 +0000</pubDate>
      <link>https://dev.to/mahima_thacker/overflow-and-underflow-causes-in-solidity-3jjf</link>
      <guid>https://dev.to/mahima_thacker/overflow-and-underflow-causes-in-solidity-3jjf</guid>
      <description>&lt;p&gt;In Solidity, arithmetic overflow and underflow were common issues before version 0.8.0.&lt;/p&gt;

&lt;p&gt;Here's a quick overview of UnderFlow and OverFlow:&lt;/p&gt;

&lt;p&gt;What is Overflow and Underflow?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Overflow:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you add 1 to the maximum value of a uint8 (255), it exceeds the range (0-255). Solidity doesn't store values beyond 255, so it wraps back to 0.&lt;/p&gt;

&lt;p&gt;Have a look at a function called overflow from the attached image, and the result you will get is 0&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fud90gcacvdi6gxxqtt13.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fud90gcacvdi6gxxqtt13.png" alt=" " width="800" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Underflow:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you subtract 1 from the minimum value of a uint8 (0), it goes below the range (negative values aren't allowed). Solidity wraps back to 255.&lt;/p&gt;

&lt;p&gt;so this is what we get when we call the function underflow from an image&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs4imo8q2vu2a8hl9hx27.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs4imo8q2vu2a8hl9hx27.png" alt=" " width="800" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But in Solidity 0.8.0 or Above it reverts with an error (overflow/underflow checks are enabled).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Does This Matter?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Overflow and underflow could lead to severe vulnerabilities in smart contracts, especially in financial calculations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Prevent This? 🕵‍♀️&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Solidity 0.8.0 or above, where overflow/underflow checks are built-in.&lt;/li&gt;
&lt;li&gt;For older versions, use libraries like OpenZeppelin’s SafeMath.&lt;/li&gt;
&lt;li&gt;Test edge cases to ensure safety in arithmetic operations.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>solidity</category>
      <category>ethereum</category>
      <category>smartcontract</category>
      <category>security</category>
    </item>
    <item>
      <title>The Danger of Randomness in Smart Contracts and its solution</title>
      <dc:creator>Mahima Thacker</dc:creator>
      <pubDate>Tue, 31 Dec 2024 16:22:43 +0000</pubDate>
      <link>https://dev.to/mahima_thacker/the-danger-of-randomness-in-smart-contracts-and-its-solution-43ln</link>
      <guid>https://dev.to/mahima_thacker/the-danger-of-randomness-in-smart-contracts-and-its-solution-43ln</guid>
      <description>&lt;p&gt;In Ethereum smart contracts, getting true randomness can be tricky and dangerous. Here’s why:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem:&lt;/strong&gt;&lt;br&gt;
When you use common methods like blockhash or now for randomness in Solidity, it can be manipulated by miners. This makes your contract vulnerable to attacks, especially in games or lotteries. &lt;/p&gt;

&lt;p&gt;The code in the below attached image seems to generate a random number, but it’s predictable and can be exploited. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr051hkk2q6edkb856rmo.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr051hkk2q6edkb856rmo.jpeg" alt=" " width="800" height="126"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Solution: Chainlink VRF 👀&lt;/strong&gt;&lt;br&gt;
Chainlink’s Verifiable Random Function (VRF) provides a secure and verifiable way to get true randomness that cannot be tampered with.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here’s how Chainlink VRF solves the problem:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chainlink VRF generates a random number off-chain and provides cryptographic proof that it was done fairly.&lt;/li&gt;
&lt;li&gt;The smart contract verifies this proof on-chain, ensuring the randomness is - reliable and cannot be tampered with.&lt;/li&gt;
&lt;li&gt;The cryptographic process ensures that even miners or oracles cannot influence the outcome, hence guaranteeing true randomness&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ethereum</category>
      <category>smartcontract</category>
      <category>solidity</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>🤑 What are Stablecoins? Let's break it down!</title>
      <dc:creator>Mahima Thacker</dc:creator>
      <pubDate>Sat, 28 Dec 2024 16:35:33 +0000</pubDate>
      <link>https://dev.to/mahima_thacker/what-are-stablecoins-lets-break-it-down-2li4</link>
      <guid>https://dev.to/mahima_thacker/what-are-stablecoins-lets-break-it-down-2li4</guid>
      <description>&lt;p&gt;1/ Stablecoins are like the anchors of the cryptocurrency world. Just as a boat uses an anchor to stay stable in the water, stablecoins keep their value steady, even when the crypto sea gets rough &lt;/p&gt;

&lt;p&gt;2/ Why do we need Stablecoins? &lt;/p&gt;

&lt;p&gt;Imagine if your $1 today could be worth 50$ tomorrow – that's how volatile some cryptocurrencies can be. Stablecoins solve this by pegging their value to something stable, like the US Dollar or gold &lt;/p&gt;

&lt;p&gt;3/ Example Time: &lt;/p&gt;

&lt;p&gt;Think of Stablecoins as gift cards. If you have a 💲50 gift card, its value doesn’t change even if the store runs a massive sale. Similarly, 1 USD stablecoin is always worth 💲1, regardless of the crypto market swings. &lt;/p&gt;

&lt;p&gt;4/ Types of Stablecoins 👀 : &lt;/p&gt;

&lt;p&gt;Fiat-backed: Like a piggy bank with $1 in cash for every $1 in Stablecoins—a guarantee your digital money is solid. &lt;/p&gt;

&lt;p&gt;Crypto-backed: Like leaving extra collateral for a borrowed library book—extra crypto ensures stability. &lt;/p&gt;

&lt;p&gt;Algorithmic: Like a smart vending machine, adjusting supply to keep everything balanced. &lt;/p&gt;

&lt;p&gt;5/ Hence, Stablecoins are like the superheroes of the crypto world—they keep your digital money safe from wild swings, making sure it’s always worth what it’s supposed to be.&lt;/p&gt;

</description>
      <category>stablecoins</category>
      <category>blockchain</category>
      <category>learning</category>
      <category>web3</category>
    </item>
    <item>
      <title>Why You Should Attend Events Like Devcon?</title>
      <dc:creator>Mahima Thacker</dc:creator>
      <pubDate>Fri, 27 Dec 2024 16:07:43 +0000</pubDate>
      <link>https://dev.to/mahima_thacker/why-you-should-attend-events-like-devcon-1684</link>
      <guid>https://dev.to/mahima_thacker/why-you-should-attend-events-like-devcon-1684</guid>
      <description>&lt;p&gt;I recently attended my first &lt;strong&gt;Devcon&lt;/strong&gt; in Bangkok, and it was an amazing experience! 🌟 &lt;/p&gt;

&lt;p&gt;For those who don't know, Devcon is the biggest Ethereum-focused conference, bringing together developers, creators, and blockchain enthusiasts to share ideas, learn, and innovate in the Web3 space.&lt;/p&gt;

&lt;p&gt;Here’s why I think events like these are worth attending: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning Opportunities&lt;/strong&gt;:Engaging talks and sessions filled with useful ideas that helped me learn more and think in new ways. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Networking:&lt;/strong&gt; I met incredible people from different backgrounds, exchanged ideas, and made meaningful connections. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diverse Perspectives:&lt;/strong&gt; Hearing from global voices expanded my viewpoint and inspired me to think differently. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Joy and Inspiration:&lt;/strong&gt; The energy of the event was unmatched, leaving me motivated and excited for the future. &lt;/p&gt;

&lt;p&gt;If you’re on the fence about attending events like these, take this as your sign to go for it! The knowledge, connections, and inspiration you’ll gain are priceless. &lt;/p&gt;

&lt;p&gt;A big thank you to everyone I met and the organisers for making this event so special 🫡 &lt;/p&gt;

&lt;p&gt;Sharing a few pictures from this memorable experience—so many moments I couldn’t capture, but the memories will stay forever. ❤️‍🔥 &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyr5hg167qkpqkavt6bgr.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyr5hg167qkpqkavt6bgr.jpeg" alt=" " width="800" height="600"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7d2qyw0pgq4ddywac217.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7d2qyw0pgq4ddywac217.jpeg" alt=" " width="800" height="600"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6snxnpb8e2abmmtk311.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6snxnpb8e2abmmtk311.jpeg" alt=" " width="800" height="1066"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff63mp58lrpvffppy07hi.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff63mp58lrpvffppy07hi.jpeg" alt=" " width="800" height="1066"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here’s to more learning and exciting journeys ahead! 🚀&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>web3</category>
      <category>devcon7</category>
    </item>
    <item>
      <title>Ethereum Transaction Calls and State Changes</title>
      <dc:creator>Mahima Thacker</dc:creator>
      <pubDate>Wed, 25 Dec 2024 17:21:31 +0000</pubDate>
      <link>https://dev.to/mahima_thacker/ethereum-transaction-calls-and-state-changes-3omf</link>
      <guid>https://dev.to/mahima_thacker/ethereum-transaction-calls-and-state-changes-3omf</guid>
      <description>&lt;p&gt;&lt;strong&gt;Let’s break down how different transaction calls work in Ethereum, and how state changes happen using a simple example🫣:&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;CALL&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Imagine Contract A wants to send 1 ETH to Contract B and run a function there.&lt;/li&gt;
&lt;li&gt; When Contract A makes the CALL:&lt;/li&gt;
&lt;li&gt;A new environment (EVM instance) is created for Contract B. &lt;/li&gt;
&lt;li&gt;msg.sender is Contract A, meaning Contract B knows who initiated the transaction.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;msg.value is set to 1 ETH (the amount being sent).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;State changes: Even though msg.sender is Contract A, any changes (like updating balances) happen in Contract B's storage, not Contract A’s. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03y611i0vuea1idran9o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03y611i0vuea1idran9o.png" alt=" " width="800" height="362"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;2.STATICCALL&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Suppose Contract A only wants to check a balance in Contract B without changing anything.&lt;/li&gt;
&lt;li&gt; When Contract A uses STATICCALL:&lt;/li&gt;
&lt;li&gt; It’s just like CALL, but no changes are allowed—just reading data.&lt;/li&gt;
&lt;li&gt; msg.sender is still Contract A, but Contract B cannot change any state. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93uxggb291fyiv3n271s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93uxggb291fyiv3n271s.png" alt=" " width="800" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3.DELEGATECALL&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Now, let’s say Contract A wants to use Contract B’s code but with 
its own (Contract A’s) storage.&lt;/li&gt;
&lt;li&gt; When Contract A uses DELEGATECALL:&lt;/li&gt;
&lt;li&gt; Contract B’s code runs, but it affects Contract A’s storage.&lt;/li&gt;
&lt;li&gt; msg.sender: The original caller (EOA), not Contract A. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F199yuriqfn28mtqqcbyf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F199yuriqfn28mtqqcbyf.png" alt=" " width="800" height="325"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;So In-short:&lt;/p&gt;

&lt;p&gt;CALL: Contract A triggers changes in Contract B’s state.&lt;br&gt;
STATICCALL: Same as CALL, but only reads data, no changes.&lt;br&gt;
DELEGATECALL: Contract A runs Contract B’s code, but changes are made to Contract A’s storage.&lt;/p&gt;

&lt;p&gt;Understanding these helps you see how smart contracts interact and manage state in #Ethereum. 💥 &lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>solidity</category>
      <category>evm</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Ever wonder what happens when you send a transaction on Ethereum? 👀</title>
      <dc:creator>Mahima Thacker</dc:creator>
      <pubDate>Tue, 24 Dec 2024 16:42:13 +0000</pubDate>
      <link>https://dev.to/mahima_thacker/ever-wonder-what-happens-when-you-send-a-transaction-on-ethereum-1knj</link>
      <guid>https://dev.to/mahima_thacker/ever-wonder-what-happens-when-you-send-a-transaction-on-ethereum-1knj</guid>
      <description>&lt;p&gt;&lt;strong&gt;Let's break it down in simple terms👇:&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Setup:&lt;/strong&gt; When you send a transaction from your wallet to a smart contract, the EVM (Ethereum Virtual Machine) gets ready. It creates a new environment to run your transaction. &lt;br&gt;
The EVM loads the smart contract's code, sets up an empty stack and memory (kind of like a workspace), and prepares all the important variables.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Execution:&lt;/strong&gt; Now, the EVM starts executing the transaction. It goes through each instruction (called opcodes) one by one. &lt;br&gt;
As it works, it uses up the gas you provided (think of gas as the fuel that powers the transaction).&lt;br&gt;
It updates the stack, memory, and storage as needed. Once it finishes, the EVM clears out the stack and memory, wiping the workspace clean.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Success:&lt;/strong&gt; If everything runs smoothly, the EVM saves the changes made during the transaction to the blockchain. &lt;br&gt;
Any leftover gas is returned to you. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Out of Gas:&lt;/strong&gt; If the transaction runs out of gas before finishing, the EVM stops. All the changes are undone, so nothing gets saved. And you don’t get back any gas. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Exception:&lt;/strong&gt; If something goes wrong (like hitting a require, revert, or assert statement), the transaction is reverted. This means no changes are made to the blockchain. And no refund for unused gas from the gas limit &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F54ivrap3gbzq8cjhmgig.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F54ivrap3gbzq8cjhmgig.png" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is how Ethereum manages your transactions behind the scenes, ensuring everything runs smoothly or is safely undone if something goes wrong 💁‍♀️&lt;/p&gt;

</description>
      <category>ethereum</category>
      <category>evm</category>
    </item>
    <item>
      <title>What's Version Control and Why Should You Care? 📣</title>
      <dc:creator>Mahima Thacker</dc:creator>
      <pubDate>Mon, 23 Dec 2024 12:22:51 +0000</pubDate>
      <link>https://dev.to/mahima_thacker/whats-version-control-and-why-should-you-care-542e</link>
      <guid>https://dev.to/mahima_thacker/whats-version-control-and-why-should-you-care-542e</guid>
      <description>&lt;p&gt;&lt;strong&gt;Ever wondered how teams work together on computer projects without chaos?&lt;/strong&gt;🤔 It's like having a super time machine for your code, and we call it Version Control!&lt;/p&gt;

&lt;p&gt;🔄 &lt;strong&gt;Version Control&lt;/strong&gt; is like a magical tool for keeping track of changes in your code. Imagine having a magic wand that helps you fix mistakes, explore different versions of your code, and work smoothly with your team. That's what Version Control does!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why It Matters:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1️⃣ &lt;strong&gt;Teamwork&lt;/strong&gt;: Version Control helps everyone in your team work together without any confusion.&lt;/p&gt;

&lt;p&gt;2️⃣ &lt;strong&gt;Fix Mistakes&lt;/strong&gt;: Made a coding mistake? Version Control lets you go back to an earlier, error-free version.&lt;/p&gt;

&lt;p&gt;3️⃣&lt;strong&gt;Working Together&lt;/strong&gt;: You can share your work with others and combine changes easily using Version Control.&lt;/p&gt;

&lt;p&gt;Ready to learn more? Check out Episode 1 of our Git and GitHub Tutorial Series to understand the magic! 🚀👩‍💻👨‍💻&lt;/p&gt;

&lt;p&gt;👉 (&lt;a href="https://www.youtube.com/watch?v=BrBvqj48Bsg)%F0%9F%91%88" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=BrBvqj48Bsg)👈&lt;/a&gt; &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>github</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
