Skip to content

5ire EVM Chain

5ire IDE

Note: In order to start using the 5ire IDE, users must set up and configure their wallet. Head to this section to start setting up your 5ire wallet.

  1. Head to the 5ire IDE Platform.

  2. Go to Workspace from the left-panel menu and choose the Create New File icon.

    EVM Image1

  3. Create a new file under contracts folder with the name “5ire.sol”

    EVM Image2

    A new file will be generated, and the main panel will appear blank.

  4. Writing the code

    You can either paste your existing code in the main panel of the 5ire.sol file or upload your contract file in the Workspace.

    You could also use the below sample ERC-20 code:

    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.13;
    // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/token/ERC20/IERC20.sol
    interface IERC20 {
    function totalSupply() external view returns (uint);
    function balanceOf(address account) external view returns (uint);
    function transfer(address recipient, uint amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint);
    function approve(address spender, uint amount) external returns (bool);
    function transferFrom(
    address sender,
    address recipient,
    uint amount
    ) external returns (bool);
    event Transfer(address indexed from, address indexed to, uint value);
    event Approval(address indexed owner, address indexed spender, uint value);
    }
    contract ERC20 is IERC20 {
    uint public totalSupply;
    mapping(address => uint) public balanceOf;
    mapping(address => mapping(address => uint)) public allowance;
    string public name = "Solidity by Example";
    string public symbol = "SOLBYEX";
    uint8 public decimals = 18;
    function transfer(address recipient, uint amount) external returns (bool) {
    balanceOf[msg.sender] -= amount;
    balanceOf[recipient] += amount;
    emit Transfer(msg.sender, recipient, amount);
    return true;
    }
    function approve(address spender, uint amount) external returns (bool) {
    allowance[msg.sender][spender] = amount;
    emit Approval(msg.sender, spender, amount);
    return true;
    }
    function transferFrom(
    address sender,
    address recipient,
    uint amount
    ) external returns (bool) {
    allowance[sender][msg.sender] -= amount;
    balanceOf[sender] -= amount;
    balanceOf[recipient] += amount;
    emit Transfer(sender, recipient, amount);
    return true;
    }
    function mint(uint amount) external {
    balanceOf[msg.sender] += amount;
    totalSupply += amount;
    emit Transfer(address(0), msg.sender, amount);
    }
    function burn(uint amount) external {
    balanceOf[msg.sender] -= amount;
    totalSupply -= amount;
    emit Transfer(msg.sender, address(0), amount);
    }
    }

    This is how your screen will appear after pasting the code mentioned above:

    EVM Image3

  5. Compilation

    Go to the Solidity Compiler from the left-panel.

    To compile a contract, either select the desired file from the File Explorer, or ensure that the desired file is the active one in the Editor if multiple files are open.

    If there is an active file chosen in the file explorer, then the solidity compiler will look like this:

    EVM Image4

    Click on Compile 5ire.sol to compile the contract file.

    After successful compilation, this is what your screen will look like:

    EVM Image5

  6. Deployment

    Go to the Deploy & Run Transactions sidebar from the left-panel.

    In order to use this module, it is necessary to have a compiled contract. Hence, if there is a contract name in the CONTRACT select box (the select box is under the VALUE input field), you can use this module.

    • 5ire Provider: For connecting 5ire IDE to an injected web3 provider. The most common injected provider is MetaMask and 5ire Wallet extension.

    • Hardhat Provider: For connecting 5ire IDE to a local Hardhat test chain.

    • Ganache Provider: For connecting 5ire IDE to a local Truffle Ganache test chain.

    EVM Image6

    Click on Deploy.

    Confirm the transaction on Web3 extension.

    Video Tutorial:

    Once the transaction is confirmed, the deployment details, contract address and transaction, will be visible in the terminal:

    EVM Image7

