Run A Node
Here, we'll be installing go-quai, the Go implementation of Quai Network. This tutorial is focused for Linux Distributions and MacOS systems.
Running go-quai on Windows or WSL2 is not currently supported.
Prefer a video tutorial? Check it out here:
Ubuntu Snap Install (snap is not default installed on all Linux Distros):
# install snapd if you don't have it already
sudo apt install snapd
# install go
sudo snap install go --classic
MacOS Install:
brew install go
If you're not on Ubuntu or MacOS, instructions on how to install go directly can be found on the golang installation page.
Linux install:
sudo apt install git make
MacOS install:
brew install git make
To clone the go-quai repo and navigate to it, run the following commands:
git clone https://github.com/dominant-strategies/go-quai
cd go-quai
This command installs the main branch to your local machine. Unless you intend to develop, you must checkout the latest release.
You can find the latest release on the go-quai releases page. Then, check out the latest release with:
git checkout put-latest-release-here
For example (this not the latest release, check the releases page for the latest release number)
git checkout v1.2.3-rc.4
After you've successfully installed go-quai, you'll need to configure your node. The
network.env.dist
is a boilerplate node configuration file. Copy the boilerplate file into network.env
so that we can create our own custom config.cp network.env.dist network.env
The
network.env
file houses a number of important parameters that we will configure to run our node correctly. The variables listed below will need to be set correctly for every experience level.COINBASE
: the address in each chain (location) that mining rewards are paid to. Note there is one coinbase address per shard.NETWORK
: the network (testnet, devnet, etc.) your node is running on.
This file also contains a number of more advanced parameters that will not be covered in this article.
Open the config file in your favorite text editor or IDE.
# edit network.env with nano
nano network.env
# open go-quai in vscode to edit network.env
code .
# edit network.env with vim
vim network.env
If you are mining, replace the dummy coinbase addresses with your own for the chains that you intend to mine. If you do not do this, your mining rewards will not be sent to your addresses.
Set the
NETWORK
variable to the network you plan on running. Available network options can be found in the network specifications page.In order to connect directly to peers in the network, you'll need to make sure the peering ports on your router are forwarded or externally accessible.
The easiest way to ensure the peering ports are forwarded on your router is to enable the universal plug and play (UPNP) option on your router. General information on how to enable UPNP for multiple different types of routers can be found in this article. If your router is not covered in this article, you may have to search for UPNP instructions for your specific model.
If your router does not have UPNP or port-forwarding enabled, your node will return an error when starting and immediately stop running.
To start the node, we first need to build the source. You can build via Makefile by running the following command:
make go-quai
Now that we've built the source, we need to decide which type of node to run. As detailed in the Node Overview page, users can opt for either a global node or slice node depending on individual use case and hardware.
Global nodes validate all of the chains within Quai Network. To spin up a global node run:
make run
Slice nodes run what is called a "slice" of Quai Network. A slice is a subset of the network that validates prime, one region, and one zone chain. In the codebase, a slice is identified by its region and zone index. Region and zone indices are 0-indexed and range from 0-2.
To spin up a slice node, you'll need to edit the
network.env
file to specify the slices you want to run. Slice specification can be done by editing the SLICES
variable, which is default set to run all slices in the network.For example, if you wanted to run two slices, you would change
SLICES
to the following (replace the corresponding INDEX
variables for your desired slices):SLICES="[FIRST_REGION_INDEX FIRST_ZONE_INDEX],[SECOND_REGION_INDEX SECOND_ZONE_INDEX]"
After configuring the slices you'd like to run in your
network.env
, start your node using the same command by running:make run
This will start up your slice node with the slices specified in your
network.env
.Node operators should self-select the slice least latent to them, in order to minimize their uncle rate and maximize network bandwidth. Providing an initial suggestion for geographic organization will expidite the minimization of latency.

