• Stars
    star
    159
  • Rank 235,916 (Top 5 %)
  • Language
  • License
    Creative Commons ...
  • Created over 5 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Documentation for ETH 2.0

ETH 2.0 educational resources

These are unofficial (whatever official means in Ethereum...) documents/diagrams for others to understand the spec better

The ETH 2.0 spec can be found here: github.com/ethereum/eth2.0-specs

Overview

External text resources:

Diagrams:

Timeline concept

Basic timeline example: Blocks, Slots and Epochs

Phase-0 BeaconState transition

Beacon State transition for Phase-0

Justification and Finalization

Justification and Finalization

Rewards and penalties table

Rewards and penalties table

SSZ hash-tree-root and merkleization

SSZ hash-tree-root, merkleization

SSZ encoding

SSZ encoding

Shuffling

Shuffling

Epoch processing

This epoch-processing help matches the phase0 beacon-chain behavior of spec v0.10.0.

Note that these diagrams are for the optimized implementation: lots of pre-computation, data in arrays, and flattening of nested spec functions.

Schematic type info

An overview of the box types used in the schematics below. Note the different kinds of pre-computation.

Committee pre-computation

Optimization: the optimized list-wise shuffling algorithm is used to compute committees data, based on the seed, derived from RANDAO data. Committee indices wil be joined with bitfields to get participant data, splitting the shuffled array into committee slices is advisable, to not re-compute bounds.

There is a look-ahead, and each epoch will only need to be computed once, for a given seed. (warning: if the chain forks deep enough, the seed for an epoch can change).

Proposer pre-computation

Optimization: the proposer indices are pre-computed using the same shuffling algorithm as committees, but only swapping an individual index around to avoid extra hashing. And the seed uses a different domain.

There is a slight chance the proposer has to be re-computed, since we try to favor validators that have a higher effective (capped) balance.

Slot transition

Not strictly part of the epoch transition, but essential to run before the actual epoch-transition, to cache the necessary state values (such as latest block root).

Justification and finalization

This is a big function, but boils down to repeating similar things for the previous and current epoch.

To speed up the processing, as well as the attester-rewards, it's best to pre-compute arrays of data (matching validator indices), and use those instead of re-processing the attestations (as the spec naively does). This way, the function can be completely flattened out to a process that dumps attestations into attester statuses, and then sums and filters the attester data a few times to get the FFG numbers.

Rewards and Penalties

Similar to justification and finalization, rewards need to process attestations extensively. Go through the attestation, dump the status data that is necessary, and then use this to.

Similarly, further array optimized lookups are:

  • Eligbility pre-computed
  • When processing attestations and dumping data, remember the minimum inclusion delay, and corresponding proposer index, for each validator. The rewarding part will not have to re-visit all attestations (like the spec naively implements).

Also note that the "source" type is a superset of the other types.

However, although theoretically it could be, "target" or "head" may be incorrectly not on the same chain, as these are unverified user-inputs.

Attestations checkpoints for a certain checkpoint type, that cannot be found on the canonical chain (roots in the state), are simply ignored, and as good as inactivity.

Registry updates

Optimization: note that the queing, ejections, and queue processing are all parallel: the validators affected cannot overlap due to their status and scheduling of follow-up actions for next epoch or later.

Optimization: the churn limit can be computed once, based on the active-indices length, also already computed.

Optimization: subsequent exits do not need to completely recompute the next exit-epoch. The max exit-epoch, and the current queue for it, can be cached. This makes the next call a simple O(1) incremental update on the cached values.

Slashings

Slashed validators get hit with a penalty that is adjusted based on the context: how many other validators are getting slashed?

The total stake to put these slashing amounts into context, is already computed and should be re-used.

Final updates

Optimization: recomputing hash-tree-root of state-roots and block-roots is unnecessary; these already are part of the merkle-tree of the state, and should already be cached somewhere. Hash these together, like a 2 field container of two roots, and it matches the batch root to put back into the state (SSZ summaries in action here).

Optimization: the registry updates can be parallelized cheaply, since the function does not access shared memory concurrently.

More Repositories

1

gocyto

Callgraph analysis and visualization for Go
Go
144
star
2

blocktopograph

Blocktopograph - Blocktopograph is a fan-made app for MCPE, it includes a top-down world viewer and a NBT editor.
Java
98
star
3

grug-wallet

A web3 wallet for Grug, by Grug.
JavaScript
90
star
4

zrnt

