codedamn logo
codedamn

Hello World in Solidity – How to get started with your First project in Solidity.

  • Vishnupriya's profile image
    Vishnupriya
    Team codedamn
Hello World in Solidity – How to get started with your First project in Solidity.

What is Solidity?

Solidity is a high level, object-oriented programming language for writing smart contracts in the Ethereum Blockchain. Smart contracts are used to manipulate the Ethereum Blockchain and govern the behaviour of the accounts within the Ethereum Blockchain.

Solidity is highly influenced by Javascript, C++ and Python. It is designed to target the EVM (Ethereum Virtual Machine). With Solidity, you can create interesting Web3.0 projects like a crowdfunding system, blind auctions, multi-signature wallets. Solidity keeps receiving many regular updates which means that you have to adapt to the new version as quickly as you can. The most recent Solidity version is 0.8x.

As Web3.0 has just started to gain traction, many companies are ahead of the curve and have already started to adapt to the change and have started implementing Solidity in their development processes. Some of the top companies using Solidity are:

  • LeewayHertz
  • EngineerBabu
  • TreeHouse Technology Group
  • OpenGeek Slab
  • Altoros
  • AppInvetiv
  • Abes Lab
  • Arc Touch

How to write Hello World in Solidity

As we know Solidity is similar to languages like Javascript, Python and Java. Many programmers begin their programming journey with the basic Hello World program, I know I did too by learning Javascript and one of my first programs was the famous Hello World program. Let’s take a look at how to write Hello World in these languages to see how they compare to Solidity!!

Javascript:

console.log("Hello World!");
// Hello World!

Python:

print("Hello World!);
// output: Hello World!

Java:

As you can see in Java, a class is required before writing anything. This makes it a statically typed language like Solidity.

class helloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!"); 
   }
}
 

Let’s see how to write Hello World! in Solidity

pragma solidity ^0.8.10
contract helloWorld {
  string public hello = "Hello World!"
}
//output: Hello World!

How you can start learning Solidity via Codedamn?

Codedamn offers a concise learning path to help you get started with writing Smart Contracts in Solidity to help you build multiple projects in the Web3.0 space. You can learn about the Ethereum Blockchain, Solidity, Smart Contracts, MetaMask, Creating your own coin and launching it, ICO(Initial Coin Offering), etc.

You can access the course here

Codedamn’s Solidity related material:

  • Solidity Fundamentals
  1. What is Solidity? 
  2. Remix IDE
  3. Solidity Compilation Steps.
  4. Mainnet vs Testnet 
  • Solidity Programming
  1. Say “Hello World” in Solidity 
  2. Contract Development Environment 
  3. Solidity Sample Program
  4. State Variables 
  5. Local Variables
  6. Functions
  7. Create functions
  8. Pass an argument to the function
  9. View vs Pure 
  10. Constructor
  11. Integers 
  12. Strings 
  13. Storage vs Memory vs Stack on EVM   
  14. If Else 
  15. Booleans 
  16. Fixed Size Array
  17. Dynamic Size Array 
  18. Fixed (byte) Size Array
  19. Dynamic (byte ) Size Array 
  20. Dynamic Array
  21. Loops 
  22. Storage program 
  23. Struct 
  24. Enum 
  25. Mappings 
  26. Mappings Struct  
  27. Global Variables (Special functions and variables)
  • Solidity Advanced Concepts
  1. Inheritance 
  2. Abstract Contracts 
  3. Interface 
  4. Polymorphism 
  5. Visibility
  6. Require 
  7. Modifier 
  8. Payable Function 
  9. Payable Address 
  10. Fallback Function 

There are many practice labs that you can use to try out the recent concepts you have learned along the way!!

Where to write Solidity Code?

You can use Codedamn’s Solidity Playground. PlayGround lets you write and edit Solidity code which you can easily run and compile right in the browser. You just need to type your code and click on the RunCode button on the bottom left of the screen and the output of your code will be displayed in the terminal. You can use the Codedamn Playground to write Smart Contracts for your Web3 projects as well

You can use the Playground for free

Codedamn Compiler opens up a docker container in the backend of the website which then uses WebSockets to verify your credentials and then help run the code in the background and display the output to you in the Terminal. In simple terms, it opens a separate PC in the background which compiles your Solidity Code checks for any errors or problems in your code and shows the output to you on your computer in the Terminal of the Codedamn PlayGround. Codedamn playground uses Solc, which has been rated as the best compiler for Solidity. Making use of Solc compiles your code and displays the output in a matter of a few seconds. It produces various outputs ranging from assemblies and simple binaries over an abstract syntax tree to estimations of gas usage. 

Why use Playground Compiler?

Installing a separate code editor for only one specific language can be a hassle. Compiling your code on Codedamn Playground is very easy as it opens up another computer for you that does all the work in the background without making your own Computer Lag and also compiles it faster than any other compiler available anywhere. The ease of use is another crucial factor that ensures that all your files are in one place and are always safe, due to the AutoSave function which saves every line of code you write ensuring that you never lose your work.

User avatar