<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Infect 3ds on Medium]]></title>
        <description><![CDATA[Stories by Infect 3ds on Medium]]></description>
        <link>https://medium.com/@infect3dlab?source=rss-86b58b47a97b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*EoGZKRjF5Kb3qxZX</url>
            <title>Stories by Infect 3ds on Medium</title>
            <link>https://medium.com/@infect3dlab?source=rss-86b58b47a97b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 07:11:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@infect3dlab/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understanding Ether Transfers in Solidity: send, transfer and call.]]></title>
            <link>https://coinsbench.com/understanding-ether-transfers-in-solidity-send-transfer-and-call-1154c0482902?source=rss-86b58b47a97b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1154c0482902</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Infect 3ds]]></dc:creator>
            <pubDate>Fri, 30 Aug 2024 12:05:27 GMT</pubDate>
            <atom:updated>2024-09-18T11:21:50.150Z</atom:updated>
            <content:encoded><![CDATA[<p>When working with Solidity it is important to understand how Ether is transferred between contracts. Solidity gives us three primary methods for sending Ether: <strong>send</strong>, <strong>transfer</strong>, and <strong>call</strong>. Each method has its own learning curves, advantages and disadvantages. This article will explore these methods in detail and explain why <strong>call</strong> is considered the most preferable.</p><blockquote><strong>What is Ether?</strong></blockquote><p>Before going into the methods, let’s explain what Ether is. Ether is the native cryptocurrency of the Ethereum blockchain. It is used to pay for transactions, smart contract execution and other services on the network. When developing smart contracts, you may need to transfer Ether between contracts or from a contract to an external account. This is where <strong>send</strong>, <strong>transfer</strong>, and <strong>call</strong> come into play.</p><h4><strong>Method 1:</strong> <em>transfer</em></h4><p>The <strong>transfer</strong> method was once the go to method for sending Ether in Solidity because of its simplicity and built in safety features. Here’s how it works:</p><ol><li>The <strong>transfer</strong> method sends exactly 2300 gas to the receiving contract. Gas is a unit that measures the amount of computational effort required to execute operations on Ethereum.</li><li>If the transfer fails (for example, if the receiving contract’s fallback function requires more than 2300 gas)the transaction is automatically reverted. This means that the entire transaction is canceled and no changes are made to the blockchain.</li><li><strong>transfer</strong> was perfect for sending Ether with minimal risk because it would automatically revert on failure, ensuring that no funds were lost.<br>Here is an Example:</li></ol><pre>// SPDX-License-Identifier: MIT<br>pragma solidity ^0.8.24;<br><br>contract EtherTransfer {<br>    // Function to send Ether using the transfer method<br>    function sendViaTransfer(address payable _to) public payable {<br>        _to.transfer(msg.value); // Automatically reverts on failure<br>    }<br>}</pre><p><strong>Limitations of transfer</strong></p><ol><li>The 2300 gas stipend can be too limiting for more complex receiving contracts. If the receiving contract needs to perform operations that require more gas, the transaction will fail.</li><li><strong>transfer</strong> doesn’t allow you to adjust the gas amount, limiting its flexibility.</li></ol><h4>Method 2: <em>send</em></h4><p>The <strong>send </strong>method is similar to <strong>transfer</strong> but provides a bit more control over the transaction:</p><ol><li>Like <strong>transfer</strong>, <strong>send</strong> also forwards 2300 gas to the receiving contract.</li><li>Unlike <strong>transfer</strong>, <strong>send</strong> does not automatically revert the transaction if it fails. Instead, it returns a Boolean value (<strong>true </strong>or <strong>false</strong>) indicating whether the transfer was successful. This allows developers to handle the failure manually within the contract.</li></ol><p>Here is an Example:</p><pre>// SPDX-License-Identifier: MIT<br>pragma solidity ^0.8.24;<br><br>contract EtherSend {<br> // Function to send Ether using the send method<br> function sendViaSend(address payable _to) public payable {<br> bool sent = _to.send(msg.value); // Returns false on failure<br> require(sent, “Failed to send Ether”); // Manually handle the error<br> }<br>}</pre><h4>Advantages of <em>send</em>:</h4><p>By returning a Boolean value, <strong>send</strong> allows developers to decide how to handle a failed transaction, offering more flexibility than <strong>transfer</strong>.</p><h4>Limitations of <strong>send</strong></h4><ol><li>Like <strong>transfer</strong>, <strong>send</strong> also sends only 2300 gas, which can be insufficient for more complex operations.</li><li>You must manually check the return value and handle errors, adding extra steps to your code.</li></ol><h4>Method 3: call</h4><p>The <strong>call</strong> method is the most powerful and flexible of the three. It was introduced as a recommended method for sending Ether in Solidity from version 0.6.0 onwards. Here’s how it works:</p><ol><li><strong>call</strong> forwards all remaining gas by default to the receiving contract, or you can specify a custom gas amount. This flexibility allows the receiving contract to perform more complex operations.</li><li>Like <strong>send</strong>, <strong>call</strong> returns a Boolean value indicating success or failure, and it also returns any data received from the called function.</li><li><strong>call</strong> is ideal for situations where the receiving contract requires more gas to execute its functions or when you need to perform advanced interactions between contracts.</li></ol><p>Here is an Example:</p><pre>// SPDX-License-Identifier: MIT<br>pragma solidity ^0.8.24;<br><br>contract EtherCall { <br> // Function to send Ether using the call method<br> function sendViaCall(address payable _to) public payable {<br> // Forward all available gas (you can also specify a custom gas amount)<br> (bool sent, bytes memory data) = _to.call{value: msg.value}(“”);<br> require(sent, “Failed to send Ether”); // Manually handle the error<br> }<br>}</pre><h4>Advantages of call</h4><ol><li>You can choose to send all remaining gas or specify a particular amount, making <strong>call</strong> suitable for complex operations.</li><li>Beyond sending Ether, <strong>call</strong> can be used to invoke functions on other contracts, providing a broader range of capabilities.</li><li>As Ethereum evolves, <strong>call</strong> is more adaptable to potential changes in gas costs and other protocol updates.</li></ol><h4>Limitations of call:</h4><ol><li>With great power comes great responsibility. Using <strong>call</strong> requires you to handle errors manually and ensure your contract is secure, particularly against vulnerabilities like reentrancy attacks.</li><li>A common attack in Solidity contracts is reentrancy, where an attacker can repeatedly call a function before the previous function call completes and can drain the contract’s funds. When using <strong>call</strong>, you must take precautions, such as making state changes before sending Ether and using reentrancy guards.</li></ol><h4><strong>Why is call More Preferable?</strong></h4><p><strong>call</strong> has become the preferred method for several reasons:</p><ol><li><strong>call</strong> allows you to send more than 2300 gas, making it better for interacting with complex contracts that require more gas to execute their operations.</li><li><strong>call</strong> isn’t limited to just sending Ether. It can be used to invoke functions on other contracts, making it a more versatile tool in your Solidity toolkit.</li><li>As Ethereum continues to evolve, <strong>call</strong> is more adaptable to changes in the network, such as updates to gas costs or new protocol features.</li><li>With <strong>call</strong>, you have full control over how much gas to send and how to handle potential errors, allowing for more fine-tuned contract interactions.</li><li>Although <strong>call</strong> requires extra care to prevent vulnerabilities like reentrancy, it also provides the tools necessary to implement robust security measures, making it the recommended choice in modern Solidity development.</li></ol><h3>Conclusion</h3><p>Understanding the differences between <strong>send</strong>, <strong>transfer</strong>, and <strong>call</strong> is important for writing secure and efficient smart contracts on the Ethereum blockchain. <strong>call</strong> offers the flexibility, control and future-proofing needed for more advanced use cases. But, with this power comes the responsibility to handle errors and security risks appropriately!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1154c0482902" width="1" height="1" alt=""><hr><p><a href="https://coinsbench.com/understanding-ether-transfers-in-solidity-send-transfer-and-call-1154c0482902">Understanding Ether Transfers in Solidity: send, transfer and call.</a> was originally published in <a href="https://coinsbench.com/">CoinsBench</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Explanation of ERC-20 Tokens on the Ethereum Network]]></title>
            <link>https://medium.com/@infect3dlab/explanation-of-erc-20-tokens-on-the-ethereum-network-b06ec09ad9d4?source=rss-86b58b47a97b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b06ec09ad9d4</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[erc20]]></category>
            <dc:creator><![CDATA[Infect 3ds]]></dc:creator>
            <pubDate>Tue, 27 Aug 2024 14:52:52 GMT</pubDate>
            <atom:updated>2024-08-27T14:52:52.505Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What Are ERC-20 Tokens?</strong></p><p>ERC-20 is a technical standard used on the Ethereum blockchain to create fungible tokens. A fungible token means that each token is identical and can be exchanged with another token of the same type. For example, one Naira is always equal to another Naira, just like one ERC-20 token is equal to another ERC-20 token. This is different from non-fungible tokens (NFTs), which are unique and cannot be exchanged on a one-to-one basis.</p><p>ERC-20 tokens are used in various applications, for example representing assets, rights, or even other cryptocurrencies. Because they follow a common standard, these tokens can easily interact with different platforms and services built on Ethereum.</p><p><strong>Based on my research here are the main facts of the ERC-20 Tokens (For TL;DR enjoyers 😉)</strong></p><ol><li>ERC-20 stands for “Ethereum Request for Comment 20.” It’s a set of rules or guidelines for creating tokens on the Ethereum blockchain.</li><li>These tokens are interchangeable, meaning they can be exchanged or traded without losing value or function.</li><li>Since the introduction of ERC-20, most tokens on Ethereum have been created using this standard.</li></ol><p><strong>History of ERC-20</strong></p><p>Before ERC-20, there were issues with how tokens were created on Ethereum. Developers could create tokens, but these tokens weren’t always compatible with each other. This lack of standardization made it hard to use or exchange tokens across different platforms.</p><p>To solve this problem, a developer named Fabian Vogelsteller proposed ERC-20 in 2015. This proposal was a set of rules that all tokens should follow to ensure they could work together perfectly. The Ethereum community accepted the proposal in 2017 and it became the standard for creating tokens on Ethereum.</p><p><strong>How Does ERC-20 Work?</strong></p><p>ERC-20 is a list of functions and events that developers must include in their tokens for them to be considered ERC-20 compliant. These functions ensure that tokens have specific characteristics and behaviors, such as:</p><ol><li><strong>TotalSupply</strong>: The total number of tokens that will ever exist.</li><li><strong>BalanceOf</strong>: Checking the balance of tokens in a particular account.</li><li><strong>Transfer</strong>: Sending a certain number of tokens from one account to another.</li><li><strong>Approve</strong>: Allowing a third party to spend a certain number of tokens on your behalf.</li><li><strong>Allowance</strong>: Checking how many tokens a third party is allowed to spend from an account.</li></ol><p>These functions make it easier for developers to create tokens that work well within the Ethereum ecosystem. They also makes sure that all ERC-20 tokens can be used interchangeably with different decentralized applications and services.</p><p><strong>Popular ERC-20 Tokens</strong></p><p>Many well-known digital currencies are ERC-20 tokens. Some examples include:</p><ol><li>Tether (USDT)</li><li>USD Coin (USDC)</li><li>Shiba Inu (SHIB)</li><li>Binance USD (BUSD)</li><li>DAI Stablecoin (DAI)</li></ol><p>These tokens are widely used in the cryptocurrency world and are supported by most Ethereum wallets and exchanges.</p><p><strong>Why Is ERC-20 Important?</strong></p><p>The ERC-20 standard is crucial because it makes sure that new tokens created on the Ethereum blockchain are compatible with existing ones. This compatibility makes it easier for developers to launch new projects without worrying about whether their tokens will work with the rest of the Ethereum ecosystem.</p><p>By following the ERC-20 standard, developers can be sure that their tokens will be accepted and usable within the broader Ethereum network. This has helped Ethereum become one of the most popular platforms for creating and launching new cryptocurrencies and decentralized applications.</p><p><strong>ERC-20 vs. Other Standards</strong></p><p>Other blockchains have their own token standards. For example, Binance has its own blockchain with a token standard called BEP-2. BEP-2 is similar to ERC-20 but is designed for the Binance Chain.</p><p>Binance also created a side chain called the Binance Smart Chain, which uses a standard called BEP-20. BEP-20 tokens are compatible with ERC-20, meaning they can work across both Ethereum and Binance networks.</p><p><strong>Conclusion</strong></p><p>ERC-20 is an important part of the Ethereum network, it provides a standard that allows tokens to be easily created, exchanged, and used. This has made Ethereum a leading platform for decentralized applications and token-based projects. Understanding ERC-20 is important to learn the world of Ethereum and blockchain technology.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b06ec09ad9d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>