1.安装 PostgreSQL
sudo apt update
sudo apt install postgresql postgresql-contrib -y
sudo systemctl status postgresql
sudo -i -u postgres
psql
\password postgres
会让输输入两次 postgres
然后exit退出,应该也是输入两次exit
2.安装Nodejs
sudo apt update
sudo apt install curl -y
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
node -v
npm -v
3.安装 Yarn
sudo apt update && sudo apt upgrade -y
sudo apt install gnupg -y
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn -y
yarn --version
4.安装docker
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce -y
sudo systemctl status docker
5.下载官方代码
git clone https://github.com/CATProtocol/cat-token-box.git
cd cat-token-box/
yarn install && yarn build
6.运行docker
cd packages/tracker/
mv .env.example .env
sudo chmod 777 docker/data
sudo chmod 777 docker/pgdata
sudo docker compose up -d
sudo systemctl disable postgresql
sudo systemctl stop postgresql
sudo docker compose up -d
cd ../../ && sudo docker build -t tracker:latest .
下面是一段,一次性输入
sudo docker run -d \
--name tracker \
--add-host="host.docker.internal:host-gateway" \
-e DATABASE_HOST="host.docker.internal" \
-e RPC_HOST="host.docker.internal" \
-p 3000:3000 \
tracker:latest
7.创建钱包
cd packages/cli/
mv config.example.json config.json
yarn cli wallet create
8.显示地址
yarn cli wallet address
9.查看余额
yarn cli wallet balances
出现:processing 450/7362: 6% 这是在同步
10.铸造(https://github.com/CATProtocol/cat-token-box/blob/main/packages/cli/README.md)
yarn cli mint -i 45ee725c2c5993b3e4d308842d87e973bf1951f5f7a804b21e4dd964ecd12d6b_0 5 --fee-rate 2
11.后台运行
创建后台窗口(创建名为run的窗口)
screen -S run
进入窗口后,执行脚本或者命令
ctrl+a+d 可以最小化窗口
screen -r run 恢复窗口
在后台窗口里按 ctrl+c 关闭脚本或命令
输入exit 关闭窗口
12.修改脚本
nano catrun.sh
修改后按 ctrl+x
接着输入y
回车确认
备注:
修复脚本
sudo apt install dos2unix
dos2unix catrun.sh