<?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: Sergio Salanitri</title>
    <description>The latest articles on DEV Community by Sergio Salanitri (@ssalanitri).</description>
    <link>https://dev.to/ssalanitri</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%2F656789%2F2247db50-fd36-4018-b0a0-ae7b4238a432.png</url>
      <title>DEV Community: Sergio Salanitri</title>
      <link>https://dev.to/ssalanitri</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ssalanitri"/>
    <language>en</language>
    <item>
      <title>ERC20 Ethereum token</title>
      <dc:creator>Sergio Salanitri</dc:creator>
      <pubDate>Wed, 27 Oct 2021 13:23:50 +0000</pubDate>
      <link>https://dev.to/ssalanitri/erc20-ethereum-token-1e30</link>
      <guid>https://dev.to/ssalanitri/erc20-ethereum-token-1e30</guid>
      <description>&lt;p&gt;Into the blochchain world exists the criptocurrency and others assest called tokens. In particular we show the most famous ethereum tokens. In fact the  ethereum cripto currency is the natiive Etereum token. Beside we develop other kind of token in base of comunity Ethereum specifications.&lt;/p&gt;

&lt;p&gt;What's ERC?&lt;/p&gt;

&lt;p&gt;Ethereun   as the recommendation of the minimal requirement to keep in mind at moment to implement this recommendations.&lt;br&gt;
This standards specificacionts define he interface that the develop MUST add in you contract. Then , other developers and existing DApps could be access to the token using the standard intefaces.&lt;br&gt;
In the practice, in Solidity this interfaces are some defined functions , state variables and events (if apply). &lt;/p&gt;

&lt;p&gt;ERC20: Is the 20th recommendation and define how to be a token to use to transfer digital tokens between blockchain address. This token could be represent a digital assets to trade on marketplace such as DAI or use into online game as digital money and son on.&lt;br&gt;
This token could be use in private economy into the Decentralize Applicarions DApps such as blockchain games or in crownfounding system in orden to get funds.&lt;br&gt;
This tokens are fungibles, so fiat money. At the moment to generate the token the user define into the ERC20 smart contract the maximum supplied tokens one token in this set is indistinguishable with other token.&lt;/p&gt;

&lt;p&gt;In order to develop ERC20 token you MUST implement at least the required function of this interface:&lt;/p&gt;
&lt;h2&gt;
  
  
  Functions
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;name&lt;/em&gt;: &lt;br&gt;
Returns the name of the token.&lt;br&gt;
OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function name() public view returns (string)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;symbol&lt;/em&gt;:&lt;br&gt;
Returns the symbol of the token. E.g. “DEV”.&lt;/p&gt;

&lt;p&gt;OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function symbol() public view returns (string)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;decimals&lt;/em&gt;:&lt;br&gt;
Returns the number of decimals the token uses - e.g. 8, means to divide the token amount by 100000000 to get its user representation.&lt;/p&gt;

&lt;p&gt;OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function decimals() public view returns (uint8)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;totalSupply&lt;/em&gt;:&lt;br&gt;
Returns the total token supply.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function totalSupply() public view returns (uint256)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;balanceOf&lt;/em&gt;:&lt;br&gt;
Returns the account balance of another account with address _owner.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function balanceOf(address _owner) public view returns (uint256 balance)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;transfer&lt;/em&gt;:&lt;br&gt;
Transfers _value amount of tokens to address _to, and MUST fire the Transfer event. The function SHOULD throw if the message caller’s account balance does not have enough tokens to spend.&lt;/p&gt;

&lt;p&gt;Note Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function transfer(address _to, uint256 _value) public returns (bool success)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;transferFrom&lt;/em&gt;:&lt;br&gt;
Transfers _value amount of tokens from address _from to address _to, and MUST fire the Transfer event.&lt;/p&gt;

&lt;p&gt;The transferFrom method is used for a withdraw workflow, allowing contracts to transfer tokens on your behalf. This can be used for example to allow a contract to transfer tokens on your behalf and/or to charge fees in sub-currencies. The function SHOULD throw unless the _from account has deliberately authorized the sender of the message via some mechanism.&lt;/p&gt;

