Official website: https://www.titannet.io/en/index.html
Official documentation: https://titannet.gitbook.io/titan-network-en
Machine configuration used in this article:
1 core 1GB
Linux Ubuntu 22.04 system
0x00: Download and extract the official code repository#
# Download
wget https://github.com/Titannet-dao/titan-node/releases/download/v0.1.16/titan_v0.1.16_linux_amd64.tar.gz
# Extract
tar -xzvf titan_v0.1.16_linux_amd64.tar.gz
# Go to the project root directory
cd titan_v0.1.16_linux_amd64/
0x01: Start the node#
(Do not execute this yet, read in conjunction with 0x02!)
# Since the project root directory is not added to the environment variables, it needs to be specified with ./
./titan-edge daemon start --init --url https://test-locator.titannet.io:5000/rpc/v0
After executing this command, the program is already running. However, it is running directly in the terminal, so when the terminal is closed or the connection to the server is disconnected, the program will be closed. Therefore, it needs to be run in the background. The following explains how to use the pm2 tool to run the command as a daemon in the background.
0x02: Run in the background#
To make it easier, write a shell script to execute the command mentioned in 0x01. Then use the pm2 tool to run the shell script as a daemon.
1. Write the shell script#
vi is a terminal text editing tool in Linux system.
Execute vi run.sh
to create the file. Press i
to enter edit mode, and enter or paste the script:
#!/bin/bash
./titan-edge daemon start --init --url https://test-locator.titannet.io:5000/rpc/v0
Press ESC
to exit edit mode.
Then press :wq
to save and exit.
Make the run.sh file executable: chmod +x run.sh
2. Run as a daemon with pm2#
pm2 is a popular Node.js process management tool that can be used to simplify the deployment, monitoring, and management of Node.js applications. It can also perform the same operations on shell files.
# Installation of pm2
sudo apt update
sudo apt install nodejs
sudo apt install npm
npm install -g pm2
# Run the run.sh script as a daemon and give it a name:
pm2 start run.sh --name titan
# Other operations:
pm2 list # List the processes managed by pm2
pm2 stop titan # Stop the execution of run.sh
pm2 start titan # Start
0x03: Apply for an identity code#
Follow the steps in the official tutorial.
My invitation code: ZYkTSc 🤝
0x04: Bind the identity code#
# Replace "your-hash-here" with the obtained identity code
./titan-edge bind --hash=your-hash-here https://api-test1.container1.titannet.io/api/v2/device/binding
Note:
- The identity code will change.
- After starting the node, binding needs to be done once.
After binding the identity code, you can go to the console to see if the device is online. Please wait for a while as there may be a delay.