Solidity Tutorial: all about Contracts

Jean Cvllr
10 min readMay 17, 2020

Table of Contents

How are smart contracts created?

The “this” keyword

Abstract contracts

Contracts inheritance

The “super” keyword

Function overriding

Deactivate and selfdestruct

How are smart contracts created ?

The EVM in Ethereum know that a smart contract is created when an Externally Owned Account (EOA):

  • sends a transaction
  • specifies a zero-address (0x0000000000000000000000000000000000000000 ) as a recipient.

The data field of the transaction contain the compiled bytecode of the smart contract written in Solidity.

Do you want to see what does this data field / bytecode looks like?

Let’s first install the solc compiler.

brew update
brew upgrade
brew tap ethereum/ethereum
brew install solidity

To check that solc was installed successfully, run the following command:

solc --version

Let’s create a new file HelloWorld.sol and add the following Solidity code :

pragma solidity >=0.4.22 <0.6.0;contract HelloWorld {    string public text  = "hello world";}

Open your terminal, go into the folder where you have your HelloWorld.sol file and run the following command :

solc HelloWorld.sol --bin

Encountering any issues? Feel free to look back at the documentation to install the solc compiler.

You should obtain the following output :

======= HelloWorld.sol:HelloWorld =======