Build your own Mini-Blockchain!

Creating Blocks

Now let's think of a way to represent a block in Python. We could create a bigger dictionary and store our data inside this dictionary. But since blocks can be represented as objects, let's create a Block Class which we can easily use to create new blocks.

Recall that a Block contains the following properties:

  • Timestamp
  • Transaction
  • Hash
  • Previous Hash
  • Nonce

In this exercise, we will be creating the default constructor for the Block class in our Mini-Blockchain.

Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.