3 Facts About Solidity That All Beginners Should Know - IgbohoConnect

Brief Introduction to Solidity


Solidity is an object-oriented programming language, meaning that it is organized by data or objects rather than functions or logic. Its main purpose is for developing smart contracts for the Ethereum Blockchain.

If this is completely new to you, I definitely recommend checking out the Ethereum website for more information.

Ethereum defines itself as a, “…community-run technology powering the cryptocurrency ether (ETH) and thousands of decentralized applications”. They describe smart contracts as the, “…computer programs stored on the blockchain that allows us to convert traditional contracts into digital parallels…”. What sets smart contracts apart from the ones we use now is that smart contracts are built to be immutable. They can’t be changed. This allows users to conduct transactions without risk for the buyer or seller.

1. Solidity is a Curly-Brace Language

Solidity has a syntax that creates statement blocks with curly braces (ex. {}). It was designed to target the Ethereum Virtual Machine (EVM), which is the code environment for smart contracts in Ethereum. EVM provides developers a way to test their contracts without truly affecting the smart contract, the network, the filesystem, etc. It’s completely isolated.


It was mainly influenced by three languages — C++, Python, and JavaScript. If you are somewhat familiar with any of those languages, you can definitely tell that Solidity is similar. Personally, I’ve never really used C++ for much, but when I first saw code written in Solidity, it reminded me of PHP.

A “contract” is very similar to a class in C++ and JavaScript. It contains the functions and the data (or state) for that specific code block.

The “uint” stands for an unsigned integer of 256 bits. The Solidity documentation defines it as, “…a single slot in a database that you can query and alter by calling functions of the code that manages the database”. Below the state variable, are two functions. There is a get function and a set function. These allow modifications or value retrieval of the variable later.

2. Solidity is Statically Typed, Supports Libraries, and Much More

Solidity is Statically Typed

Solidity is statically typed, similar to C++. This means that the variable types are declared explicitly and are determined at compile time. The compiler then decides if that specific variable that you declared can do what it is supposed to do, based on the variable type given.

Solidity Supports Expressions and Control Structures

Since Solidity is based on C++, it has many of the same expressions and control structures typically used in curly-brace languages. For example, Solidity uses structures like if, else, while, do, for, break, continue, and return. It also supports exception handling with try/catch statements.

Solidity Supports Inheritance

Inheritance is only used in Object-Oriented Programming. In Solidity, it allows developers to create a “contract” built on an existing “contract”. It would still have the same behaviors as the parent, but maybe a new implementation. Inheritance is extremely useful when following the DRY principle.

Solidity Supports Libraries

Libraries in Solidity are similar to contracts, however; their purpose is to be deployed once and reused by other contracts. They are seen as implicit and are not explicitly visible. Similar to the above, they help with following the DRY principle. Another benefit of libraries in Solidity is that it will help to reduce the size of the contract by not rewriting the code that is available in a library. Libraries can also be useful with complex functions or math. If you don’t have to re-invent the wheel, don’t.

Solidity Has Many Different Types

One thing I found interesting while learning Solidity is just how many different types there were. Solidity supports three main categories of types value types, reference types, and mapping types. I recommend looking into each one, as they all contain several different types inside each category. For example, the value type category alone includes more than 10 different types (integers, booleans, address type, fixed-point numbers, contract types, and more).

3. Solidity Has Several Global Variables and Functions

Solidity has several special global variables and functions that are mostly used to provide information or as general utility functions. This includes properties that give certain information about the blockchain, mathematical functions, decoding and encoding functions, error-handling functions, members of address types, and functions that return information about a contract or an integers’ type.



Leave a Reply

Your email address will not be published. Required fields are marked *