In this guide you will learn how to set up your own VeChain Thor node that can connect to main or test net. For this, we will be using Docker and assume you are running a Windows OS.
Step 1: Install Docker
Wikipedia defines Docker as
An open-source project that automates the deployment of software applications inside containers by providing an additional layer of abstraction and automation of OS-level virtualization on Linux.
In simpler words, Docker is a tool that allows developers to easily deploy their applications on any computer, without having to worry about the Operating System or system settings of that computer.
What it means for us, is that with Docker we can get a VeChain Thor Node and all of its dependencies up and running by simpling deploying a Docker image. So let’s go and get started by setting up Docker!
Once restarted start a Windows Command Prompt by hitting your Windows + R key and typing cmd.
docker run hello-world
You should see the following message if you installed docker successfully:
Step 2: Pull and Run the Thor docker image
First we download the latest VeChain Thor docker image. This Dockerfile is designed to build the last release of the Thor source code and will publish docker images to dockerhub with every new release.
docker pull vechain/thor
Once you have pulled the docker image we can run our vechain node by running:
docker run vechain/thor [global options] command [command options]
The following commands and options are supported:
solo client runs in solo mode for test & dev
master-key import and export master key
help, h Shows a list of commands or help for one command
|main|test||the network to join|
|directory for block-chain databases. Default is /root/.org.vechain.thor|
|address for block rewards|
|API service listening address. Default is localhost:8669|
|comma-separated list of domains from which to accept access|
|API request timeout value in milliseconds. Default is 10.000|
|limit contract call gas. Default is 50.000.000|
|limit the distance between 'position' and best block for subscriptions APIs. Default is 1.000|
|0-9||log verbosity. Default is 3|
|maximum number of P2P network peers. Default is 25.|
|P2P network listening port. Default is 11235|
|any|none|upnp|pmp|extip||port mapping mechanism. Default is any|
|print the version|
Step 3: Run Thor and connect to the API
Use the following command to start a container called mynode, that connects to the main network and allows you to browse the API by going to 127.0.0.1:8669 in your browser.
docker run --name mynode -d -p 127.0.0.1:8669:8669 -p 11235:11235 -p 11235:11235/udp vechain/thor --network main --api-addr 0.0.0.0:8669
We will dissect this command now:
|create a new Docker container called mynode|
|to stop the container from displaying data in the command prompt|
|to open up the necessary ports.|
|the Docker image to base your container on|
|connect to the main network|
|allow access to the API|
If you want your node to stop running you can run the
docker kill mynode command.
You can now visit the API to interact with the blockchain by opening a browser and pointing it to http://127.0.0.1:8669