Starting a node will run all instances of go-quai in the background and create a directory named nodelogs. Outputs from the node will be piped to a context specific
.log
file inside of nodelogs. To view the log output for a specific location, use:tail -f nodelogs/prime.log
# OR
tail -f nodelogs/region-2.log
# OR
tail -f nodelogs/zone-0-0.log
If you're running a slice node, logs will only populate in the contexts the node is validating.
Checking the node logs output is the best way to verify that your full node is running correctly. You can also easily view node logs in your favorite IDE or text editor.
The outputs of a node that has started correctly should look similar to below.
INFO [01-30|19:55:15.397] Starting Quai 0.1.0-pre.0 on local testnet
INFO [01-30|19:55:15.414] Maximum peer count ETH=50 total=50
WARN [01-30|19:55:15.460] Disable transaction unindexing for archive node
INFO [01-30|19:55:15.460] Enabling recording of key preimages since archive mode is used
INFO [01-30|19:55:15.460] Set global gas cap cap=50,000,000
INFO [01-30|19:55:15.460] Allocated trie memory caches clean=307.00MiB dirty=0.00B
INFO [01-30|19:55:15.461] Allocated cache and file handles database=/Users/user/Library/Quai/local/zone-0-0/quai/chaindata cache=512.00MiB handles=5120
INFO [01-30|19:55:17.727] Opened ancient database database=/Users/user/Library/Quai/local/zone-0-0/quai/chaindata/ancient readonly=false
INFO [01-30|19:55:17.728] Writing custom genesis block
To stop log outputs to the terminal, you can use CTRL+C.
Depending on what your node is currently doing, your logs may not look exactly the same as above.
After your node has started correctly, it will begin syncing chain state from peers. There are a few ways to check the progress of the sync.
From the command line, we can run the following command(s) to print the list of blocks that have been appended. Replace
location-to-print-here.log
with the file name of the logs you'd like to print.# Print all appended blocks
cat nodelogs/location-to-print-here.log | grep Appended
# Continuously print new appended blocks
tail -f nodelogs/location-to-print-here.log | grep Appended
# Continuously print appended blocks across all chains
tail -f nodelogs/* | grep Appended
The output should look similar to below:
INFO [09-18|10:18:17.273] Appended new block number=50075 hash=0x0000067368b679ce7994dbd6e3dfe93a5e5fe16642a6083604fd405556836cbe difficulty=405369 uncles=0 txs=0 etxs=0 gas=0 gasLimit=5000000 root=0x7df4c77d1463a5e4c7d5f5446476e34df01cf14b6226b7d83ccab072bc302edc order=2 location=[0 0] elapsed=2.019ms
INFO [09-18|10:18:17.736] Appended new block number=50076 hash=0x0000285b7ffa020c8f9f5f8832381593170d1d7618ad2fae8202350a0d81acac difficulty=405875 uncles=0 txs=0 etxs=0 gas=0 gasLimit=5000000 root=0x81954cf5d93a979890641acffe7496965ff4602ad2b24d24ab5356ba52072c39 order=2 location=[0 0] elapsed=1.933ms
INFO [09-18|10:18:17.803] Appended new block number=50077 hash=0x00000d6f0d100a8d254088090876a6ab911720af7e7bc6454f5d1a01417f786f difficulty=406382 uncles=0 txs=0 etxs=0 gas=0 gasLimit=5000000 root=0x8eb0b430e2df8f91a180b6f29fea46430c9014ccde42fa538df62bf3251dff03 order=2 location=[0 0] elapsed=2.005ms
INFO [09-18|10:18:18.511] Appended new block number=50078 hash=0x00001211f391c0a162701ad0dcbdef47f4efe96b3fb5f77e1f0b75b6ff439312 difficulty=406889 uncles=0 txs=0 etxs=0 gas=0 gasLimit=5000000 root=0xc810b3d05f9a9b7f4fee3da271d3544cba26b6368f84ee5e5e885cbe4fd11cab order=2 location=[0 0] elapsed=2.147ms
To check the progress of your node's sync, compare the number of the latest block output from the above command to the current height of the chain you're running on the Quai node stats page.
You can also check the progress of your node's sync using the client JSON RPC API. The quai_syncing API method can be used easily in the Quai Postman Workspace or via the command line.
If your node temporarily stops appending during sync, do not stop it. Allow it to continue running, and only reach out for support if the node has not appended a block for over 1 hour.
Stopping your node should be done any time you make changes to your config file or prior to shutting your machine down. A node instance can be terminated by running:
make stop
This will kill all instances of
go-quai
on your machine. This can sometimes take a few seconds to complete.If you're running a miner, running
make stop
will not work. You must kill the miner process prior to stopping the node.Making sure your node is running correctly is crucial to both the functionality of any dependent infrastructure and the network as a whole.
Initiating the node update process while the node or manager are currently running could cause issues. Make sure to stop all processes before updating.
To update a node, first make sure to kill all instances of go-quai using the above stop command.
After stopping the node, you should pull any updated code using:
git pull && git fetch --all
git checkout put-latest-release-here
Finally, rebuild the source using:
make go-quai
After pulling any new code and rebuilding the source, you can safely restart the node and continue running.
Resetting your node and clearing your database will remove any state you have synced. This is a non-reversible action and any commands noted below should be utilized with caution.
Developers and node runners may find that situations arise where they need to completely clear your node of synced state or do a full reset in the case of an issue or bug. A full reset of a node involves stopping the node, clearing the current nodelogs, and removing all synced state.
Reminder, resetting your node is non-reversible and should only be done if you understand the implications of removing all synced state.
For Linux Machines, we'll remove the
nodelogs
directory and the base .quai
directory which contains all synced state. To do this, run the following command:rm -rf nodelogs ~/.quai
For MacOS machines, we'll use a different command to remove the same directories:
rm -rf nodelogs ~/Library/Quai
After running one of the two above commands, the node has been fully reset and is ready to be restarted.
Last modified 23h ago