Convert Figma logo to code with AI

ethereum logoyellowpaper

The "Yellow Paper": Ethereum's formal specification

1,684
527
1,684
118

Top Related Projects

Ethereum Proof-of-Stake Consensus Specifications

13,311

The Ethereum Improvement Proposal repository

Ethereum Proof-of-Stake Consensus Specifications

Go implementation of the Ethereum protocol

24,310

Solidity, the Smart Contract Programming Language

Quick Overview

The ethereum/yellowpaper repository contains the Ethereum Yellow Paper, which is the formal specification of the Ethereum protocol. It provides a detailed technical description of Ethereum's architecture, consensus mechanisms, and virtual machine operations. This document serves as the authoritative reference for developers and researchers working on Ethereum-related projects.

Pros

  • Comprehensive and detailed technical specification of Ethereum
  • Regularly updated to reflect changes in the Ethereum protocol
  • Serves as a crucial resource for developers and researchers
  • Provides mathematical and formal definitions for precise implementation

Cons

  • Highly technical and may be challenging for non-experts to understand
  • Requires frequent updates to keep pace with Ethereum's rapid development
  • May not always reflect the most recent changes in the Ethereum ecosystem
  • Limited explanations of practical applications or use cases

Note: As this is not a code library, the code example and quick start sections have been omitted.

Competitor Comparisons

Ethereum Proof-of-Stake Consensus Specifications

Pros of consensus-specs

  • More actively maintained and updated
  • Focuses on specific consensus mechanisms (e.g., Proof-of-Stake)
  • Provides detailed specifications for implementers

Cons of consensus-specs

  • Less comprehensive in covering the entire Ethereum protocol
  • May be more challenging for newcomers to understand the overall system

Code comparison

yellowpaper:

\begin{equation}
\mathtt{\small BALANCE}(\boldsymbol{\sigma}, a) \equiv \begin{cases}
0 & \text{if}\ a \notin \boldsymbol{\sigma} \\
\boldsymbol{\sigma}[a]_b & \text{otherwise}
\end{cases}
\end{equation}

consensus-specs:

