我们建议你先尝试加入公共测试网。关于如何加入最新测试网的信息可在这里找到。
在设置验证者节点之前,请确保你已经完成了加入主网指南。 如果你计划使用 KMS(密钥管理系统),应先完成这些步骤:使用 KMS。

什么是验证者?

验证者负责通过自动化投票流程将新区块提交到区块链中。如果验证者离线,或在同一高度签署区块,其质押可能会被罚没。由于存在被罚没的风险,我们建议你阅读关于哨兵节点架构的内容,以保护你的节点免受 DDOS 攻击并确保高可用性。
如果你想成为 Hub mainnet 的验证者,你应进一步了解安全性。
以下说明假设你已经设置好全节点,并且已同步到最新区块高度。

创建你的验证者

你的 cosmosvalconspub 可通过质押代币用于创建新的验证者。你可以运行以下命令查看验证者公钥:
gaiad tendermint show-validator
要创建验证者,只需使用以下命令:
不要使用超过你持有数量的 uatom!
gaiad tx staking create-validator \
  --amount=1000000uatom \
  --pubkey=$(gaiad tendermint show-validator) \
  --moniker="choose a moniker" \
  --chain-id=<chain_id> \
  --commission-rate="0.10" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --gas="auto" \
  --gas-prices="0.0025uatom" \
  --from=<key_name>
指定佣金参数时,commission-max-change-rate 用于衡量相对于 commission-rate 的百分比点变化。例如,从 1% 到 2% 虽然是 100% 的费率增长,但只增加了 1 个百分点。
一开始你可能没有足够的 ATOM 进入活跃验证者集合。用户可以通过 Keplr web app 向非活跃验证者(即活跃集合之外的验证者)委托。你也可以使用第三方浏览器,例如 Mintscan,来确认自己是否已进入验证者集合。

编辑验证者描述

你可以编辑验证者的公开描述。这些信息用于标识你的验证者,委托人会依赖这些信息决定将质押委托给哪个验证者。请确保为下方每个标志都提供输入。如果命令中未包含某个标志,则当该字段从未设置过时会默认为空(--moniker 默认为机器名);如果过去设置过,则会保持原值。 key_name 用于指定你要编辑的验证者。如果你选择不包含下方某些标志,请记住必须包含 —from 标志,以标识要更新的验证者。 --identity 可用于通过 Keybase 或 UPort 等系统验证身份。使用 Keybase 时,--identity 应填写一个 16 位字符串,该字符串由 keybase.io 账户生成。这是一种可在多个在线网络中验证你身份的加密安全方法。Keybase API 允许我们获取你的 Keybase 头像。这也是你为验证者资料添加 logo 的方式。
gaiad tx staking edit-validator
  --moniker="choose a moniker" \
  --website="https://cosmos.network" \
  --identity=6A0D65E29A4CBC8E \
  --details="To infinity and beyond!" \
  --chain-id=<chain_id> \
  --gas="auto" \
  --gas-prices="0.0025uatom" \
  --from=<key_name> \
  --commission-rate="0.10"
请注意,某些参数(如 commission-max-rate 和 commission-max-change-rate)在验证者启动运行后将无法再更改。
注意:commission-rate 的值必须遵循以下规则:
  • 必须在 0 和验证者的 commission-max-rate 之间
  • 不得超过验证者的 commission-max-change-rate,该值表示每天允许的最大百分点变动率。换句话说,验证者每天只能修改一次佣金,且变动幅度必须在 commission-max-change-rate 的限制范围内。

查看验证者描述

使用以下命令查看验证者信息:
gaiad query staking validator <account_cosmos>

跟踪验证者签名信息

为了跟踪验证者过去的签名情况,你可以使用 signing-info 命令:
gaiad query slashing signing-info <validator-pubkey>\
  --chain-id=<chain_id>

解除验证者监禁状态

当验证者因宕机而被“监禁”时,你必须使用操作员账户提交一笔 Unjail 交易,才能再次获得区块提议奖励(取决于该 zone 的手续费分配机制)。
gaiad tx slashing unjail \
 --from=<key_name> \
 --chain-id=<chain_id>