ZRNT - Executable spec for ETH 2.0, implemented in Go
Go
88
star
5

go-kzg

FFT, data-recovery and KZG commitments, a.k.a. Kate commitments, in Go - *super experimental*
Go
86
star
6

forkdiff

CLI tool to generate documentation page of git fork diff
Go
78
star
7

eth2-val-tools

Some experimental tools to manage validators - use at your own risk
Go
62
star
8

rumor

Interact with Eth2 network components
Go
58
star
9

beacon-schematic

Schematic of the Ethereum 2.0 Beacon Chain specification
50
star
10

optimistic-brainfuck

Brainfuck rollup scaling experiment for fun
Python
49
star
11

eth2-testnet-genesis

Create a genesis state for an Eth2 testnet
Go
43
star
12

mergemock

Merge Mock - testing tool for the Ethereum Merge
Go
39
star
13

ethereum-scaling-diagram

Ethereum scaling diagram
38
star
14

dv5das

Data Availability Sampling (DAS) on a Discovery-v5 DHT overlay
Go
34
star
15

lmd-ghost

Comparison of the different LMD-GHOST implementations
Go
31
star
16

macula

Experimental python optimistic rollup fraud-proof generation
Python
29
star
17

zcli

Eth2 CLI debugging tool
Go
29
star
18

eth2-das

DEPRECATED - Eth2 data availability sampling - Testground plan
Go
28
star
19

mergenet-tutorial

DEPRECATED. How to setup a multi-client ethereum Eth1-Eth2 merge testnet
Python
24
star
20

remerkleable

Typed mutable SSZ views over cached and immutable binary merkle trees
Python
22
star
21

pyrmont

Pyrmont Eth2 testnet
20
star
22

op-mordor

Highly experimental fault-proof program for Optimism Bedrock
Go
20
star
23

consensus-actor

View Ethereum consensus-layer activity: network-wide historical view of attester performance as interactive map
Go
19
star
24

ztyp

ZTYP: typing for ZRNT - SSZ, Merkle partials, full caching and immutable typed state.
Go
16
star
25

eth2.0-ssz

Draft of SSZ specs repo
14
star
26

rollup-node-experiments

rollup node experiments
Shell
14
star
27

opti

Minimalist optimistic rollup tech
Go
13
star
28

eth2api

Go API bindings for Eth2, Lighthouse/Teku compat + customization (work in progress)
Go
13
star
29

zssz

[DEPRECATED] ETH 2.0 SSZ - optimized Go implementation
Go
12
star
30

merge-genesis-tools

Testnet tooling to create a Merge state at genesis. Part of Rayonism โ˜€๏ธ
Solidity
10
star
31

eth2-surround

Experimenting with different surround-vote matching optimizations for ETH 2.0
Go
10
star
32

eth2fastspec

Optimized version of the eth2spec python module.
Python
10
star
33

eth-merkle-trees

9
star
34

eth2-shuffle

Shuffling for ETH 2.0
Go
9
star
35

clique

Clique consensus layer node
Go
8
star
36

istanbul-demo

Fault Proof Program & VM demo @ onchain summit istanbul
Go
8
star
37

eth2-bootnode

bootnode utility for Eth2
Go
8
star
38

go-libp2p-gossip-berlin

Hackathon EthBerlinZwei - profile gossipsub
Go
8
star
39

siege

siege: surround an ethereum node with cannon for fault-proof testing
Go
8
star
40

bls12-381-hd

BLS12-381 hierarchical key derivation in Go - ERC-2333 & ERC-2334
Go
7
star
41

beacon-challenge

Beacon-chain state transition challenge
Go
6
star
42

pyrum

Python interface for Rumor - Eth2 networking shell
Python
6
star
43

partial_fft

FFT fun
Python
6
star
44

eth2.py

Eth2 API Python bindings
Python
6
star
45

eth2-py-hacks

Eth2 Python tooling examples and experiments
Python
5
star
46

discv5-catdog

Discv5 version bridge hack
Go
5
star
47

merklez

Experimental Rust library for binary merkle trees
Rust
5
star
48

eth2-deposit-watch

Extract Eth2 deposits and validator set information from Eth1 deposit contract source.
Python
5
star
49

automata

Cellular automata w/ WebG, NodeJS and ES6
JavaScript
4
star
50

zwtf

Tiny Eth2 block explorer with streaming data.
Go
4
star
51

e2db

DB models and feeds for Eth2 state and Eth1-deposits
Python
4
star
52

