Namada节点部署教程

大家好我是雨夜 ,专注早期项目交互,不定期发布优质项目的交互教程,欢迎关注我。

推特:@0xrainight 

Namada 是一个以资产隐私为中心的区块链,使用零知识证明技术。Namada 的加密特性为用户提供了资产不可知性、链间隐私,并且正在由 Anoma 基金会构建。

DC社区:https://discord.gg/namada

测试节点搭建教程

开始今天的教程之前,需要有一定的前置条件:

一台ubuntu服务器(最好是国外的服务器,问题会少很多),最低配置如下

  • CPUs: 4

  • RAM: 16GB

  • Storage: 150GB

  • OS:Ubuntu 22.04

1、使用ssh登录服务器(mac、linux系统下操作)

ssh root@服务器ip 

回车确认,如果出现提示”Are you sure you want to continue connecting (yes/no/[fingerprint])?“

输入 yes 回车确认

窗口等待输入服务器密码,回车确认。进入服务器

运行成功结果

2、确认当前用户是root,如果已经是root用户请略过

开启root用户,为root用户创建密码,输入两次密码

sudo passwd root

使用下面命令,切换到root用户,在输入刚才创建的密码

su root

3、安转Rust v1.64+

使用下面命令,自动安装rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

出现下面的界面时,选择1,默认安装

出现下面的界面说明安装完成

使用下面命令,让Rust生效

source "$HOME/.cargo/env"

4、安装

下载 CometBFT

mkdir -p $HOME/.local/bin
curl -sL https://github.com/cometbft/cometbft/releases/download/v0.37.2/cometbft_0.37.2_linux_amd64.tar.gz | tar -C $HOME/.local/bin -xzf- cometbft

更新系统并安装工具

sudo apt -q update
sudo apt -qy install make git-core libssl-dev pkg-config libclang-12-dev libudev-dev build-essential protobuf-compiler
sudo apt -qy upgrade

下载编译Namada

cd $HOME
rm -rf shielded-expedition.b40d8e9055
git clone -b v0.31.0 https://github.com/anoma/namada.git shielded-expedition.b40d8e9055
cd shielded-expedition.b40d8e9055
make build-release
for BIN in namada namadac namadan namadar namadaw; do install -m 0755 target/release/$BIN $HOME/.local/bin/$BIN; done

创建自启动服务

sudo tee /etc/systemd/system/namada.service > /dev/null << EOF
[Unit]
Description=Namada node
After=network-online.target

[Service]
User=$USER
ExecStart=$HOME/.local/bin/namada node ledger run
Restart=always
RestartSec=10
LimitNOFILE=65535
Environment="CMT_LOG_LEVEL=p2p:none,pex:error"
Environment="NAMADA_CMT_STDOUT=true"
Environment="NAMADA_LOG=info"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$HOME/.local/bin"

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable namada.service

初始化节点

export PATH=$HOME/.local/bin:$PATH
namada client utils join-network --chain-id shielded-expedition.b40d8e9055 # --genesis-validator bengt

export CUSTOM_PORT=266
sed -i \
  -e "s|^proxy_app = \"tcp://127.0.0.1:26658\"|proxy_app = \"tcp://127.0.0.1:${CUSTOM_PORT}58\"|" \
  -e "s|^laddr = \"tcp://127.0.0.1:26657\"|laddr = \"tcp://127.0.0.1:${CUSTOM_PORT}57\"|" \
  -e "s|^laddr = \"tcp://0.0.0.0:26656\"|laddr = \"tcp://0.0.0.0:${CUSTOM_PORT}56\"|" \
  -e "s|^prometheus_listen_addr = \":26660\"|prometheus_listen_addr = \":${CUSTOM_PORT}66\"|" \
  $HOME/.local/share/namada/shielded-expedition.b40d8e9055/config.toml

启动节点并查看日志

ctr+c 停止查看日志

sudo systemctl start namada.service && sudo journalctl -u namada.service -f --no-hostname -o cat

停止节点并重置数据

sudo systemctl stop namada.service
cp $HOME/.local/share/namada/shielded-expedition.b40d8e9055/cometbft/data/priv_validator_state.json $HOME/.local/share/namada/shielded-expedition.b40d8e9055/priv_validator_state.json.backup
rm -rf $HOME/.local/share/namada/shielded-expedition.b40d8e9055/cometbft/data $HOME/.local/share/namada/shielded-expedition.b40d8e9055/db

下载快照(快速同步)

curl -L https://snapshots.kjnodes.com/namada-testnet/snapshot_latest.tar.lz4 | tar -Ilz4 -xf - -C $HOME/.local/share/namada
mv $HOME/.local/share/namada/shielded-expedition.b40d8e9055/priv_validator_state.json.backup $HOME/.local/share/namada/shielded-expedition.b40d8e9055/cometbft/data/priv_validator_state.json

重新启动节点

ctr+c 停止查看日志

sudo systemctl start namada.service && sudo journalctl -u namada.service -f --no-hostname -o cat

查看同步状态

curl http://127.0.0.1:26657/status

catching_up:true 表示未同步完成 ,catching_up:false 表示同步完成

5、创建账号

创建新账号 wallet 是钱包自定义名称

会让你输入2次密码

namada wallet gen --alias wallet

通过 MNEMONIC 恢复账号

namada wallet derive --alias wallet

查看创建好的账号

使用命令可以查看创建的钱包,获取地址 tnam1********

namada wallet list

使用获取到的地址领水

访问 https://faucet.heliax.click/

等节点同步完成,查看测试币是否到账

wallet 改成你的自定义名称

namada client balance --owner wallet

6、创建验证节点

xxx 改成你的验证节点名称,wallet改成你的自定义钱包名称

namada client init-validator \
  --alias "XXX" \
  --account-keys wallet \
  --signing-keys wallet \
  --commission-rate 0.05 \
  --max-commission-rate-change 0.01 \
  --email validator@example.com

会多次让输入密码(可以和账号密码一样,也可以不一样)

7、重启节点

验证节点会在下一个 Epoch 生效

8、资源管理器

===========================

关注我的推特,不定期发布交互教程

Subscribe to rainight-雨夜
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.