In this section, we are going to build our transaction endpoint. Let's follow the below mentioned steps:
- Before we start, please make sure that whenever you are working on our blockchain you have your server running. We can do that by running the npm start command in our terminal.
- Let's head over to our api.js file and build our transaction endpoint. First of all, take out the example code that we added earlier in the /transaction endpoint and create a new transaction in our blockchain. To do that, we are going to use our createNewTransaction method in the blockchain.js file that we built in Chapter 2, Building a Blockchain.
- As you know, our createNewTransaction method takes in three parameters: amount, sender, and recipient:
Blockchain.prototype.createNewTransaction = function(amount, sender, recipient) {
const newTransaction ...