确认你的验证者正在运行

如果以下命令有任何返回结果,则说明你的验证者处于活跃状态:
gaiad query tendermint-validator-set | grep "$(gaiad tendermint show-address)"
现在,你应该能在某个 Cosmos Hub 浏览器中看到你的验证者。你需要查找的是 ~/.gaia/config/priv_validator.json 文件中的 bech32 编码 address。

停止你的验证者

当你要执行例行维护,或为即将到来的协调升级做准备时,让验证者以系统化且平滑的方式停止会很有用。你可以通过设置 halt-height 为希望节点关闭的区块高度,或在启动 gaiad 时传入 --halt-height 标志来实现。在提交该高度的区块后,节点会以零退出码关闭。

高级配置

关于运行节点或验证者的更多高级信息,请参阅 CometBFT Core 文档。

常见问题

问题 #1:我的验证者 voting_power: 0

你的验证者已被监禁。如果验证者没有对最近 10,000 个区块中的至少 500 个进行投票,或者发生双签,就会被监禁,也就是从活跃验证者集合中移除。 如果你是因宕机而被监禁,可以恢复验证者的投票权。首先,如果你没有使用 Cosmovisor 且 gaiad 当前未运行,请先重新启动:
gaiad start
等待你的全节点追上最新区块。然后,你可以解除验证者监禁状态 提交解除监禁交易后,再次检查你的验证者,查看投票权是否已经恢复。
gaiad status
你可能会发现投票权比之前低。这是因为你因宕机而被罚没了!

问题 #2:我的 gaiad 因 too many open files 崩溃

Linux 默认允许单个进程打开的文件数是 1024。已知 gaiad 打开的文件数会超过 1024,这会导致进程崩溃。一个快速修复方法是运行 ulimit -n 4096(提高允许打开的文件数量),然后使用 gaiad start 重启进程。如果你使用 systemd 或其他进程管理器来启动 gaiad(例如 Cosmovisor),则可能需要在对应层面进行配置。下面给出一个用于修复此问题的 systemd 示例文件:
[Unit]
Description=Cosmos Gaia Node
After=network.target

