Blockchain e smart contract

Consenso, transazioni, smart contract, gas, scalabilità e verifica crittografica.

Percorso di lettura

Questa sezione collega i concetti fondamentali ai libri che utilizzo come riferimento. Parto da un problema, individuo l’argomento e torno ai capitoli utili per comprenderlo.

Libri e percorsi della sezione

  • Mastering Bitcoin
  • Andreas M. Antonopoulos & David A. Harding
  • Mastering Ethereum
  • Carlo Parisi, Alessandro Mazza, Niccolò Pozzolini, Gavin Wood & Andreas M. Antonopoulos
  • From Transactions to Smart Contracts
  • Bitcoin Transaction
  • Ethereum Transaction
  • Smart Contract
  • Cybersecurity & Cryptography
  • Distributed Systems
  • Computer Networks
  • Databases & Data Management
  • Algorithms & Data Structures
  • Privacy-Enhancing Technologies

I titoli dei libri e le note dettagliate sui capitoli sono conservati nella lingua originale.

Leggi le note complete in inglese

Blockchain & Smart Contracts

Transactions, digital signatures, consensus, mining, smart contracts, the EVM, gas, tokens, decentralized applications, Layer 2 scaling and zero-knowledge proofs.

Blockchain was one of the areas where returning to structured technical material changed my understanding the most.

It is easy to describe a blockchain as a distributed ledger or to associate it primarily with cryptocurrencies. The more interesting part begins when we look underneath those definitions and ask how independent participants maintain a shared state without relying on a traditional central authority.

How can ownership be represented without a central database? What prevents the same asset from being spent twice? Why does a blockchain need consensus? What exactly is being signed inside a transaction? How does Ethereum turn a blockchain into a programmable execution environment? Why does executing a smart contract cost gas? And how can Layer 2 systems scale execution without simply abandoning Layer 1 security?

This section combines two complementary systems. Bitcoin is an excellent way to understand blockchain fundamentals, transaction validation, proof of work and distributed ownership. Ethereum extends many of those ideas into programmable state, smart contracts and decentralized applications.


Topics in This Section

Blockchain · Transactions · UTXO · Keys & Addresses · Digital Signatures · Wallets · Mining · Proof of Work · Consensus · Forks · Double Spending · Blocks · Merkle Trees · Bitcoin Network · Ethereum · Accounts · Gas · Smart Contracts · Solidity · EVM · Tokens · NFTs · Oracles · DApps · DeFi · Proof of Stake · Validators · Finality · Rollups · Layer 2 · Proto-Danksharding · Zero-Knowledge Proofs · zkEVM


Mastering Bitcoin

Andreas M. Antonopoulos & David A. Harding

3rd Edition — O’Reilly Media

Level
Foundation → Advanced

Best for
Understanding blockchain fundamentals through Bitcoin: keys, transactions, signatures, blocks, mining, consensus and network security.

Mastering Bitcoin is the book I use to understand blockchain technology from the bottom up.

Bitcoin provides a particularly useful learning environment because many of the core blockchain mechanisms are exposed clearly: private keys establish control, digital signatures authorize spending, transactions modify ownership, nodes validate rules independently, miners construct blocks and proof of work helps the network converge on a common transaction history.

For me, the value of the book is not primarily about Bitcoin as an asset. It is about understanding the engineering problem Bitcoin attempts to solve and the mechanisms used to solve it.

What I Use It For

  • understanding the blockchain model;
  • public and private keys;
  • addresses;
  • HD wallets;
  • transaction structure;
  • the UTXO model;
  • transaction authorization;
  • digital signatures;
  • transaction fees;
  • peer-to-peer propagation;
  • blocks and blockchain structure;
  • Merkle trees;
  • proof of work;
  • mining;
  • forks and chain selection;
  • double-spending resistance;
  • Bitcoin security;
  • advanced Bitcoin applications.

Chapters Worth Reading

Blockchain Foundations

Chapter 1 — Introduction
An introduction to Bitcoin, its origins and the basic model of decentralized digital value.

Chapter 2 — Overview
A complete high-level walkthrough of the Bitcoin system before moving into its individual mechanisms.

Running and Interacting with Bitcoin

Chapter 3 — Bitcoin Core
The reference implementation, node operation and programmatic interaction with the Bitcoin network.

Keys & Addresses

Chapter 4 — Keys and Addresses
The cryptographic foundations of ownership in Bitcoin.

  • private keys;
  • public keys;
  • elliptic-curve cryptography;
  • Bitcoin addresses;
  • encoding;
  • modern address formats.
