Run an RPC Node (with nearup)
We encourage you to set up your node with Neard instead of Nearup as Nearup is not used on Mainnet. Please head to Run a Node for instructions on how to setup a RPC node with Neard.
Heads upThe README for
nearup
(linked above) may be all you need to get a node up and running intestnet
andlocalnet
.nearup
is exclusively used to launch NEARtestnet
andlocalnet
nodes.nearup
is not used to launchmainnet
nodes.
Prerequisitesโ
- Git
- Nearup: Make sure
nearup
is installed. You can installnearup
by following the instructions at https://github.com/near-guildnet/nearup.
Steps to Run an RPC Node using nearup
โ
Running a RPC node is very similar to running a validator node as both types of node use the same nearcore
release. The main difference for running a validator node is requiring validator_key.json
to be used by the validator node to support its work of validating blocks and chunks on the network.
First, clone the nearcore
repo:
git clone https://github.com/near/nearcore.git
cd nearcore
Checkout the version you wish to build:
git checkout <version>
You can then run:
make neard
This will compile the neard
binary for the version you have checked out, it will be available under target/release/neard
.
Note that compilation will need over 1 GB of memory per virtual core
the machine has. If the build fails with processes being killed, you
might want to try reducing number of parallel jobs, for example:
CARGO_BUILD_JOBS=8 make neard
.
NB. Please ensure you build releases through make
rather than cargo
build --release
. The latter skips some optimizations (most notably
link-time optimisation) and thus produces a less efficient executable.
nearup run testnet --binary-path path/to/nearcore/target/release
You will then be prompted for an Account ID below. You should leave this empty as you are running an RPC node, not a validator node.
Enter your account ID (leave empty if not going to be a validator):
Wait until initialization finishes, use the following command to follow logs:
$ nearup logs --follow
Then run:
$ nearup stop
Retrieve a copy of the latest RPC snapshot from S3 using rclone: Prerequisite:
Recommended download client rclone
.
This tool is present in many Linux distributions. There is also a version for Windows.
And its main merit is multithread.
You can read about it on
** rclone version needs to be v1.66.0 or higher
First, install rclone:
$ sudo -v ; curl https://rclone.org/install.sh | sudo bash
Next, prepare config, so you don't need to specify all the parameters interactively:
mkdir -p ~/.config/rclone
touch ~/.config/rclone/rclone.conf
, and paste exactly the following config into rclone.conf
:
[near_cf]
type = s3
provider = AWS
download_url = https://dcf58hz8pnro2.cloudfront.net/
acl = public-read
server_side_encryption = AES256
region = ca-central-1
$ rclone copy --no-check-certificate near_cf://near-protocol-public/backups/testnet/rpc/latest ./
$ LATEST=$(cat latest)
$ rclone copy --no-check-certificate --progress --transfers=6 --checkers=6 \
near_cf://near-protocol-public/backups/testnet/rpc/${latest:?} ~/.near/data
Finally, run the following command and the node should start syncing headers:
$ nearup run testnet
Got a question?
Ask it on StackOverflow!