Skip to Content
Learn
Build your own Mini-Blockchain!
Hacking the Chain

Now we can use the code in our previous exercise to spot a broken link. Let’s try tampering with the contents of the block and see how that creates a mismatch between hash values.

Instructions

1.

Instantiate a new Blockchain object called my_blockchain.

2.

Add a new block to my_blockchain and pass in new_transactions as the argument.

Print out the contents of my_blockchain to see the new block!

3.

Select the transactions found in my_blockchain‘s chain attribute. Set the transactions variable of Block 1 to the string "fake_transactions".

4.

Now let’s check if the blockchain is still valid by calling the correct method on my_blockchain!

Folder Icon

Sign up to start coding

Already have an account?