CAUTION
Validators are responsible for the network stability, it is very important to be able to react at any time of the day or night in case of trouble. We strongly encourage validators to set up a monitoring and alerting system, learn more about this from our secure setup guide.
Start the AI Service
Prerequisite
Must have conda installed, follow the instruction .
Clone the repo
Installation Steps
1. Set up Conda Environment
First, open a terminal and create a new conda environment:
Copy conda create -n uomi-ai python=3.10 -y
If you've just installed Miniconda/Anaconda, initialize conda in your shell:
Copy # For bash users
source ~/miniconda3/etc/profile.d/conda.sh
# For zsh users
source ~/miniconda3/etc/profile.d/conda.sh
# Activate the environment
conda activate uomi-ai
2. Install PyTorch with CUDA Support
Install PyTorch and related packages:
Copy conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=12.1 -c pytorch -c nvidia
Verify the installation:
Copy python -c "import torch; print(torch.cuda.is_available())"
This should print True
if CUDA is properly installed.
Install CUDA toolkit and NVCC compiler:
Copy conda install -c nvidia/label/cuda-12.1.0 cuda-nvcc=12.1 cuda-toolkit=12.1
Verify the installation:
4. Install Additional Dependencies
Install the required Python packages:
Copy # Install Optimum
pip install -U "optimum>=1.20.0"
# Install AutoGPTQ
pip install auto-gptq --no-build-isolation
# Install Transformers
pip install transformers
# Install specific NumPy version
conda install numpy=1.24
# Install Flash Attention
pip install flash-attn --no-build-isolation
# Install Flask
pip install flask
Troubleshooting
Common Issues
CUDA Not Found
Verify NVIDIA drivers are installed: nvidia-smi
Check CUDA installation: nvcc --version
Ensure PyTorch CUDA is properly installed: python -c "import torch; print(torch.version.cuda)"
Build Failures
Ensure you have build tools installed:
Copy sudo apt-get update
sudo apt-get install build-essential
For Auto-GPTQ issues, try installing from source:
Copy git clone https://github.com/AutoGPTQ/AutoGPTQ.git
cd AutoGPTQ
rm -rf build/*
python setup.py install
Version Conflicts
If you encounter package conflicts, try creating a fresh environment
Consider using pip install --no-deps
for problematic packages
Verification
To verify the complete setup, run this test script:
Copy import torch
import transformers
import auto_gptq
import flash_attn
import flask
print(f"PyTorch version: {torch.__version__}")
print(f"CUDA available: {torch.cuda.is_available()}")
print(f"CUDA version: {torch.version.cuda}")
print(f"Transformers version: {transformers.__version__}")
Create the service
Create a new systemd service file for the AI component:
Copy sudo nano /etc/systemd/system/uomi-ai.service
Add the following content to the service file:
Copy [Unit]
Description=UOMI AI API Server
After=network.target
[Service]
User=uomi
WorkingDirectory=/home/uomi/uomi-node-ai
ExecStart=/bin/bash -c "source /home/uomi/miniconda3/etc/profile.d/conda.sh && conda activate uomi-ai && python3 uomi-ai.py"
Restart=always
RestartSec=10
TimeoutSec=30
StartLimitIntervalSec=500
StartLimitBurst=5
[Install]
WantedBy=multi-user.target
Important Notes:
The WorkingDirectory
path (/home/uomi/uomi-node-ai
) should be adjusted to match your actual installation directory
The ExecStart
command assumes:
Miniconda is installed in /home/uomi/miniconda3
A conda environment named uomi-ai
exists
The main Python script is named uomi-ai.py
Modify these paths and names according to your specific setup
Enable and start the AI service:
Copy sudo systemctl daemon-reload
sudo systemctl enable uomi-ai.service
sudo systemctl start uomi-ai.service
Verify the service is running:
Copy sudo systemctl status uomi-ai.service
Monitor the AI service logs:
Copy sudo journalctl -u uomi-ai.service -f
Set-up the validator Node
Download the binary
Directory Structure Setup
Create the necessary directories and set appropriate permissions:
Copy # Create directories
sudo mkdir -p /var/lib/uomi
sudo mkdir -p /usr/local/bin
# Create user for the service
sudo useradd --no-create-home --shell /usr/sbin/nologin uomi
# Set permissions
sudo chown -R uomi:uomi /var/lib/uomi
Binary and Genesis Setup
Add copied peers inside the genesis.json file:
Copy {
"name": "Uomi",
"id": "uomi",
"chainType": "Live",
"bootNodes": [PASTE_PEERS_ARRAY_HERE],
"telemetryEndpoints": null,
"protocolId": null,
"properties": {
"tokenDecimals": 18,
"tokenSymbol": "UOMI"
},
...
Then install binary and genesis files:
Copy the Uomi binary to the correct location:
Copy sudo cp ./uomi /usr/local/bin/uomi
sudo chmod +x /usr/local/bin/uomi
Copy sudo cp ./genesis.json /usr/local/bin/genesis.json
Create validator account
This account is the one that will validate blocks and will save output from Agents
Copy /usr/local/bin/uomi key generate --scheme Sr25519
You will get something like:
Copy Secret phrase: tackle rebuild neither turn degree real capital armed giraffe novel resist human
Network ID: substrate
Secret seed: 0x5c9499827e606bcf284e8a650a96ce13ebf0484bd64a280507ff96d99da6e174
Public key (hex): 0x14ceec080a6aa464b4235dd951a85669d25e4fa659578f01a7a7dc5c95454931
Account ID: 0x14ceec080a6aa464b4235dd951a85669d25e4fa659578f01a7a7dc5c95454931
Public key (SS58): 5CXzHQ3DmYKemRAyY6NPyKsDWiChbeeKtxW3q5RWpmdUQvdR
SS58 Address: 5CXzHQ3DmYKemRAyY6NPyKsDWiChbeeKtxW3q5RWpmdUQvdR
Generate Ed25519 key for GRANDPA using the same seed phrase:
Copy /usr/local/bin/uomi key inspect --scheme Ed25519 "YOUR_SEED_PHRASE"
you'll need the secret phrase and the secret seed later.
CAUTION
Save your secret phrase and secret seed in a safe place (preferably offline), it's the only way to recover your account if you lose it
Systemd Service Configuration
Create a systemd service file at /etc/systemd/system/uomi.service
:
Copy iniCopy[Unit]
Description=Uomi Node
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
User=uomi
Group=uomi
Restart=always
RestartSec=10
LimitNOFILE=65535
ExecStart=/usr/local/bin/uomi \
--validator \
--name "YOUR_NODE_NAME" \
--chain "/usr/local/bin/genesis.json" \
--base-path "/var/lib/uomi" \
--state-pruning 1000 \
--blocks-pruning 1000 \
--enable-evm-rpc \
--rpc-cors all \
--prometheus-external \
--telemetry-url "wss://telemetry.polkadot.io/submit/ 0"
# Hardening
ProtectSystem=strict
PrivateTmp=true
PrivateDevices=true
NoNewPrivileges=true
ReadWritePaths=/var/lib/uomi
[Install]
WantedBy=multi-user.target
Enable and start the service:
Copy sudo systemctl daemon-reload
sudo systemctl enable uomi.service
sudo systemctl start uomi.service
Add your key to your node
Once your node is running, insert your keys:
ATTENTION
Replace SECRET_PHRASE and PUBLIC_KEY with your data received with the first command "key generate --scheme Sr25519 "
Copy for key_type in babe imon uomi ipfs; do
curl -H "Content-Type: application/json" \
-d '{"id":1, "jsonrpc":"2.0", "method":"author_insertKey", "params":["'$key_type'", "SECRET_PHRASE", "PUBLIC_KEY"]}' \
http://localhost:9944
done
ATTENTION
Replace SECRET_PHRASE and PUBLIC_KEY with your data received with the first command "key inspect --scheme Ed25519 "
Copy curl -H "Content-Type: application/json" \
-d '{"id":1, "jsonrpc":"2.0", "method":"author_insertKey", "params":["gran", "SECRET_PHRASE", "PUBLIC_KEY"]}' \
http://localhost:9944
This data will be stored on your local node, no one can have access to them.
Add the account
Now you can import the account you created previously with SECRET_PHRASE to your wallet extension and fund it with the tokens you want to bond
Before jumping to the next steps, you have to wait until your node is fully synchronized . This can take a long time depending on the chain height.
Check the current synchronization:
Copy journalctl -f -u uomi -n100
Run the following command to author session keys:
Copy curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params":[]}' http://localhost:9944
The result will look like this (you just need to copy the result):
Copy {"jsonrpc":"2.0","result":"0x600e6cea49bdeaab301e9e03215c0bcebab3cafa608fe3b8fb6b07a820386048","id":1}
Register as validator
Go to Network > Staking > Accounts and then select Validator on the right
Select the account you funded previously, the amount you want to bond and the payment method and click next.
Now insert the key you copied before and follow the instructions, click "bond & validate" and then submit the transaction.