Docs
Post-Quantum Cryptography (PQC)
Consensus
Validator Consensus Key Rotation

Validator Consensus Key Rotation to ML-DSA-65

Dora Vota supports rotating a validator's CometBFT consensus key from classical Ed25519 to post-quantum ML-DSA-65 (NIST FIPS 204 (opens in a new tab)) without creating a new validator or losing delegations.

All steps below are performed on the validator host (the machine running your node) in a single shell session.

Network parameters: The commands below use vota-testnet defaults (where 100% of active validator voting power has already rotated to ML-DSA-65). When rotating on mainnet after ml_dsa_65 is enabled in consensus parameters, update CHAIN_ID, NODE, EXPECTED_VERSION, and --gas-prices to the target network's values.

1. Pre-flight Checks

Install jq if it is not already available:

sudo apt install -y jq        # or: sudo yum install -y jq

Set your environment variables:

export DORAD=/absolute/path/to/dorad
export EXPECTED_VERSION=v1.2.0     # Match your target network's active dorad version (e.g. v1.1.1 or v1.2.0)
export CHAIN_ID=vota-testnet
export NODE=https://vota-testnet-rpc.dorafactory.org:443
export DORA_HOME="$HOME/.dora"     # Node home passed to dorad start
export SERVICE=dorad               # Systemd service name (adjust if using cosmovisor/docker)
export VALOPER=<your doravaloper1... address>
export OPERATOR=<key name of the operator account in the keyring>
export KEYRING=file                # Keyring backend holding the operator key: file or test
export GAS_PRICES=10000000000peaka # Adjust to the target network's minimum gas price

Run the full pre-flight block. Every check prints [OK] or [FAIL]:

ok(){ [ "$2" = "$3" ] && echo "[OK]   $1" || printf "[FAIL] %s: expected %.50s, got %.50s\n" "$1" "$3" "$2"; }
V=$($DORAD query staking validator "$VALOPER" --node "$NODE" -o json)
OP=$($DORAD keys show "$OPERATOR" -a --keyring-backend "$KEYRING" --home "$DORA_HOME")
ok "dorad version"                         "$($DORAD version 2>&1)" "$EXPECTED_VERSION"
ok "ml_dsa_65 enabled on chain"            "$($DORAD query consensus params --node "$NODE" -o json | jq '.params.validator.pub_key_types | index("ml_dsa_65") != null')" "true"
ok "Validator not jailed"                  "$(echo "$V" | jq '.validator.jailed // false')" "false"
ok "No remote signer configured"           "$(grep '^priv_validator_laddr' "$DORA_HOME/config/config.toml")" 'priv_validator_laddr = ""'
ok "Local node caught up"                  "$(curl -s localhost:26657/status | jq .result.sync_info.catching_up)" "false"
ok "Local consensus key matches validator" "$(jq -r .pub_key.value "$DORA_HOME/config/priv_validator_key.json")" "$(echo "$V" | jq -r .validator.consensus_pubkey.value)"
ok "Operator key matches validator"        "$($DORAD debug addr "$OP" 2>/dev/null | awk '/Bech32 Val/{print $3}')" "$VALOPER"
ok "Operator balance >= 0.01 DORA"         "$($DORAD query bank balances "$OP" --node "$NODE" -o json 2>/dev/null | jq '([.balances[] | select(.denom=="peaka") | .amount | tonumber] | add // 0) >= 1e16')" "true"

Proceed only if every check reports [OK].

Remote signers (Horcrux / TMKMS): This guide applies to local file-backed consensus keys (priv_validator_laddr = ""). Do not follow this procedure if your validator uses a remote signer unless your signer explicitly supports CometBFT ML-DSA-65 keys.

2. Back Up the Current Consensus Key

mkdir -m 700 -p "$HOME/mldsa-rotation-backup"
cp "$DORA_HOME/config/priv_validator_key.json" "$HOME/mldsa-rotation-backup/ed25519-priv_validator_key.json"
cp "$DORA_HOME/data/priv_validator_state.json"  "$HOME/mldsa-rotation-backup/priv_validator_state.json.before"

3. Generate the ML-DSA-65 Consensus Key

Generate the new key inside a temporary directory without touching $DORA_HOME:

# init prints genesis output; discard it
$DORAD init mldsa-key --chain-id "$CHAIN_ID" --home "$HOME/mldsa-key-tmp" --consensus-key-algo ml_dsa_65 >/dev/null 2>&1
$DORAD comet show-validator --home "$HOME/mldsa-key-tmp" | tee "$HOME/mldsa-rotation-backup/mldsa-pubkey.json"
jq -r .pub_key.type "$HOME/mldsa-key-tmp/config/priv_validator_key.json"

