<?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: Chukwuebuka Okeke</title>
    <description>The latest articles on DEV Community by Chukwuebuka Okeke (@chukwuebuka_okeke_1451b54).</description>
    <link>https://dev.to/chukwuebuka_okeke_1451b54</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%2F1986716%2F6b365010-8d7b-491e-be98-0a378e478294.png</url>
      <title>DEV Community: Chukwuebuka Okeke</title>
      <link>https://dev.to/chukwuebuka_okeke_1451b54</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chukwuebuka_okeke_1451b54"/>
    <language>en</language>
    <item>
      <title>UNDERSTANDING THE TRANSFER OF ETHER FUNCTIONS :call,send and transfer functions</title>
      <dc:creator>Chukwuebuka Okeke</dc:creator>
      <pubDate>Sat, 31 Aug 2024 13:59:17 +0000</pubDate>
      <link>https://dev.to/chukwuebuka_okeke_1451b54/understanding-the-transfer-of-ether-functions-callsend-and-transfer-functions-3l75</link>
      <guid>https://dev.to/chukwuebuka_okeke_1451b54/understanding-the-transfer-of-ether-functions-callsend-and-transfer-functions-3l75</guid>
      <description>&lt;p&gt;Now,solidity have three(3) specific functions all used for sending ether transactions;namely the transfer function,the send function and the call function.You may be wondering,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;which is the best for transfer? &lt;br&gt;
.......&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Well,I'm here to answer your question.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. transfer Function
&lt;/h2&gt;

&lt;p&gt;What It Does:&lt;/p&gt;

&lt;p&gt;transfer is used to send Ether from a contract to an address. It automatically reverts the transaction if it fails (e.g., if there are not enough funds or if the recipient’s address is not valid).&lt;br&gt;
transfer function forwards 2300 gas to the recipient, which is enough to allow a basic Ether transfer but not enough to call another contract’s code. This helps protect against reentrancy attacks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;address payable recipient = payable(0x123...);
uint256 amount = 1 ether;
recipient.transfer(amount);

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

&lt;/div&gt;



&lt;p&gt;It reverts when unsuccessful,telling you the transfer failed.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. send Function
&lt;/h2&gt;

&lt;p&gt;What It Does:&lt;/p&gt;

&lt;p&gt;send is similar to transfer in that it sends Ether from the contract to an address. However, unlike transfer, it does not revert the transaction on failure. Instead, it returns a boolean indicating success or failure. Like transfer, send forwards 2300 gas, which helps in preventing reentrancy attacks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;address payable recipient = payable(0x123...);
uint256 amount = 1 ether;
bool success = recipient.send(amount);
require(success, "Failed to send Ether");

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

&lt;/div&gt;



&lt;p&gt;If the send operation fails, it returns false and does not revert the transaction, so you must handle errors on your own(manually) as shown by the example(above).&lt;/p&gt;

&lt;h2&gt;
  
  
  3. call Function
&lt;/h2&gt;

&lt;p&gt;What It Does:&lt;/p&gt;

&lt;p&gt;call is a more flexible way to send Ether and interact with other contracts. It can be used to call functions on other contracts and send Ether in one go. call does not impose the 2300 gas limit and is more versatile but requires careful handling. call can be used to send Ether and execute code on other contracts, but it forwards all available gas, which can lead to potential security risks if not handled properly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;address payable recipient = payable(0x123...);
uint256 amount = 1 ether;
(bool success, ) = recipient.call{value: amount}("");
require(success, "Failed to send Ether");

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

&lt;/div&gt;



&lt;p&gt;call returns a boolean indicating success and a bytes value for the return data. You must handle errors manually since it does not revert automatically(just like how send function works.......in a way though).&lt;/p&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;transfer: Safe and simple for sending Ether. Reverts on failure and forwards 2300 gas. Use it when you just need to send Ether.&lt;/li&gt;
&lt;li&gt;send: Similar to transfer, but doesn’t revert on failure. Returns a boolean indicating success.User Handle errors manually.&lt;/li&gt;
&lt;li&gt;call: Most flexible but requires careful handling. Can send Ether and call other contracts. Manually check for errors and security concerns.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding these functions helps in choosing the right one for your needs and ensuring your contract behaves safely and as expected.Use &lt;em&gt;transfer&lt;/em&gt; if you just want to send ether as its best for only ether transfer,you can also use &lt;em&gt;call&lt;/em&gt; if you really enjoy flexibility.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Happy coding!&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>ERC 20 TOKEN INTRO:Basics and Keypoints</title>
      <dc:creator>Chukwuebuka Okeke</dc:creator>
      <pubDate>Sat, 31 Aug 2024 00:10:10 +0000</pubDate>
      <link>https://dev.to/chukwuebuka_okeke_1451b54/erc-20-token-introbasics-and-keypoints-2fh6</link>
      <guid>https://dev.to/chukwuebuka_okeke_1451b54/erc-20-token-introbasics-and-keypoints-2fh6</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;&lt;u&gt;INTRODUCTION:&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;The ERC-20 standard interface allows any tokens on Ethereum to be interoperable with various applications, from wallets to decentralized exchanges. It has enhanced blockchain stability and enabled developers to build a wide range of decentralized applications (dApps).&lt;br&gt;
 #&lt;strong&gt;WHAT ARE ERC20 TOKENS&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>ERC-20 TOKEN INTRO:Basics and Keypoints</title>
      <dc:creator>Chukwuebuka Okeke</dc:creator>
      <pubDate>Tue, 27 Aug 2024 14:48:17 +0000</pubDate>
      <link>https://dev.to/chukwuebuka_okeke_1451b54/erc-20-token-introbasics-and-keypoints-4kpj</link>
      <guid>https://dev.to/chukwuebuka_okeke_1451b54/erc-20-token-introbasics-and-keypoints-4kpj</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;&lt;u&gt;INTRODUCTION:&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt; The ERC-20 standard interface allows any tokens on Ethereum to be interoperable with various applications, from wallets to decentralized exchanges. It has enhanced blockchain stability and enabled developers to build a wide range of decentralized applications (dApps).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WHAT ARE ERC20 TOKENS?&lt;/strong&gt;&lt;br&gt;
   &lt;/p&gt;
&lt;p&gt;  ERC-20(Ethereum Request for Comments-20) Standard Interface is a standard interface that allows a token to be re-used and easily integrated into different applications and platforms in the ethereum ecosystem.&lt;/p&gt;
&lt;br&gt;
   &lt;p&gt;  ERC-20 tokens are smart contracts that integrate and implement the ERC-20 standard interface, allowing for interoperability across the Ethereum network. They define how tokens can be transferred, approved, and tracked, facilitating seamless interactions with other Ethereum-based applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Key Features of ERC-20 Token&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Uniformity&lt;/strong&gt;:&lt;/u&gt;The ERC-20 standard interface token makes sure that all tokens can be used in every decentralised applications and exchanges in the ethereum ecosystem.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Standard Functions&lt;/strong&gt;&lt;/u&gt;:The ERC-20 standard interface token has specific functions that it uses like &lt;em&gt;'transfer'&lt;/em&gt;,&lt;em&gt;'approve'&lt;/em&gt;,&lt;em&gt;'transferOf'&lt;/em&gt;,&lt;em&gt;'balanceOf'&lt;/em&gt; so on and so forth.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
