How to write a classical hello world code in solidity? please ignore the below code

contract SimpleStorage { uint storedData; uint x=4; console.log("Your debug message"); }


If you want to get started with Solidity, try CryptoZombies (https://cryptozombies.io). It's a funny tutorial that takes you through the first steps of Smart-Contract-Development.

I also recoment the Remix Web-IDE (http://remix.ethereum.org) for your first own contracts. It has a built in syntax-check and compiler.


The way to an output a message is by using Events.

Events are inheritable members of contracts. When you call them, they cause the arguments to be stored in the transaction’s log - a special data structure in the blockchain. These logs are associated with the address of the contract, are incorporated into the blockchain, and stay there as long as a block is accessible (forever as of the Frontier and Homestead releases, but this might change with Serenity). The Log and its event data is not accessible from within contracts (not even from the contract that created them).

If you're looking for a basic 'Hello world'-like contract to get started. Try this:

pragma solidity >=0.4.0 <0.6.0;

contract SimpleStorage {
    uint storedData;

    function set(uint x) public {
        storedData = x;

    function get() public view returns (uint) {
        return storedData;

This example sets the value of a variable and exposes it for other contracts to access.

Not the answer you're looking for? Browse other questions tagged or ask your own question.