Last updated
Last updated
Hedera is an open-source, public, proof-of-stake network. Its network services offer low and fixed fees, 10k TPS, and instant transaction finality. Learn more about the .
In this tutorial, we will adopt, set up, and run a Hedera node locally using the NPM Command Line Interface (CLI) tool with docker compose
.
This tutorial is based on the .
Already familiar with using a cloud service? Check out the other options for setting up and running the Hedera node locally. See the for more information.
To get started with this tutorial, ensure that you have the following software installed:
>= v14.x (Check version: node -v
)
NPM >= v6.14.17 (Check version: npm -v
)
>= v20.10.x (Check version: docker -v
)
>= v2.12.3 (Check version: docker compose version
)
Hardware: Minimum 16GB RAM
Node.js and NPM: Refer to the .
Docker: See to get docker up and running (note: specific instructions may vary based on the OS).
Clone the GitHub repo, navigate to the project folder using the commands below;
Note: This version may not reflect the most recent changes to the main branch of this repository. It also uses a baked in version of the Docker Compose definitions and will not reflect any local changes made to the repository.
Install the dependencies locally.
Start the local node (Note: Ensure Docker is running):
You can pass the following CLI flags, this would be used later in the following sections:
Other NPM commands:
npm run restart
to restart the network
npm run stop
to stop the network
npm run generate-accounts
to generate new accounts - network must be running first
You should see the following response in the terminal:
To generate default accounts and start the local node in detached mode, use the command below:
You should see the following response in the terminal:
There are different ways to verify that a node is running;
Check Block Number using Hashscan Block Explorer
Send cURL request to getBlockNumber
Select any of the listed blocks to view the details (Consensus, Block, Transaction Hash, etc) for a particular block.
Let's verify that we are able to interact with Hedera Testnet using JSON-RPC by issuing an eth_getBlockByNumber
JSON-RPC request.
Enter the curl command below:
You should get the following response:
Find below some common errors and how to troubleshoot them:
Error: Node cannot start properly because necessary ports are in use!
Fix
Option 1: Instead of starting another instance of the network, use the npm run generate-accounts
to generate new accounts for an already started network.
Option 2: If you get the above error, ensure that you terminate any existing Docker processes for the local node, and also any other processes that are bound to these port numbers, before running the npm start command. You can run docker compose down -v
, git clean -xfd
, git reset --hard
to fix this.
Accounts list (ED25519 keys)
Private keys
Public address
The command below can be used to install the official release from the repository.
Visit the local mirror node explorer endpoint () in your web browser. Ensure that LOCALNET
is selected, as this will show you the Hedera network running within your local network.
For an in depth explanation of the different terms below, see the .
Want to learn how to deploy smart contracts on Hedera? Visit the guide on how to .
In this tutorial, we successfully set up and ran the Hedera local node using the tool, generated default accounts and solved common errors encountered when running the local node.
Set and Run a Hedera Node using the .
.
Use to interact with Consensus and Mirror Nodes
Using .