Using Explorer

  1. Cloning the 5ireChain node

    • On your system, open a terminal shell.

    • Clone the firechain-evm-base node repository by running the following command:

      HTTPS:

      https://github.com/5ire-tech/5ire-evm-base.git

      SSH:

      [email protected]:5ire-tech/5ire-evm-base.git
  2. Connecting to the node

    • If needed, open up a terminal shell on your local system.

    • Change the root directory where you compiled the 5ire EVM base.

    • Start the node in development mode by running the following command:

      Cargo build –release

      ./target/release/firechain-node --dev (it will run the node in development mode.)

      The —dev command-line option indicates that the node is operating using a predefined development chain specification, which includes a designated EVM account for Alice, along with other accounts specifically set up for testing purposes.

    • You can verify if your node is up and running successfully after reviewing the output displayed in the terminal.

      The terminal should display an output similar to this:

      EVM Image8

      EVM Image9

    • Use the Polkadot-JS application to connect to the local node.

    • In the top bar, click on the developer dropdown menu.

    • Create the token contract.

    • Select Extrinsics.

    • For submitting the transaction, select a funded account development account as the account.

    • Select EVM (Ethereum Virtual Machine).

    • Choose the create function.

    • Configure the parameters for the function.

      For thisSpecify this
      Source0xd43593c715fdd31c61141abd04a99fd6822c8558 (H160 Address of your Selected Account)
      InitEnter the token raw bytecode
      Value0
      Gas Limit42949672
      Max Fee Per Gas1000000
    • The optional parameters can be left empty. The nonce value will increase the known nonce for the purpose of the source account. This starts from 0x0. Depending primarily on the selected function, you will have to remove unused parameters.

    • Press submit transaction. This will start the process of completing your transaction.

    • To authorize the transaction, click Submit and Sign. This will result in completion of the transaction.

      EVM Image10

Remix IDE

You can deploy a smart contract on the 5ire EVM chain using Remix IDE through the following steps:

  1. For initiating the transaction, visit this link.

  2. Under workspaces, click on Create New File. This will help you create a new document on which you can start working on deploying a smart contract on the 5ire EVM chain.

    Remix Image1

  3. Create a New File under contracts with the name 5ire.sol. This will help you to create a new program through which you can deploy a smart contract on 5ire.

    Remix Image2

  4. Copy and paste the code given below to the 5ire.sol file.

    We have a sample code here for ERC-20 token:

    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.13;
    // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/token/ERC20/IERC20.sol
    interface IERC20 {
    function totalSupply() external view returns (uint);
    function balanceOf(address account) external view returns (uint);
    function transfer(address recipient, uint amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint);
    function approve(address spender, uint amount) external returns (bool);
    function transferFrom(
    address sender,
    address recipient,
    uint amount
    ) external returns (bool);
    event Transfer(address indexed from, address indexed to, uint value);
    event Approval(address indexed owner, address indexed spender, uint value);
    }
    contract ERC20 is IERC20 {
    uint public totalSupply;
    mapping(address => uint) public balanceOf;
    mapping(address => mapping(address => uint)) public allowance;
    string public name = "Solidity by Example";
    string public symbol = "SOLBYEX";
    uint8 public decimals = 18;
    function transfer(address recipient, uint amount) external returns (bool) {
    balanceOf[msg.sender] -= amount;
    balanceOf[recipient] += amount;
    emit Transfer(msg.sender, recipient, amount);
    return true;
    }
    function approve(address spender, uint amount) external returns (bool) {
    allowance[msg.sender][spender] = amount;
    emit Approval(msg.sender, spender, amount);
    return true;
    }
    function transferFrom(
    address sender,
    address recipient,
    uint amount
    ) external returns (bool) {
    allowance[sender][msg.sender] -= amount;
    balanceOf[sender] -= amount;
    balanceOf[recipient] += amount;
    emit Transfer(sender, recipient, amount);
    return true;
    }
    function mint(uint amount) external {
    balanceOf[msg.sender] += amount;
    totalSupply += amount;
    emit Transfer(address(0), msg.sender, amount);
    }
    function burn(uint amount) external {
    balanceOf[msg.sender] -= amount;
    totalSupply -= amount;
    emit Transfer(msg.sender, address(0), amount);
    }
    }

    This is how your screen will appear after you have inserted the code mentioned above:

    Remix Image3

  5. Click on Solidity Compiler and click on compile 5ire.sol.

    Remix Image4

    Remix Image5

  6. Click on Deploy & Run Transactions to perform your desired transactions.

    Remix Image6

  7. Deploy the contract 5ire.sol. Select Injected Web3 for deploying to live network. In this case, we have selected MetaMask as the injected provider.

    Remix Image7

  8. Confirm the transaction after verifying the details. You have to enter the wallet address as well as the amount that will be transferred to the receiving account.

    Remix Image8

  9. Confirm the gas fee in MetaMask to deploy transactions on the 5ire EVM chain (the gas fee is a small transaction fee which is used for completion of a transaction).

    Remix Image9

  10. Find the deployed contract address in Remix and update the contract by interacting with integrated functions.

    Remix Image10