Wallets

Chapter 5 — Wallets
How collections of cryptographic keys are generated, organised, backed up and recovered.

  • deterministic wallets;
  • seed phrases;
  • hierarchical deterministic wallets;
  • key derivation;
  • wallet recovery.
Transactions & the UTXO Model

Chapter 6 — Transactions
The structure through which Bitcoin transfers control over value.

  • transaction inputs;
  • transaction outputs;
  • UTXOs;
  • transaction identifiers;
  • value transfer;
  • transaction construction.
Authorization & Authentication

Chapter 7 — Authorization and Authentication
The mechanisms Bitcoin uses to define the conditions under which transaction outputs may be spent.

This chapter is particularly useful for understanding that possession of bitcoin is ultimately represented by the ability to satisfy cryptographic spending conditions.

Digital Signatures

Chapter 8 — Signatures
How cryptographic signatures authorize transactions without revealing private keys.

  • transaction signing;
  • signature verification;
  • signature hash types;
  • modern Bitcoin signature mechanisms.
Transaction Fees

Chapter 9 — Transaction Fees
How transactions compete for limited block space and how fees influence transaction inclusion.

The Bitcoin Network

Chapter 10 — Bitcoin Network
How peer-to-peer nodes propagate transactions and blocks without relying on a central server.

  • peer-to-peer networking;
  • node discovery;
  • transaction propagation;
  • block propagation;
  • network topology.
The Blockchain

Chapter 11 — Bitcoin Blockchain
The data structures used to construct a tamper-evident history of validated transactions.

  • blocks;
  • block headers;
  • block hashes;
  • Merkle trees;
  • chain structure;
  • transaction inclusion.
Mining & Proof of Work

Chapter 12 — Mining
The mechanism used to construct blocks, order transactions and make modification of historical blocks computationally expensive.

  • proof of work;
  • block construction;
  • mining difficulty;
  • chain selection;
  • competing blocks;
  • consensus through independent validation;
  • double-spending resistance.
Security

Chapter 13 — Security
Operational and cryptographic risks involved in protecting Bitcoin keys and systems.

Advanced Applications

Chapter 14 — Applications
Applications and protocols that build additional functionality on top of Bitcoin’s transaction and cryptographic foundations.

My Suggested Learning Path

Understand the System
Chapters 1–2

Keys & Ownership
Chapters 4–5

Transactions & Signatures
Chapters 6–9

Network & Blockchain
Chapters 10–11

Mining & Consensus
Chapter 12

Security & Applications
Chapters 13–14


Mastering Ethereum

Carlo Parisi, Alessandro Mazza, Niccolò Pozzolini, Gavin Wood & Andreas M. Antonopoulos

2nd Edition — O’Reilly Media

Level
Intermediate → Advanced

Best for
Understanding programmable blockchains, smart contracts, Ethereum consensus, the EVM, scaling and zero-knowledge technologies.

Mastering Ethereum is the book I use to move from blockchain as a transaction system to blockchain as a programmable execution environment.

Ethereum introduces accounts, smart contracts and a virtual machine capable of executing deterministic programs across thousands of independently operated nodes.

The second edition is particularly useful because it reflects modern Ethereum after the transition to Proof of Stake and includes dedicated material on current transaction types, DeFi, Ethereum consensus, Layer 2 scaling and zero-knowledge proofs.

What I Use It For

  • understanding Ethereum’s architecture;
  • accounts and transactions;
  • Ethereum cryptography;
  • wallets and key management;
  • transaction fees and gas;
  • EIP-1559;
  • smart contracts;
  • Solidity;
  • smart-contract security;
  • token standards;
  • ERC-20, ERC-721 and ERC-1155;
  • oracles;
  • DApps;
  • DeFi;
  • the Ethereum Virtual Machine;
  • Proof of Stake;
  • validators and attestations;
  • finality;
  • Layer 2 scaling;
  • rollups;
  • proto-danksharding;
  • zero-knowledge proofs;
  • SNARKs, STARKs and zkEVMs.

Chapters Worth Reading

Ethereum Foundations

Chapter 1 — What Is Ethereum?
Ethereum as a general-purpose blockchain and the conceptual transition from cryptocurrency to decentralized applications.

Chapter 2 — Ethereum Basics
Accounts, wallets, ether, transactions and a first interaction with a smart contract.

Ethereum Nodes

Chapter 3 — Ethereum Nodes
The client software and infrastructure participating in the Ethereum network.

  • execution clients;
  • consensus clients;
  • full nodes;
  • test networks;
  • JSON-RPC;
  • network synchronization.
