cardano-cli-staking
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecardano-cli-staking
cardano-cli-staking
This is a guidance skill. Provides templates and explanations. For execution, use.cardano-cli-staking-operator
这是一个指南类技能,提供操作模板和说明。如需执行操作,请使用。cardano-cli-staking-operator
When to use
适用场景
- Learning stake key registration and delegation
- Understanding rewards withdrawal
- Getting command templates for staking operations
- 学习质押密钥注册与委托操作
- 了解奖励提取流程
- 获取质押操作的命令模板
Operating rules (must follow)
操作规则(必须遵守)
- Confirm network before providing commands
- Never execute—only provide templates
- Include deposit/fee information
- Verify pool ID from multiple sources
- 提供命令前请确认网络环境
- 绝不执行操作,仅提供模板
- 包含押金/手续费信息
- 从多渠道验证矿池ID
Docker fallback mode
Docker fallback模式
If is not installed locally, use the wrapper script in this skill folder to run cardano-cli inside Docker (the Cardano node container images include the CLI).
cardano-clibash
chmod +x {baseDir}/scripts/cardano-cli.sh
{baseDir}/scripts/cardano-cli.sh versionNotes:
- The wrapper mounts your current directory into the container as so files like
/work,pparams.json,tx.bodywork normally.datum.json - If you have a local node socket, set before running so
CARDANO_NODE_SOCKET_PATHcommands work.query - Override the image with .
CARDANO_DOCKER_IMAGE=ghcr.io/intersectmbo/cardano-node:<tag>
如果本地未安装,可使用本技能文件夹中的包装脚本在Docker内运行cardano-cli(Cardano节点容器镜像已包含该CLI工具)。
cardano-clibash
chmod +x {baseDir}/scripts/cardano-cli.sh
{baseDir}/scripts/cardano-cli.sh version注意事项:
- 该包装脚本会将当前目录挂载到容器的路径下,因此
/work、pparams.json、tx.body等文件可正常使用。datum.json - 若本地存在节点套接字,请在运行前设置环境变量,以确保
CARDANO_NODE_SOCKET_PATH命令正常工作。query - 可通过指定镜像版本。
CARDANO_DOCKER_IMAGE=ghcr.io/intersectmbo/cardano-node:<tag>
Key concepts
核心概念
Stake addresses vs payment addresses
质押地址 vs 支付地址
- Payment address: Holds funds, used for spending
- Stake address: Controls delegation, receives rewards
- Base address: Combines both (most common)
- 支付地址:存储资金,用于转账支出
- 质押地址:控制委托操作,接收奖励
- 基础地址:同时包含支付与质押功能(最常用)
Deposits
押金
- Stake key registration: ~2 ADA deposit (refundable)
- Pool registration: ~500 ADA deposit (refundable)
- 质押密钥注册:约2 ADA押金(可退还)
- 矿池注册:约500 ADA押金(可退还)
Workflow templates
工作流模板
Check stake status
查看质押状态
bash
undefinedbash
undefinedDerive stake address
Derive stake address
cardano-cli conway stake-address build
--stake-verification-key-file stake.vkey
--testnet-magic 1
--out-file stake.addr
--stake-verification-key-file stake.vkey
--testnet-magic 1
--out-file stake.addr
cardano-cli conway stake-address build
--stake-verification-key-file stake.vkey
--testnet-magic 1
--out-file stake.addr
--stake-verification-key-file stake.vkey
--testnet-magic 1
--out-file stake.addr
Query status
Query status
cardano-cli conway query stake-address-info
--testnet-magic 1
--address $(cat stake.addr)
--testnet-magic 1
--address $(cat stake.addr)
undefinedcardano-cli conway query stake-address-info
--testnet-magic 1
--address $(cat stake.addr)
--testnet-magic 1
--address $(cat stake.addr)
undefinedRegister stake key
注册质押密钥
bash
undefinedbash
undefined1. Create registration certificate
1. Create registration certificate
cardano-cli conway stake-address registration-certificate
--stake-verification-key-file stake.vkey
--out-file stake-reg.cert
--stake-verification-key-file stake.vkey
--out-file stake-reg.cert
cardano-cli conway stake-address registration-certificate
--stake-verification-key-file stake.vkey
--out-file stake-reg.cert
--stake-verification-key-file stake.vkey
--out-file stake-reg.cert
2. Build transaction with certificate
2. Build transaction with certificate
cardano-cli conway transaction build
--testnet-magic 1
--tx-in <utxo>#<index>
--change-address <payment-addr>
--certificate-file stake-reg.cert
--out-file tx.unsigned
--testnet-magic 1
--tx-in <utxo>#<index>
--change-address <payment-addr>
--certificate-file stake-reg.cert
--out-file tx.unsigned
cardano-cli conway transaction build
--testnet-magic 1
--tx-in <utxo>#<index>
--change-address <payment-addr>
--certificate-file stake-reg.cert
--out-file tx.unsigned
--testnet-magic 1
--tx-in <utxo>#<index>
--change-address <payment-addr>
--certificate-file stake-reg.cert
--out-file tx.unsigned
3. Sign with BOTH keys
3. Sign with BOTH keys
cardano-cli conway transaction sign
--tx-file tx.unsigned
--signing-key-file payment.skey
--signing-key-file stake.skey
--testnet-magic 1
--out-file tx.signed
--tx-file tx.unsigned
--signing-key-file payment.skey
--signing-key-file stake.skey
--testnet-magic 1
--out-file tx.signed
cardano-cli conway transaction sign
--tx-file tx.unsigned
--signing-key-file payment.skey
--signing-key-file stake.skey
--testnet-magic 1
--out-file tx.signed
--tx-file tx.unsigned
--signing-key-file payment.skey
--signing-key-file stake.skey
--testnet-magic 1
--out-file tx.signed
4. Submit
4. Submit
cardano-cli conway transaction submit
--testnet-magic 1
--tx-file tx.signed
--testnet-magic 1
--tx-file tx.signed
undefinedcardano-cli conway transaction submit
--testnet-magic 1
--tx-file tx.signed
--testnet-magic 1
--tx-file tx.signed
undefinedDelegate to pool
委托至矿池
bash
undefinedbash
undefined1. Create delegation certificate
1. Create delegation certificate
cardano-cli conway stake-address stake-delegation-certificate
--stake-verification-key-file stake.vkey
--stake-pool-id pool1...
--out-file delegation.cert
--stake-verification-key-file stake.vkey
--stake-pool-id pool1...
--out-file delegation.cert
cardano-cli conway stake-address stake-delegation-certificate
--stake-verification-key-file stake.vkey
--stake-pool-id pool1...
--out-file delegation.cert
--stake-verification-key-file stake.vkey
--stake-pool-id pool1...
--out-file delegation.cert
2. Build, sign (both keys), submit
2. Build, sign (both keys), submit
Same pattern as registration
Same pattern as registration
undefinedundefinedWithdraw rewards
提取奖励
bash
undefinedbash
undefined1. Check rewards balance
1. Check rewards balance
cardano-cli conway query stake-address-info
--testnet-magic 1
--address $(cat stake.addr)
--testnet-magic 1
--address $(cat stake.addr)
cardano-cli conway query stake-address-info
--testnet-magic 1
--address $(cat stake.addr)
--testnet-magic 1
--address $(cat stake.addr)
2. Build withdrawal tx
2. Build withdrawal tx
cardano-cli conway transaction build
--testnet-magic 1
--tx-in <utxo>#<index>
--withdrawal $(cat stake.addr)+<reward-lovelace>
--change-address <payment-addr>
--out-file tx.unsigned
--testnet-magic 1
--tx-in <utxo>#<index>
--withdrawal $(cat stake.addr)+<reward-lovelace>
--change-address <payment-addr>
--out-file tx.unsigned
cardano-cli conway transaction build
--testnet-magic 1
--tx-in <utxo>#<index>
--withdrawal $(cat stake.addr)+<reward-lovelace>
--change-address <payment-addr>
--out-file tx.unsigned
--testnet-magic 1
--tx-in <utxo>#<index>
--withdrawal $(cat stake.addr)+<reward-lovelace>
--change-address <payment-addr>
--out-file tx.unsigned
3. Sign with BOTH keys, submit
3. Sign with BOTH keys, submit
undefinedundefinedDe-register stake key (get deposit back)
注销质押密钥(取回押金)
bash
cardano-cli conway stake-address deregistration-certificate \
--stake-verification-key-file stake.vkey \
--out-file stake-dereg.certbash
cardano-cli conway stake-address deregistration-certificate \
--stake-verification-key-file stake.vkey \
--out-file stake-dereg.certBuild tx with certificate, sign, submit
Build tx with certificate, sign, submit
undefinedundefinedExamples
示例
Example: Delegate to a pool
示例:委托至矿池
User request: "Delegate my stake to pool1abc..."
Response:
bash
undefined用户请求:“将我的质押委托至pool1abc...”
响应:
bash
undefined=== Delegate to Pool ===
=== Delegate to Pool ===
POOL_ID="pool1abc..."
STAKE_VKEY="stake.vkey"
PAYMENT_ADDR=$(cat base.addr)
POOL_ID="pool1abc..."
STAKE_VKEY="stake.vkey"
PAYMENT_ADDR=$(cat base.addr)
1. Verify pool exists
1. Verify pool exists
cardano-cli conway query stake-pools --testnet-magic 1 | grep $POOL_ID
cardano-cli conway query stake-pools --testnet-magic 1 | grep $POOL_ID
2. Create delegation certificate
2. Create delegation certificate
cardano-cli conway stake-address stake-delegation-certificate
--stake-verification-key-file $STAKE_VKEY
--stake-pool-id $POOL_ID
--out-file delegation.cert
--stake-verification-key-file $STAKE_VKEY
--stake-pool-id $POOL_ID
--out-file delegation.cert
cardano-cli conway stake-address stake-delegation-certificate
--stake-verification-key-file $STAKE_VKEY
--stake-pool-id $POOL_ID
--out-file delegation.cert
--stake-verification-key-file $STAKE_VKEY
--stake-pool-id $POOL_ID
--out-file delegation.cert
3. Build transaction
3. Build transaction
cardano-cli conway transaction build
--testnet-magic 1
--tx-in <your-utxo>#0
--change-address $PAYMENT_ADDR
--certificate-file delegation.cert
--out-file tx.unsigned
--testnet-magic 1
--tx-in <your-utxo>#0
--change-address $PAYMENT_ADDR
--certificate-file delegation.cert
--out-file tx.unsigned
cardano-cli conway transaction build
--testnet-magic 1
--tx-in <your-utxo>#0
--change-address $PAYMENT_ADDR
--certificate-file delegation.cert
--out-file tx.unsigned
--testnet-magic 1
--tx-in <your-utxo>#0
--change-address $PAYMENT_ADDR
--certificate-file delegation.cert
--out-file tx.unsigned
4. Sign with both keys
4. Sign with both keys
cardano-cli conway transaction sign
--tx-file tx.unsigned
--signing-key-file payment.skey
--signing-key-file stake.skey
--testnet-magic 1
--out-file tx.signed
--tx-file tx.unsigned
--signing-key-file payment.skey
--signing-key-file stake.skey
--testnet-magic 1
--out-file tx.signed
cardano-cli conway transaction sign
--tx-file tx.unsigned
--signing-key-file payment.skey
--signing-key-file stake.skey
--testnet-magic 1
--out-file tx.signed
--tx-file tx.unsigned
--signing-key-file payment.skey
--signing-key-file stake.skey
--testnet-magic 1
--out-file tx.signed
5. Submit (use operator skill)
5. Submit (use operator skill)
Delegation takes effect at next epoch boundary
Delegation takes effect at next epoch boundary
undefinedundefinedSafety / key handling
安全与密钥管理
- Verify pool ID from multiple sources (adapools, cexplorer)
- Staking never risks your principal
- Delegation can be changed anytime
- Rewards accumulate until withdrawn
- 从多渠道验证矿池ID(如adapools、cexplorer)
- 质押操作不会危及你的本金
- 委托操作可随时更改
- 奖励会累积至提取时
References
参考资料
shared/PRINCIPLES.md- (for execution)
cardano-cli-staking-operator
shared/PRINCIPLES.md- (用于执行操作)
cardano-cli-staking-operator