Min-fee calculation for stake pool registration fails

Hi Cardanians,

I’m working on a collection of automated shell scripts for ubuntu to simplify creation of a stake pool, and I’m running into a problem preventing me from fully automating one of the last steps, the submission of the stake pool registration. I am following both Carlos’ video ( Register stake pool and metadata - Stake pool course ) as well as the corresponding documentation in the gitbook. The problem is the min-fee command returns a fee that is too low. Carlos runs into this in his video and just takes the new fee from the error messages and recalculates everything ( https://youtu.be/OHj0eJ8p4OY?t=1887 ).

Since this does not work for my intended automation, I’m trying to find the underlying cause of this fee discrepancy. Here is my order of commands and the message I am getting.

cardano-cli transaction build-raw
–tx-in …#0
–tx-out addr_test1…+0
–ttl 300
–fee 0
–certificate-file certs/pool-registration.cert
–certificate-file certs/pool-delegation.cert
–out-file txtmp/tx.raw

cardano-cli transaction calculate-min-fee
–tx-body-file txtmp/tx.raw
–testnet-magic 1097911063
–protocol-params-file protocol.json
–tx-in-count 1
–tx-out-count 1
–witness-count 1

cardano-cli transaction build-raw
–tx-in …#0
–tx-out addr_test1…+495299320
–ttl 300
–fee 184245
–certificate-file certs/pool-registration.cert
–certificate-file certs/pool-delegation.cert
–out-file txtmp/tx.raw

cardano-cli transaction sign
–tx-body-file txtmp/tx.raw
–signing-key-file keys/stake-payment.skey
–signing-key-file keys/stake.skey
–signing-key-file pool-keys/cold.skey
–testnet-magic 1097911063
–out-file txtmp/tx.signed

cardano-cli transaction submit
–tx-file txtmp/tx.signed
–testnet-magic 1097911063

Between the min fee and building the final transaction, I calculate the amount to be returned to the stake payment address (total amount - fee - pool deposit from protocol.json) and use that in the final transaction generation. After submission, the following errors pops up

Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraMary (ApplyTxError [LedgerFailure (UtxowFailure (UtxoFailure (FeeTooSmallUTxO (Coin 187017) (Coin 184245))))])

The protocol.json file is retrieved for/from the testnet.

There’s 2772 Lovelace somewhere that aren’t accounted for by the min-fee or I’m missing something. Any ideas are welcome.

Thanks in advance

~ Nils

Heya,

This can be closed, but I’ll leave the thread here in case someone runs into it. [BUG] - FeeTooSmallUTxO when registering the pool · Issue #2335 · input-output-hk/cardano-node · GitHub led me to the right answer, which is that might witness-count when calculating fees needed to be 3, not 1 (3 --signing-key-files on the transaction signing, not just 1).

~ Nils

2 Likes