Hey guys, i’m kinda new to all this and i’m having the following issue:
I’ve got this wallet:
$ cardano-cli query utxo --address $(cat payment.addr ) --mainnet
TxHash TxIx Amount
--------------------------------------------------------------------------------------
9fd27cf74cc30982fc927d1c60e6523cutxoutxoutxo1d0aacb71d330c5e542e 0 4810211 lovelace + 1000001 38149ef0f3886ffedpolicyidpolicyid9243c3dc0b76e0a1ef37662.TokenName + TxOutDatumHashNone
I’m trying to send away 1000000 TokenName and keep 1 and the resulting change.
So i’ve done this:
utxo=4810211
txin=9fd27cf74cc30982fc927d1c60e6523cutxoutxoutxo1d0aacb71d330c5e542e
txix=0
expire=$(( $(cardano-cli query tip --mainnet | jq -r '.slot') + 1800 ))
cardano-cli transaction build-raw \
--fee 10000 \
--tx-in "$txin#$txix" \
--tx-out "$(cat tokens.addr)+1000000 $(cat policy/tokens/policy.id).TokenName" \
--tx-out "$(cat payment.addr)+$((utxo-fee))+1 $(cat policy/tokens/policy.id).TokenName" \
--invalid-hereafter $expire \
--out-file token_tx.raw
then i calculate the fee, considering there’s just one txin and two tx-outs.
fee=( $(cardano-cli transaction calculate-min-fee \
--tx-body-file token_tx.raw \
--tx-in-count 1 \
--tx-out-count 2 \
--witness-count 2 \
--protocol-params-file protocol.json) )
Then i rebuild the transaction:
cardano-cli transaction build-raw \
--fee ${fee[0]} \
--tx-in "$txin#$txix" \
--tx-out "$(cat tokens.addr)+1000000 $(cat policy/tokens/policy.id).TokenName" \
--tx-out "$(cat payment.addr)+$((utxo-fee))+1 $(cat policy/tokens/policy.id).TokenName" \
--invalid-hereafter $expire \
--out-file token_tx.raw
Then i sign it and sumit:
cardano-cli transaction sign \
--signing-key-file payment.skey \
--mainnet \
--tx-body-file token_tx.raw \
--out-file token_tx.signed
cardano-cli transaction submit \
--tx-file token_tx.signed \
--mainnet
And i get the following error:
Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (OutputTooSmallUTxO [(Addr Mainnet (KeyHashObj (KeyHash "<somehash>")) (StakeRefBase (KeyHashObj (KeyHash "<another hash>"))),Value 0 (fromList [(PolicyID {policyID = ScriptHash "<script hash>"},fromList [("TokenName",1000000)])]),SNothing)])))])
I have simply NO IDEA what i’m doing wrong. Any ideas?