Skip to content

Commit

Permalink
Adding gettransaction command available
Browse files Browse the repository at this point in the history
  • Loading branch information
PsySc0rpi0n committed Oct 12, 2019
1 parent 0950881 commit a522f75
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions TugaRevoBTC.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ send_many(){
mk_json_object_one_val "$btc_amount_dec" "${addr_arr[@]}"
mk_json_lst_one_val "${addr_arr[@]}"
if [[ $used_net == "testnet" ]]; then
bitcoin-cli -testnet sendmany "" {$pairs} 6 Payments [$items] true 6 CONSERVATIVE
output=$(bitcoin-cli -testnet sendmany "" {$pairs} 6 Payments [$items] true 6 CONSERVATIVE)
else
bitcoin-cli sendmany "" {pairs} 6 Payments [$items] true 6 CONSERVATIVE
output=$(bitcoin-cli sendmany "" {pairs} 6 Payments [$items] true 6 CONSERVATIVE)
fi
echo "Transaction complete"
echo "TxID: $?"
echo "TxID: $output"
}

# ------ Send BTC Paymento to a single Address ------ #
Expand All @@ -129,6 +129,7 @@ send_single_payment(){
bitcoin-cli sendtoaddress "$address" "$amount" false
fi
echo "Transaction complete"
return 0
else
echo Action cancelled. Amount $amount BTC not confirmed!
return 1
Expand All @@ -147,7 +148,7 @@ check_balance(){
if [[ $used_net == "testnet" ]]; then
bitcoin-cli -testnet getbalance
else
bitcoin-cli getbalance
bitcoin-cli getbalance
fi
}

Expand Down Expand Up @@ -198,6 +199,29 @@ mk_json_lst_one_val(){
mk_json_lst $args
}

# ====== Check TxID details ====== #
check_txid(){
local txid
local txidlen=64
local strlen
echo "Enter transaction ID:"
read -p '> ' txid
echo "\$TxID is: $txid"
strlen=$($(echo -n "txid" | wc -c))
echo "strlen is $strlen"
while [[ -z $txid || $strlen -ne $txidlen ]]
do
echo "TxID not valid. Please enter a valid one: "
read -p '> ' txid
strlen=$(echo -n "txid" | wc -c)
done
if [[ $used_net == "testnet" ]]; then
bitcoin-cli -testnet gettransaction $txid
else
bitcoin-cli gettransaction $txid
fi
}

# ====== Main script starts here ======
LC_NUMERIC=C

Expand Down

0 comments on commit a522f75

Please sign in to comment.