DEV Community

Cover image for Introduction to Solidity
Paul C. Ishaili
Paul C. Ishaili

Posted on

Introduction to Solidity

Introduction

In the beginning, there was Bitcoin. It was a fast, easy way to exchange money in a decentralized way – no banks involved. And people could trust it because every transaction is recorded in a public ledger that can’t be changed.

But Bitcoin was limited. Blockchain technology had the potential to do so much more than peer to peer currency exchanges if it had the right code. So the Ethereum network was created, underpinned by a new language called Solidity.

Solidity Introduction logo

What is 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.

Solidity is an object-oriented, high-level langauge designed for implementing smart contracts on the Ethereum Virtual Machine (EVM).

While Bitcoin provides rewards for running a transaction, Ethereum charges fees for executing software instructions. The gas mechanism in Ethereum lets users pre-pay for the instructions they want to execute on the EVM using Ether, its native currency. The contracts that are run using the EVM are written using Solidity.

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.

Historical View

  • August 2014: The Solidity language is proposed by Gavin Wood.
  • October 2014: Solidity is adopted as a language by Monax, a rival platform.
  • August 2015: Solidity is officially released.

Solidity logo

The Solidity project team was led by Christian Reitwiessner, and they were successful in creating a Turing-complete, object oriented programming language for implementing smart contracts. Being a high-level language means developers create smart contracts without having to manipulate system-level information like memory or bytecode to perform computations.

The profound influence of Solidity from C++ can be seen in the syntax for variable declarations, for loops, the concept of overloading functions, implicit and explicit type conversions and many other details.

In the early days of the language, Solidity used to be partly influenced by JavaScript. This was due to function-level scoping of variables and the use of the keyword var. The JavaScript influence was reduced starting from version 0.4.0. Now, the main remaining similarity to JavaScript is that functions are defined using the keyword function. Solidity also supports import syntax and semantics that are similar to those available in JavaScript. Besides those points, Solidity looks like most other curly-bracket languages and has no major JavaScript influence anymore.

Another influence to Solidity was Python. Solidity’s modifiers were added trying to model Python’s decorators with a much more restricted functionality. Furthermore, multiple inheritance, C3 linearization, and the super keyword are taken from Python as well as the general assignment and copy semantics of value and reference types.

Terms Associated with Solidity language

In programming with the solidity language there are terms associated with the sphere.

Solidity langauage

Ethereum

Ethereum is a decentralized open-source platform based on blockchain domain, used to run smart contracts i.e. applications that execute the program exactly as it was programmed without the possibility of any fraud, interference from a third party, censorship or downime. It serves a platform for nearly 260,00 different cryptocurrencies.

Ehter

Ether is the cryptocurrency generated by ethereum miners used to reward for the computations performed to secure the blockchain.

Ehtereum Virtual Machine (EVM)

Ethereum Virtual Machine (EVM) is a runtime environment for executing smart contracts in ethereum. It focueses widely on providing security and execution of ntrusted code using an internaitonal network of public node. EVM is specialized oto prevent Denial-of-Service attack and confirms that theprogram does not ensure that the commnication is established without any potential interference.

Smart contract

Smart contracts in Solidity

Smart contract are high-level program codes that are compiled to EVM byte codes and deployed to the ethereum blickchain for further execution. It allows us to perform credible transactions without any interference of the third party. These transactions are traceable and irreversible.

Features of Solidity

The features of Solidity programming language can be numerous, and these include:

  • It is high level programming langauge designed for implementing smart contracts.

  • It is a statically typed object-oriented (contract-oriented) language.

  • It is influenced by C++, Python and JavaScript and it is designed to run on the Ethereum Virtual Machine (EVM).

  • It supports complex user-defined programming libraries and inheritance.

  • It is the primary language for blockchains running platforms.

  • It is a language that can be used to creating contracts like voting, blind auctions, crowdfunding, multi-signature wallet, etc.

How Solidity works

The beauty of the Ethereum ecosystem is that so many different cryptocurrencies and decentralized applications can use it. Smart contracts make it possible for unique technologies to be made on Ethereum for all kinds of businesses and organizations.

Smart contracts built using Solidity can be thought of as a way to automate business and non-business processes between different people. This ensures that people making transactions on the blockchain do not have to worry about risks such as fraud or not being able to use the same currency.