[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu
ExecStart=/home/ubuntu/go/bin/gaiad start
Restart=on-failure
RestartSec=3
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target

We suggest you try out joining a public testnet first. Information on how to join the most recent testnet can be found here.
Before setting up a validator node, make sure to have completed the Joining Mainnet guide. If you plan to use a KMS (key management system), you should go through these steps first: Using a KMS.

What is a Validator?

Validators are responsible for committing new blocks to the blockchain through an automated voting process. A validator’s stake is slashed if they become unavailable or sign blocks at the same height. Because there is a chance of slashing, we suggest you read about Sentry Node Architecture to protect your node from DDOS attacks and to ensure high-availability.
If you want to become a validator for the Hub’s mainnet, you should learn more about security.
The following instructions assume you have already set up a full-node and are synchronised to the latest blockheight.

Create Your Validator

Your cosmosvalconspub can be used to create a new validator by staking tokens. You can find your validator pubkey by running:
gaiad tendermint show-validator
To create your validator, just use the following command:
Don’t use more uatom than you have!
gaiad tx staking create-validator \
  --amount=1000000uatom \
  --pubkey=$(gaiad tendermint show-validator) \
  --moniker="choose a moniker" \
  --chain-id=<chain_id> \
  --commission-rate="0.10" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --gas="auto" \
  --gas-prices="0.0025uatom" \
  --from=<key_name>
When specifying commission parameters, the commission-max-change-rate is used to measure % point change over the commission-rate. E.g. 1% to 2% is a 100% rate increase, but only 1 percentage point.
It’s possible that you won’t have enough ATOM to be part of the active set of validators in the beginning. Users are able to delegate to inactive validators (those outside of the active set) using the Keplr web app. You can confirm that you are in the validator set by using a third party explorer like Mintscan.

Edit Validator Description

You can edit your validator’s public description. This info is to identify your validator, and will be relied on by delegators to decide which validators to stake to. Make sure to provide input for every flag below. If a flag is not included in the command the field will default to empty (--moniker defaults to the machine name) if the field has never been set or remain the same if it has been set in the past. The key_name specifies which validator you are editing. If you choose to not include some of the flags below, remember that the —from flag must be included to identify the validator to update. The --identity can be used as to verify identity with systems like Keybase or UPort. When using Keybase, --identity should be populated with a 16-digit string that is generated with a keybase.io account. It’s a cryptographically secure method of verifying your identity across multiple online networks. The Keybase API allows us to retrieve your Keybase avatar. This is how you can add a logo to your validator profile.
gaiad tx staking edit-validator
  --moniker="choose a moniker" \
  --website="https://cosmos.network" \
  --identity=6A0D65E29A4CBC8E \
  --details="To infinity and beyond!" \
  --chain-id=<chain_id> \
  --gas="auto" \
  --gas-prices="0.0025uatom" \
  --from=<key_name> \
  --commission-rate="0.10"
Please note that some parameters such as commission-max-rate and commission-max-change-rate cannot be changed once your validator is up and running.
Note: The commission-rate value must adhere to the following rules:
  • Must be between 0 and the validator’s commission-max-rate
  • Must not exceed the validator’s commission-max-change-rate which is maximum % point change rate per day. In other words, a validator can only change its commission once per day and within commission-max-change-rate bounds.

View Validator Description

View the validator’s information with this command:
gaiad query staking validator <account_cosmos>

Track Validator Signing Information

In order to keep track of a validator’s signatures in the past you can do so by using the signing-info command:
gaiad query slashing signing-info <validator-pubkey>\
  --chain-id=<chain_id>

Unjail Validator

When a validator is “jailed” for downtime, you must submit an Unjail transaction from the operator account in order to be able to get block proposer rewards again (depends on the zone fee distribution).
gaiad tx slashing unjail \
 --from=<key_name> \
 --chain-id=<chain_id>

Confirm Your Validator is Running

Your validator is active if the following command returns anything:
gaiad query tendermint-validator-set | grep "$(gaiad tendermint show-address)"
You should now see your validator in one of the Cosmos Hub explorers. You are looking for the bech32 encoded address in the ~/.gaia/config/priv_validator.json file.

Halting Your Validator

When attempting to perform routine maintenance or planning for an upcoming coordinated upgrade, it can be useful to have your validator systematically and gracefully halt. You can achieve this by either setting the halt-height to the height at which you want your node to shutdown or by passing the --halt-height flag to gaiad. The node will shutdown with a zero exit code at that given height after committing the block.

Advanced configuration

You can find more advanced information about running a node or a validator on the CometBFT Core documentation.

Common Problems

Problem #1: My validator has voting_power: 0

Your validator has become jailed. Validators get jailed, i.e. get removed from the active validator set, if they do not vote on at least 500 of the last 10,000 blocks, or if they double sign. If you got jailed for downtime, you can get your voting power back to your validator. First, if you’re not using Cosmovisor and gaiad is not running, start it up again:
gaiad start
Wait for your full node to catch up to the latest block. Then, you can unjail your validator After you have submitted the unjail transaction, check your validator again to see if your voting power is back.
gaiad status
You may notice that your voting power is less than it used to be. That’s because you got slashed for downtime!

Problem #2: My gaiad crashes because of too many open files

The default number of files Linux can open (per-process) is 1024. gaiad is known to open more than 1024 files. This causes the process to crash. A quick fix is to run ulimit -n 4096 (increase the number of open files allowed) and then restarting the process with gaiad start. If you are using systemd or another process manager to launch gaiad (such as Cosmovisor) this may require some configuration at that level. A sample systemd file to fix this issue is below:
[Unit]
Description=Cosmos Gaia Node
After=network.target

[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu
ExecStart=/home/ubuntu/go/bin/gaiad start
Restart=on-failure
RestartSec=3
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target