Gist 83b992dc85e966c5da1755c8630ce330
✓ Published0🌍 Public
SSassOnTheRoad
Last edited Jul 16, 2017
Created on Feb 24, 2018
This example demonstrates a simple blockchain implementation in Python, showing how twenty blocks are sequentially chained together after the genesis block. The code defines a `Block` class that uses the `hashlib` library’s SHA-256 hashing algorithm to compute each block’s hash from its index, timestamp, data, and the previous block’s hash. Using the `datetime` module to timestamp each block, the script prints the index and hash of each newly added block, illustrating how the cryptographic chain grows and verifies its integrity.
AI-generated description