Skip to main content

Configuring the Validator Node

This guide provides step-by-step instructions for configuring your BBAChain validator node, including system setup, user creation, and disk configuration.

Table of Contents

Prerequisites

Before configuring your validator node, ensure you have:

  • Server Access: SSH access to your Ubuntu server
  • Storage: Attached storage configured (if using cloud providers)
  • Permissions: Root or sudo access on the server
  • Network: Internet connection for downloading packages
info

If you're using a cloud provider (e.g., Google Cloud, AWS, Azure), ensure you've configured attached storage before proceeding.

Storage Configuration

Check Storage

If you configured attached storage, follow your cloud provider's instructions to mount the drive to your VM. The boot disk will automatically be mounted.

Check available storage:

df -h

This command displays all mounted filesystems and their available space. Confirm that your disk capacity is available.

tip

For cloud providers, refer to their documentation for attaching and mounting persistent disks:

System Setup

Connect to Validator via SSH

To connect to your Ubuntu server via SSH, use the following command:

ssh username@your_server_ip

Replace:

  • username with your actual username
  • your_server_ip with the IP address of your server

Custom SSH Port

If you're using a custom SSH port, specify it with the -p option:

ssh username@your_server_ip -p custom_port

Using SSH Key

If you're using an SSH key, provide the path to your private key:

ssh -i /path/to/your/private/key username@your_server_ip

Or ensure your SSH key is added to your SSH agent:

ssh-add /path/to/your/private/key

Update Ubuntu Packages

Update and upgrade your Ubuntu packages to ensure you have the latest security patches and software:

sudo apt-get update
sudo apt-get upgrade -y

This command:

  • Updates the package list (apt-get update)
  • Upgrades all installed packages (apt-get upgrade -y)
tip

Run this regularly to keep your system up to date with security patches.

User Creation

Create BBAChain User

Create a dedicated bbachain Linux user to run the BBAChain validator. For security reasons, you may not want the bbachain user as part of the sudoers group after installation.

Step 1: Create User

Create a new bbachain user:

sudo adduser bbachain

This command creates a new user with default settings. Follow the prompts to set up the user.

Step 2: Remove Password (Optional)

To delete the password for the bbachain user (for key-based authentication only):

sudo passwd -d bbachain
warning

Only remove the password if you're using SSH key authentication. Otherwise, keep a strong password.

Step 3: Add to Sudo Group (Optional)

To add the bbachain user to the sudo group (optional — you may remove it after installation):

sudo usermod -aG sudo bbachain
info

You may want to remove sudo access after installation for security reasons. Only grant sudo access during setup if needed.

Step 4: Switch to BBAChain User

Switch to the bbachain user:

sudo su - bbachain

This switches your current session to the bbachain user.

Disk Configuration

Step 1: List Available Block Devices

List all available block devices to identify your disk:

lsblk -l

This command displays detailed information about all block devices, including:

  • Device names (e.g., sda, sdb, nvme0n1)
  • Mount points
  • Sizes
  • Types

Step 2: Format the Disk

Format the disk device using the mkfs tool. Warning: This command deletes all data from the specified disk, so ensure you specify the correct disk device.

We recommend using a single ext4 filesystem without a partition table. You can increase the disk size later without modifying disk partitions.

To maximize disk performance, use the recommended formatting options:

sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/<DEVICE_NAME>

Replace <DEVICE_NAME> with the device name of the disk you're formatting (e.g., sdb, nvme0n1).

Formatting Options Explained:

  • -m 0: Don't reserve space for root (use all available space)
  • -E lazy_itable_init=0,lazy_journal_init=0: Disable lazy initialization for better performance
  • discard: Enable TRIM support for SSDs
danger

Warning: This command will delete all data on the specified disk. Double-check the device name before running this command.

Step 3: Create Mount Point

Create a directory that serves as the mount point for the new disk:

sudo mkdir -p /mnt/disks/MOUNT_DIR

Replace MOUNT_DIR with your desired mount directory name (e.g., ledger, accounts, data).

Example:

sudo mkdir -p /mnt/disks/ledger

Step 4: Mount the Disk

Mount the disk to the instance with the discard option enabled:

sudo mount -o discard,defaults /dev/DEVICE_NAME /mnt/disks/MOUNT_DIR

Replace:

  • DEVICE_NAME: The device name of the disk to mount
  • MOUNT_DIR: The directory where you want to mount the disk

Example:

sudo mount -o discard,defaults /dev/sdb /mnt/disks/ledger

Step 5: Set Permissions

Configure read and write permissions on the disk:

sudo chmod a+w /mnt/disks/MOUNT_DIR

Replace MOUNT_DIR with the directory where you mounted your disk.

Example:

sudo chmod a+w /mnt/disks/ledger

Step 6: Configure Automatic Mounting

Add the disk to your /etc/fstab file so it automatically mounts when the VM restarts.

Why Use UUID?

On Linux systems, device names can change with each reboot, but the device UUID always points to the same volume. We recommend using the device UUID instead of the device name for automatic mounting.

Step 6a: Backup fstab

Create a backup of your current /etc/fstab file:

sudo cp /etc/fstab /etc/fstab.backup

Step 6b: Get Disk UUID

Use the blkid command to list the UUID for the disk:

sudo blkid /dev/DEVICE_NAME

Replace DEVICE_NAME with the device name of the disk you want to automatically mount.

Example Output:

/dev/sdb: UUID="12345678-1234-1234-1234-123456789abc" TYPE="ext4"

Step 6c: Add Entry to fstab

Open the /etc/fstab file in a text editor and add an entry:

sudo nano /etc/fstab

Add a line with the following format:

UUID=UUID_VALUE /mnt/disks/MOUNT_DIR ext4 discard,defaults,MOUNT_OPTION 0 2

Replace:

  • UUID_VALUE: The UUID of the disk (from the previous step)
  • MOUNT_DIR: The directory where you mounted your disk
  • MOUNT_OPTION: Mount option (see below)

Mount Options:

  • nofail: Allows the system to boot even if the disk is unavailable
  • nobootwait: Similar to nofail, but doesn't wait for the disk during boot

Example Entry:

UUID=12345678-1234-1234-1234-123456789abc /mnt/disks/ledger ext4 discard,defaults,nofail 0 2

Step 6d: Verify fstab

Verify that your /etc/fstab entries are correct:

cat /etc/fstab

Step 6e: Test Mount

Test the fstab configuration:

sudo mount -a

This command attempts to mount all filesystems listed in /etc/fstab. If there are no errors, your configuration is correct.

warning

Important: Always keep the /etc/fstab file in sync with the devices attached to your VM. If you detach a disk or create a snapshot, edit /etc/fstab and remove the entry for that disk.

Verification

Verify Disk Mount

Verify that your disk is mounted correctly:

df -h

You should see your mounted disk in the output.

Verify Permissions

Verify that the bbachain user has access to the mounted disk:

ls -la /mnt/disks/MOUNT_DIR

Next Steps

After configuring your validator node:

  1. Build BBAChain from Source: Build and install the validator software (includes CLI and keygen tools)
  2. Generate Keypairs: Create the required keypairs for your validator
  3. Start Validator: Begin running your validator node

Next Steps: After configuring your system, proceed to build BBAChain from source.