Skip to main content
Version: 1.29.0

Building from source

The Nethermind's source code can be obtained from our repository on GitHub:

git clone --recursive https://github.com/nethermindeth/nethermind.git

There are two options buiding Nethermind from source code:

Building standalone binaries

Prerequisites

To build Nethermind from source, install .NET SDK 8 or later.

tip

For a seamless experience, ensure your .NET SDK is up to date.

Building

To build both the client and tests, run the following command from the project's root directory:

dotnet build src/Nethermind/Nethermind.sln -c release

To simply run the client with a specific configuration without building tests, see below.

info

Before running the client or tests, ensure the platform-specific prerequisites are met.

Running

Nethermind can be launched immediately without compiling explicitly (thus, the previous step can be skipped). The following command builds Nethermind if needed and runs it:

cd src/Nethermind/Nethermind.Runner
dotnet run -c release -- -c mainnet

All Nethermind-specific parameters can be specified after --. For instance, the command above specifies the Mainnet configuration only.

The build artifacts can be found in the src/Nethermind/artifacts/bin/Nethermind.Runner/release directory. By default, the logs and database directories are located here as well.

For more info, see Running a node.

Testing

There are two test suites — Nethermind and Ethereum Foundation. Tests can be run with the following commands (the initial step of the build is not required):

cd src/Nethermind

# Run Nethermind tests
dotnet test Nethermind.sln -c release

# Run Ethereum Foundation tests
dotnet test EthereumTests.sln -c release

Bulding Docker image

Currently, there are three Docker images available in the project's root directory:

  • Dockerfile: the default Nethermind Docker image.
  • Dockerfile.chiseled: the rootless and chiseled version of the Nethermind Docker image.
  • Dockerfile.diag: the diagnostics image with pre-installed .NET diagnostic and tracing tools. This image is intended for internal use and is not distributed via public channels.

All Docker images have the following optional arguments:

  • BUILD_CONFIG: the build configuration that is either release or debug. Defaults to release.
  • BUILD_TIMESTAMP: the build time as a Unix timestamp. Defaults to the current time.
  • CI: this is mostly used for CI builds determining whether the build is deterministic. Must be either true or false. Defaults to false.
  • COMMIT_HASH: the Git commit hash to use as a part of the version string. Defaults to the latest commit hash.

Given the above, the following command builds the Nethermind chiseled Docker image from the project's root directory:

build_timestamp=$(date '+%s')
commit_hash=$(git rev-parse HEAD)

docker build . \
-f Dockerfile.chiseled \
-t nethermind-chiseled \
--build-arg BUILD_TIMESTAMP=$build_timestamp \
--build-arg CI=true \
--build-arg COMMIT_HASH=$commit_hash

For quick testing images, the above arguments can be omitted if not needed:

docker build . -t nethermind

For more info about running Docker containers, see Installing Nethermind.