1. Introduction to Solidity


In this tutorial, you came across everything about Solidity Programming and its concepts like how it evolved, what EVM and Smart Contracts are, what the Data Types in Solidity Programming are, and what its advantages are.

Whether you’re an experienced Blockchain developer or just an enthusiast who is interested to explore more about the crypto world or a fresher who wants to explore and understand the in-depth technicality of Blockchain networks, enrolling in Simplilearn’s Blockchain Certification Training program will help you understand, learn and explore more about cryptocurrencies, Blockchain, and its technology like programming languages with all level of experience.

1. Introduction to Solidity

Advantages of Solidity Programming

Apart from the primary functionality of Solidity Programming, there are many other features provided by Solidity programming that cause it to have an edge over other Ethereum based languages.

  • Apart from fundamental data types, Solidity programming also allows complex data types and member variables.
  • It provides an Application Binary Interface (ABI) to enable type safety. If the compiler discovers a data type mismatch for any variable, the ABI generates an error.
  • It refers to the ‘Natural Language Specification,’ which is used to turn user-centric specifications into language that machines can understand.

1. Introduction to Solidity

How to Execute The Code

How to Execute the Code

You can execute a Solidity Program in two ways – 

  1. Offline Mode
  2. Online Mode

Offline Mode 

To operate a Solidity smart contract in Offline mode, it must meet three conditions and follow four essential actions:

  • Conditions
  1. Download and install node.js.
  2. Install Truffle globally.
  3. Install ganache-cli.
  • Actions
  1. Create a truffle project and set up a development network for it.
  2. Develop and deploy a smart contract for it.
  3. From the Truffle console, interact with the smart contract.
  4. Create tests to evaluate Solidity’s primary features.

Online Mode 

In the Online Mode, the Remix IDE is typically used to compile and run Solidity smart contracts.

1. Introduction to Solidity

Smart Contract

Smart contracts are high-level program codes that are compiled to EVM byte code and deployed to the ethereum blockchain for further execution. It allows us to perform credible transactions without any interference of the third party, these transactions are trackable and irreversible. Languages used to write smart contracts are Solidity (a language library with similarities to C and JavaScript), Serpent (similar to Python, but deprecated), LLL (a low-level Lisp-like language), and Mutan (Go-based, but deprecated).

Example: In the below example, we have discussed a sample solidity program to demonstrate how to write a smart contract in Solidity.

  • Solidity
// Solidity program to
// demonstrate how to
// write a smart contract
pragma solidity >= 0.4.16 < 0.7.0;
// Defining a contract
contract Test
	// Declaring state variables
	uint public var1;
	uint public var2;
	uint public sum;
	// Defining public function
	// that sets the value of
	// the state variable
	function set(uint x, uint y) public
		var1 = x;
	// Defining function to
	// print the sum of
	// state variables
	function get(
	) public view returns (uint) {
		return sum;


Smart contract


1. Version Pragma: 

pragma solidity >=0.4.16 <0.7.0;

Pragmas are instructions to the compiler on how to treat the code. All solidity source code should start with a “version pragma” which is a declaration of the version of the solidity compiler this code should use. This helps the code from being incompatible with the future versions of the compiler which may bring changes. The above-mentioned code states that it is compatible with compilers of version greater than and equal to 0.4.16 but less than version 0.7.0.

2. The contract keyword: 

contract Test{ 
//Functions and Data 

The contract keyword declares a contract under which is the code encapsulated.

3. State variables: 

uint public var1;
uint public var2;
uint public sum;

State variables are permanently stored in contract storage that they are written in Ethereum Blockchain. The line uint public var1 declares a state variable called var1 of type uint (unsigned integer of 256 bits). Think of it as adding a slot in a database. Similarly, goes with the declaration uint public var2 and uint public sum.

4. A function declaration:

function set(uint x, uint y) public
function get() public view returns (uint)
  • This is a function named set of access modifier type public which takes a variable x and variable y of datatype uint as a parameter.
  • This was an example of a simple smart contract which updates the value of var1 and var2. Anyone can call the function set and overwrite the value of var1 and var2 which is stored in Ethereum blockchain. This is an example of a decentralized application that is censorship proof and unaffected to the shutdown of any centralized server. As long as someone is running a single node of Ethereum blockchain, this smart contract will be accessible.
  • The variable sum is calculated by adding the values of the variables var1 and var2.
  • Function get will retrieve and print the value of the state variable sum.
1. Introduction to Solidity

EVM or Ethereum Virtual Machine

  • The Ethereum Virtual Machine (EVM) provides a runtime environment for Ethereum smart contracts.
  • It is primarily concerned with ensuring the security and execution of untrusted programs through the use of an international network of public nodes.
  • EVM is specialized in preventing Denial-of-Service attacks and certifies that the programs do not have access to each other’s state, as well as establishing communication, with no possible interference.

Ethereum Virtual Machine abbreviated as EVM is a runtime environment for executing smart contracts in ethereum. It focuses widely on providing security and execution of untrusted code using an international network of public nodes. EVM is specialized to prevent Denial-of-service attack and confirms that the program does not have any access to each other’s state, also ensures that the communication is established without any potential interference. 

1. Introduction to Solidity

Evolution of Solidity Programming

Solidity is a relatively new language that is rapidly growing.

  • Solidity is currently the core language on Ethereum and other private blockchains operating on competing platforms, such as Monax and its Hyperledger Burrow blockchain which uses Tendermint for consensus. 
  • SWIFT has created a proof of concept that runs on Burrow and uses Solidity.
1. Introduction to Solidity


Solidity is a brand-new programming language created by the Ethereum which is the second-largest market of cryptocurrency by capitalization, released in the year 2015 led by Christian Reitwiessner. Some key features of solidity are listed below: 

  • Solidity is a high-level programming language designed for implementing smart contracts.
  • It is statically-typed object-oriented(contract-oriented) language.
  • Solidity is highly influenced by Python, c++, and JavaScript which runs on the Ethereum Virtual Machine(EVM).
  • Solidity supports complex user-defined programming, libraries and inheritance.
  • Solidity is primary language for blockchains running platforms.
  • Solidity can be used to creating contracts like voting, blind auctions, crowdfunding, multi-signature wallets, etc.

Solidity is an object-oriented, high-level language for implementing smart contracts. Smart contracts are programs which govern the behaviour of accounts within the Ethereum state.

Solidity is a curly-bracket language. It is influenced by C++, Python and JavaScript, and is designed to target the Ethereum Virtual Machine (EVM).

Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.

With Solidity you can create contracts for uses such as voting, crowdfunding, blind auctions, and multi-signature wallets.

When deploying contracts, you should use the latest released version of Solidity. Apart from exceptional cases, only the latest version receives security fixes. Furthermore, breaking changes as well as new features are introduced regularly.