eth2-crawl

Eth2 crawl
Go
4
star
53

eth2-snappy-experiments

Eth2 snappy-compression experiments
Python
4
star
54

nocturne

Nocturne testnet configs - Rayonism Eth2 Merge prototyping
Python
4
star
55

jsonrpc2

Go JSON-RPC v2.0 types and utils
Go
4
star
56

bls12-381-util

BLS 12-381 utils, POP signature scheme, pure Go (use at own risk).
Go
3
star
57

ctxlock

Go Read-Write lock with context cancellation support
Go
3
star
58

eth2-impl-design

Eth 2.0 implementation design
3
star
59

dotfiles

Dotfiles
Shell
3
star
60

eth2-config-tester

Test eth2 configurations for interopability, correctness, formatting
Go
3
star
61

redapp

Redux web3 integration and util for DApps
JavaScript
3
star
62

mergenet-ansible

Ansible playbooks and configs for rayonism mergenets
3
star
63

toledo

Toledo Eth2 testnet
3
star
64

chain-metrics

Go
3
star
65

nimbus-docker

Nimbus Eth2 dockerfile for testnet experimentation
Dockerfile
3
star
66

ask

Golang CLI library for on-the-fly typed commands with Cobra-like parsing
Go
3
star
67

testnet-dep-contract

Testnet deposit contract for Eth2 - permissioned, tokens, drain, admin funcs. DO NOT USE ON MAINNET.
Makefile
3
star
68

attacknet.eth2.wtf

Dashboard for eth2 attacknet
TypeScript
3
star
69

go-eth2-peerstore

Eth2 peerstore for Go libp2p
Go
3
star
70

gofbp

Go Flow Based Programming (FBP) model
Go
3
star
71

go-rlp

Golang RLP
Go
3
star
72

eth2-py-scripts

Eth2 py scripts for debugging and more
Python
2
star
73

fafafa

2
star
74

airviz-server

EthNY hack, websocket server for network graph viz of eth 2.0
Go
2
star
75

protolith

Compositional blockchain - experimental
Dart
2
star
76

not-a-client

ZRNT + Rumor+ Go-remerkleable, syncing lighthouse testnet.
Go
2
star
77

rumor-tg

Rumor telegram bot
Go
2
star
78

muskoka-client

Muskoka client
TypeScript
2
star
79

rayonism

Rayonism website
SCSS
2
star
80

ansible_eth2

[ARCHIVE] Collection of Eth2 clients, utilities, testnet data and more
Jinja
2
star
81

go-enode

enode util from go-ethereum
Go
2
star
82

steklo

Steklo merge devnet configs
Python
2
star
83

eth2-shuffle-experiment

ETH 2.0 shuffling experimental improvement
Go
2
star
84

eth2-merkle-server

API server for Eth2 beacon merkle proofs (experimental)
Go
2
star
85

go-discover

discv4 and discv5, isolated from go-ethereum for tooling/experiments
Go
2
star
86

go-eth-crypto

crypto secp256k1 and sha3 utils from go-ethereum
Go
1
star
87

go-eth2-reqresp

Go implementation of the Eth2 Req-Resp protocol
Go
1
star
88

singapore

Ethereum 2.0 Sharding on top of Protolith, an experimental generalized blockchain project. ETHSingapore hackathon project.
Dart
1
star
89

optimism-monorepo-experiment

Testing how monorepo + specs merge runs
Go
1
star
90

toy-monorepo

Go
1
star
91

toledo.eth2.wtf

Toledo testnet dashboard
TypeScript
1
star
92

go-enr

ENR utils from go-ethereum
Go
1
star
93

legendre-key-recovery

Optimizing a key recovery attack scenario, initial python code by @dankrad. Also see https://eprint.iacr.org/2019/862.pdf
Go
1
star
94

eth2-tests-experiment

experimental tests format
1
star
95

elmo

Execution Layer Mock Overlay for Ethereum
Go
1
star
96

go-secp256k1

secp256k1 go bindings from go-ethereum
C
1
star
97

go-mclock

mclock util from go-ethereum
Go
1
star
98

ssz_testgen

Edge case exploration and testing for SSZ
Python
1
star
99

go-keystorev4

Golang implementation of Keystore v4, for BLS12-381 keys, following EIP 2335. (Experimental, not audited)
Go
1
star
100

muskoka-worker

Muskoka worker: Go program to subscribe to a transitions task queue, manage processing and uploading of results
Go
1
star