Complete Technical Reference for SigmaState Interpreter, ErgoTrees, and Sigma Language
This is a PRE-ALPHA version. Before using this material:
- Not Authoritative — This is NOT an official specification. It is a research/educational resource.
- May Contain Errors — Content has not been formally verified.
- Subject to Change — Chapters may be incomplete or substantially rewritten.
- Verify Everything — Cross-reference against the source code.
Authoritative Sources:
- sigmastate-interpreter — Reference Scala implementation
- sigma-rust — Rust implementation
- ergo — Ergo node
- ErgoTree Spec (spec.pdf)
A comprehensive technical reference for engineers who need deep understanding of the implementation details, algorithms, and design decisions behind the Ergo blockchain's smart contract system.
The book is organized into ten parts covering the full stack:
| Part | Title | Chapters |
|---|---|---|
| I | Foundations | Introduction, Type System, ErgoTree Structure |
| II | Abstract Syntax Tree | Value Nodes, Operations & Opcodes, Methods on Types |
| III | Serialization | Serialization Framework, Value Serializers |
| IV | Cryptographic Foundations | Elliptic Curve Cryptography, Hash Functions, Sigma Protocols |
| V | Interpreter Engine | Evaluation Model, Cost Model, Verifier, Prover |
| VI | Compiler | ErgoScript Parser, Semantic Analysis, IR, Pipeline |
| VII | Data Structures | Collections, AVL+ Trees, Box Model |
| VIII | Ergo Node Integration | Interpreter Wrappers, Transaction Validation, Cost Limits, Wallet |
| IX | SDK and APIs | High-Level SDK, Key Derivation |
| X | Advanced Topics | Soft-Fork Mechanism, Cross-Platform, Performance |
Plus comprehensive appendices covering type codes, opcodes, costs, methods, serialization formats, and version history.
cargo install mdbook# Build the book
mdbook build
# Serve locally with hot reload
mdbook serve --openThe built book will be in the book/ directory.
This book is derived from:
- sigmastate-interpreter — Reference Scala implementation
- sigma-rust — Rust implementation
- ergo — Full node implementation
- ErgoTree Specification — Formal specification
Contributions are welcome. Please open an issue or pull request on GitHub.
See LICENSE for details.