Launch NEAR betanet
and testnet
nodes.
Before you proceed, make sure you have Python 3
and pip3
installed.
On ubuntu, you can install with,
sudo apt update
sudo apt install python3 python3-pip python3-dev
pip3 install --upgrade pip
--user
flag.
pip3 install --user nearup
Verify that you local installation is in python3 -m site --user-base
under bin directory by running:
which nearup
nearup
to your $PATH
in ~/.profile
, ~/.bashrc
, or appropriate shell config.
USER_BASE_BIN=$(python3 -m site --user-base)/bin
export PATH="$USER_BASE_BIN:$PATH"
nearup
, you can upgrade to the latest version by using the command below
pip3 install --user --upgrade nearup
This is recommended for running on servers
You can start your node with (remove the --interactive
flag if you don't want to be prompted):
nearup run betanet --interactive
Replace betanet
if you want to use a different network.
Recommended for security critical validators or during development.
Clone and compile nearcore with make release
or make debug
first.
nearup run betanet --binary-path path/to/nearcore/target/{debug, release}
Replace betanet
with testnet
if you want to use a different network.
Clone and compile nearcore with make release
or make debug
first.
nearup run localnet --binary-path path/to/nearcore/target/{debug, release}
By default it will spawn 4 nodes validating in 1 shard. RPC ports of each nodes will be consecutive starting from 3030. Access one node status using http://localhost:3030/status
nearup stop
nearup run betanet --help
docker build . -t nearup/nearprotocol
If you don't want to build a docker image locally, you can pull the latest
from Docker Hub,
docker pull nearup/nearprotocol
nearup
and neard
are running inside the container, to ensure you don't lose your data which should live on the host you have to mount the ~/.near folder.
To run the nearup
docker image run:
docker run -v $HOME/.near:/root/.near -p 3030:3030 --name nearup nearup/nearprotocol run betanet
To run nearup
in docker's detached (non-blocking) mode, you can add -d
to the docker run
command,
docker run -v $HOME/.near:/root/.near -p 3030:3030 -d --name nearup nearup/nearprotocol run betanet
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fc17f7f7fae0 nearup "/root/start.sh run …" 3 minutes ago Up 3 minutes 324324 mystifying_moore
To execute other nearup
commands like logs
, stop
, run
, you can use docker exec
,
docker exec nearup nearup logs
docker exec nearup nearup stop
docker exec nearup nearup run {betanet/testnet}
(The container is running in a busy wait loop, so the container won't die.)
To get the neard
logs run:
docker exec nearup nearup logs
or,
docker exec nearup nearup logs --follow
To get the nearup
logs run:
docker logs -f nearup
docker kill nearup
To build a development image:
docker build . -t nearup/nearprotocol:dev
The following will mount your repo directory into the running container and drop you into a shell to run test commands.
docker run -it --entrypoint "" -v $PWD:/root/nearup -v $HOME/.near:/root/.near -w /root/nearup nearup/nearprotocol:dev bash
For testing and other checks, nearup
uses tox
.
To install,
pip3 install --user tox
Unit tests
tox
Unit tests w/ coverage
tox -e coverage
Linter checks
tox -e lint
Python style checks
tox -e style