<?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 Abdulhakim Luanda on Medium]]></title>
        <description><![CDATA[Stories by Abdulhakim Luanda on Medium]]></description>
        <link>https://medium.com/@altunkaya2?source=rss-6bbba131c316------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*45YRgPiK9PTwuyb_oO5Kdg.jpeg</url>
            <title>Stories by Abdulhakim Luanda on Medium</title>
            <link>https://medium.com/@altunkaya2?source=rss-6bbba131c316------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 10:02:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@altunkaya2/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[What is “msg.data” in Solidity?]]></title>
            <link>https://medium.com/@altunkaya2/what-is-msg-data-in-solidity-19156ff8fe9d?source=rss-6bbba131c316------2</link>
            <guid isPermaLink="false">https://medium.com/p/19156ff8fe9d</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[variables]]></category>
            <dc:creator><![CDATA[Abdulhakim Luanda]]></dc:creator>
            <pubDate>Tue, 28 Mar 2023 13:48:55 GMT</pubDate>
            <atom:updated>2023-03-28T13:48:55.526Z</atom:updated>
            <content:encoded><![CDATA[<p>msg.data is a special global variable in solidity that contains the complete calldata of the current function call.</p><p>It contains data about two things: function selector (the function which is called) + function arguments</p><p>It is a dynamic byte array which means, it does not have fixed bytes size. Selector is <strong>always</strong> 4 bytes, and each argument of the function can be <strong>maxium</strong> 32 bytes. So, bytes size/length of msg.data for a simple function with two uint256 parameters is:</p><p>4 bytes selector + 32 bytes first argument + 32 second argument = 68 bytes</p><p>However, as Solidity uses a 32-byte word size for data storage and memory access, we need to round up 68 to the nearest multiple of 32 bytes. For this reason, the final length of the msg.data is:</p><p>68 + 28 = 96 bytes</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19156ff8fe9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are view function calls recorded in block?]]></title>
            <link>https://medium.com/@altunkaya2/are-view-function-calls-recorded-in-block-a4f3ac45c532?source=rss-6bbba131c316------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4f3ac45c532</guid>
            <category><![CDATA[evm]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[view-function]]></category>
            <dc:creator><![CDATA[Abdulhakim Luanda]]></dc:creator>
            <pubDate>Sun, 26 Feb 2023 16:53:48 GMT</pubDate>
            <atom:updated>2023-02-26T16:53:48.794Z</atom:updated>
            <content:encoded><![CDATA[<p>Yes, view function calls are recorded in blocks on the Ethereum blockchain. However, since view functions do not modify the state of the blockchain, they are executed locally by each node and not included in the block’s state transitions. This means that view function calls do not consume gas or require mining, and they do not generate transactions that are broadcast to the network.</p><p>Instead, when a node receives a request to call a view function, it locally executes the function and returns the result to the requesting client. The result of the view function call can then be used by the client to perform other operations or to make decisions about subsequent transactions to send to the network.</p><p>Therefore, while view function calls are recorded in the blockchain’s transaction history, they are not considered transactions in the traditional sense and do not have the same impact on the state of the blockchain as other types of function calls.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4f3ac45c532" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WHY BYTES START WITH 0x IN SOLIDITY]]></title>
            <link>https://medium.com/@altunkaya2/why-bytes-start-with-0x-in-solidity-b7602d92d6eb?source=rss-6bbba131c316------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7602d92d6eb</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[hexadecimal]]></category>
            <dc:creator><![CDATA[Abdulhakim Luanda]]></dc:creator>
            <pubDate>Thu, 16 Feb 2023 19:51:31 GMT</pubDate>
            <atom:updated>2023-02-16T19:51:31.572Z</atom:updated>
            <content:encoded><![CDATA[<p>In Solidity, the bytes data type can be initialized using a hexadecimal string literal. When you initialize a bytes variable with a hexadecimal string literal, the string must start with 0x to indicate that it is a hexadecimal value.</p><p>The 0x prefix is used in hexadecimal notation to indicate that the following characters represent a hexadecimal value. This prefix is used in Solidity (as well as in other programming languages and contexts) to distinguish hexadecimal values from other types of values.</p><p>So, the 0x prefix is not specific to the bytes data type in Solidity, but rather a general convention used to indicate that a value is represented in hexadecimal notation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7602d92d6eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BYTES AND HEXADECIMAL VALUES IN SOLIDITY]]></title>
            <link>https://medium.com/@altunkaya2/in-solidity-bytes-and-hexadecimal-are-related-concepts-but-they-are-not-exactly-the-same-thing-10dcf3823a94?source=rss-6bbba131c316------2</link>
            <guid isPermaLink="false">https://medium.com/p/10dcf3823a94</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[hexadecimal]]></category>
            <dc:creator><![CDATA[Abdulhakim Luanda]]></dc:creator>
            <pubDate>Thu, 16 Feb 2023 19:45:53 GMT</pubDate>
            <atom:updated>2023-02-16T19:46:30.615Z</atom:updated>
            <content:encoded><![CDATA[<p>BYTES AND HEXADECIMAL VALUES IN SOLIDITY</p><p>In Solidity, bytes and hexadecimal are related concepts but they are not exactly the same thing.</p><p>bytes is a built-in data type that represents a variable-length array of bytes, while hexadecimal is a numbering system that uses base 16 to represent values.</p><p>When working with binary data in Solidity, hexadecimal notation is often used to represent binary data in a more human-readable format. In this context, hexadecimal values are often used to initialize bytes variables.</p><p>So while bytes and hexadecimal are related concepts in Solidity, they are not the same thing. bytes is a data type that represents a sequence of bytes, while hexadecimal is a numbering system used to represent values. However, hexadecimal notation is often used to represent binary data in Solidity, including as a way to initialize bytes variables.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10dcf3823a94" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Interface, Abstract Contract, Inheritance, Call, Virtual/Override in SOLIDITY]]></title>
            <link>https://medium.com/@altunkaya2/interface-abstract-contract-inheritance-call-virtual-override-in-solidity-32f64902ab7d?source=rss-6bbba131c316------2</link>
            <guid isPermaLink="false">https://medium.com/p/32f64902ab7d</guid>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[smart-contract-blockchain]]></category>
            <dc:creator><![CDATA[Abdulhakim Luanda]]></dc:creator>
            <pubDate>Mon, 26 Dec 2022 20:17:11 GMT</pubDate>
            <atom:updated>2023-01-08T19:34:55.609Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article we will explore Interface, Inheritance, Abstract Contract, Call method and Virtual/Override concepts in Solidity.</p><p>It is not uncommon for Solidity Developers to mix these important concepts when creating smart contracts and building connections between multiple contracts. This articles aims to explain above mentioned concepts from a different perspective by comparing them with one another. For more detailed information about each concept, please visit Solidity Documentation or Medium website articles.</p><h3>1. IMPORT &amp; INHERITANCE</h3><p>Import and Inheritance is the easiest to understand. To make inheritance we need to use “import” statement and “is” keyword on the inheriting (child) contract. Imagine we have contract A and contract B and they are inside the same folder. Contract B can inherit all the function and variables of Contract A. By doing so, Contract B will become a child of Contract A.</p><pre>//SPDX-License-Identifier: MIT<br><br>pragma solidity &gt;=0.8.7;<br><br>contract A {<br>    string public myWord = &quot;Hello&quot;;<br><br>    function changeWord(string memory _word) external {<br>        myWord = _word;<br>    }<br>}</pre><p>And here is our Contract B:</p><pre>//SPDX-License-Identifier: MIT<br><br>pragma solidity &gt;=0.8.7;<br><br>import &quot;./A.sol&quot;;<br><br>contract B is A {<br><br>    string public myCity = &quot;Oslo&quot;;<br><br>}</pre><p>When you deploy contract A and B to Remix, you will see, contract B will also have access to “myWord” variable and “changeWord” function from contract A. And when you call any of those functions and variables that you inherited from Contract A, you might be tempted to think that you are calling the contract A. However, in practice you are actually calling your own contract (which is B). Inheritance is like copying the variables and functions of contract A to contract B. And when you make any change by using the functions that you inherited from contract A, you are not changing the state of contract A, you are changing the state of contract B. And please read this paragraph one more time because it will beimportant to understand “Virtual/Override” below.</p><h3><strong>2. VIRTUAL-OVERRIDE</strong></h3><p>In the simple inheritance above, we saw how to inherit functions and variables of another contract without changing their implementation. If you want to inherit the functions of another contract and later change their implementation part, then you will need to use “virtual/override”.</p><p>Remember, in Chapter 1 we said inheriting a contract is like copying its functions and variables to your contract. And as you cannot have two functions with the same name inside your contract, you also cannot declare an inherited function again inside your contract. However, Solidity lets you to do this by using “virtual-override”. The original function inside contract A needs to be tagged with “virtual”.</p><pre>//SPDX-License-Identifier: MIT<br><br>pragma solidity &gt;=0.8.7;<br><br>contract A {<br>    string public myWord = &quot;Hello&quot;;<br><br>    function changeWord(string memory _word) external virtual {<br>        myWord = _word;<br>    }<br>}</pre><p>Repetitive function inside contract B needs to be tagged with “override”. By using “override” we can change the implementation part of the inherited function. We cannot change other parts of the function such as its name, parameters etc.</p><pre>//SPDX-License-Identifier: MIT<br><br>pragma solidity &gt;=0.8.7;<br><br>import &quot;./A.sol&quot;;<br><br>contract B is A {<br><br>    string public myCity = &quot;Oslo&quot;;<br><br>    function changeWord(string memory _word) external override {<br>        myWord = _word;<br>        myCity = &quot;El Paso&quot;;<br>    }<br>}</pre><p>Just like simple inheritance, when you use virtual-override and make function call which changes state, you are not changing the state of contract A, you are changing the state of contract B.</p><h3><strong>3. CALL() METHOD</strong></h3><p>Now here comes our call() method. Simple inheritance and Virtual-Override inheritance above let us to interact with another contract (which is contract A) but we cannot change the state of contract A by calling the functions we inherited. This is the main important point of call() method. By using call() we can really call a specific function of contract A and we can change the state of contract A.</p><pre>//SPDX-License-Identifier: MIT<br><br>pragma solidity &gt;=0.8.7;<br><br>contract A {<br>    string public myWord = &quot;Hello&quot;;<br><br>    function changeWord(string memory _word) external virtual {<br>        myWord = _word;<br>    }<br>}</pre><p>And inside contract B we can create a function which will call the “changeWord()” function of contract A. As for parameters, we need pass the address of contract A and any string of our choice.</p><pre>//SPDX-License-Identifier: MIT<br><br>pragma solidity &gt;=0.8.7;<br><br>contract B {<br>    bytes public data;<br>    function callOtherContract(address otherContract, string memory _word) external {<br>        (bool success, bytes memory _data ) = otherContract.call{value: 0}(abi.encodeWithSignature(&quot;changeWord(string)&quot;, _word));<br>        require(success, &quot;call failed for some reason&quot;);<br>        data = _data;<br>    }<br><br>}</pre><p><strong>call() </strong>method allows us to call a <strong>specific </strong>function of contract A and make changes on contract A. This is an important point that makes differentiation with “<strong>interface</strong>”. Interface helps us to call a <strong>standard </strong>function of contract A, not a specific function. It also changes the state of contract A.</p><h3><strong>4.INTERFACE</strong></h3><p>In some cases we may not know specific functions (or we may not need to know) of contract A but we may know standard functions of it. In this case, we can call these standard functions by using the interface which helped creating those standard functions. The reason why we hear word “interface” so often is it helps to create standards for function creation and standards are key to Ethereum ecosystem.</p><p>Remember, call() method can call a certain specific function of contract A. However, interface helps us to call standard functions of contract A. Because sometimes, we do not need specific custom functions of contract A, we need standard functions of it.</p><p>Imagine that our contract B is a DEX contract and our contract A is an ERC20 token contract. Contract B will be able to integrate contract A into its DEX system with the help of standard ERC20 functions that the contract A has. Without the standard functions that are created with the ERC20 Interface (IERC20), it would be painly difficult to integrate each token to the DEX.</p><p>Interfaces are created with “interface” keyword. If a contract (contract A) would like to be compatible with an interface (interface IApple), then it must implement all the non-implemented functions of the interface. Here is our interface: IApple.sol</p><pre>//SPDX-License-Identifier: MIT<br><br>pragma solidity &gt;=0.8.7;<br><br>interface IApple {<br>    function getFruit() external view returns(string memory);<br>    function changeFruit(string memory _fru) external;<br>}</pre><p>And now, here is contract A, which is created by following IApple interface (we do not need “is”, “virtual”, “override”):</p><pre>//SPDX-License-Identifier: MIT<br><br>pragma solidity &gt;=0.8.7;<br><br>import &quot;./IApple.sol&quot;<br><br>contract A{<br>    string public fruit;<br><br>    function getFruit() external view returns(string memory) {<br>        return fruit;<br>    }<br><br>    function changeFruit(string memory _fru) external {<br>        fruit = _fru;<br>    }<br><br>    function anySpecificCustomFunc() external pure returns(uint) {<br>        return 555;<br>    }<br>}</pre><p>And lastly here is contract B. It will first import the interface. Later it will create an instance of contract A by using its address. This instance will be saved inside a variable and will be type “IApple”. By using this variable we will be able to call the standard functions inside contract A. Also we will be able to change state of the contract A. However, we will not be able to call `anySpecificCustomFunc()` of contract A because this function is not a standard function defined in the IApple.</p><pre>//SPDX-License-Identifier: MIT<br><br>pragma solidity &gt;=0.8.7;<br><br>import &quot;./IApple.sol&quot;;<br><br>contract B{<br><br>    IApple public otherContract;<br><br>    function setContract(address contractAaddress) external {<br>        otherContract = IApple(contractAaddress);<br>    }<br><br>    function getValue() external view returns(string memory) {<br>        return otherContract.getFruit();<br>    }<br>    function changeValue(string memory _fru) external {<br>        otherContract.changeFruit(_fru);<br>    }<br>    /* THIS FUNCTION BELOW WILL NOT WORK<br>    function getValue2() external view returns(uint) {<br>        return otherContract.anySpecificCustomFunc();<br>    } <br>    */<br><br>}</pre><h3><strong>5.ABSTRACT CONTRACT AND LIBRARIES</strong></h3><p>Abstract Contracts are something between interface and inheritance. They are not very popular, because inheritance and interface are more sharp to-the-point solutions. You should know that abstract contracts exist, but I doubt if you will ever need to use them. Here is an example of abstract contract:</p><pre>//SPDX-License-Identifier: MIT<br><br>pragma solidity &gt;=0.8.7;<br><br>abstract contract Apple {<br>    function getFruit() external view virtual returns(string memory);<br>    function changeFruit(string memory _fru) external virtual;<br><br>    function hello() external pure returns(uint) {<br>        return 888;<br>    }<br>}<br><br>contract A is Apple {<br>    string public fruit;<br><br>    function getFruit() external view override returns(string memory) {<br>        return fruit;<br>    }<br><br>    function changeFruit(string memory _fru) external override {<br>        fruit = _fru;<br>    }<br><br>    function extraFunction() external pure returns(uint) {<br>        return 555;<br>    }<br>}</pre><p>Libraries are not even comparable at all, they are useful for function restructuring and preventing code duplication.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32f64902ab7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>