Post

Become a Validator

Introduction

This guide walks you through the process of setting up a validator node for the XDBchain network. Validator nodes are essential components of the network, contributing to the consensus and overall reliability of the system. This setup involves installing Stellar Core, creating a configuration file, and ensuring proper network settings.

Prerequisites

  • Basic understanding of system administration and command-line operations.
  • A server with a Ubuntu-like operating system.
  • Familiarity with Stellar technology and concepts.

Installing Stellar Core

Stellar Core is the backbone software that powers each validator node on the XDBchain network. Follow these steps to install Stellar Core on your server:

  1. Update Package Lists:
    1
    
    apt update
    
  2. Install Dependencies: Stellar Core requires a PostgreSQL client and aws-cli tool (if you chose to store your history in S3 bucket). Install them using:
    1
    2
    
    apt install -y postgresql-client
    snap install aws-cli --classic
    
  3. Add Stellar’s Package Repository: Import Stellar’s GPG key and add the repository to your system:
    1
    2
    
    wget -qO - https://apt.stellar.org/SDF.asc | apt-key add -
    echo "deb https://apt.stellar.org $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/SDF-stable.list
    
  4. Install Stellar Core: Update your package list again and install Stellar Core:
    1
    2
    
    apt update
    apt install -y stellar-core
    

Configuration

After installing Stellar Core, you need to configure it. Configuration is done via the /etc/xdbchain.cfg file.

  1. Create Configuration File: Create a new configuration file using your preferred text editor (like nano or vim):
    1
    
    nano /etc/xdbchain.cfg
    

    Then, insert the following content into the file:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    
     LOG_FILE_PATH="/var/log/stellar-core.log"
     BUCKET_DIR_PATH="/var/history/buckets"
    
     NODE_HOME_DOMAIN="livenet.example.com"
    
     NODE_SEED="SBPBMOA5SJR6LH3BDHXLOUK3UXCVIO6CBGIHLICZ4U6ANFMKNV47JE4T self"
     NODE_IS_VALIDATOR=true
    
     DATABASE="postgresql://dbname=dbname user=user password=password host=localhost"
    
     HTTP_PORT=11626
     PUBLIC_HTTP_PORT=true
    
     NETWORK_PASSPHRASE="LiveNet Global XDBChain Network ; November 2023"
    
     PEER_PORT=11625
    
     KNOWN_CURSORS=["HORIZON"]
    
     FAILURE_SAFETY=0
     CATCHUP_COMPLETE=true
    
     [[HOME_DOMAINS]]
     HOME_DOMAIN="livenet.example.com"
     QUALITY="LOW"
    
     #list your quorum here
    
     [[HOME_DOMAINS]]
     HOME_DOMAIN="deu.livenet.xdbchain.com"
     QUALITY="HIGH"
    
     [[VALIDATORS]]
     NAME="deu-1"
     HOME_DOMAIN="deu.livenet.xdbchain.com"
     PUBLIC_KEY="GDKMIZ6AJQVGYIKFNXLL6DR3J2V252ZVNIKMX5R4MCN4A567ESURCRZJ"
     ADDRESS="deu-1.livenet.xdbchain.com"
     HISTORY="curl -sf https://history.xdbchain.com/sdeu-1/{0} -o {1}"
    
     [[VALIDATORS]]
     NAME="deu-2"
     HOME_DOMAIN="deu.livenet.xdbchain.com"
     PUBLIC_KEY="GDS25FEPPK5LK5BVWGEPLFCQQV7DQOXS6ERYWHDQIKZU3YGO5NRODIAT"
     ADDRESS="deu-2.livenet.xdbchain.com"
     HISTORY="curl -sf https://history.xdbchain.com/sdeu-2/{0} -o {1}"
    
     [[VALIDATORS]]
     NAME="deu-3"
     HOME_DOMAIN="deu.livenet.xdbchain.com"
     PUBLIC_KEY="GBDWWMQKFO3WBTSZ74F64LNXETXBD7VYQT6MIXFVIBHLM57HIR7LYKI2"
     ADDRESS="deu-3.livenet.xdbchain.com"
     HISTORY="curl -sf https://history.xdbchain.com/sdeu-3/{0} -o {1}"
    
    
     [[HOME_DOMAINS]]
     HOME_DOMAIN="irl.livenet.xdbchain.com"
     QUALITY="HIGH"
    
     [[VALIDATORS]]
     NAME="irl-1"
     HOME_DOMAIN="irl.livenet.xdbchain.com"
     PUBLIC_KEY="GA4CBXL5DIL7LECFOCHMZXSGNPWFDZA4FDWR56XGXPG5TZYXQRUTOS2H"
     ADDRESS="irl-1.livenet.xdbchain.com"
     HISTORY="curl -sf https://history.xdbchain.com/sirl-1/{0} -o {1}"
    
     [[VALIDATORS]]
     NAME="irl-2"
     HOME_DOMAIN="irl.livenet.xdbchain.com"
     PUBLIC_KEY="GDN7LWK72AE7EWTVXY5BXQVLVJMQZCYVUKJCERX2DPAXFSJLPV7TJSYP"
     ADDRESS="irl-2.livenet.xdbchain.com"
     HISTORY="curl -sf https://history.xdbchain.com/sirl-2/{0} -o {1}"
    
     [[VALIDATORS]]
     NAME="irl-3"
     HOME_DOMAIN="irl.livenet.xdbchain.com"
     PUBLIC_KEY="GDCJSCZHL273AWSQ37P3K6SNA2XIA3U2D4FTAWIEO7GCWXWJHIJWT4FO"
     ADDRESS="irl-3.livenet.xdbchain.com"
     HISTORY="curl -sf https://history.xdbchain.com/sirl-3/{0} -o {1}"
    
    
     [[HOME_DOMAINS]]
     HOME_DOMAIN="gbr.livenet.xdbchain.com"
     QUALITY="HIGH"
    
     [[VALIDATORS]]
     NAME="gbr-1"
     HOME_DOMAIN="gbr.livenet.xdbchain.com"
     PUBLIC_KEY="GDDQQYYEO3CAP5KMIEFLCRFRANGWZH4PRDEM4R2Z5GYHLDLFY67XSQY2"
     ADDRESS="gbr-1.livenet.xdbchain.com"
     HISTORY="curl -sf https://history.xdbchain.com/sgbr-1/{0} -o {1}"
    
     [[VALIDATORS]]
     NAME="gbr-2"
     HOME_DOMAIN="gbr.livenet.xdbchain.com"
     PUBLIC_KEY="GDW4SSXHC553SKITNNZ4LKOETM5K46DM7AQ2PKZV42JHETEWH3KMGC7S"
     ADDRESS="gbr-2.livenet.xdbchain.com"
     HISTORY="curl -sf https://history.xdbchain.com/sgbr-2/{0} -o {1}"
    
     [[VALIDATORS]]
     NAME="gbr-3"
     HOME_DOMAIN="gbr.livenet.xdbchain.com"
     PUBLIC_KEY="GDJ6EC46DILSHHUURCQWALQMUSCKZZ632AOARRQWWNHG3533ZBEO5HQF"
     ADDRESS="gbr-3.livenet.xdbchain.com"
     HISTORY="curl -sf https://history.xdbchain.com/sgbr-3/{0} -o {1}"
    
    
     [[HOME_DOMAINS]]
     HOME_DOMAIN="fra.livenet.xdbchain.com"
     QUALITY="HIGH"
    
     [[VALIDATORS]]
     NAME="fra-1"
     HOME_DOMAIN="fra.livenet.xdbchain.com"
     PUBLIC_KEY="GDNJNROGCT6MKYJ6IAS3JACP525IHNGNQ2M5LZ546K7I2PHIRRLKFAU2"
     ADDRESS="fra-1.livenet.xdbchain.com"
     HISTORY="curl -sf https://history.xdbchain.com/sfra-1/{0} -o {1}"
    
     [[VALIDATORS]]
     NAME="fra-2"
     HOME_DOMAIN="fra.livenet.xdbchain.com"
     PUBLIC_KEY="GAMD5WGIVTF7XMYKM7EOONSPRAIIVCEBZ7MP2VJRPSG3WLGYGUW4BQ27"
     ADDRESS="fra-2.livenet.xdbchain.com"
     HISTORY="curl -sf https://history.xdbchain.com/sfra-2/{0} -o {1}"
    
     [[VALIDATORS]]
     NAME="fra-3"
     HOME_DOMAIN="fra.livenet.xdbchain.com"
     PUBLIC_KEY="GCHH7WYXSMFVEWAKLI3B6NCTFYQTMTGWEAEMLUNL3J426JRHQ7EYR2EB"
     ADDRESS="fra-3.livenet.xdbchain.com"
     HISTORY="curl -sf https://history.xdbchain.com/sfra-3/{0} -o {1}"
    
    
     [HISTORY.local]
     get="aws s3 cp s3://your-bucket/node1/{0} {1}"
     put="aws s3 cp {0} s3://your-bucket/node1/{1}"
    

    This configuration sets up your node’s basic parameters, database connection (using PostgreSQL), network settings, and validator information.

