8. Đồng bộ node nhanh với Mithril client
Mithril Networks cung cấp khả năng tải xuống và khởi động các nút Cardano thông qua snapshot của blockchain Cardano. Đây là một cách tuyệt vời để tăng tốc quá trình đồng bộ hóa một nút mới, đặc biệt là đối với các nhà điều hành nhóm stake (stake pool). Các công cụ được cung cấp bởi Guild Operators được thiết kế để tạo điều kiện thuận lợi cho việc dễ dàng thiết lập và quản lý:
mithril-client.sh là một công cụ được sử dụng để thiết lập môi trường máy khách Mithril và quản lý việc tải xuống Snapshot Mithril.
a. Tải xuống Mihril được tích hợp sẵn trong cntools.
cd "$HOME/tmp"
curl -sS -o guild-deploy.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/guild-deploy.sh
chmod 755 guild-deploy.sh
./guild-deploy.sh -b master -n preview -s m
. "${HOME}/.bashrc"
Các tính năng chính bao gồm:
– environment – Tạo một tệp mithril.env mới với tất cả các biến môi trường cần thiết cho MithrilClient.
– cardano-db – Tải xuống, liệt kê tất cả hoặc hiển thị snapshot Mithril cụ thể có sẵn.
– stake-distribution – Tải xuống hoặc liệt kê các bản phân phối stake Mithril khả dụng.
– u – Bỏ qua kiểm tra cập nhật tập lệnh.
b. Cách sử dụng.
Usage: bash [-u] <command> <subcommand> [<sub arg>]
A script to run Cardano Mithril Client
-u Skip script update check overriding UPDATE_CHECK value in env (must be first argument to script)
Commands:
environment Manage mithril environment file
setup Setup mithril environment file
override Override default variable in the mithril environment file
update Update mithril environment file
cardano-db Interact with Cardano DB
download Download Cardano DB from Mithril snapshot
snapshot Interact with Mithril snapshots
list List available Mithril snapshots
json List availble Mithril snapshots in JSON format
show Show details of a Mithril snapshot
json Show details of a Mithril snapshot in JSON format
stake-distribution Interact with Mithril stake distributions
download Download latest stake distribution
list List available stake distributions
json Output latest Mithril snapshot in JSON format
c. Chuẩn bị node Relay hoặc node Block Producer
Để chuẩn bị đồng bộ một node relay hoặc node block Producer, bạn cần thực hiện theo các bước sau:
cd $CNODE_HOME/scripts
./mithril-client.sh environment setup
Tải xuống snapshot Mithril./mithril-client.sh cardano-db download
sau khi thiết lập tệp môi trường, bạn có thể tải xuống bản chụp nhanh Mithril mới nhất bằng cách chạy tập lệnh với lệnh snapshot download. Bản snapshot này chứa trạng thái mới nhất của cơ sở dữ liệu blockchain Cardano từ Mithril.
![](https://ada-bamboo.com/wp-content/uploads/2024/12/1230-1024x224.gif)
Sau khi dữ liệu đã tải xuống hoàn tất, ta tiến hành khởi động node của mình.
sudo systemctl start cnode