PQC Auth: CLI Guide
This guide walks through registering PQC Auth keys for an existing classical account, sending a protected transfer using the offline bundle workflow, and using every dorad tx pqcauth and dorad query pqcauth subcommand. For conceptual background, read PQC Auth: How It Works.
Prerequisites
doradv1.2.0+ (recommended;v1.1.1+minimum for registration fingerprint flags,protection-readiness, andnext_key_idin account queries;v1.2.0aligns on-chainSIGN_MODE_DIRECTenforcement for recovery transactions),jq, and thefilekeyring backend.- An existing, funded single-signer classical account (
secp256k1,ed25519, orsecp256r1). - Three isolated key locations:
- Online wallet machine: holds your original classical account key (
OWNER_KEY). - Signing device: holds your
pqc-signingML-DSA-65 key (stays offline). - Offline recovery device: holds your
pqc-recoveryML-DSA-65 key (cold storage).
- Online wallet machine: holds your original classical account key (
Testnet vs. Mainnet: The examples below use mainnet endpoints (
vota-ash). To practice on testnet first, setRPC="https://vota-testnet-rpc.dorafactory.org:443"andCHAIN_ID="vota-testnet", and query that network'sNETWORK_ID—never reuse aNETWORK_IDacross chains.
Walkthrough: Register and Send a Protected Transfer
Step 1: Query Chain State and Check Delegations (Online Machine)
RPC="https://vota-rpc.dorafactory.org:443"
CHAIN_ID="vota-ash"
OWNER_KEY=alice # Name of your existing classical key
GAS_PRICE=10000000000peaka # Standard Dora Vota gas price; adjust if your RPC node requires higher
OWNER=$(dorad keys show "$OWNER_KEY" --address --keyring-backend file)
# 1. Fetch chain parameters and network_id
dorad query pqcauth params --node "$RPC" --output json > params.json &&
NETWORK_ID=$(jq -er '.params.network_id | select(type == "string" and length > 0)' params.json)
# 2. Confirm the account is not already registered
dorad query pqcauth account "$OWNER" --node "$RPC" --output json
# 3. Check outgoing authz grants and feegrant allowances at one consistent height (outputs JSON)
dorad query pqcauth protection-readiness "$OWNER" --node "$RPC"- Continue only if
paramsreturns a non-emptyNETWORK_ID. Stop onunknown query path,Not Implemented, or RPC errors. - Before enrollment,
query pqcauth accountreturnsPQC account policy not found. protection-readinessprints a JSON report to stdout and exits0only whenoutgoing_grants_clearistrue(no outgoingauthzgrants orfeegrantallowances and no truncated pages). Review and revoke any unwanted delegations before continuing.
Copy OWNER, CHAIN_ID, and NETWORK_ID to your signing device and offline recovery device.
Step 2: Generate the Signing Key and Proof (Signing Device)
dorad keys add pqc-signing --key-type ml_dsa_65 --keyring-backend file
dorad tx pqcauth create-key-proof pqc-signing "$OWNER" 1 signing register-signing \
--network-id-base64 "$NETWORK_ID" --chain-id "$CHAIN_ID" \
--policy-version 0 --keyring-backend file > signing-proof.json
# Record this SHA-256 fingerprint independently on the signing device
jq -er '.public_key_sha256' signing-proof.jsonStep 3: Generate the Recovery Key and Proof (Offline Recovery Device)
dorad keys add pqc-recovery --key-type ml_dsa_65 --keyring-backend file
dorad tx pqcauth create-key-proof pqc-recovery "$OWNER" 2 recovery register-recovery \
--network-id-base64 "$NETWORK_ID" --chain-id "$CHAIN_ID" \
--policy-version 0 --keyring-backend file > recovery-proof.json
# Record this SHA-256 fingerprint independently on the recovery device
jq -er '.public_key_sha256' recovery-proof.jsonUse a fresh, separate mnemonic for each PQC key and back both up offline. Transfer only the public files signing-proof.json and recovery-proof.json back to the online wallet machine, and carry the two public_key_sha256 fingerprints independently to verify against tampering.
Step 4: Submit Registration (Online Machine)
Set SIGNING_SHA256 and RECOVERY_SHA256 to the trusted fingerprints recorded on each key device, then submit register-key:
SIGNING_SHA256="<64-char-hex-from-signing-device>"
RECOVERY_SHA256="<64-char-hex-from-recovery-device>"
dorad tx pqcauth register-key 1 \
"$(jq -er '.public_key_base64' signing-proof.json)" \
"$(jq -er '.proof_base64' signing-proof.json)" \
--recovery-public-key-base64 "$(jq -er '.public_key_base64' recovery-proof.json)" \
--recovery-proof-base64 "$(jq -er '.proof_base64' recovery-proof.json)" \
--expect-signing-key-sha256 "$SIGNING_SHA256" \
--expect-recovery-key-sha256 "$RECOVERY_SHA256" \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" \
--keyring-backend file --gas auto --gas-adjustment 1.5 --gas-prices "$GAS_PRICE"The CLI prints both SHA-256 fingerprints to stderr and aborts before broadcast if either expected fingerprint does not match (including with -y or --generate-only).
Wait for inclusion at height H, verify code == 0, and check at height H+1 that protection is active:
TXHASH="<txhash-from-register-key>"
dorad query tx "$TXHASH" --node "$RPC" --output json
dorad query pqcauth account "$OWNER" --node "$RPC" --output jsonProtection is active once active_signing_key matches your signing public key and policy.self_enforced is true. Note next_key_id in the response (it starts at 3 after initial enrollment).
Step 5: Send a Protected Transfer (Online → Signing Device → Online)
TO="$OWNER" # Test with a self-transfer first
AMOUNT=1000000000000000000peaka # 1 DORA = 10^18 peaka
GAS_LIMIT=250000 # Must cover full tx + ~3.4 KB PQC extension; see gas note below
FEES=2500000000000000peaka # GAS_LIMIT * 10000000000peaka (0.0025 DORA)
# 1. Online machine: generate unsigned JSON and freeze on-chain state into a bundle
dorad tx bank send "$OWNER_KEY" "$TO" "$AMOUNT" \
--chain-id "$CHAIN_ID" --node "$RPC" --keyring-backend file \
--generate-only --gas "$GAS_LIMIT" --fees "$FEES" > send.json
dorad tx pqcauth prepare-bundle send.json send.prepared.json \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" --keyring-backend fileCopy send.prepared.json to your signing device and sign offline:
# 2. Signing device (offline): review decoded transaction and sign
dorad tx pqcauth sign-bundle send.prepared.json pqc-signing send.signed.json \
--keyring-backend fileCopy send.signed.json back to your online machine, revalidate, add the classical signature, and broadcast:
# 3. Online machine: revalidate state, attach PQC extension, classically sign, and broadcast
dorad tx pqcauth broadcast-bundle send.signed.json \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" --keyring-backend fileConfirm committed execution (code == 0):
dorad query tx "<txhash-from-broadcast-bundle>" --node "$RPC" --output jsonGas budgeting for protected transactions:
GAS_LIMITmust cover message execution, state reads, PQC verification gas (750default), and extension byte cost (~3.4 KB ≈ 34,000+ gas attx_size_cost_per_byte = 10).prepare-bundledoes not simulate or add gas automatically. For more complex messages (staking, governance, IBC, or CosmWasm), rundorad tx bank send "$OWNER" "$TO" "$AMOUNT" --chain-id "$CHAIN_ID" --node "$RPC" --dry-run(using the address$OWNER, not key name, with your target command) for a base estimate and add at least 60,000–100,000 gas headroom for the PQC extension bytes and state reads. The same three-step bundle workflow applies to any single-signer transaction.
Complete Transaction Subcommand Reference (dorad tx pqcauth)
All 13 subcommands live under dorad tx pqcauth. Every lifecycle operation must be the sole top-level message in a SIGN_MODE_DIRECT transaction.
1. create-key-proof
Generate an offline proof of possession for a newly created ML-DSA-65 key.
dorad tx pqcauth create-key-proof [key-name] [owner] [key-id] [role] [purpose] \
--network-id-base64 "$NETWORK_ID" \
--chain-id "$CHAIN_ID" \
--policy-version "$POLICY_VERSION" \
--keyring-backend file > key-proof.jsonValid (role, purpose, policy-version) combinations:
| Operation | role | purpose | --policy-version |
|---|---|---|---|
Initial signing key (register-key) | signing | register-signing | 0 |
Initial recovery key (register-key) | recovery | register-recovery | 0 |
Rotate signing key (rotate-key) | signing | rotate-signing | Current .policy.policy_version |
Rotate recovery key (rotate-recovery-key) | recovery | rotate-recovery | Current .policy.policy_version |
Recover signing key (recover-key) | signing | recover-signing | Current .policy.policy_version |
- Output (stdout JSON):
algorithm,public_key_base64,public_key_sha256, andproof_base64. - Offline keyring flags:
--keyring-backend(defaults toos, so pass--keyring-backend fileexplicitly when using afilekeyring),--keyring-dir, and--legacy-key-file(treats[key-name]as a legacy raw private-key file).
2. register-key
Enroll an existing classical account with initial signing key (expected-key-id, normally 1) and recovery key (expected-key-id + 1, normally 2). Activates at H+1.
dorad tx pqcauth register-key [expected-key-id] [public-key-base64] [proof-base64] \
--recovery-public-key-base64 "<base64>" \
--recovery-proof-base64 "<base64>" \
--expect-signing-key-sha256 "<64-hex>" \
--expect-recovery-key-sha256 "<64-hex>" \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" \
--keyring-backend file --gas auto --gas-adjustment 1.5 --gas-prices "$GAS_PRICE"--self-enforcedefaults totrue;falseis rejected by consensus (registration must enable self-enforcement).- Factor-independence check: All four key-introducing commands (
register-key,rotate-key,rotate-recovery-key, andrecover-key) verify locally that none of the new ML-DSA public keys were derived from the owner'ssecp256k1private key when the owner key is present in the local keyring. If the owner's classical private key is unavailable locally (e.g., watch-only or external signer), you must explicitly pass--acknowledge-independent-factors.
3. prepare-bundle, sign-bundle, and broadcast-bundle
The three-step offline signing workflow for any ordinary protected transaction (such as bank send, staking delegate, gov vote, or authz revoke):
| Subcommand | Machine | Syntax | What it does |
|---|---|---|---|
prepare-bundle | Online | prepare-bundle [tx-json] [prepared-out] | Queries account number, sequence, active PQC key, and policy at one committed height and writes a frozen bundle (0600, no-overwrite). Rejects mutation flags (--gas, --fees, --sequence, --sign-mode, --offline). |
sign-bundle | Offline | sign-bundle [prepared] [key-name] [signed-out] | Validates hashes, canonical protobuf encoding, and transaction contents; displays full JSON for human review; signs with ML-DSA-65 (--keyring-backend defaults to os). For key-rotation bundles, requires exactly one of --expect-new-key or --expect-new-key-sha256 (rejected on non-rotation bundles; -y skips interactive confirmation but never bypasses this check). |
broadcast-bundle | Online | broadcast-bundle [signed] | Revalidates latest on-chain state, attaches PQC extension, classically signs with --from, broadcasts, and returns a nonzero exit code if CheckTx fails or confirmation is declined. |
4. rotate-key
Replace the active PQC signing key at H+1. Authorized by the current PQC signing key + classical account key.
Always generate fresh ML-DSA-65 key material (consensus does not prohibit reusing a historical public key under a new key ID, so never reuse a previously revoked or compromised key). Query NEW_ID and POLICY_VERSION, then generate the new key proof on the target device with role signing and purpose rotate-signing:
dorad query pqcauth account "$OWNER" --node "$RPC" --output json > account.json
NEW_ID=$(jq -er '.next_key_id' account.json)
POLICY_VERSION=$(jq -er '.policy.policy_version' account.json)Recommended offline bundle flow:
# 1. Online machine: prepare rotation bundle (supports --gas auto)
dorad tx pqcauth rotate-key "$NEW_ID" \
"$(jq -er '.public_key_base64' new-key-proof.json)" \
"$(jq -er '.proof_base64' new-key-proof.json)" \
--pqc-sign-bundle-output rotation.prepared.json \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" \
--keyring-backend file --gas auto --gas-adjustment 1.5 --gas-prices "$GAS_PRICE"
# 2. Signing device (offline): MUST supply trusted target via --expect-new-key or --expect-new-key-sha256
dorad tx pqcauth sign-bundle rotation.prepared.json pqc-signing rotation.signed.json \
--expect-new-key-sha256 "$TRUSTED_NEW_KEY_SHA256" \
--keyring-backend file
# 3. Online machine: revalidate, classically sign, and broadcast
dorad tx pqcauth broadcast-bundle rotation.signed.json \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" --keyring-backend fileOnline shortcut (trusted host only): Replace
--pqc-sign-bundle-output ...with--pqc-key pqc-signingto sign and broadcast in one step. That mode does not provide an offline signing boundary.
5. rotate-recovery-key
Replace the active offline recovery key at H+1. Authorized by the current PQC signing key + classical account key (not the old recovery key).
Generate the new recovery key proof with role recovery, purpose rotate-recovery, current POLICY_VERSION, and NEW_ID from .next_key_id, then run the same offline flow:
# 1. Online machine
dorad tx pqcauth rotate-recovery-key "$NEW_ID" \
"$(jq -er '.public_key_base64' new-recovery-proof.json)" \
"$(jq -er '.proof_base64' new-recovery-proof.json)" \
--pqc-sign-bundle-output rotate-recovery.prepared.json \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" \
--keyring-backend file --gas auto --gas-adjustment 1.5 --gas-prices "$GAS_PRICE"
# 2. Signing device (offline): verify the NEW recovery key's trusted SHA-256
dorad tx pqcauth sign-bundle rotate-recovery.prepared.json pqc-signing rotate-recovery.signed.json \
--expect-new-key-sha256 "$TRUSTED_NEW_RECOVERY_SHA256" \
--keyring-backend file
# 3. Online machine
dorad tx pqcauth broadcast-bundle rotate-recovery.signed.json \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" --keyring-backend file6. recover-key, sign-recovery-bundle, and broadcast-recovery-bundle
Schedule a replacement signing key after losing the current PQC signing key. Authorized by the registered offline recovery key + classical account key (SIGN_MODE_DIRECT). Activates after recovery_delay_blocks (default 107,520 blocks ≈ 7 days).
First, generate a proof for the new signing key with role signing, purpose recover-signing, current POLICY_VERSION, and NEW_ID from .next_key_id. Read RECOVERY_ID from .policy.recovery_key_id.
# 1. Online machine: prepare recovery bundle (no recovery private key needed here)
dorad tx pqcauth recover-key "$RECOVERY_ID" "$NEW_ID" \
"$(jq -er '.public_key_base64' new-signing-proof.json)" \
"$(jq -er '.proof_base64' new-signing-proof.json)" \
--recovery-sign-bundle-output recovery.prepared.json \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" \
--keyring-backend file --gas auto --gas-adjustment 1.5 --gas-prices "$GAS_PRICE"
# 2. Offline recovery device: MUST verify the NEW signing key via --expect-new-signing-key or --expect-new-signing-key-sha256
dorad tx pqcauth sign-recovery-bundle recovery.prepared.json pqc-recovery recovery.signed.json \
--expect-new-signing-key-sha256 "$TRUSTED_NEW_SIGNING_SHA256" \
--keyring-backend file
# 3. Online machine: revalidate, classically sign in DIRECT mode, and broadcast
dorad tx pqcauth broadcast-recovery-bundle recovery.signed.json \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" --keyring-backend file- For a trusted online recovery key,
--recovery-key pqc-recoverycan be used in place of--recovery-sign-bundle-output. - Passing
-ytosign-recovery-bundleskips the interactive prompt but still enforces--expect-new-signing-keyor--expect-new-signing-key-sha256(pass--keyring-backend fileif using afilekeyring). - Recovery remains available even during an active governance emergency pause (
PAUSE_NEW_KEYSorPAUSE_PQC_TRANSACTIONS).
7. cancel-recovery
Immediately cancel a pending recovery you did not authorize. Authorized by the current PQC signing key + classical account key.
Read PENDING_SIGNING_KEY_ID (.policy.pending_signing_key_id) and PENDING_POLICY_VERSION (.policy.pending_policy_version) from dorad query pqcauth account "$OWNER":
dorad tx pqcauth cancel-recovery "$PENDING_SIGNING_KEY_ID" "$PENDING_POLICY_VERSION" \
--pqc-sign-bundle-output cancel-recovery.prepared.json \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" \
--keyring-backend file --gas auto --gas-adjustment 1.5 --gas-prices "$GAS_PRICE"Sign on your signing device with sign-bundle and broadcast with broadcast-bundle (or pass --pqc-key pqc-signing directly on a trusted host).
Compromised recovery key: Cancelling a recovery does not revoke the recovery key. Immediately follow
cancel-recoverywith a separaterotate-recovery-keytransaction.
8. set-protection
Enable or disable personal self_enforced protection at H+1. Authorized by the current PQC signing key + classical account key.
dorad tx pqcauth set-protection true \
--pqc-sign-bundle-output set-protection.prepared.json \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" \
--keyring-backend file --gas auto --gas-adjustment 1.5 --gas-prices "$GAS_PRICE"- Pass
falseto disable personal protection. - Disabling
self_enforceddoes not override chain-wideREQUIRED_FOR_REGISTEREDenforcement, and lifecycle operations (rotate-key,rotate-recovery-key,set-protection,revoke-key,cancel-recovery,recover-key) still require PQC/recovery authorization andSIGN_MODE_DIRECT.
9. revoke-key
Immediately mark a historical (non-current, non-pending) key record as REVOKED. Authorized by the current PQC signing key + classical account key.
dorad tx pqcauth revoke-key "$OLD_KEY_ID" \
--pqc-sign-bundle-output revoke-key.prepared.json \
--from "$OWNER_KEY" --chain-id "$CHAIN_ID" --node "$RPC" \
--keyring-backend file --gas auto --gas-adjustment 1.5 --gas-prices "$GAS_PRICE"Attempting to revoke the active signing key, active recovery key, or any pending key is rejected—rotate or cancel first.
Complete Query Subcommand Reference (dorad query pqcauth)
| Subcommand | Example | What it returns |
|---|---|---|
params | dorad query pqcauth params --node "$RPC" -o json | Active and pending parameters: network_id, enforcement_mode, verification_gas, emergency_mode, immutable delays (governance_safety_delay_blocks, recovery_delay_blocks, max_emergency_duration_blocks), and effective modes. |
protection-readiness | dorad query pqcauth protection-readiness "$OWNER" --limit 20 --node "$RPC" | Outgoing authz grants and feegrant allowances queried at one consistent block height (--limit 1–100; always prints JSON). Exits 0 only if outgoing_grants_clear is true (both lists empty and more_authz_grants / more_feegrant_allowances are false). |
account | dorad query pqcauth account "$OWNER" --node "$RPC" -o json | Effective and pending policy, active_signing_key, compacted key_histories, and next_key_id (always use next_key_id for your next rotation or recovery). |
key | dorad query pqcauth key "$OWNER" 1 --node "$RPC" -o json | One retained PQCKeyRecord (role, algorithm, public key, status, created/effective/inactive heights). Older terminal keys beyond 16 per role are compacted into key_histories. |
keys | dorad query pqcauth keys "$OWNER" --limit 50 --node "$RPC" -o json | Paginated list of all retained key records for an account. |
estimate-verification-gas | dorad query pqcauth estimate-verification-gas --signatures 1 --proofs 0 --node "$RPC" | Deterministic PQC cryptographic gas component only (signatures * verification_gas + proofs * verification_gas). Does not include tx byte cost or message execution gas. |
Governance and Legacy Compatibility Notes
- Governance updates: Chain parameters (
enforcement_mode,verification_gas,emergency_mode) are updated via governance message/doravota.pqcauth.v1.MsgUpdateParams(there is notx pqcauth update-paramsshortcut). Stronger enforcement or higher verification gas waitsgovernance_safety_delay_blocks(default 17,280 blocks ≈ 27 hours);emergency_only: trueactivates/renews/clears a pause atH+1without disturbing a queued ordinary plan. - Legacy raw key files: Keys created by pre-keyring tooling remain usable via
--legacy-key-file(forcreate-key-proof,sign-bundle,sign-recovery-bundle) or--pqc-private-key-file/--recovery-private-key-file(for online commands). Files must have mode0600(no group/other permissions). Prefer the SDK keyring (--pqc-key/--recovery-key) for all new keys.
Safety Checklist
| Avoid | Do this instead |
|---|---|
| Keeping all three private keys on one online machine | Use a separate signing device, keep the recovery key offline, and generate a fresh mnemonic for each PQC key |
| Sending private keys or mnemonics to websites, RPC endpoints, colleagues, or chat tools | Transfer only public keys, proofs, and signing bundles between devices |
| Registering or rotating without verifying public-key fingerprints | Always pass --expect-signing-key-sha256 / --expect-recovery-key-sha256 (registration) and --expect-new-key-sha256 / --expect-new-signing-key-sha256 (rotation/recovery) using fingerprints obtained independently from the key device |
Guessing the next key ID from current_signing_key_id + 1 | Read .next_key_id from dorad query pqcauth account "$OWNER" |
| Deleting old keys or backups immediately after broadcast | Confirm code == 0, wait for activation height (H+1 or recovery height), and query active_signing_key first |
| Editing a signed bundle or sending concurrent txs from the same account | Bundle signatures bind exact contents and sequence; prepare a fresh bundle if state changes |
| Assuming the original classical key alone can disable protection | set-protection false still requires the current PQC signing key |
| Assuming the recovery key can restore a lost classical account key | Recovery only replaces the PQC signing key; back up the classical key separately |