What is Solidity?

What is Solidity?

Introduction

This blog defines Solidity and describes how it is utilised in the Ethereum ecosystem. I will also be going through my experience learning solidity and what I’ve done to make it a smooth learning curve for myself.

When did it start

Since it was first proposed in 2014 and later developed by Ethereum's Solidity team, Solidity has come a long way. Hundreds of thousands of developers are using the programming language to build blockchain-based services for an increasing variety of decentralized applications. If you want to understand more about the inner workings of blockchain-based programming language, this article is for you.

The language is mostly used to write smart contracts on the Ethereum blockchain, but it can also be used on other blockchains. Solidity is similar to JavaScript, one of the most widely used computer languages. It can be thought of as a JavaScript dialect which means that if you know JavaScript, learning Solidity should be simple. Solidity has features in common with the programming languages C++ and Python. I have had a good spell with learning Python and HTML in school and university which has made the transition into solidity a walk in the park.

Deploying your first smart contract

Learning the history of solidity can get boring so let’s get straight in to what i learned first. Below will show step by step with photos what I learned first.

A.Visit remix.ethereum.org

B.Select Default Workspace

C.Create a file ‘HelloWorld.sol’. (HINT all solidity files end in sol) image.png

D.Open the HelloWorld.sol file and write down the below code

image.png

  1. This first line is declaring the license to avoid compiler warnings.
  2. This line of code shows the version of solidity we'll be using.
  3. This line of code starts the smart contract up. 'Contract' is equivalent to 'class' if you're familiar with object-oriented programming.
  4. This sets the string variable to 'Hello world'

E. Lets compile this file. click on the 'solidity compiler button I've pointed out and then click the 'compile button' in blue.

image.png

F. After you're done compiling we will deploy this solidity file to the test network, Click the button where the arrow is pointing. Click on the orange button with the word 'deploy'.

image.png

G. Click on the orange button with the word 'deploy'

image.png

H. Finally click the '>'. This is below 'deployed contracts'.

image.png

Well done, you've written your first smart contract in solidity. Hopefully that was a smooth ride. A really good resource I used was learnxinyminutes.com/docs/solidity to learn more complex smart contracts. If you have any questions feel free to leave a comment or message me on twitter. @44daz_

Did you find this article valuable?

Support Dahir Abib by becoming a sponsor. Any amount is appreciated!