SOLID STATE PRESS
← Back to catalog
Solidity: Smart Contract Programming Basics cover
Coming soon
Coming soon to Amazon
This title is in our publishing queue.
Browse available titles
Cryptocurrency & Blockchain

Solidity: Smart Contract Programming Basics

State Variables, Functions, and the EVM That Runs Them — A TLDR Primer

You opened a DeFi or NFT tutorial and hit a wall of Solidity code you couldn't parse. Or your computer science class mentioned blockchain and the textbook said nothing useful. Either way, you need a fast, clear foundation — not a 600-page reference manual.

**Solidity: Smart Contract Programming Basics** is a focused primer that walks you from zero to functional. It covers what the Ethereum Virtual Machine actually does with your code, how to structure a contract with state variables and functions, which data types live on-chain and why that matters for cost, and how the runtime context (gas, msg.sender, events) shapes every line you write. The final sections tackle the security traps that have cost real projects millions — reentrancy, overflow, tx.origin misuse — and show you the practical deploy-and-test workflow using Remix and MetaMask on a free testnet.

This is a beginner's guide to Ethereum smart contract development: no prior blockchain experience required, though basic programming familiarity (any language) will help. It is short by design. The goal is orientation and confidence, not exhaustive reference. You will finish it in a sitting, understand what your code is doing and why, and be ready to follow more advanced DeFi or NFT project walkthroughs without feeling lost.

If you want to write your first real contract without wading through documentation rabbit holes, start here.

What you'll learn
  • Explain what a smart contract is and how the Ethereum Virtual Machine executes Solidity code
  • Read and write basic Solidity contracts using state variables, functions, and visibility modifiers
  • Use core data types, mappings, structs, and arrays to model on-chain state
  • Understand gas, the msg context, events, and require statements for safe contract logic
  • Recognize common vulnerabilities like reentrancy and integer issues, and apply standard guards
  • Deploy and test a simple contract using Remix and connect it to a wallet like MetaMask
What's inside
  1. 1. What Solidity Is and Why It Exists
    Introduces smart contracts, Ethereum, the EVM, and how Solidity compiles down to bytecode that runs on every node.
  2. 2. Your First Contract: Structure, State, and Functions
    Walks through a minimal contract showing pragma, contract declaration, state variables, constructors, and function visibility.
  3. 3. Data Types, Mappings, and Storing On-Chain State
    Covers value vs reference types, integers, addresses, booleans, strings, arrays, structs, and mappings — the building blocks of contract storage.
  4. 4. Gas, msg, Events, and require: The Runtime Context
    Explains how Solidity code interacts with the blockchain at runtime — who called the function, how much gas is left, how to log data, and how to enforce conditions.
  5. 5. Common Pitfalls and Security Basics
    Surveys the classic bugs every Solidity beginner should know — reentrancy, integer overflow, tx.origin misuse, and unchecked external calls — with standard mitigations.
  6. 6. Deploying and Testing with Remix and MetaMask
    Shows the practical workflow: writing in Remix, compiling, deploying to a testnet, interacting via MetaMask, and reading transactions on Etherscan.
Published by Solid State Press
Solidity: Smart Contract Programming Basics cover
TLDR STUDY GUIDES

Solidity: Smart Contract Programming Basics

State Variables, Functions, and the EVM That Runs Them — A TLDR Primer
Solid State Press

Contents

  1. 1 What Solidity Is and Why It Exists
  2. 2 Your First Contract: Structure, State, and Functions
  3. 3 Data Types, Mappings, and Storing On-Chain State
  4. 4 Gas, msg, Events, and require: The Runtime Context
  5. 5 Common Pitfalls and Security Basics
  6. 6 Deploying and Testing with Remix and MetaMask
Chapter 1

What Solidity Is and Why It Exists

Before Solidity existed, there was no good way to tell a blockchain what to do beyond "move this coin from address A to address B." Ethereum changed that by adding a programmable layer — and Solidity is the language that programs it.

Ethereum is a public blockchain where participants agree on a shared record of transactions. What makes it different from Bitcoin is that Ethereum nodes do not just record value transfers; they also store and execute programs. Those programs are called smart contracts.

A smart contract is code that lives at a permanent address on the Ethereum blockchain, holds its own data, and runs automatically when someone sends it a transaction. There is no company hosting the contract, no database administrator, and no way to take it offline. Once deployed, the contract does exactly what its code says — every time, for anyone who calls it. That guarantee of automatic, tamper-proof execution is the entire reason the technology matters.

The machine underneath: the EVM

Every Ethereum node — there are thousands of them, run by volunteers and institutions worldwide — runs the Ethereum Virtual Machine, or EVM. The EVM is a sandboxed computing environment: it can read and write the blockchain's state, do arithmetic, and branch on conditions, but it cannot make HTTP requests or read from a hard drive. That isolation is intentional. Every node must reach the exact same result when running the same code, and outside data would break that agreement.

Solidity source code — the human-readable files you will write — is not what the EVM runs directly. A compiler translates Solidity into bytecode, a compact sequence of low-level instructions that the EVM understands. You can think of bytecode the same way you think of machine code for a CPU: it is the actual thing being executed, and the higher-level language exists purely for human convenience. When you deploy a contract, you are uploading its bytecode to the blockchain, where it sits at a specific address forever.

Gas: paying for computation

About This Book

If you are working through a university blockchain course, teaching yourself Ethereum programming basics as a new developer, or looking for a cryptocurrency programming primer before diving into your first Web3 project, this book is written for you. It also fits bootcamp students who need a fast foundation before tackling more advanced work, and self-taught coders who want to learn blockchain coding from scratch without wading through sprawling documentation.

This Solidity EVM beginner study guide covers the core ideas you need: contract structure, state variables, data types, mappings, gas, the msg object, events, require, security pitfalls, and how to write and deploy Ethereum contracts using Remix and MetaMask. It also introduces the concepts behind intro to DeFi development and smart contracts so you understand where these skills lead. A concise introduction, short by design, with no filler between you and working code.

Read straight through once for orientation, follow each worked example in Remix as you go, then attempt the problem set at the end to confirm your understanding holds up.

Keep reading

You've read the first half of Chapter 1. The complete book covers 6 chapters in roughly fifteen pages — readable in one sitting.

Coming soon to Amazon