def get_base_reward(state: BeaconState, index: ValidatorIndex) -> Gwei:
    total_balance = get_total_active_balance(state)
    effective_balance = state.validators[index].effective_balance
    return Gwei(effective_balance * BASE_REWARD_FACTOR // integer_squareroot(total_balance) // BASE_REWARDS_PER_EPOCH)

The yellowpaper uses LaTeX for formal mathematical definitions, while consensus-specs employs Python for more implementation-oriented specifications. The yellowpaper covers a broader range of Ethereum concepts, whereas consensus-specs focuses on specific consensus mechanisms and provides more practical, code-like specifications for implementers.

13,311

The Ethereum Improvement Proposal repository

Pros of EIPs

  • More accessible and easier to understand for a wider audience
  • Regularly updated with new proposals and improvements
  • Provides a structured process for suggesting changes to Ethereum

Cons of EIPs

  • Less comprehensive technical details compared to the Yellow Paper
  • May contain proposals that are not yet implemented or finalized
  • Requires more effort to track the status and implementation of each proposal

Code Comparison

Yellow Paper (mathematical notation):

σ' ≡ Υ(σ, T)
Υ(σ, T) ≡ Ω(Υ, σ, T)

EIPs (example from EIP-20):

function transfer(address _to, uint256 _value) public returns (bool success) {
    require(balanceOf[msg.sender] >= _value);
    balanceOf[msg.sender] -= _value;
    balanceOf[_to] += _value;
    emit Transfer(msg.sender, _to, _value);
    return true;
}

The Yellow Paper uses formal mathematical notation to define Ethereum's behavior, while EIPs often include example code implementations in Solidity or other languages to illustrate proposed changes or standards.

Ethereum Proof-of-Stake Consensus Specifications

Pros of consensus-specs

  • More actively maintained and updated
  • Focuses on specific consensus mechanisms (e.g., Proof-of-Stake)
  • Provides detailed specifications for implementers

Cons of consensus-specs

  • Less comprehensive in covering the entire Ethereum protocol
  • May be more challenging for newcomers to understand the overall system

Code comparison

yellowpaper:

\begin{equation}
\mathtt{\small BALANCE}(\boldsymbol{\sigma}, a) \equiv \begin{cases}
0 & \text{if}\ a \notin \boldsymbol{\sigma} \\
\boldsymbol{\sigma}[a]_b & \text{otherwise}
\end{cases}
\end{equation}

consensus-specs:

def get_base_reward(state: BeaconState, index: ValidatorIndex) -> Gwei:
    total_balance = get_total_active_balance(state)
    effective_balance = state.validators[index].effective_balance
    return Gwei(effective_balance * BASE_REWARD_FACTOR // integer_squareroot(total_balance) // BASE_REWARDS_PER_EPOCH)

The yellowpaper uses LaTeX for formal mathematical definitions, while consensus-specs employs Python for more implementation-oriented specifications. The yellowpaper covers a broader range of Ethereum concepts, whereas consensus-specs focuses on specific consensus mechanisms and provides more practical, code-like specifications for implementers.

Go implementation of the Ethereum protocol

Pros of go-ethereum

  • Practical implementation of Ethereum protocol in Go
  • Actively maintained with frequent updates and bug fixes
  • Includes tools like Geth for running Ethereum nodes

Cons of go-ethereum

  • More complex codebase, harder for beginners to understand
  • May contain implementation-specific details not in the official specification

Code comparison

yellowpaper (LaTeX):

\begin{equation}
L_{\mathbf{I}}(\boldsymbol{\sigma}, \mathbf{g}, \mathbf{I}) \equiv \mathbf{g}_r - \mathbf{g}_a
\end{equation}

go-ethereum (Go):

func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bool, err error) {
    if err = st.preCheck(); err != nil {
        return
    }
    // ... (additional code)
}

The yellowpaper provides formal mathematical specifications using LaTeX, while go-ethereum implements these specifications in Go code. The yellowpaper focuses on precise definitions and formulas, whereas go-ethereum translates these into executable code with additional implementation details.

go-ethereum serves as a practical reference implementation, making it easier for developers to build Ethereum-based applications and tools. However, for those seeking a deep understanding of the protocol's theoretical foundations, the yellowpaper remains an essential resource.

24,310

Solidity, the Smart Contract Programming Language

Pros of Solidity

  • Practical implementation of Ethereum smart contracts
  • Active development and frequent updates
  • Large community and extensive documentation

Cons of Solidity

  • More complex and prone to bugs compared to the formal specification
  • Subject to changes and updates, potentially affecting backward compatibility
  • Requires additional tooling and infrastructure for deployment

Code Comparison

Yellowpaper (formal specification):

σ' = Υ(σ, T)

Solidity (smart contract language):

pragma solidity ^0.8.0;

contract SimpleStorage {
    uint256 private storedData;

    function set(uint256 x) public {
        storedData = x;
    }
}

The Yellowpaper provides a formal mathematical representation of Ethereum's state transition function, while Solidity offers a high-level programming language for implementing smart contracts on the Ethereum platform. The Yellowpaper serves as the theoretical foundation, whereas Solidity is the practical tool for developers to create decentralized applications.

While the Yellowpaper ensures precise specification and formal verification, Solidity enables rapid development and deployment of smart contracts. However, Solidity's complexity can lead to potential vulnerabilities if not carefully implemented, whereas the Yellowpaper's formal approach minimizes such risks at the protocol level.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Ethereum Yellow Paper

License: CC BY-SA 4.0 Gitter GitPOAP Badge

The Yellow Paper is a formal definition of the Ethereum protocol, originally by Gavin Wood, currently maintained by Andrew Ashikhmin and with contributions from many people around the world.

It is a free culture work, licensed under Creative Commons Attribution Share-Alike (CC-BY-SA) Version 4.0.

Repository Currently Outdated

The Yellow Paper is out of date. It reflects the Ethereum specification up to the Shanghai network upgrade, activated on the Ethereum mainnet at block 17_034_870 (April 2023).

It does not yet contain changes introduced by the Cancun upgrade.

An alternative Python Execution Layer specification is actively maintained and up to date.

Usage

If you just want to read the paper, the latest version is generally available as a PDF at https://ethereum.github.io/yellowpaper/paper.pdf. If you find that the borders for links block too much text when viewing the PDF in the browser, you can instead download it and open and view it with a PDF viewer application such as Adobe Acrobat or Evince, where the borders are less likely to display over text.

However, if you want to edit the paper, then read on. The paper comes as a single latex file Paper.tex.

It is recommended to use an IDE such as Visual Studio Code with the LaTeX Workshop extension, to edit the tex file, and show the PDF.

Another option is to separately edit the tex file and build as follows (you'll still need to clone the repo then open the yellowpaper folder):

git clone https://github.com/ethereum/yellowpaper.git
cd yellowpaper
./build.sh

This will create a PDF version of the Yellow Paper. Following building, you can also use standard pdflatex tools for compiling/preview, like http://latex.informatik.uni-halle.de/latex-online/latex.php.

Tips on editing

You can use TeX Stack Exchange; https://en.wikibooks.org/wiki/LaTeX/ (e.g. Bibliography Management and Hyperlinks); and BibTeX editor.

Versions

The previous protocol versions are listed in BRANCHES.md.

Other language versions

  • Chinese translated by YuanGe and GaoTianlu.
  • French translated by Asseth (checkout to branch 'french' ).
  • Vietnamese translated by KodyFanz (checkout to branch 'vietnamese').