Skip to content

Getting Started with Nethermind on Windows

Nethermind is an Ethereum Client built on .NET Core. It is extremely fast and efficient.

Website
Github
Read The Docs

  1. Download Nethermind from the official page
    • For this tutorial I’m going to use D:\Nethermind\
    • I’m going to extract the latest version (1.3.2 as of writing) to D:\Nethermind\1.3.2\ in order to have a ‘fresh’ copy.
    • I’m then going to copy the contents to D:\Nethermind\Current\ as this will be my ‘working directory’.NethermindPath
  2. Create a folder for your custom config files
    • I’m going to use D:\Nethermind\MyConfig\
  3.  Create folders for your data (Database, Log, Keystore)
    • I’m going to use D:\Nethermind\MyData\MyDataPath
      NethermindFolders
  4. Populate your Config Folder with optional Static-Nodes
    • If you have other nodes on your network or wish to statically assign peers you can create or copy “static-nodes.json” from the D:\Nethermind\Current\Data folder. Then simply add your enodes.
  5. Generate your configuration file
    • The default config file is “mainnet.cfg” located in D:\Nethermind\Current\configs\ copy this file to your MyConfig folder
    • You will want to modify a few options at the very least, below is my config.
{
  "KeyStore": {
	"KeyStoreDirectory": "D:/Nethermind/MyData/KeyStore"
  },
  "Init": {
    "WebSocketsEnabled": true,
    "StoreReceipts" : true,
    "IsMining": false,
    "ChainSpecPath": "D:/Nethermind/Current/chainspec/foundation.json",
    "GenesisHash": "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
    "BaseDbPath": "D:/Nethermind/MyData/Database/Mainnet",
    "LogFileName": "D:/Nethermind/MyData/Log/Mainnet.log",
    "StaticNodesPath": "D:/Nethermind/MyConfig/static-nodes.json"
  },
  "Network": {
    "DiscoveryPort": 30303,
    "P2PPort": 30303,
    "ActivePeersMaxCount" : 100
  },
  "JsonRpc": {
    "Enabled": true,
    "Host": "127.0.0.1",
    "Port": 8545   
  },
  "Db": {
    "WriteBufferSize": 64000000,
    "WriteBufferNumber": 4,
    "BlockCacheSize": 1536000000,
    "CacheIndexAndFilterBlocks": true,
    "BlockInfosDbCacheIndexAndFilterBlocks": false
  },
  "Sync": {
    "BeamSync": false,
    "FastSync": true,
    "PivotNumber" : 9000000,
    "PivotHash" : "0x388f34dd94b899f65bbd23006ee93d61434a2f2a57053c9870466d8e142960e3",
    "PivotTotalDifficulty" : "13014076996386893192616",
    "FastBlocks" : true,
    "DownloadBodiesInFastSync" : true,
    "DownloadReceiptsInFastSync" : true,
    "UseGethLimitsInFastBlocks" : true
  },
  "EthStats": {
    "Enabled": true,
    "Server": "wss://ethstats.net/api",
    "Name": "name",
    "Secret": "secret",
    "Contact": "my contact info"
  },
  "Metrics": {
    "NodeName": "Mainnet",
    "Enabled": false,
    "PushGatewayUrl": "http://localhost:9091/metrics",
    "IntervalSeconds": 5
  }
}

The key aspects/modifications from default here are:

Keystore:
"KeyStoreDirectory": "D:/Nethermind/MyData/KeyStore"

Init:
"WebSocketsEnabled": true
"ChainSpecPath": "D:/Nethermind/Current/chainspec/foundation.json"
"BaseDbPath": "D:/Nethermind/MyData/Database/Mainnet"
"LogFileName": "D:/Nethermind/MyData/Log/Mainnet.log"
"StaticNodesPath": "D:/Nethermind/MyConfig/static-nodes.json"

Sync:
"BeamSync": true

Network:
"ActivePeersMaxCount" : 100

JsonRpc:
"Enabled": true

EthStats:
"Enabled": true
"Server": "wss://ethstats.net/api"

KeyStoreDirectory will ensure that when you upgrade your software in the future, your node will retain the same “enodeId” which is beneficial for peering purposes.

WebSockets enables you to connect to your node via WebSockets which is generally better performance than the JSON RPC method, also enabled.

ChainSpecPath is required simply for unattended launching. This is ‘default’ for mainnet.

BaseDbPath, LogFileName, and StaticNodesPath are all custom locations allowing us to put this data anywhere we want instead of in the home directory of the app when it’s launched.

BeamSync is a new feature of Nethermind that is still quite experimental, keep an eye on this. BeamSync looks like an awesome alternative to Fast Sync.

ActivePeersMaxCount is simply allowing us to connect to more peers, default is 25.

Ethstats is enabled and the Server is updated with the working server endpoint for ethstats.net. If you don’t have a secret, google how to find it 🙂

MyConfigPath

You’re now ready to run your node with the command:

D:\Nethermind\Current\Nethermind.Runner --config "D:\Nethermind\MyConfig\mainnet.cfg"

You can make a shortcut to run this command or you can even place this in Task Scheduler to auto-start at login.

The benefit of following this guide is that when the next version is released, say, 1.4.0, you’ll be able to simply over-write everything in D:\Nethermind\Current\ with the new version and relaunch using your custom config file.

Note that currently these are the defaults for mainnet:

 "DownloadBodiesInFastSync" : false,
 "DownloadReceiptsInFastSync" : false

In MY config both of these are true. This adds significant time to the initial sync process but it is healthier for the network to download these otherwise Geth nodes cannot sync from you. They are not required for the node to operate though…

Published inTech

3 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *