Categories
cardano Uncategorized

Cardano simple transaction – Testnet

payment2.addr = TO address (addr_test1qqr585tvlc7ylnqvz8pyqwauzrdu0mxag3m7q56grgmgu7sxu2hyfhlkwuxupa9d5085eunq2qywy7hvmvej456flknswgndm3)
payment.addr = FROM address(addr_test1qzvvw5j2636y3r0cg3spu94htzjxupmt2hxld5gxzsp873lpqqmdlvg6k2sfdnzjz8q3pr3q8meydx05q4cacmnzxxesawnv76)

#Draft transaction

cardano-cli shelley transaction build-raw \
--tx-in 173dcc8ce28c8d6c3900363c8c3a18f0dcdc953f1f108d1acf99bbfc66f99d9d#0 \
--tx-out $(cat payment2.addr)+0 \
--tx-out $(cat payment.addr)+0 \
--ttl 0 \
--fee 0 \
--out-file tx.draft

#Minimum fee

cardano-cli shelley transaction calculate-min-fee \
--tx-in-count 1 \
--tx-out-count 2 \
--tx-body-file tx.draft \
--testnet-magic 1097911063 \
--witness-count 3 \
--protocol-params-file protocol.json

minimum fee : 189481

#Calculation

497452809 – 100000000 – 189481 = 397263328
payment.addr – payment2.addr – fee = 397263328

#Get updated slot

currentSlot=$(cardano-cli query tip --testnet-magic 1097911063 | jq -r '.slotNo')
echo Current Slot: $currentSlot
updated_currentSlot=$(($currentSlot+1000))
echo Updated Slot: $updated_currentSlot

#Build raw transaction

cardano-cli shelley transaction build-raw \
--tx-in 173dcc8ce28c8d6c3900363c8c3a18f0dcdc953f1f108d1acf99bbfc66f99d9d#0 \
--tx-out $(cat payment2.addr)+100000000 \
--tx-out $(cat payment.addr)+397263328 \
--ttl 14949695 \
--fee 189481 \
--out-file tx.raw

#Sign transaction

cardano-cli shelley transaction sign \
--tx-body-file tx.raw \
--signing-key-file payment.skey \
--testnet-magic 1097911063 \
--out-file tx.signed

#Submit transaction

cardano-cli shelley transaction submit \
--tx-file tx.signed \
--testnet-magic 1097911063

root@core:~/cardano-my-node# cat protocol.json | grep minUTxOValue
minUTxOValue“: 1000000,

Shelley command failed: transaction submit Error: Error while submitting tx: ApplyTxError [LedgerFailure (UtxowFailure (UtxoFailure (OutputTooSmallUTxO [(Addr Mainnet (KeyHashObj (KeyHash “6ccf7afbb2f916c52aa01eeffaa71b500d903ef2421c9b40343a5145”)) (StakeRefBase (KeyHashObj (KeyHash “61ffb9726ac8436bdecfe9b94b9f18d51ce26672452808019212cfdd”))),Coin 472257)])))]

Leave a Reply

Your email address will not be published.