Transaction fails with cardano-node

Summary

We operate a staking pool on Cardano. I’m trying to pull some Ada from the payment address there, but transactions have been failing for a couple of hours already, as usual. Documentation doesn’t help either, as usual. It’s the cryptic errors that bother me the most, so I’m asking for help from the people who understand them.

Important to note: I successfully transferred Ada before from this machine, using the same node version, and from the same payment address. I also ran a withdrawal transaction today from the stake address, this worked fine, no issues.

All relay and producer nodes are running normally, no issues in the logs.

Environment

  • Linux 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • cardano-node 1.25.0 - linux-x86_64 - ghc-8.10 \n git rev f1b27a5eca3890594ddaec7fbb47ec83914498f1
  • cardano-cli 1.25.0 - linux-x86_64 - ghc-8.10 \n git rev f1b27a5eca3890594ddaec7fbb47ec83914498f1

Steps to reproduce

Look at this address: https://explorer.cardano.org/en/address?address=addr1q9f9vaesgahawqx4wk39vt78fe0rppjaz5q0xzwtvelduasjz4jacu3etwvz5m43p2v4eg3vqrgayxg9cegfduqygl7sege2yt&page=4&perPage=2

I query the address, I get this:

                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
0fb394df9d5a18fcc0a9de411f1bde5018e429731c720322661588d8861f9557     0        397959868

Ok, pretty clear, one hash one ix, 397959868 in amount.

Next steps, I draft:

cardano-cli transaction build-raw \
--tx-in 0fb394df9d5a18fcc0a9de411f1bde5018e429731c720322661588d8861f9557#0 \
--tx-out long_addr_here+0 \
--tx-out $(cat payment.addr)+0 \
--invalid-hereafter 0 \
--fee 0 \
--out-file tx.draft
cardano-cli transaction calculate-min-fee \
--tx-body-file tx.draft \
--tx-in-count 1 \
--tx-out-count 2 \
--witness-count 1 \
--byron-witness-count 0 \
--mainnet \
--protocol-params-file protocol.json
176413 Lovelace.

Ok, again, pretty clear, 176413. I want to keep 10A in the current address, but transfer the rest out.
And so I calculate:

fee=176413
total=397959868
keep=10000000
canTransfer=$(expr $total - $fee - $keep)  # Results in 387783455

I fetch the current tip:

{
    "hash": "461189aabe246ad711795508b56dcf1a0f7e09e7eddd95b7f4152f0af80512b0",
    "block": 5397539,
    "slot": 22879923
}

I will add 500 slots to be sure. So, 22880423.

cardano-cli transaction build-raw \
--tx-in 0fb394df9d5a18fcc0a9de411f1bde5018e429731c720322661588d8861f9557#0 \
--tx-out long_addr_here+387783455 \
--tx-out $(cat payment.addr)+10000000 \
--invalid-hereafter 22880423 \
--fee 176413 \
--out-file tx.draft

Sign, and submit:

cardano-cli transaction sign \
--tx-body-file tx.raw \
--signing-key-file payment.skey \
--mainnet \
--out-file tx.signed
cardano-cli transaction submit \
--tx-file tx.signed \
--mainnet

Issue

Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAllegra (ApplyTxError [LedgerFailure (UtxowFailure (UtxoFailure (OutsideValidityIntervalUTxO (ValidityInterval {invalidBefore = SNothing, invalidHereafter = SJust (SlotNo 22171798)}) (SlotNo 22880056)))),LedgerFailure (UtxowFailure (UtxoFailure (BadInputsUTxO (fromList [TxInCompact (TxId {_unTxId = "ab53818c8dc20be9b28bb148f4b914cd146f92afefd81aefb185946f46f2d1a8"}) 0])))),LedgerFailure (UtxowFailure (UtxoFailure (ValueNotConservedUTxO (DeltaCoin 0) (DeltaCoin 228623572))))])

What I think might be the issue:

  1. ... ValueNotConservedUTxO (DeltaCoin 0) (DeltaCoin 228623572)) ...
  2. ... OutsideValidityIntervalUTxO (ValidityInterval ...

And to mention once again, I’ve done transactions from this node, pool and machine before (as you can see in Cardano Explorer).


Any ideas what to do?

I’m really hoping it’s some dumb typo :slight_smile:

You’ve been caught out by copy/pasting the draft transaction for calculating fees.
Change the --out-file tx.draft to --out-file tx.raw and you’re good to go :smiley:

Hahaha I thought it was something like this, I just spent too much time on it and stop seeing the difference. @0percentpool thanks a bunch!

1 Like

No worries @milosmns, sometimes we’re so focused on a problem and the error logs that we miss these things :innocent: