Run multiple XSAT Validators
If your company plans to operate multiple XSAT Validator nodes, follow this structured approach to streamline the process:
Roles Within the Company
Operations Team: Handles the initialization of XSAT Validator accounts and manages node operations.
Finance Team: Manages XSAT (for staking) and BTC (for gas fees) and oversees the collection of XSAT rewards.
Assumptions
You aim to run 10 nodes named
sat1
,sat2
,sat3
, ...,sata
on a single server.
Preparations Before Operation
1. Server Setup
For running 10 XSAT Validator nodes, the recommended server configuration is:
CPU: 2 cores
RAM: 8 GB
Disk: 40 GB
Ensure that all necessary software is installed on the server.
2. Account Setup
The finance team should prepare the following accounts:
Stake Account:
Should hold at least 21,000 XSAT (2,100 XSAT per validator) for staking.
Should hold sufficient BTC to cover gas fees (approximately 0.0005 BTC per validator per month according to current gas fee level).
The private key for this EVM account is retained exclusively by the finance team.
Temporary Account:
Used specifically to pay network resource fees for creating XSAT Validator accounts.
Each XSAT Validator account requires 0.000102 BTC (0.0001 BTC for creating the exSat Validator account and 0.000002 BTC for gas fee) for creation. For 10 validators, prepare at least 0.00102 BTC.
The private key for this account should be shared with the operations team to facilitate account creation.
3. BTC Node Setup
A BTC node is required to provide BTC RPC services. Both full nodes and light nodes are supported. Follow this to set up a BTC node.
Batch Operation Steps
1. Initialize the XSAT Validator Accounts
Clone the Repository and Configure the .env
File
git clone https://github.com/exsat-network/batch-reg-xsat-validators
cd batch-reg-xsat-validators
cp .env.example .env
vim .env
Configure the .env
File
Below is an example .env
file. Update the values as needed. By default, it is configured for the mainnet, but you can modify it for the Hayek testnet if required.
# Network name | testnet
NETWORK=mainnet
# exsat node |testnet https://chain-tst3.exactsat.io
EXSAT_RPC_URLS=["https://rpc-us.exsat.network"]
# exsat-evm node and chainId | testnet https://evm-tst3.exsat.network
EVM_RPC_URL=https://evm.exsat.network
# exsat-evm node and chainId | testnet 839999
EVM_CHAIN_ID=7200
# Private key of the Tempory account - starts with 0x,needs sufficient BTC for creating exSat Validator accounts (e.g., 10*0.0001 BTC for 10 exSat Validators)
PRIVATE_KEY=0x00000000000
# Stake Address, needs sufficient $XSAT for staking & $BTC for refilling gas fees, starts with 0x
# Only Address is needed
STAKER_REWARD_ADDRESS=0x00000000000
# Path to the keystore files exsited,e.g.,"./keystores"
KEYSTORE_PATH="."
# Password for the keystore files generated.
# All keystore files share the same password
KEYSTORE_PASSWORD=123456
# rpc url of bitcoin node, configure the username and password if needed
BTC_RPC_URL=http://your-btc-rpc:8332
BTC_RPC_USERNAME=
BTC_RPC_PASSWORD=
# XSAT Validator account prefix to generate,
# example: ACCOUNT_PREFIX=ex, the account name will be ex1.sat, ex2.sat, ex3.sat, ...
# the prefix can't be longer than 6 characters.
# Charaters allowed: a-z, 1-5
ACCOUNT_PREFIX=ex
# Number of XSAT Validator accounts to generate
TOTAL=10
# Amount of xsat tokens for registering one xsat staker, don't modify this.
DEPOSIT_AMOUNT=2100000000000000000000
# testnet contract 0xe9C82be5C9eD3Cee4B99465Bec857395D0d0e502
XSAT_STAKE_HELPER_CONTRACT=0x10CECB61325db0C49201Fc72c50c27AeBd0Ac523
Required Parameters:
PRIVATE_KEY
: The private key of the "Temporary Account", which holds BTC for creating XSAT Validator accounts. To create 10 XSAT Validator accounts, ensure this account has a minimum balance of a little more than 0.001 BTC (10 ร 0.0001 BTC) and a little more BTC for gas fee). Provide the private key starting with "0x" here.STAKER_REWARD_ADDRESS
: The address of the "Stake Account", which holds XSAT for staking and BTC for Validator gas fees. To operate 10 XSAT Validators, ensure this account holds at least 21,000 XSAT (10 ร 2,100 XSAT) and sufficient BTC to refilling gas fees for maintaining these validators. At the current gas fee level, each XSAT Validator requires approximately 0.0005 BTC per month. Just provide the EVM address of the Stake Account here.KEYSTORE_PATH
: The directory path to store keystore files. Use a relative path, such as./keystores
, as an example. The keystore file securely stores the private key of the XSAT Validator account. It is encrypted and requires the "KEYSTORE_PASSWORD" for decryption.KEYSTORE_PASSWORD
: The password for the keystore files. All keystore files share the same password.BTC_RPC_URL
: The URL of your BTC RPC node. If authentication is required, also provide:BTC_RPC_USERNAME
BTC_RPC_PASSWORD
ACCOUNT_PREFIX
: The prefix for your XSAT Validator account names. The complete account names will include this prefix followed by sequential numbers or letters. e.g., IfACCOUNT_PREFIX
is "ex" , the XSAT Validator names will be "ex1.sat", "ex2.sat", ... "exa.sat" in our example. Notes onACCOUNT_PREFIX
:The total length must not exceed 6 characters.
It can only include lowercase letters (
a-z
) and numbers (1-5
).
TOTAL
: The total number of XSAT Validators to create. For example, set this to10
to run 10 validators.
Why Separate the Temporary Account and Stake Account? Why Provide the Private Key for the Temporary Account but Only the Address for the Stake Account?
This separation ensures both security and convenience.
Organizations operating multiple XSAT Validators need a clear division of responsibilities between the operations and financial teams.
The operations team handles the deployment and management of XSAT Validators on servers. To streamline this process, the fees for registering XSAT Validator accounts are kept in the Temporary Account. The private key for this account is provided to the script used for batch registration, simplifying operations. Since the Temporary Account contains only enough funds for account registration, it's secure to supply the private key here.
In contrast, the Stake Account holds substantial funds, including XSAT for staking and BTC for gas fees, and is managed by the financial team. For enhanced security, only the Stake Account address is required. The financial team can connect the Stake Account to the dApp interface to perform staking and top up gas fees. Thus, providing just the Stake Account address in the script is sufficient and secure.
Generate XSAT Validator Accounts
Create the KEYSTORE_PATH
folder, take "keystores" in current folder as example.
mkdir keystores
To generate XSAT Validator accounts, execute the following commands:
yarn install
yarn cracc
This command performs the following actions:
Generate Keystore Files:
Creates a private key for each XSAT Validator.
Saves the private keys as encrypted keystore files in the
KEYSTORE_PATH
folder.Secures each keystore file with the
KEYSTORE_PASSWORD
.
Account Creation:
Uses the Temporary Account to cover the on-chain resources required for account creation.
Uses the Temporary Account to Create the XSAT Validator accounts on-chain, with names prefixed by
ACCOUNT_PREFIX
.
After executing these commands, you will have 10 XSAT Validator accounts on the exSat network. The private keys of these accounts will be securely stored as keystore files in the KEYSTORE_PATH
directory, and the keystore files will be encrypted with the KEYSTORE_PASSWORD
.
2. Stake for Validators and Refill Gas Fees
This task should be handled by the financial team.
Open the Validators Portal and connect to your Stake Account.
Stake XSAT for your XSAT Validator accounts (2100 $XSAT each) and refill their gas fees. At the current gas price level, each XSAT Validator requires approximately 0.0005 BTC per month for gas fees.
Use the "Switch" button to toggle between different XSAT Validator accounts as needed.
The finance team can also claim XSAT rewards directly on the same page.
3. Generate Docker Compose Configuration File and Run Containers in Batch
Modify ognize_cli.sh
File
vim ognize_cli.sh
Modify the red parts in the ognize_cli.sh
file
BASE_DIR
: Replace the portion after:-
with the path specified in the.env
file forKEYSTORE_PATH.
BASE_DIR="${1:-./keystores}"
NETWORK
: Ensure the value matches theNETWORK
setting in the.env
file.EXSAT_RPC_URLS
: Update this value to match theEXSAT_RPC_URLS
in the.env
file.KEYSTORE_PASSWORD
: Set this value to match theKEYSTORE_PASSWORD
in the.env
file.BTC_RPC_URL
: Provide the URL of your BTC RPC node.If authentication is required, replace
"user"
and"password"
inBTC_RPC_USERNAME
andBTC_RPC_PASSWORD
with your BTC RPC credentials.
Execute the Following Commands:
chmod +x ognize_cli.sh
./ognize_cli.sh
This command will do below actions:
Organize Keystore Files:
Creates a folder for each XSAT Validator account under the
KEYSTORE_PATH
.Moves the keystore file for each Validator into its corresponding folder.
Generates an
.env
configuration file for each Validator to be used by Docker, you can edit the .env file if needed.
Generate
docker-compose.yml
:Creates a
docker-compose.yml
file in theKEYSTORE_PATH
directory for batch deployment of Docker containers.
After running these commands, the contents of the KEYSTORE_PATH
directory will appear as follows:
Start Docker Containers:
Enter the KEYSTORE_PATH
folder and Run the command to start the containers. Ensure both Docker and Docker Compose are installed beforehand.
cd keystores
docker compose up -d
After executing the command, your 10 XSAT Validators will be running in Docker containers. You can monitor the logs for each Validator to verify their operations.
If your Validator Client is operating correctly, the following logs should appear in Docker. Here's how to view the Docker logs:
2025-02-28T12:25:23.325+00:00 info: ExsatApi initialized successfully.
2025-02-28T12:25:24.051+00:00 info: Validator[xsatval1.sat] client configurations are correct, and the startup was successful
2025-02-28T12:25:25.499+00:00 info: Endorse task is running
2025-02-28T12:25:26.158+00:00 info: Endorse task is finished
Last updated