Block Explorer for Local Network in Hardhat

Nov 11, 2022

Hardhat, by default, uses a per-process built-in local Ethereum network to run your scripts, tests, deploys, etc.

It creates the network when you run a script, and destroys it afterwards. You can get more info here.

As an alternative, you can run it in stand-alone mode, to support external wallets (MetaMask et al). For this, you need to run: npx hardhat node.

Then, to connect your scripts to this stand-alone network, you need to specify the localhost network. As an example, to run a script called deploy.ts, you would run something like: npx hardhat run scripts/deploy.ts --network localhost.

Local Network Explorer

I felt the need for an explorer of this local network, to get the actual data that is used in each transaction, gas costs data, etc.

So far, the only tool I’ve found is Etherparty Explorer, whose last commit was on 2017.

It works, although it will give you some warnings that the node version you are using is not the one specified (it was meant to be run with Node <=2).

Install its dependencies with npm install, then run it with npm start, and by default it will connect to your local hardhat network which serves a JSON-RPC server at port :8545.

You will need to open it manually at http://localhost:8000/, and it will show you something like:

Etherparty Explorer


Do you have any feedback/comments? Hit me up at maxiredigonda@gmail.com