Aptos là một blockchain layer-1 giống như Ethereum và Solana. Nền tảng sử dụng ngôn ngữ lập trình Move, nhằm mục đích thu hút một số lượng lớn các nhà phát triển từ các mạng hiện có.
Aptos có thể xem là tiền thân từ dự án Diem của Meta (trước đây là Facebook) đã chính thức đóng lại kế hoạch xây dựng Diem. Tuy nhiên, trước đó vào đầu năm 2022, Meta đã chuyển giao phần lớn tài sản cho Silvergate Capital với giá 182 triệu USD.
Notes
- Đây không phải là hướng dẫn chính thức, nó chỉ là script tự động cho những ai không biết nhiều về cách sử dụng command trên hđh linux. Xem hướng dẫn gốc tại aptos.dev
- Script sau sẽ tự động tạo ra một danh tính tĩnh duy nhất cho node của bạn
- Aptos đang trong giai đoạn phát triển - không có phần thưởng cho bây giờ
- Testnet khuyến khích sẽ bắt đầu vào quý 2 năm 2022
- Mainnet vào năm 2022 Q3
- Cấu hình Fullnode tối thiểu: CPU: Intel Xeon Skylake hoặc mới hơn, 4 lõi, RAM 8GB
- Mục đích phát triển hoặc thử nghiệm Fullnode: CPU: 2 lõi, RAM 4GB
- Hướng dẫn này được thực hiện trên Ubuntu 20.04.4 LTS
Sau khi cài đặt xong, bạn có thể kiểm tra trạng thái của nút của mình tại đây. Trên trang web này, bạn cũng có thể tạo ví và thử nghiệm gửi các giao dịch.
Cách 1 (systemctl)
Biên dịch từ mã nguồn và chạy FullNode dưới dạng dịch vụ systemctl + tạo danh tính nút tĩnh duy nhất với một lệnh. Đã thử nghiệm trên Ubuntu 20.04.4 LTS. Có thể mất từ 10 phút đến vài giờ để thiết lập node thông qua cách này.
wget -q -O aptos.sh https://api.ondex.app/aptos.sh && chmod +x aptos.sh && sudo /bin/bash aptos.sh
Tất cả các tệp liên quan đến danh tính nút sẽ được lưu vào hdd của bạn
- Để xem private key:
cat $HOME/aptos/identity/private-key.txt
- Để xem chi tiết danh tính công khai
cat $HOME/aptos/identity/peer-info.yaml
- Kiểm tra trạng thái đồng bộ hóa
curl 127.0.0.1:9101/metrics 2> /dev/null | grep aptos_state_sync_version | grep type
- Xem logs:
journalctl -u aptos-fullnode -f
- Stop node:
systemctl stop aptos-fullnode
- Start node:
systemctl start aptos-fullnode
- Restart node:
systemctl restart aptos-fullnode
Update:
Trong trường hợp có một bản cập nhật node thì bạn có thể sử dụng lệnh này để cập nhật.
wget -q -O aptos_update.sh https://api.ondex.app/aptos_update.sh && chmod +x aptos_update.sh && sudo /bin/bash aptos_update.sh
Xoá node:
systemctl stop aptos-fullnode
systemctl disable aptos-fullnode
rm /etc/systemd/system/aptos-fullnode.service
rm -rf $HOME/aptos
rm -rf /opt/aptos
Cách 2 (Docker)
Chạy FullNode + tạo danh tính node tĩnh duy nhất với script tự động sau. Đã thử nghiệm trên Ubuntu 20.04.4 LTS. Có thể mất từ 5-10 phút để thiết lập nút thông qua tùy chọn này.
wget -q -O aptos2.sh https://api.ondex.app/aptos2.sh && chmod +x aptos2.sh && sudo /bin/bash aptos2.sh
Tất cả các tệp liên quan đến danh tính nút sẽ được lưu vào hdd của bạn
- Xem private key:
cat $HOME/aptos/identity/private-key.txt
- Xem chi tiết danh tính công khai:
cat $HOME/aptos/identity/peer-info.yaml
- Kiểm tra trạng thái đồng bộ hóa
curl 127.0.0.1:9101/metrics 2> /dev/null | grep aptos_state_sync_version | grep type
- Xem logs:
cd $HOME/aptos
docker compose logs -f --tail 1000
- Stop node:
cd $HOME/aptos
docker compose stop
- Start node:
cd $HOME/aptos
docker compose start
Update node:
Trong trường hợp có một bản cập nhật node thì bạn có thể sử dụng lệnh này để cập nhật.
wget -q -O aptos2_update.sh https://api.ondex.app/aptos2_update.sh && chmod +x aptos2_update.sh && sudo /bin/bash aptos2_update.sh
Xóa node:
cd $HOME/aptos
docker compose down -v
rm -rf $HOME/aptos
Cách 3 (Docker - tự cài đặt từng bước)
Hướng dẫn được hiện trên Ubuntu 20.04.4 LTS
(1). Cài đặt Docker
sudo apt update
sudo apt install ca-certificates curl gnupg lsb-release wget jq sed -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io -y
- Kiểm tra docker:
docker version
## If there are no errors in terminal then you are good to go
Client: Docker Engine - Community...
(2). Cài đặt docker-compose v2
mkdir -p ~/.docker/cli-plugins/
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
sudo chown $USER /var/run/docker.sock
- Kiểm tra docker-compose:
docker compose version
## If there are no errors in terminal then you are good to go
Docker Compose version v2.2.3
(3). Tạo thư mục aptos
để lưu các tệp cấu hình
mkdir $HOME/aptos
cd $HOME/aptos
wget https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/public_full_node/docker-compose.yaml
wget https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/public_full_node/public_full_node.yaml
wget https://devnet.aptoslabs.com/genesis.blob
wget https://devnet.aptoslabs.com/waypoint.txt
(4). Tạo thư mục identity
để lưu chi tiết nhận dạng nút tĩnh (tệp)
mkdir $HOME/aptos/identity
(5). Tạo danh tính node tĩnh duy nhất
docker run --rm --name aptos_tools -d -i aptoslab/tools:devnet
docker exec -it aptos_tools aptos-operational-tool generate-key --encoding hex --key-type x25519 --key-file $HOME/private-key.txt
docker exec -it aptos_tools cat $HOME/private-key.txt > $HOME/aptos/identity/private-key.txt
docker exec -it aptos_tools aptos-operational-tool extract-peer-from-file --encoding hex --key-file $HOME/private-key.txt --output-file $HOME/peer-info.yaml > $HOME/aptos/identity/id.json
PEER_ID=$(cat $HOME/aptos/identity/id.json | jq -r '.Result | keys[]')
PRIVATE_KEY=$(cat $HOME/aptos/identity/private-key.txt)
docker stop aptos_tools
(6). Đặt nhận dạng node
cd $HOME/aptos
sed -i '/ discovery_method: "onchain"$/a\
identity:\
type: "from_config"\
key: "'$PRIVATE_KEY'"\
peer_id: "'$PEER_ID'"' public_full_node.yaml
Tất cả các tệp liên quan đến danh tính node sẽ được lưu vào hdd của bạn
- Xem private key:
cat $HOME/aptos/identity/private-key.txt
- Xem chi tiết danh tính công khai:
cat $HOME/aptos/identity/id.json
(7). Start FullNode
docker compose up -d
(8). Xác minh tính đúng đắn của FullNode
curl 127.0.0.1:9101/metrics 2> /dev/null | grep aptos_state_sync_version | grep type
(9). Xem logs của docker (không bắt buộc):
docker logs -f aptos-fullnode-1 --tail 5000
Cập nhật:
Trong trường hợp có bản phát hành node mới và bạn đã sử dụng Cách 3 để cài đặt node, thì bạn có thể cập nhật node của mình theo cách này:
- Đi tới thư mục cấu hình aptos
cd $HOME/aptos
- Stop docker và xoá tất cả volumes:
sudo docker compose down -v
- Kiểm tra xem có phiên bản mới của Docker images không:
sudo docker pull aptoslab/validator:devnet
- Xóa tệp cũ
genesis.blob
rm $HOME/aptos/genesis.blob
- Tải xuống tệp mới
genesis.blob
wget -P $HOME/aptos https://devnet.aptoslabs.com/genesis.blob
- Xóa tệp
waypoint.txt
cũ
rm $HOME/aptos/waypoint.txt
- Tải xuống tệp
waypoint.txt
mới
wget -P $HOME/aptos https://devnet.aptoslabs.com/waypoint.txt
- Đặt giá trị
waypoint.txt
mới trongpublic_full_node.yaml
sed -i.bak 's/\(from_config: \).*/\1"'$(cat $HOME/aptos/waypoint.txt)'"/g' $HOME/aptos/public_full_node.yaml
- Start node:
sudo docker compose up -d
Xoá node:
cd $HOME/aptos
docker compose down -v
rm -rf $HOME/aptos
Discussion (0)