Cryptography

Chapter 4 — Cryptography
The cryptographic primitives Ethereum uses for ownership, authentication and newer consensus and scaling mechanisms.

  • private and public keys;
  • elliptic-curve cryptography;
  • Keccak-256;
  • Ethereum addresses;
  • BLS signatures;
  • KZG commitments and proofs.
Wallets & Account Abstraction

Chapter 5 — Wallets
Key-management architectures together with newer approaches to account usability and recovery.

  • HD wallets;
  • mnemonic codes;
  • key derivation;
  • account abstraction;
  • social recovery;
  • ENS.
Transactions & Gas

Chapter 6 — Transactions
The structure and lifecycle of Ethereum transactions.

  • legacy transactions;
  • EIP-1559 transactions;
  • EIP-4844 transactions;
  • EIP-7702 transactions;
  • nonces;
  • gas;
  • base fee and priority fee;
  • ECDSA signatures;
  • transaction lifecycle;
  • MEV;
  • proposer-builder separation.
Smart Contracts & Solidity

Chapter 7 — Smart Contracts and Solidity
The programming model used to create executable applications on Ethereum.

  • smart-contract lifecycle;
  • Solidity;
  • ABI;
  • data types;
  • functions;
  • inheritance;
  • events;
  • contract-to-contract calls;
  • gas considerations.

Chapter 8 — Smart Contracts and Vyper
An alternative smart-contract language and the design choices it makes compared with Solidity.

Smart-Contract Security

Chapter 9 — Smart Contract Security
Security properties and failure modes specific to immutable blockchain applications.

  • reentrancy;
  • DELEGATECALL;
  • front-running;
  • denial of service;
  • precision errors;
  • oracle and price manipulation;
  • signature replay;
  • input validation;
  • configuration risks.
Tokens & NFTs

Chapter 10 — Tokens
The standards used to represent fungible and non-fungible assets through smart contracts.

  • ERC-20;
  • ERC-721;
  • ERC-1155;
  • fungibility;
  • token interfaces;
  • EIP-165;
  • token-standard security.
Oracles

Chapter 11 — Oracles
How smart contracts obtain information and computation that cannot be derived directly from blockchain state.

  • oracle design patterns;
  • data authentication;
  • decentralized oracles;
  • computation oracles;
  • cross-chain messaging.
Decentralized Applications

Chapter 12 — Decentralized Applications
How smart contracts, web interfaces and decentralized storage can be combined into a DApp.

  • smart-contract backend;
  • frontend integration;
  • blockchain interaction;
  • IPFS;
  • decentralized deployment.
Decentralized Finance

Chapter 13 — Decentralized Finance
Financial applications built from programmable blockchain primitives.

  • decentralized exchanges;
  • automated market makers;
  • lending markets;
  • stablecoins;
  • liquid staking;
  • real-world assets;
  • bridges;
  • DeFi risks.
The Ethereum Virtual Machine

Chapter 14 — The Ethereum Virtual Machine
The deterministic execution environment responsible for running smart-contract bytecode.

  • EVM bytecode;
  • Ethereum state;
  • stack;
  • memory;
  • storage;
  • calldata;
  • contract deployment;
  • gas accounting;
  • EVM Object Format.
Consensus & Proof of Stake

Chapter 15 — Consensus
How Ethereum reaches agreement on blockchain state after its transition from Proof of Work to Proof of Stake.

  • safety;
  • liveness;
  • finality;
  • Proof of Stake;
  • validators;
  • attestations;
  • LMD-GHOST;
  • Casper FFG;
  • epochs and checkpoints;
  • justification and finalization;
  • slashing;
  • fork choice;
  • Gasper.
Scaling Ethereum

Chapter 16 — Scaling Ethereum
The architectural approaches used to increase transaction throughput while managing the limits of Layer 1.

  • the scalability trilemma;
  • Layer 1 limitations;
  • rollups;
  • validiums;
  • sidechains;
  • based rollups;
  • native rollups;
  • danksharding;
  • proto-danksharding;
  • stateless Ethereum;
  • Verkle trees.
Zero-Knowledge Proofs

Chapter 17 — Zero-Knowledge Proofs
An introduction to proofs that allow one party to demonstrate the validity of a statement without revealing all of the information behind it.

  • zero-knowledge properties;
  • commitments;
  • Fiat-Shamir heuristic;
  • SNARKs;
  • STARKs;
  • zero-knowledge Layer 2 systems;
  • zkEVMs;
  • zkVMs.

My Suggested Learning Path

