Failure to register stake pool - stake key already exists

Hi Guys,

thanks for the help in advance!

I got stuck at the very last step before registering my pool. When submitting the signed transaction I get the error “… (ApplyTxError [LedgerFailure (DelegsFailure (DelplFailure (DelegFailure (StakeKeyAlreadyRegisteredDELEG (KeyHashObj (KeyHash “119b42d6590ad15c6bfaacb8e0660e1e8dfb1fd4f25ed8289f544882”))))))…”
The KeyHash is the Hash of my stake.cert
Any idea what could cause the error? I followed the cashcoin guide.
Thx in advance!
Chris

1 Like

Hi!

Is this the full output of the submit? might there is a useful info in the ... :slight_smile:

hi laplasz,

thank your for your reply!

Here is the full output
Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraMary (ApplyTxError [LedgerFailure (DelegsFailure (DelplFailure (DelegFailure (StakeKeyAlreadyRegisteredDELEG (KeyHashObj (KeyHash “119b42d6590ad15c6bfaacb8e0660e1e8dfb1fd4f25ed8289f544882”)))))),LedgerFailure (UtxowFailure (UtxoFailure (OutsideValidityIntervalUTxO (ValidityInterval {invalidBefore = SNothing, invalidHereafter = SJust (SlotNo 27967598)}) (SlotNo 28025968)))),LedgerFailure (UtxowFailure (UtxoFailure (BadInputsUTxO (fromList [TxInCompact (TxId {_unTxId = SafeHash “7b23ae70be6adeb9595bf61837e321ad577363575b8b94a1c0651b7edd6ae6e0”}) 0,TxInCompact (TxId {_unTxId = SafeHash “b55dc2d47886dae5c888a8447e198634dc957a641ff4bd11782204ac7e726708”}) 0])))),LedgerFailure (UtxowFailure (UtxoFailure (ValueNotConservedUTxO (Value 0 (fromList )) (Value 71182017663 (fromList )))))])

I think I messed up with the stake.cert file.

Kind regards,
Chris

so there are couple of things:

The current slotno is 28026463 - so you have to define greater value in invalidHereafter

how did you calculated the txout and how did you build the transaction?

I calculated the current slot:

currentSlot=$(cardano-cli query tip --mainnet | jq -r ‘.slot’)
echo Current Slot: $currentSlot

I queried my balance:

cardano-cli query utxo
–address $(cat payment.addr)
–mainnet > fullUtxo.out

tail -n +3 fullUtxo.out | sort -k3 -nr > balance.out

cat balance.out

tx_in=""
total_balance=0
while read -r utxo; do
in_addr=$(awk ‘{ print $1 }’ <<< “${utxo}”)
idx=$(awk ‘{ print $2 }’ <<< “${utxo}”)
utxo_balance=$(awk ‘{ print $3 }’ <<< “${utxo}”)
total_balance=$((${total_balance}+${utxo_balance}))
echo TxHash: ${in_addr}#${idx}
echo ADA: ${utxo_balance}
tx_in="${tx_in} --tx-in ${in_addr}#${idx}"
done < balance.out
txcnt=$(cat balance.out | wc -l)
echo Total ADA balance: ${total_balance}
echo Number of UTXOs: ${txcnt}

I calculated the deposit fee:

stakePoolDeposit=$(cat $NODE_HOME/params.json | jq -r ‘.stakePoolDeposit’)
echo stakePoolDeposit: $stakePoolDeposit

I build the raw transaction. I added 10.000 Slots to the current

cardano-cli transaction build-raw
${tx_in}
–tx-out $(cat payment.addr)+$(( ${total_balance} - ${stakePoolDeposit}))
–invalid-hereafter $(( ${currentSlot} + 10000))
–fee 0
–certificate-file pool.cert
–certificate-file deleg.cert
–out-file tx.tmp

Minimum fee:

fee=$(cardano-cli transaction calculate-min-fee
–tx-body-file tx.tmp
–tx-in-count ${txcnt}
–tx-out-count 1
–mainnet
–witness-count 3
–byron-witness-count 0
–protocol-params-file params.json | awk ‘{ print $1 }’)
echo fee: $fee

tx_out

txOut=$((${total_balance}-${stakePoolDeposit}-${fee}))
echo txOut: ${txOut}

build transaction:

cardano-cli transaction build-raw
${tx_in}
–tx-out $(cat payment.addr)+${txOut}
–invalid-hereafter $(( ${currentSlot} + 10000))
–fee ${fee}
–certificate-file pool.cert
–certificate-file deleg.cert
–out-file tx.raw

sign (on cold machine):

cardano-cli transaction sign
–tx-body-file tx.raw
–signing-key-file payment.skey
–signing-key-file $HOME/cold-keys/node.skey
–signing-key-file stake.skey
–mainnet
–out-file tx.signed

send. in this step the error occured

cardano-cli transaction submit
–tx-file tx.signed
–mainnet

I must have missed a step or copying between the hot and cold machine messed things up. What would you recommend? Should I try the whole flow again?

I really do appreciate your help! Thanks a ton!!

Kind regards,
Chris

All the output of the echo command would be helpful

1 Like

[quote=“kriskind75, post:5, topic:58991, full:true”]

I calculated the current slot:

currentSlot=$(cardano-cli query tip --mainnet | jq -r ‘.slot’)
echo Current Slot: $currentSlot

Current Slot: 28030173

I queried my balance:

cardano-cli query utxo
–address $(cat payment.addr)
–mainnet > fullUtxo.out

tail -n +3 fullUtxo.out | sort -k3 -nr > balance.out

cat balance.out

tx_in=""
total_balance=0
while read -r utxo; do
in_addr=$(awk ‘{ print $1 }’ <<< “${utxo}”)
idx=$(awk ‘{ print $2 }’ <<< “${utxo}”)
utxo_balance=$(awk ‘{ print $3 }’ <<< “${utxo}”)
total_balance=$((${total_balance}+${utxo_balance}))
echo TxHash: ${in_addr}#${idx}
echo ADA: ${utxo_balance}
tx_in="${tx_in} --tx-in ${in_addr}#${idx}"
done < balance.out
txcnt=$(cat balance.out | wc -l)
echo Total ADA balance: ${total_balance}
echo Number of UTXOs: ${txcnt}

Total ADA balance: 71179835618
Number of UTXOs: 1

I calculated the deposit fee:

stakePoolDeposit=$(cat $NODE_HOME/params.json | jq -r ‘.stakePoolDeposit’)
echo stakePoolDeposit: $stakePoolDeposit

stakePoolDeposit: 500000000

I build the raw transaction. I added 10.000 Slots to the current

cardano-cli transaction build-raw
${tx_in}
–tx-out $(cat payment.addr)+$(( ${total_balance} - ${stakePoolDeposit}))
–invalid-hereafter $(( ${currentSlot} + 10000))
–fee 0
–certificate-file pool.cert
–certificate-file deleg.cert
–out-file tx.tmp

no error

Minimum fee:

fee=$(cardano-cli transaction calculate-min-fee
–tx-body-file tx.tmp
–tx-in-count ${txcnt}
–tx-out-count 1
–mainnet
–witness-count 3
–byron-witness-count 0
–protocol-params-file params.json | awk ‘{ print $1 }’)
echo fee: $fee

fee: 196433

tx_out

txOut=$((${total_balance}-${stakePoolDeposit}-${fee}))
echo txOut: ${txOut}

txOut: 70679639185

build transaction:

cardano-cli transaction build-raw
${tx_in}
–tx-out $(cat payment.addr)+${txOut}
–invalid-hereafter $(( ${currentSlot} + 10000))
–fee ${fee}
–certificate-file pool.cert
–certificate-file deleg.cert
–out-file tx.raw

no errors

sign (on cold machine):

cardano-cli transaction sign
–tx-body-file tx.raw
–signing-key-file payment.skey
–signing-key-file $HOME/cold-keys/node.skey
–signing-key-file stake.skey
–mainnet
–out-file tx.signed

no error

send. in this step the error occured

cardano-cli transaction submit
–tx-file tx.signed
–mainnet

Transaction successfully submitted.

No it worked. Sorry for bothering you! But with your comments you forced me to go through the process step by step!!

Thanks again!!

1 Like