Ganache

Ganache is a private Ethereum blockchain environment that allows you to emulate the Ethereum blockchain to interact with smart contracts in a private blockchain. It can run tests, execute commands, and inspect states while controlling how the chain operates.

Visit this link to download Ganache.

The following guide will walk you through the process of deploying a smart contract using Ganache:

  1. Open Remix IDE in your browser and create a new file under the contract section.

    Ganache Image1

  2. Use one of the sample code templates and compile by clicking the Compile button as shown below.

    Ganache Image2

  3. After compilation, open Ganache on your desktop. Your display will resemble the illustration below. Click on QUICKSTART Ethereum.

    Ganache Image3

  4. You will now see 10 default accounts, along with a mnemonic for your blockchain at a local RPC server (http://127.0.0.1:7545) as shown below:

    Ganache Image4

  5. Go back to the browser and move to the Deploy section just below Compile and select Ganache Provider from the environment as shown below:

    Ganache Image5

  6. Enter the server http://127.0.0.1:7545 as Ganache Provider. Your screen will look like the image shown below:

    Ganache Image6

  7. Your contract is now ready to be deployed! Click on the Deploy button to proceed.

    Ganache Image7

  8. Check the output tab to verify whether your contract has been successfully deployed.

    Ganache Image8

  9. To verify whether your transaction (process) was successfully reflected on the server, open Ganache and move to Transactions. Here you will see the details of your transaction as shown in the image below:

    Ganache Image9

    Video Tutorial:

Hardhat

This guide outlines the process for deploying an EVM Smart Contract using Hardhat, which will be carried out on the 5ire EVM IDE.

  1. Start by creating a project folder. For this guide, the project folder is titled “mkdir hardhat-tutorial”.

    Hardhat Image1

  2. Run the command npx hardhat.

  3. The next step is to select Create a Javascript/Typescript project when prompted with the question, “What do you want to do?”

    Hardhat Image2

  4. Add the hardhat project root created at the start.

    Hardhat Image3

  5. Press “Y” to complete the process.

    Hardhat Image4

  6. Upon completion of the process, the appearance of your screen will be as depicted in the image below.

    Hardhat Image5

  7. Open Remix IDE and select Deploy and Run Transactions.

    Hardhat Image6

  8. Select Hardhat Provider.

    Hardhat Image7

  9. You will see the chain ID and list of accounts if the connection has been established.

    Hardhat Image8

  10. Run the command npx hardhat node. It will then display a list of 20 accounts with a balance of 10000 ETH.

    Hardhat Image9

  11. By clicking on Deploy, you can initiate deployment of a specific smart contract, and if all goes well, your transaction will be successful.

    Hardhat Image10

  12. You can verify the completion of your transaction by checking the terminal.

    Hardhat Image11

Video Tutorial: