Root Node Server Setup (Linux)
Connect to Your VPS
Connect to your root node server. How you do this might differ depending on your setup. For instance, Mac users can use the “terminal” application to set up an SSH connection to their server instance, while Windows users can use "PuTTy" or "Powershell". You could also use your server hosting provider's management system to access your server console. If you experience problems during this step, contact a core team member. Check our guide for more details.
Install Required Applications
To install Docker, you may refer to the following guide > "Step 1 - Installing Docker" and ensure that you choose the correct Operating System from the drop-down menu at the beginning of the documentation. See Docker guide
To install Docker Compose, you may refer to the following guide > "Step 1 - Installing Docker Compose" and ensure that you choose the correct Operating System from the drop-down menu at the beginning of the documentation. See Docker Compose guide
Although optional, we recommend you install git (you might need to add
sudobefore that, depending on what rights your current user has):
apt-get install git
Basic Configuration
- Clone the repository, containing the latest Q client version. To accomplish this task, copy and paste the following command into your console and press enter to execute it (you might need to add
sudobefore that):
git clone https://gitlab.com/q-dev/mainnet-public-tools
- Go to the /rootnode directory by executing this command:
cd mainnet-public-tools/rootnode
- Create a /keystore directory by executing this command:
mkdir keystore
- Create a pwd.txt file by executing this command (you might need to add
sudobefore that):
nano keystore/pwd.txt
- In the newly created pwd.txt file set a password that will be used for future account unlocking. Simply type the password at the beginning of the file. After defining a password, save your changes by pressing
CTRL+O, press enter, and close the nano editor by pressingCTRL+X. - Back in the /rootnode directory, copy the
.env.exampleto.envby executing this command (you might need to addsudobefore that):
cp .env.example .env
- To generate a keypair, execute this command (you might need to add
sudobefore that):
docker-compose run --rm --entrypoint "geth account new --datadir=/data --password=/data/keystore/pwd.txt" rootnode
This way, a new private key is generated and stored in the keystore directory encrypted with a password from the pwd.txt file.
- Type in the password that you just defined in the
pwd.txtfile and repeat the password to confirm. - Write down the public address of the key as indicated by the output of the previous command.
- To configure your node, edit the environment file by executing this command (you might need to add
sudobefore that):
nano .env
- In the .env file, enter your (newly created) root node public address without leading 0x. Here is an example:
# your q address here (without leading 0x)
ADDRESS=b3FF24F818b0ff6Cc50de951bcB8f86b52287DAc
- Now, add your machine's public IP address and ensure that your device is accessible at the assigned IP address as it is necessary for other network users to detect and connect to it. Here is an example:
# your public IP address here
IP=193.19.228.94
- You have the option to select a port for the p2p protocol, or you can stick with the default value. If you are operating multiple nodes on the same machine, using different ports for each node is important. Here is an example:
# the port you want to use for p2p communication (default is 30304)
EXT_PORT=30304
- Save your changes by pressing
CTRL+O, press enter, and close the nano editor by pressingCTRL+X. - Although optional, we recommend you add your root node to Q stats. To accomplish this open the
docker-compose.yamlfile by executing this command (you might need to addsudobefore that):
nano docker-compose.yaml
- Now, add the additional flag
..., "--ethstats=<Your_RootNode_Name>:<Mainnet_access_key>@stats.q.org",...to the entrypoint. Here is an example:
rootnode:
image: $QCLIENT_IMAGE
entrypoint: ["geth", "--ethstats=<Your_RootNode_Name>:<Mainnet_access_key>@stats.q.org", "--datadir=/data", ...]
- Replace
<Your_RootNode_Name>with an arbitrary name that will be displayed on Q statistics. Including special characters, emojis, and spaces is possible. It would be helpful if you could also provide the beginning of your root node public address to establish a connection between your client and address. Here is an example: "OurCoolCompany - 0xABC123". - We can provide you the
<Mainnet_access_key>if you write us on Discord
- Save your changes by pressing
CTRL+O, press enter, and close the nano editor by pressingCTRL+X. - Now launch your root node using the docker-compose file by executing this command (you might need to add
sudobefore that):
docker-compose up -d
- It can take a few hours until your node is fully synchronized to the mainnet, you can check your node's real-time logs with the following command (you might need to add
sudobefore that):
docker-compose logs -f --tail "100"
FAQ
Q: What is git?
A: Git is a distributed version control system used for collaborating on, sharing, and storing computer code. It allows blockchain developers to document modifications in client software, collaborate with their peers, and ensure that various development paths can be merged without conflict. Given the emphasis blockchains place on decentralization, git's capacity to function locally on a developer's computer and synchronize changes across multiple remote repositories is particularly valuable.
Q: What is Docker? And what is Docker-compose?
A: Docker is a software platform that allows developers to package their applications and dependencies into standardized units called containers. These containers can be easily deployed and run on different operating systems and environments, making it easier to manage and distribute software.
Docker Compose, on the other hand, is a tool that simplifies the process of running multi-container applications. It allows developers to define and manage multiple containers that work together as a system, specifying their configurations, dependencies, and network connections in a single file. Docker Compose makes it easier to set up and run complex applications with multiple components.