One of the key components that makes the execution of Solidity code possible is the EVM. The EVM is described as a virtual computer on the blockchain which turns people’s ideas into code that runs applications on the blockchain.

Under the hood, Solidity creates machine-level code that is executed on the EVM. A compiler is used to break down high-level human-readable code, which it turns into instructions that the processor reads. Different platforms provide free Solidity compilation, including the Remix online compiler and a downloaded command-like compiler on a PC.

EVM smart contracts have some limitations which need to be addressed. One of the most significant of these is the limited access to useful library functions for parsing JSON structures or floating-point arithmetic.

Why Solidity language

The feasibility of Solidity programming for Ethereum blockchain depends a lot on the value advantages it delivers.

Other than the basic functionalities, Solidity offers many interesting features which verify that it is a better option than many Ethereum-based programming languages.

  • The first benefit of Solidity programming refers to the support for complicated data types and member variables alongside the fundamental data types.

  • Furthermore, Solidity programming language also offers an Application Binary Interface or ABI for enabling data type safety. The Application Binary Interface (ABI) could help in quick identification of errors when the compiler recognizes any data type mismatch for specific variables.

  • Another popular highlight of Solidity programming in Ethereum points towards the effect of ‘Natural Language Specification.’ Solidity leverages the Natural Language Specification for transforming user-centric specifications into a language that is comprehensible to machines.

The other critical advantages of using Solidity to build decentralized applications and smart contracts would include the following:

  • Easy access to object-oriented attributes in smart contracts, such as multi-level inheritance traits.
  • Solidity supports multiple variants of supporting roles by leveraging the Application Binary Interface or ABI.
  • The easier syntax helps beginners in learning the fundamentals of smart contracts and blockchain development.
  • Development of smart contracts on Solidity programming language would help in driving secure and trustworthy processes for various platforms dealing with agreements between two parties.

Applications of Solidity

Solidity is the foundation of the Ethereum network. No Solidity = no Ethereum. Here’s what you can do, thanks to the language.

Solidity with Ethereum

  • Dapps: The programming language gives developers the ability to create their own decentralized apps. A way to think about is like apps you get on your smartphone. You can download all kinds of apps from the app store, from games to fitness to banking. Dapps are the same. The main difference is that they are open source and don’t have a middleman (hence the word decentralized’). Just like apps in the Apple app store are built to run on iOS, Dapps on Ethereum are built to run on Solidity.

  • Smart contracts: Within Dapps, there are pieces of code known as smart contracts. These help people exchange money, shares, property and nearly anything of value when certain conditions are met. That eliminates the need for an expensive third party like a notary.

  • ICOs: Developers can also create their own tokens and launch an ICO right on the Ethereum platform. These tokens are known as ERC20 tokens; examples include OmiseGO, 0x, and the Basic Attention Token.

Conclusion

Ethereum is changing. The slew of developments and upgrades are bundled together under the banner, Ethereum 2.0. This will include developments like a new proof of stake, and sharding to make the blockchain run faster.

It’s all being done as an open source project by a large group of developers and researchers. This community goes far beyond the Ethereum Foundation – the group behind Ethereum. As such, there have been problems, disagreements, and roadblocks along the way, you can read about some of those issues in our ongoing coverage on the future of Ethereum. But whatever happens Solidity is here to stay.


Futher Reading & Resources


References

Calvin Ebun A., (2021). What Is Solidity and How Is It Used to Develop Smart Contracts?. https://www.makeuseof.com/what-is-solidity/

Matt Hursey, (2019). What is Solidity Programming Language?. https://decrypt.co/resources/solidity. https://www.makeuseof.com/what-is-solidity/

Solidity - Useful Resources. https://www.tutorialspoint.com/solidity/solidity_useful_resources.htm

Vedant Chainani, @envoy_. (2022). History and Origin of Solidity. https://dev.to/envoy_/history-and-origin-of-solidity-2mhl


Follow on Twitter for more.

Top comments (2)

Collapse
 
mrpaulishaili profile image
Paul C. Ishaili

You are sighted @adetutu777. Thank you all for the warm reactions!

Collapse
 
adetutu777 profile image
Adetutu Gbangbola

You are welcome 🤗