Solidity Programming Essentials
Ritesh Modi
- 222 páginas
- English
- ePUB (apto para móviles)
- Disponible en iOS y Android
Solidity Programming Essentials
Ritesh Modi
Información del libro
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.
Key Features
- 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
Book Description
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.
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
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.
Preguntas frecuentes
Información
Introducing Solidity
- Solidity and Solidity files
- Structure of a contract
- Data types in Solidity
- Storage and memory data locations
- Literals
- Integers
- Boolean
- The byte data type
- Arrays
- Structure of an array
- Enumeration
- Address
- Mappings
Ethereum Virtual Machine
Solidity and Solidity files
- Pragma
- Comments
- Import
- Contracts/library/interface
Pragma
pragma Solidity ^0.4.19;
pragma Solidity <<version number>> ;
- The ^ character refers to the latest version within a major version. So, ^0.4.0 refers to the latest version within build number 4, which currently would be 0.4.19.
- The ^ character will not target any other major build apart from the one that is provided.
- The Solidity file will compile only with a compiler with 4 as the major build. It will not compile with any other major build.
Comments
- Single-line comments
- Multiline comments
- Ethereum Natural Specification (Natspec)
// This is a single-line comment in Solidity
/* This is a multiline comment
In Solidity. Use this when multiple consecutive lines
Should be commented as a whole */
The import statement
import <<filename>> ;
import 'CommonLibrary.sol';
Contracts
Structure of a contract
Índice
- Title Page
- Copyright and Credits
- Packt Upsell
- Contributors
- Preface
- Introduction to Blockchain, Ethereum, and Smart Contracts
- Installing Ethereum and Solidity
- Introducing Solidity
- Global Variables and Functions
- Expressions and Control Structures
- Writing Smart Contracts
- Functions, Modifiers, and Fallbacks
- Exceptions, Events, and Logging
- Truffle Basics and Unit Testing
- Debugging Contracts
- Other Books You May Enjoy