Run a Node on Windows
If this is the first time for you to setup a validator node, head to our Validator Bootcamp 🚀. Please head to Run a node for instructions on how to setup a RPC node with neard.
This doc is written for developers, sysadmins, DevOps, or curious people who want to know how to run a NEAR node on Windows.
Heads up
This documentation may require additional edits. Please keep this in mind while running the following commands.
If Windows Subsystem for Linux is not enabled, open PowerShell as administrator and run:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-LinuxThen restart your computer.
Go to your Microsoft Store and look for Ubuntu; this is the Ubuntu Terminal instance. Install and launch it.
Now you might be asked for username and password, do not use admin as username.
Your Ubuntu Instance need initial before next steps
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential pkg-config libssl-devYou need to install OpenSSL, which you will need to run the node. To download OpenSSL, please run the following commands in the Ubuntu Terminal:
cd /tmp
wget https://www.openssl.org/source/openssl-1.1.1.tar.gz
tar xvf openssl-1.1.1.tar.gzAfter it finished downloading OpenSSL, run the following commands to install:
cd openssl-1.1.1
sudo ./config -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)'
sudo make
sudo make installThe files will be under the following directory: /usr/local/ssl.
Once this is finished, you have to ensure that Ubuntu is going to use the right version of OpenSSL. Now update the path for man pages and binaries. Run the following command:
cd ../..
sudo nano /etc/manpath.configA text file will open, add the following line:
MANPATH_MAP /usr/local/ssl/bin /usr/local/ssl/manOnce this is done press ctrl + o . It will ask you to save the file, just press enter. Now press ctrl + x to exit.
To make sure that OpenSSL is installed run:
openssl version -vThis should show you the installed version. More info on this can be found here. (https://manpages.ubuntu.com/manpages/bionic/man1/version.1ssl.html)
Now you have to run the following commands to install all nessesary software and dependencies:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y git jq binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev cmake gcc g++ protobuf-compiler python3 python3-pip llvm clangInstall Rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup default nightlyGreat! All set to get the node up and running!
Clone the github nearcore
First we need to check the version that
testnetcurrently runs:curl -s https://rpc.testnet.near.org/status | jq -r .version.versionThis prints the version that testnet runs. Testnet usually runs a release candidate, whose version ends in
-rc.and a number. Each version is a git tag in the nearcore repository. Clone that tag, replacing<version>with the value you got:git clone --branch <version> https://github.com/near/nearcore.gitThis created a nearcore directory, change into that one and build a node:
cd nearcore
make neardInitialize the working directory and run the node. The node needs boot nodes to find its first peers. The reference RPC
config.jsonhas no boot nodes. Follow Fetch boot nodes withCHAIN_ID=testnetin your WSL shell to setBOOT_NODES. Return here and continue in the same shell:./target/release/neard --home ~/.near init --chain-id testnet --download-genesis --download-config rpc --boot-nodes "${BOOT_NODES:?}"Check that
network.boot_nodesinconfig.jsonis not empty:jq -r '.network.boot_nodes' ~/.near/config.jsonThe command should print a comma-separated list of boot nodes. If it prints an empty line, the node has no peers to sync from. Add boot nodes as described in Update an existing configuration. Running
neard initagain does not add them, because it does not change an existingconfig.json.Then run the node:
./target/release/neard --home ~/.near runFor detailed instructions on initializing and running the node (including mainnet), see Run a Validator Node.
To run this node as a validator, you must configure your validator keys in the --home directory (for example by placing validator_key.json there) and follow the steps in the Validator Bootcamp.