🔥 $100K Hit! Where Will Bitcoin Go Next? Find Out Live!

Code has been added to clipboard!

Learn the Solidity Basics From This Solidity Tutorial

Reading time 4 min
Published Jan 1, 2016
Updated Oct 3, 2019

Solidity Tutorial
What is Solidity, and how is it related to blockchain? This Solidity tutorial reveals that this language is object-oriented, statically typed and meant for creating smart contracts.

To make the learning process of Solidity easier, its founder based this language on the ECMAScript. Therefore, people with the programming background in Python, JavaScript, or C++ will master Solidity faster.

For the purposes of learning and writing smart contracts, Remix is currently the most optimal way of trying out Solidity. Remix is an integrated development environment (IDE) based on a web browser.

Solidity Tutorial: Main Tips

  • Solidity programming language creates smart contracts for blind auctions, crowdfunding, voting, etc.
  • This language is ECMAScript-based and its syntax rules resemble JavaScript.
  • Updates and upgrades are frequently released for Solidity. Currently, the latest version is 0.5.x.

Solidity Basics

Smart contracts consist of instructions and rules, governing the interactions between them. To write them and become a Solidity developer, you must be familiar with the basics of Ethereum Virtual Machine (EVM) and blockchain.

After reading Solidity tutorials about value types, variables and events, similarities between this language and JavaScript are obvious.

Solidity is a language to create contracts commonly used for:

  • Crowdfunding: creating new projects, reviewing existing projects, funding projects with Ether, and retrieving of collected funds.
  • Auctions: allows creating both open and blind auctions. However, blind auctions reveal bids only after the bidding ends.
  • Voting: guarantees transparency and creates one contract per ballot.
  • Multi-signature wallets: contains the instructions and rules for fund management and transfer. It needs permission from multiple participants before the manipulation of funds can occur.

Creation and management of smart contracts become easier if you know JavaScript. Contracts are similar to classes in such languages as they have persistent data in state variables and functions for their modification.

Note: Solidity language is used for EVM, supports libraries, inheritance, and user-defined types.

New Solidity versions are released regularly as their support team constantly fixes bugs and implements other necessary changes. Pay attention when new Solidity updates come out and review the significant modifications. Currently, the latest version of Solidity is 0.5.x.

DataCamp
Pros
  • Easy to use with a learn-by-doing approach
  • Offers quality content
  • Gamified in-browser coding experience
  • The price matches the quality
  • Suitable for learners ranging from beginner to advanced
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable
Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid Certificates of completion
edX
Pros
  • A wide range of learning programs
  • University-level courses
  • Easy to navigate
  • Verified certificates
  • Free learning track available
Main Features
  • University-level courses
  • Suitable for enterprises
  • Verified certificates of completion

Brief Overview of Solidity Syntax and Compilers

For practicing Solidity programming skills, we recommend using Remix. However, there are other options to choose from. It is also possible to install a compiler such as solcjs on computers or use binary packages.

The syntax rules for Solidity programming are similar to JavaScript. The main idea is to work with a stack-and-memory model. There are two types of accounts in Ethereum: external accounts (managed by public-private key pairs) and contract accounts (controlled by the code stored together with the account).

Note: every account has storage, a persistent memory area for mapping 256-bit words to 256-bit words. Modification or reading of storage is expensive, and enumeration of storage is impossible.

Solidity Concepts

This Solidity tutorial also introduces you to the main concepts that you will see during your learning process:

  • Smart contract: a collection of code located at a certain address on the Ethereum blockchain and containing functions and data.
  • Transaction: sets of modifications to be applied to the state of the blockchain.
  • Blockchain: a public transactional database, storing records of transactions made in various cryptocurrencies.
  • Ethereum Virtual Machine: the platform for smart contracts in Ethereum.
  • Gas: a factor to calculate and limit the work for the execution of transactions and smart contracts. The initiator of the transaction decides the price for gas and pays it from the sending account.
  • Mapping: a way to structure value types (integers, addresses, structs, and booleans) and similar to hash tables.

Solidity Tutorial: Summary

  • Smart contracts are created with Solidity which is used for EVM. Contracts are for voting, blind auctions, crowdfunding, etc.
  • Usage and syntax of Solidity are similar to ECMAScript. Developers who have worked with JavaScript or other languages will learn Solidity easier.
  • Track updates of Solidity in their official website. The newest Solidity version is 0.5.x.