Assignment 15 – Creating your own Blockchain
Outcomes
You will learn to use all the algorithms and data structures from this course to build your own Blockchain.
Assignment
You will create your own Blockchain (just like in the video) with only one little difference. He uses an Array to store his Blockchain, you are simply going to do this, making the Blockchain a List.
Differences will be;
- Block object will need a pointer to next (and previous if implemented doubly, which I recommend)
- Your Block will NOT need an index
- Your Block will NOT need a timestamp.
- Blockchain Object will need a pointer to the head and tail.
- Blockchain will need to implement push (you should have this).
- The key will be writing the isChainValid() function
- You must use a 64-bit or greater Hash Function
For the output – you will create a Blockchain that allows the user to input data and push that onto the end of the node. When the user does that, the output should be the results of the isChainValid() function (true or false). This function checks the entire chain to ensure all nodes are valid.
Note: You do not need to implement the Proof of Work capability.
In your Fiddle code output, give an application where a Blockchain can be used and why a Blockchain is useful in this application.
Submission Instructions
You will submit a link to your Fiddle as a text file or as a text link.
Information
Before starting this assignment, you should watch 2 videos
- How Does Blockchain Work – https://www.youtube.com/watch?v=SSo_EIwHSd4
- Creating a Blockchain with Javascript – https://www.youtube.com/watch?v=zVqczFZr124
Please note that neither of these video segments are ones I created. There are reasons (1) every programmer has their own personal style and syntax. Sanjee is an excellent programmer and demonstrates some different ways of doing things. It is worth noting that the syntax he uses in his Javascript, such as the use of the class keyword does not work in every browser. The second is that he programs in Visual Studio, which, if you continue to program, you will become very familiar with, and this is a good exposure to VS. Third, he uses Node.js in this video – which means you must know enough coding to translate his code into pure js.
Grading Criteria
Partial Credit will be assigned based on your ability to achieve the different parts of the assignment;
- Create a List that can hash previous list contents.
- Ability to add new items successfully to the blockchain.
- Ability to check the validity of the blockchain.
You must prove this capability (as described in the assignment).
I will simply be looking through your code to determine how well you implemented the Blockchain. This should be pretty easy as it is simply the child of a List and a Hash Function.