1 of 18

Erasure Coding For Dummies

Eric Olszewski

State Channels

Sharding

zk STARKS

Casper

Truebit

Plasma

2 of 18

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.

3 of 18

Why Does it Matter?

  • You only need a subset of the shards to rehydrate data.
  • You can replace failed components when convenient, without taking the system offline.
  • The compromise of a shard of a file is much less worrisome than the compromise of the file, itself.

Decentralize everything!

4 of 18

Basics

Data

Nodes

5 of 18

Basics (cont’d)

Data

Nodes

6 of 18

Example 1

Data

Nodes

75

7 of 18

Example 1 (cont’d)

Data

Nodes

75

x+y=12

2x+2y=24

3x+3y=36

8 of 18

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

9 of 18

Example 2

Data

Nodes

ABDEFGHIJKLMNOP

DATA

DATA

DATA

DATA

PARITY

PARITY

10 of 18

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

=

11 of 18

Example 2 (cont’d)

Data

Nodes

ABDEFGHIJKLMNOP

ABCD

IJKL

EFGH

MNOP

51525349

55565725

12 of 18

13 of 18

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

=

14 of 18

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

=

15 of 18

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

16 of 18

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

17 of 18

18 of 18

Additional Resources

Special thanks to all the members of the open source community - we are nothing without them.