- Soạn thảo giao dịch
- Ký giao dịch
- Submit giao dịch
- Kiểm tra số dư
testnet="--testnet-magic 2"
address=$(cat $BASENAME.payment-0.addr)
address_SKEY="$BASENAME.payment-0.skey"
BOB_ADDR="addr_test1qz8shh6wqssr83hurdmqx44js8v7tglg9lm3xh89auw007dd38kf3ymx9c2w225uc7yjmplr794wvc96n5lsy0wsm8fq9n5epq"
LOVELACE_VALUE=101000000cardano-cli query utxo $testnet --address $addressXác định UTXO sử dụng để chi tiêu từ ví của Alice với cú pháp: UTXO_IN=# Trong đó và được lấy từ kết quả của câu lệnh truy vấn trên, cụ thể như sau:
UTXO_IN=b8c108bde14a183b79d00a48108c40808f46757ddfd16cdbf797fc0ebecd8047#0cardano-cli conway transaction build $testnet \
--tx-in $UTXO_IN \
--tx-out $BOB_ADDR+$LOVELACE_VALUE \
--change-address $address \
--out-file simple-tx.rawBạn sẽ thấy xuất hiện file simple-tx.raw trong cùng thư mục thực hiện câu lệnh.
cardano-cli transaction sign $testnet \
--signing-key-file $address_SKEY \
--tx-body-file simple-tx.raw \
--out-file simple-tx.signedBạn sẽ thấy xuất hiện file simple-tx.signed trong cùng thư mục thực hiện câu lệnh.
cardano-cli transaction submit $testnet \
--tx-file simple-tx.signedbạn sẽ nhìn thấy dòng chữ
Transaction successfully submitted.
→ điều này có nghĩa Thông báo giao dịch đã được thực hiện thành công
cardano-cli query utxo $testnet --address $addressSố dư của bạn sẽ thay đổi (giảm đi) so với ban đầu, Chúc mừng bạn đã hoàn thành lab2