Erasure Coding For Dummies
Eric Olszewski
State Channels
Sharding
zk STARKS
Casper
Truebit
Plasma
What is Erasure Coding?
Erasure Coding is a data protection scheme that shatters data into shards (fragments) that are encoded with parity (redundant data) and then stores those shards across multiple storage media and locations.
Why Does it Matter?
Decentralize everything!
Basics
Data
Nodes
Basics (cont’d)
Data
Nodes
Example 1
Data
Nodes
75
Example 1 (cont’d)
Data
Nodes
75
x+y=12
2x+2y=24
3x+3y=36
Reed-Solomon Codes (1960)
Systematic stores has k data disks in the clear as well as m coding or parity disks. Non-systematic only stores coding information and does so on k + m, or n, disks.
Systematic and Non-Systematic Forms
Data is stored as stripes which are r rows of w-bit symbols from each of n disks.
Stripes
Optimal erasure codes have the property that any k out of the n code word symbols are sufficient to recover the original message (i.e., they have optimal reception efficiency).
MDS Erasure Codes
Example 2
Data
Nodes
ABDEFGHIJKLMNOP
DATA
DATA
DATA
DATA
PARITY
PARITY
Example 2 (cont’d)
Data
Generator Matrix
A | B | C | D |
E | F | G | H |
I | J | K | L |
M | N | O | P |
01 | 00 | 00 | 00 |
00 | 01 | 00 | 00 |
00 | 00 | 01 | 00 |
00 | 00 | 00 | 01 |
1c | 1b | 12 | 14 |
1b | 1c | 14 | 12 |
Data + Parity
A | B | C | D |
E | F | G | H |
I | J | K | L |
M | N | O | P |
51 | 52 | 53 | 49 |
55 | 56 | 57 | 25 |
X
=
Example 2 (cont’d)
Data
Nodes
ABDEFGHIJKLMNOP
ABCD
IJKL
EFGH
MNOP
51525349
55565725
Example 2 (cont’d)
A | B | C | D |
E | F | G | H |
I | J | K | L |
M | N | O | P |
01 | 00 | 00 | 00 |
00 | 01 | 00 | 00 |
1c | 1b | 12 | 14 |
1b | 1c | 14 | 12 |
A | B | C | D |
E | F | G | H |
51 | 52 | 53 | 49 |
55 | 56 | 57 | 25 |
X
=
Example 2 (cont’d)
01 | 00 | 00 | 00 |
00 | 01 | 00 | 00 |
8d | f6 | 7b | 01 |
f6 | 8d | 01 | 7b |
01 | 00 | 00 | 00 |
00 | 01 | 00 | 00 |
1c | 1b | 12 | 14 |
1b | 1c | 14 | 12 |
01 | 00 | 00 | 00 |
00 | 01 | 00 | 00 |
00 | 00 | 01 | 00 |
00 | 00 | 00 | 01 |
X
=
Example 2 (cont’d)
01 | 00 | 00 | 00 |
00 | 01 | 00 | 00 |
8d | f6 | 7b | 01 |
f6 | 8d | 01 | 7b |
X
=
A | B | C | D |
E | F | G | H |
I | J | K | L |
M | N | O | P |
A | B | C | D |
E | F | G | H |
51 | 52 | 53 | 49 |
55 | 56 | 57 | 25 |
Example 2 (cont’d)
01 | 00 | 00 | 00 |
00 | 01 | 00 | 00 |
8d | f6 | 7b | 01 |
f6 | 8d | 01 | 7b |
X
=
A | B | C | D |
E | F | G | H |
I | J | K | L |
M | N | O | P |
A | B | C | D |
E | F | G | H |
51 | 52 | 53 | 49 |
55 | 56 | 57 | 25 |
Additional Resources
Special thanks to all the members of the open source community - we are nothing without them.