Skip to content Skip to footer

Solidity Programming Essentials

Author: Ritesh Modi

A beginner’s guide to build smart contracts for Ethereum and blockchain

Additional information

Year of Publishing



Packt Publishing


Kindle, Paperback

Categories: , , Product ID: 19497


Learn the most powerful and primary programming language for writing smart contracts and find out how to write, deploy, and test smart contracts in Ethereum.

About This Book

  • Get you up and running with Solidity Programming language
  • Build Ethereum Smart Contracts with Solidity as your scripting language
  • Learn to test and deploy the smart contract to your private Blockchain

Who This Book Is For

This book is for anyone who would like to get started with Solidity Programming for developing an Ethereum smart contract. No prior knowledge of EVM is required.

What You Will Learn

  • Learn the basics and foundational concepts of Solidity and Ethereum
  • Explore the Solidity language and its uniqueness in depth
  • Create new accounts and submit transactions to blockchain
  • Get to know the complete language in detail to write smart contracts
  • Learn about major tools to develop and deploy smart contracts
  • Write defensive code using exception handling and error checking
  • Understand Truffle basics and the debugging process

In Detail

Solidity is a contract-oriented language whose syntax is highly influenced by JavaScript, and is designed to compile code for the Ethereum Virtual Machine. Solidity Programming Essentials will be your guide to understanding Solidity programming to build smart contracts for Ethereum and blockchain from ground-up.

We begin with a brief run-through of blockchain, Ethereum, and their most important concepts or components. You will learn how to install all the necessary tools to write, test, and debug Solidity contracts on Ethereum. Then, you will explore the layout of a Solidity source file and work with the different data types. The next set of recipes will help you work with operators, control structures, and data structures while building your smart contracts. We take you through function calls, return types, function modifers, and recipes in object-oriented programming with Solidity. Learn all you can on event logging and exception handling, as well as testing and debugging smart contracts.

By the end of this book, you will be able to write, deploy, and test smart contracts in Ethereum. This book will bring forth the essence of writing contracts using Solidity and also help you develop Solidity skills in no time.

Style and approach

Solidity is a high-level programming language best understood using examples. After covering basic concepts of Ethereum and Solidity, programming constructs will be explained with help of examples. As the chapters progress, deployment, usage, and testing of contacts will form major aspect of the book. Troubleshooting and unit testing is an important exercise and skill to master this language will also be covered in this book.

Table of Contents

Introduction to Blockchain, Ethereum, and Smart Contracts

  • What is a blockchain?
  • Why blockchains?
  • Cryptography
    • Symmetric encryption and decryption
    • Asymmetric encryption and decryption
    • Hashing
    • Digital signatures
  • Ether
  • Gas
  • Blockchain and Ethereum architecture
    • How are blocks related to each other?
    • How are transactions and blocks related to each other?
  • Ethereum nodes
    • EVM
    • Ethereum mining nodes
    • How does mining work?
  • Ethereum accounts
    • Externally owned accounts
    • Contract accounts
  • Transactions
  • Blocks
  • An end-to-end transaction
  • What is a contract?
  • What is a smart contract?
    • How to write smart contracts?
  • How are contracts deployed?

Installing Ethereum and Solidity

  • Ethereum networks
    • Main network
    • Test network
      • Ropsten
      • Rinkeby
      • Kovan
    • Private network
    • Consortium network
  • Geth
    • Installing Geth on Windows
  • Creating a private network
  • ganache-cli
  • Solidity compiler
  • The web3 JavaScript library
  • Mist wallet
  • MetaMask

Introducing Solidity

  • Ethereum Virtual Machine
  • Solidity and Solidity files
    • Pragma
    • Comments
    • The import statement
    • Contracts
  • Structure of a contract
    • State variables
    • Structure
    • Modifiers
    • Events
    • Enumeration
    • Functions
  • Data types in Solidity
    • Value types
      • Passing by value
    • Reference types
      • Passing by reference
  • Storage and memory data locations
  • Literals
  • Integers
  • Boolean
  • The byte data type
  • Arrays
    • Fixed arrays
    • Dynamic arrays
    • Special arrays
      • The bytes array
      • The String array
    • Array properties
  • Structure of an array
  • Enumerations
  • Address
  • Mappings

Global Variables and Functions

  • The var type variables
  • Variables hoisting
  • Variable scoping
  • Type conversion
    • Implicit conversion
    • Explicit conversion
  • Block and transaction global variables
    • Transaction and message global variables
    • Difference between tx.origin and msg.sender
  • Cryptography global variables
  • Address global variables
  • Contract global variables

Expressions and Control Structures

  • Solidity expressions
  • The if decision control
  • The while loop
  • The for loop
  • The do…while loop
  • The break statement
  • The continue statement
  • The return statement

Writing Smart Contracts

  • Smart contracts
  • Writing a simple contract
  • Creating contracts
    • Using the new keyword
    • Using address of a contract
  • Constructors
  • Contract composition
  • Inheritance
    • Single inheritance
    • Multi-level inheritance
    • Hierarchical inheritance
    • Multiple inheritance
  • Encapsulation
  • Polymorphism
    • Function polymorphism
    • Contract polymorphism
  • Method overriding
  • Abstract contracts
  • Interfaces

Functions, Modifiers, and Fallbacks

  • Function input and output
  • Modifiers
  • The view, constant, and pure functions
  • The address functions
    • The send method
    • The transfer method
    • The call method
    • The callcode method
    • The delegatecall method
  • The fallback function

Exceptions, Events, and Logging

  • Error handling
    • The require statement
    • The assert statement
    • The revert statement
  • Events and logging

Truffle Basics and Unit Testing

  • Application development life cycle management
  • Truffle
  • Development with Truffle
  • Testing with Truffle

Debugging Contracts

  • Debugging
    • The Remix editor
    • Using events
  • Using a Block Explorer


Sign up for new books releases

The Crypto Bookstore © 2022. All Rights Reserved. | Privacy Policy

The Crypto Bookstore is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to