Understand Ethereum
Chapters 1–3

Keys, Wallets & Transactions
Chapters 4–6

Smart Contracts
Chapters 7–9

Tokens, Oracles & DApps
Chapters 10–13

Understand Execution
Chapter 14

Understand Consensus
Chapter 15

Understand Scaling
Chapter 16

Cryptographic Proofs
Chapter 17


Why I Keep Both Books

Mastering Bitcoin

Blockchain foundations first.

  • keys and ownership;
  • UTXO transactions;
  • digital signatures;
  • peer-to-peer networking;
  • blocks and Merkle trees;
  • proof of work;
  • mining;
  • chain selection;
  • double-spending resistance.

Mastering Ethereum

Programmable blockchain first.

  • accounts and gas;
  • smart contracts;
  • Solidity;
  • EVM;
  • tokens;
  • DApps and DeFi;
  • Proof of Stake;
  • rollups;
  • zero-knowledge proofs.

Bitcoin helps me understand why a blockchain can maintain decentralized ownership. Ethereum helps me understand what becomes possible when that shared state is also programmable.


From Transactions to Smart Contracts

Bitcoin Transaction

Defines how previously created outputs can be spent and who receives new outputs.

Ethereum Transaction

Can transfer value or request execution of code stored in a smart contract.

Smart Contract

Defines deterministic rules that modify blockchain state when executed by the Ethereum Virtual Machine.

A blockchain can record who owns something. A programmable blockchain can also define the rules governing how that state is allowed to change.


Topic → Book Map

Blockchain Foundations

Mastering Bitcoin: Chapters 1–2 and 10–12
Mastering Ethereum: Chapter 1

Keys, Addresses & Wallets

Mastering Bitcoin: Chapters 4–5
Mastering Ethereum: Chapters 4–5

Transactions & Digital Signatures

Mastering Bitcoin: Chapters 6–9
Mastering Ethereum: Chapters 4 and 6

Blockchain Data Structures

Mastering Bitcoin: Chapter 11
Mastering Ethereum: Chapters 14–15 for Ethereum state and consensus structures

Consensus

Mastering Bitcoin: Chapter 12 — Proof of Work
Mastering Ethereum: Chapter 15 — Proof of Stake

Smart Contracts

Mastering Ethereum: Chapters 7–9

Ethereum Virtual Machine & Gas

Mastering Ethereum: Chapters 6, 7 and 14

Tokens & NFTs

Mastering Ethereum: Chapter 10

Oracles, DApps & DeFi

Mastering Ethereum: Chapters 11–13

Rollups & Layer 2 Scaling

Mastering Ethereum: Chapter 16

Zero-Knowledge Proofs

Mastering Ethereum: Chapter 17


How I Use These Books

I find blockchain much easier to understand when I begin with the property the system needs to preserve and then identify the mechanism responsible for it.

“How can the network know that I am authorized to spend an asset without knowing my private key?”

That leads to public-key cryptography, transaction authorization and digital signatures.

“Two miners discover valid blocks at approximately the same time. Which transaction history becomes canonical?”

That leads to temporary forks, proof of work, chain selection and eventual convergence on one history.

“Why does executing a smart contract cost gas?”

That leads to replicated computation, finite block capacity, resource accounting and the need to prevent unbounded execution inside the EVM.

“Why can a rollup process many transactions more cheaply than executing each one directly on Ethereum Layer 1?”

That leads to moving execution away from Layer 1, batching many transactions together and using Layer 1 primarily for data availability, settlement and verification.

“How can Ethereum verify that a computation was performed correctly without executing every step itself?”

That opens the door to validity proofs, zero-knowledge systems, SNARKs, STARKs and zkEVMs.

Start from the guarantee the blockchain needs to preserve, then identify the cryptographic, distributed-systems or economic mechanism used to preserve it.


Related Areas

Blockchain sits at the intersection of several areas in this library.

Cybersecurity & Cryptography

Hashes, elliptic-curve cryptography, digital signatures, commitments and cryptographic proofs.

Distributed Systems

Consensus, replicated state, fault tolerance, forks, finality and Byzantine behaviour.

Computer Networks

Peer-to-peer propagation, distributed nodes and communication between independently operated participants.

Databases & Data Management

Replicated state, transaction ordering, immutability and alternative models for maintaining shared data.

Algorithms & Data Structures

Hash trees, graph structures, proof-of-work search and efficient verification.

Privacy-Enhancing Technologies

Zero-Knowledge Proofs, commitments and privacy-preserving verification.


Torna alla biblioteca