&lt;p&gt;Note Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;approve&lt;/em&gt;&lt;br&gt;
Allows _spender to withdraw from your account multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value.&lt;/p&gt;

&lt;p&gt;NOTE: To prevent attack vectors like the one described here and discussed here, clients SHOULD make sure to create user interfaces in such a way that they set the allowance first to 0 before setting it to another value for the same spender. THOUGH The contract itself shouldn’t enforce it, to allow backwards compatibility with contracts deployed before&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function approve(address _spender, uint256 _value) public returns (bool success)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;allowance&lt;/em&gt;&lt;br&gt;
Returns the amount which _spender is still allowed to withdraw from _owner.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function allowance(address _owner, address _spender) public view returns (uint256 remaining)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Events
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Transfer&lt;/em&gt;:&lt;br&gt;
MUST trigger when tokens are transferred, including zero value transfers.&lt;/p&gt;

&lt;p&gt;A token contract which creates new tokens SHOULD trigger a Transfer event with the _from address set to 0x0 when tokens are created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;event Transfer(address indexed _from, address indexed _to, uint256 _value)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Approval&lt;/em&gt;:&lt;br&gt;
MUST trigger on any successful call to approve(address _spender, uint256 _value).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;event Approval(address indexed _owner, address indexed _spender, uint256 _value)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Basic ERC20 Implementation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pragma solidity ^0.4.24;

// ----------------------------------------------------------------------------
// Sample token contract
//
// Symbol        : ETN
// Name          : Sample ERC20 Token
// Total supply  : 10000000
// Decimals      : 18
// Owner Account : {{Owner Account}}
// ----------------------------------------------------------------------------


// ----------------------------------------------------------------------------
// Lib: Safe Math
// ----------------------------------------------------------------------------
contract SafeMath {

    function safeAdd(uint a, uint b) public pure returns (uint c) {
        c = a + b;
        require(c &amp;gt;= a);
    }

    function safeSub(uint a, uint b) public pure returns (uint c) {
        require(b &amp;lt;= a);
        c = a - b;
    }

    function safeMul(uint a, uint b) public pure returns (uint c) {
        c = a * b;
        require(a == 0 || c / a == b);
    }

    function safeDiv(uint a, uint b) public pure returns (uint c) {
        require(b &amp;gt; 0);
        c = a / b;
    }
}


/**
ERC Token Standard #20 Interface
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
*/
contract ERC20Interface {
    function totalSupply() public constant returns (uint);
    function balanceOf(address tokenOwner) public constant returns (uint balance);
    function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
    function transfer(address to, uint tokens) public returns (bool success);
    function approve(address spender, uint tokens) public returns (bool success);
    function transferFrom(address from, address to, uint tokens) public returns (bool success);

    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}


/**
Contract function to receive approval and execute function in one call
Borrowed from MiniMeToken
*/
contract ApproveAndCallFallBack {
    function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}

