Setting up a Tezos Node in 5 steps
Tezos is a Proof of Stake blockchain supporting Smart Contracts and On-chain Governance. The blockchain is supported by Nodes which exchange blockchain information and Bakers which produce new blocks. Running a node adds to the stability of the network, but you might have a specific application for its use. If you want to participate in Baking then you will need to run a node. Often blockchain application developers will have their own node to communicate with the network and indexes will maintain their own archive node.
In this short article, we will show you how to set up a Tezos Node. This can be done by anyone with a modern computer running Linux. We have only included the detail to get started. In a future article, we will show you how to set up a Baker.
1 - Decide which History Mode
Before starting you should determine which history mode you would like to run. There are three main modes:
- Archive - every piece of detail from the first block to the current time, a complete copy of the blockchain;
- Full - detail from the first block to the current time but with transactions rolled up;
- Rolling - enough blocks to stay current with the network.
It is possible to run a baker with any of these modes. If you are writing an indexing application, you are likely to need an archive node. For most home users, a rolling node is sufficient.
As I write this an Archive node needs approximately 680GB of storage with a growth rate of approximately 1GB/week. A full node will fit on a system with 200GB of storage and a rolling node will fit on a system with 60GB. The disc needs to be fast, preferably SSD or NvME.
You will need a computer to run this on. Although it is possible to run the Tezos blockchain software on a Raspberry Pi, we will assume PC hardware running Debian 12. An AWS or GCP compute instance with SSD-backed storage is suitable. We’ll also assume that you have root access.
2 - Install the software
The reference implementation of the Tezos Blockchain software is called Octez. For several versions of Linux, you can use these packages of Octez. Here you can find packages for various operation systems but we will assume Debian 12:
Make sure that your system is up to date with apt update && apt upgrade
then install the packages with dpkg
. You will need the client and node package for this article. For example:
apt install libev4 libhidapi-libusb0
dpkg -i ./octez-client_21.0-1_amd64.deb \
./octez-node_21.0-1_amd64.deb
Any further missing dependencies can be installed with apt install
.
3 - Configuring the node
Our package has a configuration file to help set it up stored at /etc/octez/node.conf
. By default we have assumed that the software will run as user tezos and group tezos in a directory called
/var/tezos/.tezos-node. Similarly, we will log output into /var/log/tezos. You can change the details in the configuration file to suit your needs.
/var/tezos will need to be a large partition capable of storing the blockchain. The package installation automatically adds a tezos user and group.
Make the node directory where you would like. This might be a dedicated filesystem or different hard drive:
mkdir -p /var/tezos/.tezos-node
chown -R tezos:tezos /var/tezos
Assume the role of tezos and initialise the node. We have used sensible defaults for a rolling node on the production blockchain (called mainnet). The node will listen on port 9732 to exchange information on the Tezos gossip network and offer an RPC service to local users on port 8732. By running an RPC service, we will be able to connect to the node locally.
sudo su - tezos
octez-node config init --data-dir /var/tezos/.tezos-node \
--network=mainnet \
--history-mode=rolling \
--net-addr="[::]:9732" \
--rpc-addr="127.0.0.1:8732"
You can change the settings above to suit your needs. For example, you might want to allow the RPC service on your local network so that you can connect your Tezos wallet to a node you maintain.
4 - Obtaining a snapshot or archive
If you were to start the node now, it would start to download the blockchain from the very first block. On a test network, this will be quick, but on mainnet it will be very slow and will take weeks. For a head-start, we fetch a snapshot and import it. Do these operations using the tezos user.
sudo su - tezos
wget -O /tmp/snap https://snapshots.eu.tzinit.org/mainnet/rolling
octez-node snapshot import /tmp/snap --data-dir /var/tezos/.tezos-node
rm /tmp/snap
For a full node, you will need to use a full snapshot. For an archive node, you will need to find a compressed archive node data directory, or reconstruct the node from a full node - this can take a long time. There are several snapshot providers in the community including:
Provider | Rolling | Full | Archive | HTTPS | GCS copy |
---|---|---|---|---|---|
Lambs on Acid | Yes | Yes | No | Yes | No |
Tzinit | Yes | Yes | Yes | Yes | Yes |
5 - Starting the node
As root, start the node using systemctl. The enable command will ensure that the node starts on boot.
systemctl enable octez-node.service
systemctl start octez-node.service
You can now view the progress of the node in the log file. It will sync with the network and fill the gap from the point that the snapshot was taken to the current block. Then you will have a working Tezos node.
tail -f /var/log/tezos/node.log
You can also monitor the progress of the sync with the network using:
octez-client bootstrapped
More information
I have only scratched the surface of the available options here. Please see How to get Tezos and Getting Started with Tezos for other installation options and information on building from source.
There are other Octez packages available from Serokell for direct download or using other packaging systems. The setup will differ from the above and you should refer to the documentation that comes with the package.