How To Deploy A Stellar Node

How To Deploy A Stellar Node
How to Deploy a Stellar Node

Are you interested in becoming a part of the Stellar network? If so, one crucial step is to learn how to deploy a Stellar node. Our step-by-step instructions will help you set up your own node smoothly, from understanding the basics of nodes and requirements before you start.

What is a Stellar Node?

A Stellar node is a computer responsible for maintaining a shared ledger. It uses Stellar Core, implementing the Stellar Consensus Protocol, to validate and add transactions. Nodes reach consensus and update the ledger every 3-5 seconds.

Developers can use public Horizon instances without running their own node. However, running a node is beneficial for those serious about building on Stellar or requiring high-availability access to the network.

There are three types of nodes based on configurations:

  • Basic validators participate in consensus and store a copy of the full ledger. They are responsible for validating transactions and proposing new blocks.
  • Full validators are the same as basic validators, but they also store the complete history of the ledger. This makes them more reliable for historical queries but also requires more storage space.
  • Archiver nodes store the complete history of the ledger, including all transactions and account balances. They are used to provide historical data for research and analysis.

Running a Stellar node allows you to participate in the consensus process and contribute to the security, maintenance, and overall functionality of the network.

Run a Stellar Node
Run a Stellar Node

Stellar Node Requirements

Storage: Ensure a minimum of 1TB of storage capacity to accommodate the growing ledger data.

RAM: Stellar Core is designed to run on relatively modest hardware. A recommended minimum of 8GB RAM should suffice for most basic nodes. However, for more demanding use cases, additional RAM might be necessary.

CPU: Stellar Core is not highly CPU-intensive, but a modern multi-core processor with a clock speed of at least 2.5 GHz is recommended for optimal performance.

Network Access:

  • Inbound: Open the PEER_PORT (default: 11625) to allow other nodes to connect to your node for peer-to-peer communication.
  • Outbound: Enable your node to connect to other nodes' PEER_PORTs (default: 11625) for data synchronization and consensus participation.

Database: Stellar Core requires access to a PostgreSQL database. Ensure connectivity to the database server, especially if it's hosted on a different machine within your network.

HTTP Endpoint (HTTP_PORT, default: 11626):

  • Inbound: Expose the HTTP endpoint for Horizon integration, transaction submission, and querying Stellar Core info.
  • Internal System Access: Use the HTTP endpoint for administrative commands, scheduling upgrades, and changing log levels.

Security: For exposing the HTTP endpoint to other hosts in your local network, implement authentication using an intermediate reverse proxy server. Avoid direct exposure to the open internet to enhance security.

By meeting these requirements, you can set up and run a Stellar node effectively and contribute to the network's operation and decentralization. To get the latest updates, check out Stellar Node Prerequisites.

How To Deploy A Stellar Node

Before getting started, you need to choose the preferred installation method and configure the node as either a Basic Validator or a Full Validator.

Step 1: Install Stellar Core

There are three ways to install Stellar Core:

  • Docker image: This is the quickest and easiest method. To install Stellar Core using Docker, run the following command:
docker pull stellar/stellar-core:latest
  • Pre-built packages: This method is more suitable for production environments. To install Stellar Core using pre-built packages, you will need to download the packages for your operating system from the Stellar website.
  • Build from source: This method gives you the most control over the installation process, but it is also the most time-consuming. To build Stellar Core from source, you will need to download the source code from the Stellar website and follow the instructions in the README file.

Step 2: Configure Stellar Core

Once you have installed Stellar Core, you will need to configure it. The configuration file is located at ~/.stellar/stellar.conf. The most important settings in the configuration file are:

  • NETWORK_PASSPHRASE: This setting specifies the network that your node will connect to. The default value is PUBLIC for the public network and TESTNET for the testnet.
  • NODE_SEED: This setting specifies the secret key for your node. You can generate a keypair using the stellar-core gen-seed command.
  • NODE_IS_VALIDATOR: This setting specifies whether your node is a validator. If you want your node to participate in consensus, you need to set this value to true.

Step 3: Publish a History Archives

To successfully run a Full Validator or an Archiver, it is necessary to create a history archive publication using your node setup. You can accomplish this by hosting an archive on a blob store like Amazon's S3 or Digital Ocean's spaces.

Another option is to serve a local archive directly through an HTTP server like Nginx or Apache. If you are setting up a Basic Validator, you can disregard this section. Regardless of the type of node you are deploying, it is important to configure it to access historical data.

To publish a history archive, you need to integrate a history configuration stanza into your /etc/stellar/stellar-core.cfg. For example:

="cp /mnt/xvdf/stellar-core-archive/node_001/{0} {1}"
put="cp {0} /mnt/xvdf/stellar-core-archive/node_001/{1}"mkdir="
mkdir -p /mnt/xvdf/stellar-core-archive/node_001/{0}"
  • Execute the "new-hist" command to create the local archive:

# sudo -u stellar stellar-core --conf /etc/stellar/stellar-core.cfg new-hist local

This command establishes the structure for the history archive.

  • Finally, configure a virtual host to serve the local archive (Nginx)

Step 4: Run Your Stellar Node

Once you have configured Stellar Core, you can start your node by running the following command:

stellar-core run

Your node will now be connected to the Stellar network and participating in consensus.

For more information on how to deploy a Stellar node, please refer to the Stellar documentation.

Read more