In order for the block explorer to function correctly, we'll need to query the blockchain for addresses, block hashes, and transaction IDs so that we can search for a particular parameter and get that particular piece of data in return. Consequently, the first step that we'll need to carry out is to build a few more endpoints. To do this, lets proceed with the following steps:
- Go to the dev/networkNode.js file and after the /consensus endpoint, let's define the first endpoint of our block explorer, /block/:blockHash, as follows:
app.get('/block/:blockHash', function(req, res) {
});
A specific blockHash will be sent with this endpoint, which, as a result, will simply return to us the block that the input of blockHash corresponds to.
- The next endpoint that we'll build will be /transaction/:transactionId....