Setting up a Hardhat Node
In this guide, you will learn how to set up a Hardhat node using DIVE CLI. This process allows you to interact with the Ethereum blockchain on your local environment using the Hardhat development environment. Follow these steps to get started:
Step 1: Ensure Kurtosis Engine is Running
Starting a Hardhat chain with DIVE CLI is a straightforward process. Before you proceed, ensure that the Kurtosis Engine is running in the background. If it's not already running, start it with the following command:
kurtosis engine start
Step 2: Start Hardhat Chain
To start a single Hardhat node, execute the following command:
dive chain hardhat
Executing this command will generate a 'services.json' file in the working directory, which contains service details for the 'hardhat' chain.
services.json
{
"hardhat-node":{
"service_name":"hardhat-node",
"endpoint_public":"http://127.0.0.1:8545",
"endpoint":"http://172.16.0.4:8545",
"keypassword":"hardhat",
"keystore_path":"keystores/hardhat_keystore.json",
"network":"0x539.hardhat",
"network_name":"hardhat",
"nid":"0x539"
}
}
- service_name: The name of the service.
- endpoint_public: The public endpoint URL for interacting with the service.
- endpoint: The private endpoint.
- keypassword: The password used for accessing the service's keystore.
- keystore_path: The file path for the service's keystore.
- network: The network ID.
- network_name: The name of the network.
- nid: The unique identifier for the network.
Step 3: Setup is Completed
After running the command, DIVE CLI will automatically start the Hardhat node and handle the necessary initialization processes. Please wait for the Hardhat node to fully initialize, which may take a few moments.
Once the initialization is complete, you can interact with the local Hardhat chain as needed. DIVE CLI sets up the Hardhat node on your local environment, enabling you to deploy and test smart contracts, explore transactions, and experiment with various Ethereum blockchain features using the Hardhat development environment.