I used beer to explain blockchain
I had the great privilege of giving a talk at Welecja, a Polish academic fraternity founded in 1883. To explain blockchain, I ran an IRL simulation of chain creation and forking. Below the reference for the exercise and slides. These are under the UNLICENSE so feel free to use, modify etc
.
BEER: Blockchain Explanation Exercise Reference
An exercise by Konrad Urban (kkonrad.com)
Materials You'll Need:
A beer tab (representing blocks in our blockchain)
Paper and pen/pencil
Dice
Beers (used as rewards and the token)
Instructions for Participants:
Setup:
Make sure you understand that the token rewards (beers) are given to you by the system because everyone agrees to participate, not by a centralised entity. We treat empty and full bottles as equal value.
Each of you or a group of you represents a 'node' in our blockchain network. Nodes are labelled A, B, C, D, etc.
Start with your beer tab, representing your initial block. Place this in front of you.
On your notepad, note down this initial beer tab as "Block 1" with the set of numbers.
Mining Blocks: Each round of this exercise represents an attempt to “mine a new block” (to basically update the balances)
2.1. Generating Block Data:After generating your block data using the dice rolls, consider the current state of each node's account (how many beers they have) and any new transactions that have been announced.
For example, at the beginning, the state might be A:5, B:2, C:8, D:11 (where A has 5 beers, B has 2 beers, etc.).
If a transaction is announced, such as A sending one beer to B, you would adjust the state accordingly to A:4, B:3, C:8, D:11.
Now, for hashing: sum your dice rolls and add the numbers from the new proposed state. So if you rolled a 3 and a 5 (totaling 8) and the new state is A:4, B:3, C:8, D:11, you'd add up these numbers to get a total (4 + 3 + 8 + 11 + 8 = 34).
Your block's hash is then determined by taking the last digit of this new total, which in this example would be 4.
Record this hash next to your dice number, the transaction data, and the new state on the notepad.
Check If You've Successfully Mined a Block:
If your hash is "0", congratulations! You've mined a block. Announce to everyone the details of your block: your number and the hash.
Receiving Your Mining Reward:
If you've successfully mined a block, collect a beer as your reward.
Add a new beer tab to your collection, representing the block you've just mined.
Everyone, including those who didn't mine the block, will also add a beer tab to their collection to maintain a consistent blockchain across all nodes.
Submitting a Transaction:
You can propose a transaction, such as trading beers with another participant.
Announce your transaction to the group.
Subtract a number of beers from your own tab and add to the recipient's.
Ensure that all participants record this transaction to keep their ledgers consistent. Copy the last block.
Keeping Your Blockchain Updated:
As the exercise progresses and more blocks are mined, ensure you maintain a record of all blocks on your notepad. Record each block's data, hash, and any transactions.
Periodically, compare your chain of beer tabs and notepad records with others to verify consistency.
Decentralisation and Forks:
After every block is mined, all participants should independently calculate the hash of the last block by considering the recent transactions.
Once everyone has their calculated hash, compare the results. The hash should match across all participants.
If two nodes (say, A and B) announce that they've mined a block exactly at the same time, there is a fork. In the case of a fork, follow these steps:
The nodes sitting closer to A choose to acknowledge A's block, and the nodes sitting close to B only acknowledge B’s block, unknowingly creating a fork.
Each half continues mining on their branch. Transactions can also be introduced, and they might differ between the two branches.
After a few rounds, one group will likely have a longer chain (more mined blocks) than the other.
Announce the discovery of a fork. Have each group present their chains and identify which one is longer.
The longer chain is deemed the valid one, and all participants should adopt this chain. Transactions in the shorter chain that haven't been included in the longer one are considered as "orphaned" and should return to the pool of pending transactions.
Continuing the Mining Process:
Using the simple hashing method provided, aim to mine as many blocks as you can to collect more beers and beer tabs!
End of Exercise: Once the exercise is concluded, there will be a discussion and reflection session. Be ready to share your insights, ask questions, and discuss what you've learned.