Solidity Remix-IDE? A Beginner’s Guide

Remix-IDE at www.blockchaindoyen.com
Getting your Trinity Audio player ready...

Solidity Remix-IDE? A Beginner’s Guide

Remix-IDE at www.blockchaindoyen.com

Introduction 

Remix is an Integrated Development Environment (IDE) designed for developing smart contracts primarily in the Solidity programming language. This browser-based IDE allows you to write, compile, and debug Solidity code. Here are three ways you can access Remix-IDE:

  1. Online: You can use Remix in any browser by entering the URL: https://remix.ethereum.org/.
  2. Local installation: Install Remix on your system using this link.
  3. Mist: Another way to access Remix is through Mist, the Ethereum Dapp browser.

Getting Started: Writing Your First Smart Contract With Solidity Remix-IDE

This section will guide you through the process of writing your first smart contract using Remix-IDE, a browser-based IDE.

  • Open the Remix-IDE by visiting https://remix.ethereum.org/.
  • Once the Remix-IDE is open, you will see a screen with various options
  • On the left side of the screen, click on the “Create new file” icon (indicated by a yellow arrow).

Create New File in Remix at www.blockchaindoyen.com

  • Provide the file name as “HelloWorld.sol”.

How to Name a Smart Contract file at www.blockchaindoyen.com

….then enter the following code into the editor on the right-hand side.
// My First Smart Contract
pragma solidity >=0.5.0 <0.9.0;
contract HelloWorld {
    function get() public pure returns (string memory) {
    return 'Hello Contracts';
    }
}
The Hello World Smart Contract at www.blockchaindoyen.com
  • After entering the code, click the icon “Solidity Compiler”, located just below the “Search Glass” icon.

How to Compile a Smart Contract at www.blockchaindoyen.com

  • This will bring up a new screen.                                               
  • Click “Compile HelloWorld.sol” and leave the remaining settings unchanged.

Solidity Remix-IDE-5 at www.blockchaindoyen.com

  • Once the compilation is successful, click the icon below “Solidity Compiler” labeled “Deploy and run transactions.”

Solidity Remix-IDE-6 at www.blockchaindoyen.com

  • After deploying and running transactions, you will see a section titled “Deployed Contracts” on the left side of the Remix-IDE.

Solidity Remix-IDE-7 at www.blockchaindoyen.com

  • Under the “HelloWorld” contract, locate the button with the function named “get” and click on it.

Solidity Remix-IDE-8 at www.blockchaindoyen.com

  • The system will show the returned value from the “get” function “Hello Contracts”.

Solidity Remix-IDE-9 at www.blockchaindoyen.com

Hello World Program Using a Setter and a Getter Function In Remix-IDE

To achieve the output of “Hello World” using setters and getters, we can follow the steps outlined below:

Define a Solidity contract named “HelloWorld2” with a pragma specifying the version.

  • Inside the contract, declare a string variable called “userInput” to store the user input.
  • Implement a “set” function that takes a string parameter named “testValue” and assigns it to the “testInput” variable.
  • Implement a “get” function that returns the value of the “testInput” variable. The following is the final program.
    pragma solidity >= 0.8.2 <0.9.0;
    contract HelloWorld2{
        string testInput;
        function set(string memory testValue) public
        {
            testInput = testValue;
        }
        function get() public view returns(string memory){
            return testInput;
        }
         
    }
  • To execute the contract, follow the steps mentioned in the “Getting Started” section above.
  • After clicking the arrow symbol (“>”) in the “Deployed Contracts” section, a drop-down menu will appear with two methods: “Set” and “Get”.
  • Next to the “Set” method, there will be a blank box where you can enter a string value (“New Value” ) that you want to print or display.

Solidity Remix-IDE-10 at www.blockchaindoyen.com

  • Enter the desired string value and click on the “Set” button.  The terminal, on the right-hand side, will show a new transaction (which is not visible in the picture below).

Solidity Remix-IDE-11 at www.blockchaindoyen.com

  • Finally, click on the “Get” button, and the string (“New Value” ) that you entered will be visible below.

5 Interesting but Lesser-Known Facts About Solidity Remix-IDE

  1. Remix IDE is a widely used Integrated Development Environment (IDE) specifically designed for Solidity smart contract development on the Ethereum blockchain.
  2. It is a web-based IDE, allowing developers to access and use it directly from their web browsers without any additional installations or setup procedures.
  3. Remix IDE provides a user-friendly interface that simplifies the Solidity development process, making it accessible to developers of all skill levels.
  4. It offers built-in tools and features for writing, testing, debugging, and deploying smart contracts, eliminating the need for external plugins or modules.
  5. Developers can choose the desired compiler version for their projects as Remix IDE supports various versions of the Solidity programming language.

Related Tutorials

What Is a Solidity Smart Contract? A Beginner’s Guide

Solidity Tutorial. A Comprehensive Guide

Solidity Data Types. A Beginner’s Guide

Solidity Variables. A Beginner’s Guide

Solidity Functions. A Beginner’s Guide

Solidity Constructors. A Beginner’s Guide

References

Solidity documentation

Solidity tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *