<jupyter_start><jupyter_text>A Basic Blockchain- [NeuralNine's 'Coding A Blockchain in Python'](https://youtu.be/pYasYyjByKI)  HashingTODO: Why is hashing so important?<jupyter_code>import hashlib<jupyter_output><empty_output><jupyter_text>BlockchainTODO: What is a blockchain?<jupyter_code>class NeuralCoinBlock:

    def __init__(self, previous_block_hash, transaction_list):
        self.previous_block_hash = previous_block_hash
        self.transaction_list = transaction_list

        self.block_data = "-".join(transaction_list) + "-" + previous_block_hash
        self.block_hash = hashlib.sha256(self.block_data.encode()).hexdigest()<jupyter_output><empty_output><jupyter_text>TransactionsTODO: What are transactions?<jupyter_code>t1 = "Anna sends 2 NC to Mike"
t2 = "Bob sends 4.1 NC to Mike"
t3 = "Mike sends 3.2 NC to Bob"
t4 = "Daniel sends 0.3 NC to Anna"
t5 = "Mike sends 1 NC to Charlie"
t6 = "Mike sends 5.4 NC to Daniel"<jupyter_output><empty_output><jupyter_text>Creating and Chaining Blocks<jupyter_code>initial_block = NeuralCoinBlock("Initial String", [t1, t2])
print(initial_block.block_data)
print(initial_block.block_hash)
second_block = NeuralCoinBlock(initial_block.block_hash, [t3, t4])
print(second_block.block_data)
print(second_block.block_hash)
third_block = NeuralCoinBlock(second_block.block_hash, [t5, t6])
print(third_block.block_data)
print(third_block.block_hash)<jupyter_output>Mike sends 1 NC to Charlie-Mike sends 5.4 NC to Daniel-77df85743d58d74d264b295beccb5e77b9ab55e25c136cccf01a092f9900fa2e
d72b3e86f9a78b719e5b011d8434f2787<KEY>
{'fraction_non_alphanumeric': 0.09904761904761905, 'fraction_numerical': 0.05650793650793651, 'mean_word_length': 7.040816326530612, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '297348', 'license': 'MIT', 'n_tokens_mistral': 644, 'n_tokens_neox': 582, 'n_words': 110, 'path': 'book/a_basic_blockchain.ipynb', 'repo_name': 'witt3rd/learning-blockchain-with-python-', 'size': '1601'}