The next method that we are going to add to our blockchain constructor function is called createNewTransaction. This method will create a new transaction for us. Let's follow the below mentioned steps to create the method:
- Start building up this method by adding the following line of code after our getLastBlock method:
Blockchain.prototype.createNewTransaction = function () {
}
- The function () will take three parameters, such as the following:
Blockchain.prototype.createNewTransaction = function (amount, sender, recipient) {
}
What these three parameters will do is as follows:
- amount: This parameter will take in the amount of the transaction or how much is being sent in this transaction.
- sender: This will take in the sender's address.
- recipient: This will take in the recipient's address.
- The next thing that we want...