Setting Up Stellar Core as a Systemd Service

After configuring Stellar Core, it’s recommended to set it up as a systemd service. This ensures that Stellar Core automatically starts on boot and restarts in case of failure.

  1. Create Systemd Service File: Create a new systemd service file for Stellar Core:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
    cat <<EOF > /etc/systemd/system/stellar-core.service
    [Unit]
    Description=Stellar Core Service
    After=network.target
    StartLimitIntervalSec=0
    
    [Service]
    Type=simple
    Restart=always
    RestartSec=1
    User=root
    ExecStart=/usr/bin/stellar-core --conf /etc/xdbchain.cfg run
    
    [Install]
    WantedBy=multi-user.target
    EOF
    

    This script creates a new service file with the necessary configurations to manage the Stellar Core process. The ExecStart line points to the location of the Stellar Core executable and specifies the configuration file to use.

  2. Reload Systemd and Enable Service: To apply the new service configuration, reload the systemd daemon and enable the Stellar Core service:
    1
    2
    
    systemctl daemon-reload
    systemctl enable stellar-core.service
    

    These commands make systemd aware of the new service and ensure that it starts automatically at system boot.

With Stellar Core set up as a systemd service, you have additional reliability for your validator node, as it will automatically restart if it encounters any issues and will start automatically when the server boots up.

Additional Notes

  • Database Choice: In this example, we use a PostgreSQL database. You can also use SQLite. However, the installation and configuration of the database are not covered in this guide.
  • Network Setup: Ensure your network settings allow connections on the required ports for Stellar Core (default is 11625 for PEER_PORT and 11626 for HTTP_PORT).
  • Validator Setup: The configuration file includes settings for your validator node. Adjust the [VALIDATORS] section to reflect your network’s validators. It is possible to run just one validator node, but for greater stability, we recommend running at least three.
  • Public History: Stellar Core, as well as Horizon, require the blockchain history to be publicly available. In this example, we chose AWS S3 + CloudFront to serve our history. However, you can choose any other method for this purpose, such as an Nginx web server.
This post is licensed under CC BY 4.0 by the author.