# Nibiru public testnet phase 1 节点 教程

By [撸币党的天下-币圈薅羊毛](https://paragraph.com/@0xa14b482fd4db6aa39f5f649daee63faaea171bb2) · 2022-11-14

---

Cosmos生态近期火热。Nibiru是一个基于Cosmos Sdk的DEFI Hub，为衍生品和现货交易提供动力。安全、无需许可、完全上链。其种子轮融资了750万美元，Tribe captital, Kraken, Republic Crypto，Guardian 创始人Strafach guardian参投。

近期其开放了公开测试网，目前为测试网的第一阶段，**不是激励性测试网**，目前开发者和节点运营者可以参与。**建议体验为主，为接下来的测试网做准备**。

![目前为第一阶段测试网](https://storage.googleapis.com/papyrus_images/325fd4dd7a9e8643e8adcc0ecb77dadcc1e6ad7657617985c88a444ae17be605.png)

目前为第一阶段测试网

目前为第一阶段测试网

**_本教程仅供参考，请以官方教程为准。_**

官方教程
----

最低配置
----

*   2 CPU
    
*   4 GB RAM （官方教程写的要求偏高，实际8GB+即可）
    
*   100GB SSD
    

服务器购买联系：

TG：

[https://t.me/hahah007](https://t.me/hahah007)

推特:@shok88991

QQ3245512225

服务器配置介绍：

韩国 L5520\*2/16G/1T 1IP 10M 700元/月 双CPU，物理核16线程，支持超线程技术，在任务管理器里面显示16个核心数

韩国 E5-2650\*2/32G/1T 10M 1000元/月 双CPU，物理核心1632线程，支持超线程技术，在任务管理器里面显示32个核心数字

韩国 L5630\*2/32G/1T 10M 800元/月 双CPU，物理8核16线程器，支持超线程技术，在任务管理里面显示116个内核数

450L\* E2-32G /1T SSD220M 200M 2000元/月 100M/1TSSD00元/月100M/1TSSD00元/月100M，支持美国固态硬盘，CPU，物理1632线程，硬盘双线程技术，在任务管理器里面32个内核

香港 L5630\*2/16G/1T 10M 1300元/月 双CPU，物理8核16线程器，支持超线程技术，在任务管理里面显示116个核心数

香港 E5-2450L\*2/32G/1T 10M 1600元/月 双CPU，物理核心1632线程，支持超线程技术，在任务管理器里面显示32个核心数字

也非常支持淘宝购买！！！

安装基础环境
------

**本教程使用的系统为Ubuntu20.04，其他系统的部分命令请自行调整。建议用国外的VPS。**

安装go

    sudo rm -rf /usr/local/go;
    curl https://dl.google.com/go/go1.19.2.linux-amd64.tar.gz | sudo tar -C/usr/local -zxvf - ;
    cat <<'EOF' >>$HOME/.profile
    export GOROOT=/usr/local/go
    export GOPATH=$HOME/go
    export GO111MODULE=on
    export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
    EOF
    source $HOME/.profile
    

安装完成后运行以下命令查看版本

    go version
    

安装其他必要的环境

    sudo apt-get update -y && sudo apt-get upgrade -y;
    sudo apt-get install curl build-essential jq git -y;
    

### 下载源代码并编译

    cd
    git clone https://github.com/NibiruChain/nibiru
    cd nibiru
    git checkout v0.15.0
    make install
    

安装完成后可以运行 `nibid version`检查是否安装成功。

显示应为v0.15.0

运行节点
----

### 初始化节点

    moniker=你的节点名
    nibid init $moniker --chain-id=nibiru-testnet-1
    nibid config chain-id nibiru-testnet-1
    

### 下载Genesis 文件

    curl -s https://rpc.testnet-1.nibiru.fi/genesis | jq -r .result.genesis >  ~/.nibid/config/genesis.json
    

### 设置peer和seed

    PEERS="968472e8769e0470fadad79febe51637dd208445@65.108.6.45:60656"
    seeds=""
    sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.nibid/config/config.toml
    sed -i.bak -e "s/^seeds *=.*/seeds = \"$seeds\"/" ~/.nibid/config/config.toml
    

Pruning设置
---------

    pruning="custom" && \
    pruning_keep_recent="100" && \
    pruning_keep_every="0" && \
    pruning_interval="10" && \
    sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.nibid/config/app.toml && \
    sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.nibid/config/app.toml && \
    sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.nibid/config/app.toml && \
    sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.nibid/config/app.toml
    

### State-sync快速同步

    SNAP_RPC="https://rpc.nibiru-testnet-1.silentvalidator.com:443" \
    LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
    BLOCK_HEIGHT=$((LATEST_HEIGHT - 500)); \
    TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash); \
    echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH
    #if there are no errors, then continue
    
    peers="5eecfdf089428a5a8e52d05d18aae1ad8503d14c@65.108.141.109:19656,5c30c7e8240f2c4108822020ae95d7b5da727e54@65.108.75.107:19656"
    sed -i 's|^persistent_peers *=.*|persistent_peers = "'$peers'"|' $HOME/.nibid/config/config.toml
    sed -i -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
    s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
    s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
    s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" $HOME/.nibid/config/config.toml
    

### 启动节点

    sudo tee <<EOF >/dev/null /etc/systemd/system/nibid.service
    [Unit]
    Description=nibid daemon
    After=network-online.target
    [Service]
    User=$USER
    ExecStart=$(which nibid) start
    Restart=on-failure
    RestartSec=3
    LimitNOFILE=10000
    [Install]
    WantedBy=multi-user.target
    EOF
    

    sudo systemctl daemon-reload && \
    sudo systemctl enable nibid && \
    sudo systemctl start nibid
    

### 查看日志

    sudo journalctl -u nibid -f
    

### 检查同步状态

    curl -s localhost:26657/status | jq .result | jq .sync_info
    

其中显示 `"catching_up":`显示为`false`即已经同步上。同步需要一段时间，可能半小时到一小时，如果一直没有开始同步一般是因为peer不够，可以考虑添加Peer或者使用别人的addrbook。

### 更换 addrbook

    wget -O $HOME/.nibid/config/addrbook.json "https://raw.githubusercontent.com/sergiomateiko/addrbooks/main/nibiru/addrbook.json"
    

创建验证人
-----

### 创建钱包

    nibid keys add 钱包名
    

**注意请保存助记词。若不保存，之后将无法恢复。**

### 领取测试币

进入nibiru discord [https://discord.gg/nsV3a5CdC9](https://discord.gg/nsV3a5CdC9)

在 #faucet 频道发送

    $request 你的nibiru地址 
    

之后可以用

    nibid query bank balances 你的nibiru地址
    

查询测试币余额。

### 创建验证人

获取足够测试币，且节点完成同步后，可以创建验证人。只有质押量在前100的验证人才是活跃验证人。

    daemon=nibid
    denom=unibi
    moniker=验证人名
    chainid=nibiru-testnet-1
    $daemon tx staking create-validator \
        --amount=1000000$denom \
        --pubkey=$($daemon tendermint show-validator) \
        --moniker=$moniker \
        --chain-id=$chainid \
        --commission-rate=0.05 \
        --commission-max-rate=0.2 \
        --commission-max-change-rate=0.1 \
        --min-self-delegation=1000000 \
        --fees 5000unibi \
        --from=钱包名 
    

之后可以去[区块浏览器](https://nibiru.explorers.guru/)查看你的验证人是否创建成功。

更多信息
----

官网：

官方推特：

Discord:

官方文档： [https://docs.nibiru.fi](https://t.co/tqGATv7ks9)

欢迎关注 [https://silentvalidator.com](https://silentvalidator.com/)
----------------------------------------------------------------

其他常用命令
------

#### 服务管理

检查日志

    sudo journalctl -u nibid -f
    

运行/重启节点

停止节点

    sudo systemctl stop nibid
    

#### 节点信息

同步信息

    nibid status 2>&1 | jq .SyncInfo
    

验证人信息

    nibid status 2>&1 | jq .ValidatorInfo
    

节点信息

    nibid status 2>&1 | jq .NodeInfo
    

获取node id

    nibid tendermint show-node-id
    

#### 钱包操作

显示所有钱包

    nibid keys list
    

恢复钱包

    nibid keys add 你的钱包名 --recover
    

删除钱包

    nibid keys delete 你的钱包名
    

查询余额

    nibid query bank balances 接收者nibiru地址
    

发送代币

    nibid tx bank send 你的钱包名 接收者nibiru地址 数量unibi --from 你的钱包名 -y --chain-id=nibiru-testnet-1 --fees 5000unibi
    

**注意：1nibi=1000000unibi**

#### 投票

    nibid tx gov vote 提案编号 投票选项 --from 你的钱包名 -y --chain-id=nibiru-testnet-1 --fees 5000unibi
    

投票选项包括yes/no/no\_with\_veto/abstain。大部分情况我们投yes就好。

#### 质押，提取奖励

质押

    nibid tx staking delegate 你要质押的验证人地址 数量unibi --from 你的钱包名 -y --chain-id=nibiru-testnet-1 --fees 5000unibi
    

解除质押

    nibid tx staking unbond 你要解除质押的验证人地址 数量unibi --from 你的钱包名 -y --chain-id=nibiru-testnet-1 --fees 5000unibi
    

提取质押奖励和验证人佣金

    nibid tx distribution withdraw-rewards 你的验证人地址 --commission --from 你的钱包名 -y --chain-id=nibiru-testnet-1 --fees 5000unibi
    

提取所有奖励

    nibid tx distribution withdraw-all-rewards --from=你的钱包名 -y --chain-id=nibiru-testnet-1 --fees 5000unibi
    

#### 验证人管理

修改验证人信息

    nibid tx staking edit-validator \
      --new-moniker=节点名 \
      --identity=你的keybase id \
      --website="你的网站" \
      --details="你的验证人描述" \
      --from=你的钱包名 \
      --fees 5000unibi \
      --chain-id=nibiru-testnet-1
    

假如你想在区块浏览器显示你的验证人logo。需要注册一个keybase账号，上传logo。在验证人信息中设置`--identity=你的keybase id`，区块链浏览器中就会显示你的keybase logo作为验证人logo。

Unjail

    nibid tx slashing unjail --from <你的钱包名> -y --chain-id=nibiru-testnet-1 --fees 5000unibi

---

*Originally published on [撸币党的天下-币圈薅羊毛](https://paragraph.com/@0xa14b482fd4db6aa39f5f649daee63faaea171bb2/nibiru-public-testnet-phase-1)*
