#Current EPOC
cat testnet-shelley-genesis.json | grep epoch
#"epochLength": 432000
cardano-cli shelley query tip --testnet-magic 1097911063 | grep slotNo
#"slotNo": 14711760
expr 14711760 / 432000
#34
#34+1 = earliest epoch for retirement
cardano-cli shelley query protocol-parameters \
--testnet-magic 1097911063 \
--allegra-era \
--out-file protocol.json
cat protocol.json | grep eMax
#"eMax": 18
#Create deregistration certificate
cardano-cli shelley stake-pool deregistration-certificate \
--cold-verification-key-file node.vkey \
--epoch 35 \
--out-file pool.deregistration
#Draft the transaction
cardano-cli shelley query utxo \
--address $(cat payment.addr) \
--testnet-magic 1097911063 \
--allegra-era
cardano-cli shelley transaction build-raw \
--tx-in 173dcc8ce28c8d6c3900363c8c3a18f0dcdc953f1f108d1acf99bbfc66f99d9d#0 \
--tx-out $(cat payment.addr)+0 \
--ttl 0 \
--fee 0 \
--out-file tx.draft \
--certificate-file pool.deregistration
#Calculate the fees
cardano-cli shelley transaction calculate-min-fee \
--tx-body-file tx.draft \
--tx-in-count 1 \
--tx-out-count 1 \
--witness-count 1 \
--byron-witness-count 0 \
--testnet-magic 1097911063 \
--protocol-params-file protocol.json
#172761
expr 497452809 - 172761 = 497280048

#Build, sign and submit the transaction
#TTL
currentSlot=$(cardano-cli query tip --testnet-magic 1097911063 | jq -r '.slotNo')
echo Current Slot: $currentSlot
updated_currentSlot=$(($currentSlot+10000))
echo Updated Slot: $updated_currentSlot
#14721760
cardano-cli shelley transaction build-raw \
--tx-in 173dcc8ce28c8d6c3900363c8c3a18f0dcdc953f1f108d1acf99bbfc66f99d9d#0 \
--tx-out $(cat payment.addr)+497280048 \
--ttl 14721760 \
--fee 172761 \
--out-file tx.raw \
--certificate-file pool.deregistration
#sign
cardano-cli shelley transaction sign \
--tx-body-file tx.raw \
--signing-key-file payment.skey \
--signing-key-file node.skey \
--testnet-magic 1097911063 \
--out-file tx.signed
#submit
cardano-cli shelley transaction submit \
--tx-file tx.signed \
--testnet-magic 1097911063
#stackpool status:
cardano-cli stake-pool id --cold-verification-key-file $HOME/cold-keys/node.vkey --output-format hex > stakepoolid.txt
cat stakepoolid.txt
cardano-cli query ledger-state --testnet-magic 1097911063 --allegra-era | grep -C 20 $(cat stakepoolid.txt)
Check status
cardano-cli query ledger-state --testnet-magic 1097911063 --allegra-era --out-file ledger-state.json
jq -r '.esLState._delegationState._pstate._pParams."'"$(cat stakepoolid.txt)"'" // empty' ledger-state.json
Reward status:
cardano-cli query stake-address-info \
--testnet-magic 1097911063 \
--allegra-era \
--address $(cat stake.addr) | jq -r ".[0].rewardAccountBalance"
Refrences:
– https://www.coincashew.com/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node#19-retire-your-stake-pool
– https://docs.cardano.org/projects/cardano-node/en/latest/stake-pool-operations/retire_stakepool.html