Problem Registering a Stake Address (following the Operate a Stake Pool instructions)

I’m currently trying to setup a test stake pool on the preview env (test-net 2 I believe) as that is what Trezor seems to support and wanted to test things end to end.

I’m finding that the docs are lacking some updates. For instance, sometimes i have to use cardano-cli latest and some flags are occasionally missing, such as --socket-path, or in my current situation, --key-reg-deposit-amt. I tried to look up what that was and didn’t find an explanation about that specific setting in isolation. I think that’s part of where my problem lies since trying to run through the following link ends in an error:

The error is:

Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraConway (ApplyTxError (ConwayUtxowFailure (MissingVKeyWitnessesUTXOW (fromList [KeyHash {unKeyHash = "f4e5bdea423affa3494d8260584ddf5f341aeadeb368ef426da1614b"}])) :| [ConwayUtxowFailure (UtxoFailure (ValueNotConservedUTxO (MaryValue (Coin 9967323740) (MultiAsset (fromList []))) (MaryValue (Coin 100000000) (MultiAsset (fromList [])))))]))

I ended up putting all the steps in a shell script to make things a bit easier to work with but doing it “manually” gave me the same error too. I’ll put the shell script at the bottom of this post. I was hoping folks might be able to point me to a direction of where to go from here?

TESTNET=2
SOCKET=../db/socket
KEY_REG_DEPOSIT_AMOUNT=2000000

cardano-cli query utxo \
    --socket-path $SOCKET \
    --address $(cat payment.addr) \
    --testnet-magic $TESTNET > fullUtxo.out

cat fullUtxo.out

TX_HASH=`tail -n1 fullUtxo.out | awk {'print $1'}`

# Find the current slot
CURRENT_SLOT=$(cardano-cli latest query tip --socket-path $SOCKET --testnet-magic $TESTNET | jq -r '.slot')

# Create a stake address registration certificate
cardano-cli latest stake-address registration-certificate \
    --stake-verification-key-file stake.vkey \
    --out-file stake.cert \
    --key-reg-deposit-amt $KEY_REG_DEPOSIT_AMOUNT

# Build transaction and generate tx.raw
FEE_RAW=`cardano-cli latest transaction build \
    --socket-path $SOCKET \
    --tx-in ${TX_HASH}#1 \
    --tx-out $(cat payment.addr)+1000000 \
    --change-address $(cat payment.addr) \
    --testnet-magic $TESTNET \
    --certificate-file stake.cert \
    --invalid-hereafter $(( ${currentSlot} + 1000)) \
    --witness-override 2 \
    --out-file tx.raw`
FEE=`echo $FEE_RAW | awk {'print $4'}`
echo $FEE_RAW

cardano-cli latest query protocol-parameters \
    --socket-path $SOCKET \
    --testnet-magic $TESTNET \
    --out-file protocol.json

STAKE_ADDRESS_DEPOSIT=`cat protocol.json | jq -r '.stakeAddressDeposit'`
echo $STAKE_ADDRESS_DEPOSIT


TX_OUT=$((100000000-${STAKE_ADDRESS_DEPOSIT}-$FEE))
echo ${TX_OUT}

# Build Final Tranaction
cardano-cli latest transaction build-raw \
    --tx-in ${TX_HASH}#1 \
    --tx-out $(cat payment.addr)+${TX_OUT} \
    --invalid-hereafter $((${CURRENT_SLOT} + 1000)) \
    --fee $FEE \
    --certificate-file stake.cert \
    --out-file tx.raw

# Sign Transaction
cardano-cli latest transaction sign \
    --tx-body-file tx.raw \
    --signing-key-file payment.skey \
    --signing-key-file stake.skey \
    --testnet-magic $TESTNET \
    --out-file tx.signed

cardano-cli latest transaction submit \
    --tx-file tx.signed \
    --socket-path $SOCKET \
    --testnet-magic $TESTNET 

That’s from May 15, 2023 it’s outdated. Now you put conway after each cardano-cli to specify the current ledger era.

You might want to check this guide instead Guide: How to Set Up a Cardano Stake Pool | CoinCashew

1 Like

Aha! Thank you, I’ll give these a try!

1 Like