Overview
Block is the basic element in a blockchain system, as we known blockchain system is just a ledger, which means a bookkeeping1 that recording of financial transactions. In the blockchain system, those transactions are stored in the blocks. In each block, the data stored in may look like:
TXN | FROM | TO | VALUE |
---|---|---|---|
#0 | God | Cale | 100 |
#1 | Cale | Alice | 10 |
#2 | Alice | Bob | 1 |
#3 | Bob | Mike | 0.5 |
Then what’s a blockchain? Just simply chain the blocks together, usually add a field to point to its parent:
-
Blocks #0
Parent: None
Data:
TXN FROM TO VALUE #0 God Cale 100 -
Blocks #1
Parent: #0
Data:
TXN FROM TO VALUE #0 Cale Alice 10 #1 Cale Mike 1 -
Blocks #2 Parent: #1
Data:
TXN FROM TO VALUE #0 Alice Bob 1 #1 Mike David 0.5 -
Blocks #3
Parent: #2
Data:
TXN FROM TO VALUE #0 Bob David 0.5
As above shows, we can figure out each person’s balance:
ACCOUNT | BALANCE | WHY? |
---|---|---|
Cale | 89 | +100 from god, -10 to Alice, -1 to Mike |
Alice | 9 | +10 from Cale, -1 to Bob |
Bob | 0 | +1 from Alice, -0.5 to Mike, -0.5 to David |
Mike | 0 | +0.5 from Bob, -0.5 to David |
David | 1 | +0.5 from Bob, +0.5 from Mike |