Let's continue with building our blockchain data structure. After defining our constructor function in the previous section, the next thing that we want to do with our constructor function is to place a method in our Blockchain function. This method that we are going to create will be called createNewBlock. As its name suggests, this method will create a new block for us. Let's follow the below mentioned steps to build the method:
- The createNewBlock method will be defined as follows:
Blockchain.prototype.createNewBlock = function () { }
- Now we've got this createNewBlock method on our blockchain prototype object. This method will take the three parameters, as highlighted in the following line of code: ...