Verify both outputs:

  • The first output must begin with {"@type":"/cosmos.crypto.mldsa65.PubKey" (the base64-encoded public key is ~2.6 KB).
  • The second output must be cometbft/PubKeyMlDsa65.

Back up $HOME/mldsa-key-tmp/config/priv_validator_key.json to an offline location before submitting the rotation. Once the rotation takes effect, the old Ed25519 key is retired and no further consensus-key rotation is permitted for the staking unbonding period (21 days). The chain also deducts the staking module's key_rotation_fee (currently 1000000peaka, negligible compared to transaction gas). If the new key file is lost during the 21-day cooldown, the validator cannot sign blocks and will be jailed for downtime.

4. Submit the Rotation Transaction (Keep the Node Running)

Always coordinate key cutover using the apply_height reported in the committed transaction's event log (H+2, approximately 10 seconds, is typical on Dora Vota, not a hardcoded constant). Between APPLY_HEIGHT and restarting your node with the new key, your validator will miss blocks—keep Step 5 ready so you can switch immediately after APPLY_HEIGHT.

cd "$HOME/mldsa-rotation-backup"
$DORAD tx staking rotate-cons-pub-key "$(cat mldsa-pubkey.json)" \
  --from "$OPERATOR" --keyring-backend "$KEYRING" --home "$DORA_HOME" \
  --chain-id "$CHAIN_ID" --node "$NODE" \
  --gas auto --gas-adjustment 1.5 --gas-prices "$GAS_PRICES" \
  -y -o json | tee rotate-tx.json

Wait for inclusion and read APPLY_HEIGHT (brief tx not found responses right after broadcast are normal and retried automatically):

if [ "$(jq -r .code rotate-tx.json 2>/dev/null)" != 0 ]; then
  echo "[FAIL] Broadcast failed; see the error from the previous command"
else
  TXHASH=$(jq -r .txhash rotate-tx.json)
  until $DORAD query tx "$TXHASH" --node "$NODE" -o json > rotate-result.json 2>/dev/null; do sleep 2; done
  APPLY_HEIGHT=$(jq -r '[.events[].attributes[] | select(.key=="apply_height") | .value][0]' rotate-result.json)
  jq -r 'if .code==0 then "[OK]   Rotation succeeded; proceed to step 5 now" else "[FAIL] Rotation failed (code \(.code)): \(.raw_log)" end' rotate-result.json
  echo "TXHASH=$TXHASH APPLY_HEIGHT=$APPLY_HEIGHT"
fi
  • [OK]: The rotation is committed on-chain and activates at APPLY_HEIGHT (~10 seconds). Proceed to Step 5 immediately.
  • [FAIL]: No rotation occurred; the chain still expects your old key. Leave the node running as-is and do not run Step 5.

5. Switch to the New Key

# 1) Wait until network height exceeds APPLY_HEIGHT; keep the node running meanwhile (~10 s)
while [ "$(curl -s "$NODE/status" | jq -r .result.sync_info.latest_block_height)" -le "$APPLY_HEIGHT" ]; do sleep 2; done
 
# 2) Stop the node (systemctl / cosmovisor / docker, as applicable) and confirm it has stopped
sudo systemctl stop "$SERVICE"
pgrep -x dorad || echo stopped                        # Must print: stopped
 
# 3) Replace ONLY priv_validator_key.json; never touch data/priv_validator_state.json
cp "$HOME/mldsa-key-tmp/config/priv_validator_key.json" "$DORA_HOME/config/priv_validator_key.json"
jq -r .pub_key.type "$DORA_HOME/config/priv_validator_key.json"   # Must print: cometbft/PubKeyMlDsa65
 
# 4) Start the node
sudo systemctl start "$SERVICE"

Do not stop the node before APPLY_HEIGHT has passed. Blocks up to APPLY_HEIGHT still require signatures from the old Ed25519 key. If more than 1/3 of voting power stops early, the network halts before the activation height and the new keys cannot take effect.

6. Verify Signing

About 1 minute after the node restarts, run the verification block:

ok(){ [ "$2" = "$3" ] && echo "[OK]   $1" || printf "[FAIL] %s: expected %.50s, got %.50s\n" "$1" "$3" "$2"; }
V=$($DORAD query staking validator "$VALOPER" --node "$NODE" -o json)
NEW_ADDR=$(jq -r .address "$DORA_HOME/config/priv_validator_key.json")
H=$(curl -s "$NODE/status" | jq -r .result.sync_info.latest_block_height)
SIGNED=0; for h in $(seq $((H-9)) $H); do curl -s "$NODE/block?height=$h" | jq -e --arg a "$NEW_ADDR" 'any(.result.block.last_commit.signatures[]; .validator_address==$a)' >/dev/null && SIGNED=$((SIGNED+1)); done
ok "On-chain consensus key is ML-DSA"        "$(echo "$V" | jq -r .validator.consensus_pubkey.type)" "/cosmos.crypto.mldsa65.PubKey"
ok "On-chain key matches local new key"      "$(echo "$V" | jq -r .validator.consensus_pubkey.value)" "$(jq -r .pub_key.value "$DORA_HOME/config/priv_validator_key.json")"
ok "New address is in the validator set"     "$(curl -s "$NODE/validators?per_page=100" | jq --arg a "$NEW_ADDR" '.result.validators | any(.address==$a)')" "true"
ok "Signed at least 8 of the last 10 blocks" "$([ "$SIGNED" -ge 8 ] && echo true || echo "false ($SIGNED/10)")" "true"
echo "NEW_ADDR=$NEW_ADDR"

Once every check reports [OK], securely remove $HOME/mldsa-key-tmp after confirming your offline backup of the new priv_validator_key.json is intact.

Critical Rules (Do Not)

  • Never start any node with the old Ed25519 key again, and never run the new ML-DSA key on two machines simultaneously (double-signing results in a 0.5% slash under current chain slashing parameters and permanent tombstoning).
  • Never delete or reset data/priv_validator_state.json, and never run unsafe-reset-all.
  • Never submit a rotation while the validator is jailed.

Troubleshooting

SymptomAction
No new signatures long after restartConfirm APPLY_HEIGHT has passed, verify jq -r .pub_key.type "$DORA_HOME/config/priv_validator_key.json" outputs cometbft/PubKeyMlDsa65, and check that the node is synced. If it still fails, contact the coordinators. Do not switch back to the old key.
The wait loop in Step 5 never exitsThe network is not producing blocks. Do not stop the node or swap the key. Keep running on the old key and contact the coordinators.

For measured node load, latency, and throughput after rotating to ML-DSA-65 consensus keys, see the Post-Quantum Consensus Benchmark.