The Mining Game: Explaining Blockchains
November 5, 2017
To help people understand blockchains, I have created a blockchain game available here. (The source code is available here.) I will explain the game rules and the user interface. I will also mention some possible insights from playing this game.
- Players can create and submit blocks for inclusion into chains.
- Blocks consist of five fields: block numbers, nonces, previous initials, player initials, and, payloads.
- Chains are sets of valid blocks that are ordered by block numbers, and, that start with block number zero.
- Blocks are valid if their hashes begin with a zero, their previous initials equal the player initials of the preceding block in a chain, and, they contain a payload from the payload list.
- Nonces can be changed to modify hashes.
- It is possible to submit invalid blocks.
- The game is over when at least one block has been submitted for every possible block number.
- Winners have the greatest numbers of blocks in the longest chains.
- It is possible for the longest chain to not extend to the largest possible block number.
Players can enter block fields in the form:
Players select payloads from the payload list:
Players can click the “Hash Block” button to calculate the hash of a block, or, the “Submit Block” button to submit a block:
Submitted blocks appear in the yellow region. Valid blocks will be blue and invalid blocks will be red:
Block numbers correspond to rows, and, there is a row for every possible block number. Therefore, games are over when there is at least one block in every row of the yellow region. When games are over, the blocks of the longest chains turn white:
Refresh the web page to start new games.
The incentives for winning are the same as for mining. For example, because only valid blocks contribute towards winning, players are motivated to validate blocks just like in mining. Also, because only the longest chains contribute towards winning, players are motivated to ignore the smaller chains just like in mining.
Hopefully this game will help illuminate many blockchain concepts. Feel free to share it with anyone interested in blockchains.
You can contact me by clicking any of these icons:
I would like to thank IOHK (Input Output Hong Kong) for funding this effort.
This work is licensed under the Creative Commons Attribution ShareAlike 4.0 International License.