Let's test the updated /mine endpoint and the /receive-new-block endpoint that we just created. Basically, the /mine endpoint will mine the new block for us. It will also take that block and broadcast it across the entire blockchain network so that every node is synchronized and all the nodes have the same blocks and the same data. This is the result we expect to observe when we test the /mine endpoint:
- To get started, you should have all five of the nodes running. You should also have connected them together to create a blockchain network.
- Next, go to the browser. The first thing to do here is to choose a node to mine the new block. We have got five nodes to choose from but in our case, we will just stick with the first node. Therefore, type localhost:3001/mine in the address bar and then hit Enter. You will get an output like...