Hello World Ethereum Solidity Smart Contract


As we typically start every programming language with “Hello, World”, let start our first Ethereum Dapp with the same customary Hello World appp.

Ethereum uses Solidity to create smart contracts. As per definition “Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed to target the Ethereum Virtual Machine (EVM)”

Here is our first Hello World smart contract
pragma solidity ^0.4.11;

contract FirstContract {

    function Greet() public constant returns (string) {
        return "Hello, World";
    }
}


We can execute our very first contract using web based Remix Solidity IDE. Go to the below URL

Delete the default contract that comes with Remix. Create a new contract and write our first contract. Your browser should look like this:

Now click on the “Create” button. Remix will compile and deploy the contract. It will also shows you the output of our contract, which is “Hello, World” as shown below:

So we complete our traditional Hello World app using the browser based Remix Solidity IDE
Remis IDE is good for quick prototyping. If you need to build smart contracts and Dapps, you need the following tools. Please see my other blogs on this:

  • Visual Studio Code for compiling Contracts
  • Deploying and transacting with contracts using JavaScript Console
  • Development Test Chain during development phase
  • Rinkeby Test Chain for full node testing



No comments:

Post a Comment

Ethereum Solidity Compiler

Ethereum contracts are written in the high level language called Solidity and compiled into bytecode using the Solidity compiler. This ...