/**
ERC20 Token, with the addition of symbol, name and decimals and assisted token transfers
*/
contract ETNToken is ERC20Interface, SafeMath {
    string public symbol;
    string public  name;
    uint8 public decimals;
    uint public _totalSupply;
    address owner = {{Owner Account}}

    mapping(address =&amp;gt; uint) balances;
    mapping(address =&amp;gt; mapping(address =&amp;gt; uint)) allowed;


    // ------------------------------------------------------------------------
    // Constructor
    // ------------------------------------------------------------------------
    constructor() public {
        symbol = "ETN";
        name = "Sample ERC20 Token";
        decimals = 18;
        _totalSupply = 10000000;
        balances[owner] = _totalSupply;
        emit Transfer(address(0), owner, _totalSupply);
    }


    // ------------------------------------------------------------------------
    // Total supply
    // ------------------------------------------------------------------------
    function totalSupply() public constant returns (uint) {
        return _totalSupply  - balances[address(0)];
    }


    // ------------------------------------------------------------------------
    // Get the token balance for account tokenOwner
    // ------------------------------------------------------------------------
    function balanceOf(address tokenOwner) public constant returns (uint balance) {
        return balances[tokenOwner];
    }


    // ------------------------------------------------------------------------
    // Transfer the balance from token owner's account to to account
    // - Owner's account must have sufficient balance to transfer
    // - 0 value transfers are allowed
    // ------------------------------------------------------------------------
    function transfer(address to, uint tokens) public returns (bool success) {
        balances[msg.sender] = safeSub(balances[msg.sender], tokens);
        balances[to] = safeAdd(balances[to], tokens);
        emit Transfer(msg.sender, to, tokens);
        return true;
    }


    // ------------------------------------------------------------------------
    // Token owner can approve for spender to transferFrom(...) tokens
    // from the token owner's account
    //
    // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
    // recommends that there are no checks for the approval double-spend attack
    // as this should be implemented in user interfaces 
    // ------------------------------------------------------------------------
    function approve(address spender, uint tokens) public returns (bool success) {
        allowed[msg.sender][spender] = tokens;
        emit Approval(msg.sender, spender, tokens);
        return true;
    }


    // ------------------------------------------------------------------------
    // Transfer tokens from the from account to the to account
    // 
    // The calling account must already have sufficient tokens approve(...)-d
    // for spending from the from account and
    // - From account must have sufficient balance to transfer
    // - Spender must have sufficient allowance to transfer
    // - 0 value transfers are allowed
    // ------------------------------------------------------------------------
    function transferFrom(address from, address to, uint tokens) public returns (bool success) {
        balances[from] = safeSub(balances[from], tokens);
        allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens);
        balances[to] = safeAdd(balances[to], tokens);
        emit Transfer(from, to, tokens);
        return true;
    }


    // ------------------------------------------------------------------------
    // Returns the amount of tokens approved by the owner that can be
    // transferred to the spender's account
    // ------------------------------------------------------------------------
    function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
        return allowed[tokenOwner][spender];
    }


    // ------------------------------------------------------------------------
    // Token owner can approve for spender to transferFrom(...) tokens
    // from the token owner's account. The spender contract function
    // receiveApproval(...) is then executed
    // ------------------------------------------------------------------------
    function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
        allowed[msg.sender][spender] = tokens;
        emit Approval(msg.sender, spender, tokens);
        ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
        return true;
    }


    // ------------------------------------------------------------------------
    // Don't accept ETH
    // ------------------------------------------------------------------------
    function () public payable {
        revert();
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;References:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://eips.ethereum.org/EIPS/eip-20"&gt;https://eips.ethereum.org/EIPS/eip-20&lt;/a&gt;&lt;/p&gt;

</description>
      <category>token</category>
      <category>solidity</category>
      <category>blockchain</category>
      <category>ethereum</category>
    </item>
    <item>
      <title>Run Solidity Code in Remix</title>
      <dc:creator>Sergio Salanitri</dc:creator>
      <pubDate>Tue, 27 Jul 2021 12:22:57 +0000</pubDate>
      <link>https://dev.to/ssalanitri/run-solidity-code-in-remix-1fee</link>
      <guid>https://dev.to/ssalanitri/run-solidity-code-in-remix-1fee</guid>
      <description>&lt;p&gt;Remix is a awersome Web Solidity Code Editor, with Remix do you not need install anything in your computer. &lt;br&gt;
Using Remix you can edit, compile, deploy, test solidity contract show transaction logs, run contract methods, get github code, interact with JVM web blockchain, Metamask wallet (mainnet or testnet) and other features using Remix plugins.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z5xB4yak--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iv7l5hwlc7cedydnke9a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z5xB4yak--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iv7l5hwlc7cedydnke9a.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;File Explorer&lt;/em&gt;:&lt;br&gt;
Show directoy tree with contracts codes. Keep in mind that this files save in local storage, however not shared between differents machine. I recommend create a github repo and load your code in it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Command Bar&lt;/em&gt;:&lt;br&gt;
Allow cahge betwwen the Remix features, such Solidity Compiler, Solidity Deploy &amp;amp; Run Transactions, Debug , plugins and general settings.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Solidity Editor&lt;/em&gt;:&lt;br&gt;
Is the area where the developer write the solidity code. This to have code highlighting, intellisent, code lint and son on.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Transactions Logs&lt;/em&gt;:&lt;br&gt;
Show the compiler, deploy, test, run contract functions, connect with blockchain provider etc.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;General Settings&lt;/em&gt;:&lt;br&gt;
Allow to develop set the editor settings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solidity Compiler&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LeUz9CO9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tutxu1el5w70euxzzamu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LeUz9CO9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tutxu1el5w70euxzzamu.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The solidity compiler version must be compatible with &lt;strong&gt;#pragma&lt;/strong&gt; definition in the code.&lt;/p&gt;

&lt;p&gt;Where run the Compiler buttom, Remix compile the contract and in succesful case generate the ABI and the bycode associated with the contract.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yl-OuzpR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pi5o2g8w8v5czpul6nrf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yl-OuzpR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pi5o2g8w8v5czpul6nrf.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Application Binary Interface is the interface that expose the compiler contact. This is used to interact with the contract from out of chain.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Deploy the contract&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Remix allow deploy the contract into JVM local blockchain, inject into external wallet such Metamask or external Web3 provider. Web3 is the protocol used to interact with external chain clients. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kX0B6FX9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f5bfcjd4dry2pro8qhe3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kX0B6FX9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f5bfcjd4dry2pro8qhe3.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;1- Deploy the contract in selected provider, in this case in JVM provider.&lt;br&gt;
2- If the deploy is succesful Remix show button relationship with the contract public functions. The buttons color indicate if the operaction transaction save data (orange) or get data (blue) to or form chain.&lt;br&gt;
3- We can view in transaction panel the information about the storage function. &lt;br&gt;
4- Button to invoke retrieve function.&lt;br&gt;
5- Beside we can view the transaction log from retrieve function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deploy the contract with Metamask&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Metamask is a wallet implemented how Chrome extension, allow to developers connect to Ethereum blockchain.&lt;br&gt;
In the case of Remix we can select Metamask provider using  the Remix Enviroment combo box.&lt;br&gt;
Previously you must install the Metamask extension and create a a wallet.&lt;/p&gt;

&lt;p&gt;Now, we deploy and run the contract using Metamask.&lt;br&gt;
Metamask allow connect to different blockchains, testnet , mainnet and other networks using RPC protocol. In this example with use the Rinkeby testnet network.&lt;br&gt;
Before use it, we must transfer some fake Ethers to te wallet using th &lt;a href="http://rinkeby-faucet.com/"&gt;Rinkeby Faucet&lt;/a&gt; web page.&lt;/p&gt;

&lt;p&gt;First in all you select one account address in your wallet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sUx7HHCZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ul9v81aziuo25lx06rjo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sUx7HHCZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ul9v81aziuo25lx06rjo.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Second , you use this address en Rinkey Faucet web page, follow the intructions to transfer some fake ethers to you address.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RLtWkRVO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rz68wv05u87qpzwh1j7d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RLtWkRVO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rz68wv05u87qpzwh1j7d.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this case when you run some transaction the Metamask extension popup a authorization message, if you click OK; the transation is send to Rinkeby network and several seconds later the transaction is confirmed.&lt;/p&gt;

&lt;p&gt;If you enter to the Rinkeby account , you show that the account balance decrease en little ETH, this difference is due to the transaction gas fee.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;br&gt;
Remix IDE: &lt;a href="http://remix.ethereum.org/"&gt;http://remix.ethereum.org/&lt;/a&gt;&lt;br&gt;
Solidity ABI specification: &lt;a href="https://bit.ly/3Ai3qof"&gt;https://bit.ly/3Ai3qof&lt;/a&gt;&lt;br&gt;
Metamask: &lt;a href="https://metamask.io/"&gt;https://metamask.io/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Solidity in depth I</title>
      <dc:creator>Sergio Salanitri</dc:creator>
      <pubDate>Sun, 27 Jun 2021 04:46:41 +0000</pubDate>
      <link>https://dev.to/ssalanitri/solidity-for-beginners-3c3e</link>
      <guid>https://dev.to/ssalanitri/solidity-for-beginners-3c3e</guid>
      <description>&lt;p&gt;Solidity is the main smart contract language. This is used to develop smart contract that deploy in Ethereun network and others forked Ethereun blockchains.&lt;/p&gt;

&lt;p&gt;But, what is a smart contract?&lt;/p&gt;

&lt;p&gt;The smart contract is a code that run into de Ethereun Virtual Machine (EVM), deployed into the Ethereun Blockchaing and run in it. With the smart contract the developer can run  transaction logic that perfome transferences, storage data, user validation and a lot of others thinks.&lt;/p&gt;

&lt;p&gt;In this article I explain about simple contract development in Solidity Language.&lt;br&gt;
In brief Solidity sintax is based in C++ and javascript but have to several unique sintaxis.&lt;br&gt;
Not confuse the similar sintaxis to other language with how to run the solidity binaries code, is very different.&lt;/p&gt;

&lt;p&gt;Well, enought talk and we write the code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//SPDX-Licence-Identifier: GPL-3.0
pragma solidity &amp;gt;=0.7.0 &amp;lt;0.9.0;

/**
 * @title Storage
 * @dev Store &amp;amp; retrieve value in a variable
 */
contract Storage {

    uint256 number;

    /**
     * @dev Store value in variable
     * @param num value to store
     */
    function store(uint256 num) public {
        number = num;
    }

    /**
     * @dev Return value 
     * @return value of 'number'
     */
    function retrieve() public view returns (uint256){
        return number;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The firsts lines are the Licence and the solidity compiler version. The last line is very important to avoid some issue  with different language features between compiler versions.&lt;/p&gt;

&lt;p&gt;The keyword &lt;strong&gt;Contract&lt;/strong&gt; indicate the contract inself. &lt;br&gt;
Keep in mind that Solidity is a Object Oriented Language and the contract have to similar features that classes.&lt;/p&gt;

&lt;p&gt;The next line &lt;strong&gt;uint256 number&lt;/strong&gt;;  indicate the variable declaration , Solidity es a strong typed language , in this case the variable &lt;strong&gt;number&lt;/strong&gt; is a 256 bits int.&lt;/p&gt;

&lt;p&gt;Declare functions in solidity we use the following sintax&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function functioName(type2 arg1, type3 arg2...) &amp;lt;visibility scope&amp;gt; &amp;lt;other attributes&amp;gt; returns(type1, type2, type3...){
   //function body
}

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

&lt;/div&gt;



&lt;p&gt;In this contract there are two fuctions, the first save some integer in number variable and the second read this variable and return it.&lt;/p&gt;

&lt;p&gt;Despite being a very simple code it apply several Solidity importants features.&lt;/p&gt;

&lt;p&gt;The storage function save some integer in &lt;strong&gt;number&lt;/strong&gt; variable, this integer save into the blockchain and needed run a blockchain transaction, this transaction spend gas (the cost of the transaction). Beside the function retrieve don't consume gas because only read the variable from blochchain (the atribute &lt;em&gt;view&lt;/em&gt; allow this feature).&lt;/p&gt;

&lt;p&gt;Do you view the attribute &lt;strong&gt;returns&lt;/strong&gt;? How the name  indicate is the return type, but unlike other language solidity &lt;em&gt;&lt;strong&gt;allow retuns more that one variable in the same function!!&lt;/strong&gt;&lt;/em&gt; :)&lt;/p&gt;

&lt;p&gt;How we run this code?&lt;/p&gt;

&lt;p&gt;The easiest way is using the Remix Web IDE (&lt;a href="http://remix.ethereum.org/"&gt;http://remix.ethereum.org/&lt;/a&gt;), in fact this example I get from this ide.&lt;/p&gt;

&lt;p&gt;How we run this code in Remix Ide?&lt;/p&gt;

&lt;p&gt;In the next article :), but while I propose that you try use the Remix IDE and research it.&lt;/p&gt;

&lt;p&gt;See you!!&lt;/p&gt;

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