# Deploy Node in Docker
The easiest way to run Waves node is by means of Waves Docker container. Waves Docker image is focused on fast and convenient deployment of Waves Node and contains scripts and configs to run the node in Mainnet, Testnet, Stagenet or any other custom network.
GitHub repository: https://github.com/wavesplatform/Waves/tree/master/docker.
Install Docker app from Docker website.
# Building Docker image
You can get the latest image at Docker Hub or download it with the following command:
docker pull wavesplatform/wavesnode
Or use the following command to build an image with the current local repository (from the repository root):
./build-with-docker.sh && docker build -t wavesplatform/wavesnode docker
You can specify the following arguments when building the image:
|WAVES_NETWORK||mainnet||Waves Blockchain network. The available values are |
|WAVES_LOG_LEVEL||DEBUG||Default Waves Node log level. The available values are |
|WAVES_HEAP_SIZE||2g||Default Waves Node JVM Heap Size limit in -X Command-line Options notation (-Xms=[your value]). Can be overridden in a runtime using environment variable with the same name. Read more about -X Command-line Options.|
# Running the Image
# Node Configuration Parameters
Be careful: the security of your wallet and funds depends on the configuration. For detailed information, see the Node Configuration article.
You can set the node configuration parameters in the node configuration file or in the command to start the node image as environment variables.
# Environment Variables
|WAVES_WALLET_SEED||Base58 encoded seed. Ignored if JVM option |
|WAVES_WALLET_PASSWORD||Password for the wallet file. Ignored if JVM option |
|WAVES_LOG_LEVEL||Node logging level. Available values: |
|WAVES_HEAP_SIZE||Default Java Heap Size limit in -X Command-line Options notation (-Xms=[your value]). Read more about -X Command-line Options|
|WAVES_NETWORK||Waves Blockchain network. The available values are |
|JAVA_OPTS||Additional Waves Node JVM configuration parameters. Refer to application.conf file to get the full path of the configuration parameters and examples of values|
An example of the command to start a node image with environment variables:
docker run -v /docker/waves/waves-data:/var/lib/waves -v /docker/waves/waves-config:/etc/waves -p 6869:6869 -p 6862:6862 -e JAVA_OPTS="-Dwaves.rest-api.enable=yes -Dwaves.wallet.password=myWalletSuperPassword" -ti wavesplatform/wavesnode
# Configuration File
The Waves Node looks for configuration parameters in the
/etc/waves/waves.conf file inside the container. You can mount your own configuration file using Docker volumes, as described in the Managing Data section below.
If the configuration file does not exist, the default configuration file will be created depending on the network type specified by the
If the value of
WAVES_NETWORK is anything other than
stagenet, the default configuration won't be enough for correct node working. In this case, the
CUSTOM network type will be used, which requires a configuration file with the appropriate settings. If you run the image with the network type
CUSTOM and the system does not find the
/etc/waves/waves.conf file, then the image will not run.
# Parameter Priority
- Parameters set by
- Parameters specified in the customized configuration file (if it is mounted).
- Parameters set by
- Default configuration parameters.
- If the customized configuration file is mounted, then the parameters from this file are used, except for those overridden in JAVA_OPTS.
- If the default configuration file is used and the environment variables
WAVES_WALLET_PASSWORDare set, then these variables are used (unless they are overridden in
# Managing Data
It is recommended to store the blockchain state as well as node configuration on the host side. Consider using Docker volumes mapping to map host directories inside the container.
Create directories on the host to store Waves data:
mkdir -p /docker/waves mkdir /docker/waves/waves-data mkdir /docker/waves/waves-config
If you already have node configuration file or other data, place it in the corresponding directory.
To map the host directories inside the container, add the appropriate arguments to
docker runcommand similar to the following example:
docker run -v /docker/waves/waves-data:/var/lib/waves -v /docker/waves/waves-config:/etc/waves -e WAVES_NETWORK=stagenet -e WAVES_WALLET_PASSWORD=myWalletSuperPassword -ti wavesplatform/wavesnode
If the configuration file
/docker/waves/waves-config/waves.confexists, the node inside the container sees it as
/etc/waves/waves.confand reads the settings specified in it. If the file is missing when the container starts, the default configuration file is used.
Besides, the node inside the container uses the following subdirectories in the
/docker/waves/waves-data/log— for node logs
/docker/waves/waves-data/data— for the blockchain state
/docker/waves/waves-data/wallet— for the wallet data
If the subdirectories do not exist when the container is started, they are created.
# Blockchain State
If you are new to Waves Blockchain and running node for the first time be aware that after the launch the node will start downloading blockchain state from other nodes. This takes much time. During downloading the node will be verifying all the blocks one after another.
You can speed this process up by downloading a compressed blockchain state from our official resources, extracting and mounting it inside the container (as described in Managing Data section). In this scenario the node skips block verifying so the process takes less time. This is also the reason why you must download blockchain state only from our official resources:
Note: We do not guarantee the state consistency if it is downloaded from third parties.
Example of commands to download blockchain state and run Docker image:
mkdir -p /docker/waves/waves-data wget -qO- http://blockchain-stagenet.wavesnodes.com/blockchain_last.tar --show-progress | tar -xvf - -C /docker/waves/waves-data/data docker run -v /docker/waves/waves-data:/var/lib/waves -e WAVES_NETWORK=stagenet -e WAVES_WALLET_PASSWORD=myWalletSuperPassword -ti wavesplatform/wavesnode
# Network Ports
Node REST API parameters can be specified in REST API section of the node configuration file. Node communication port for incoming connections can be specified in the Network Settings section of the node configuration file.
The following example command runs image with:
- REST-API port enabled and configured on the socket
- Waves node communication port enabled and configured on the socket
6870are mapped from the host to the container
docker run -v /docker/waves/waves-data:/var/lib/waves -v /docker/waves/waves-config:/etc/waves -p 6870:6870 -p 6868:6868 -e JAVA_OPTS="-Dwaves.network.declared-address=0.0.0.0:6868 -Dwaves.rest-api.port=6870 -Dwaves.rest-api.bind-address=0.0.0.0 -Dwaves.rest-api.enable=yes" -e WAVES_WALLET_PASSWORD=myWalletSuperPassword -ti wavesplatform/wavesnode
Note: The default network port for connecting peers depends on the network type: 6868 for Mainnet, 6863 for Testnet or custom, 6862 for Stagenet. The default port for the REST API is 6869.
To check that the REST API is up, navigate to the following URL from the host side: http://localhost:6870/api-docs/index.html
You can run custom extensions as follows:
Copy all lib/*.jar files from extension to any directory, for example
Add extension class in the node configuration file (for example in
waves.extensions += com.johndoe.WavesExtension
Run the image with the following command:
docker run -v "$(pwd)/plugins:/usr/share/waves/lib/plugins" -v "$(pwd)/local.conf:/etc/waves/local.conf" -i wavesplatform/wavesnode
# Running Node with Blockchain Updates Extension
You can run the node with the blockchain updates extension enabled. The extension itself is already included in the node image that we post, so you can just enable it by means of console commands. However, you will still need to download the blockchain state and also the blockchain updates data from
blockchain.wavesnodes.com and unzip it to
Example of commands to run the node Docker image with blockchain updates enabled:
docker run \ -v /docker/waves/waves-data:/var/lib/waves \ -e JAVA_OPTS="-Dwaves.rest-api.bind-address=0.0.0.0 -Dwaves.extensions.0=com.wavesplatform.events.BlockchainUpdates" \ -e WAVES_WALLET_PASSWORD=myWalletSuperPassword \ -p 6869:6869 \ -p 6881:6881 \ -i wavesplatform/wavesnode:1.3.15