-
Notifications
You must be signed in to change notification settings - Fork 4
/
01-simple-send.sh
executable file
·47 lines (36 loc) · 1.05 KB
/
01-simple-send.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
#############################################
### Sends ADA from one address to another ###
#############################################
# Enter the UTXO which ADA + transaction fees
# will be spent from
payorUTXO=""
# Amount in ADA
amountInADA=10
# Address ADA will be sent to
destinationADDR=$()
# Address for change
payorADDR=$()
# Signature file of sender
txSignatory=""
####################################
### No need to change code below ###
####################################
tmpBuild=$(mktemp)
cardano-cli conway transaction build \
--testnet-magic 1 \
--tx-in $payorUTXO \
--tx-out "$destinationADDR $(($amountInADA*1000000)) lovelace" \
--change-address $payorADDR \
--out-file $tmpBuild
[ $? -eq 0 ] || { echo "Error building transaction"; exit 1; }
tmpSig=$(mktemp)
cardano-cli transaction sign \
--testnet-magic 1 \
--tx-body-file $tmpBuild \
--signing-key-file $txSignatory \
--out-file $tmpSig
cardano-cli transaction submit \
--testnet-magic 1 \
--tx-file $tmpSig
cardano-cli transaction txid --tx-file $tmpSig