Browse Source

modified: scripts.notary/cron_splitfunds

deleted:    scripts.notary/sendawaynn.sh
	modified:   scripts.seed/sendawaynn.sh
master^2
blackjok3r 7 years ago
parent
commit
13d595efea
  1. 7
      a-team/scripts.notary/cron_splitfunds
  2. 45
      a-team/scripts.notary/sendawaynn.sh
  3. 14
      a-team/scripts.seed/sendawaynn.sh

7
a-team/scripts.notary/cron_splitfunds

@ -5,7 +5,12 @@ declare -a skip=("BEER" "PIZZA")
TARGETAMNT=10
print_txid () {
echo -n $(echo $1 | jq -r .txid)
txid=$(echo $1 | jq -r .txid)
if [[ $txid = "null" ]]; then
echo -n "No valid UTXO to split"
else
echo -n $txid
fi
}
# Amount of UTXOs to create at one time

45
a-team/scripts.notary/sendawaynn.sh

@ -1,45 +0,0 @@
#!/bin/bash
cd ~/scripts/
curdir=$(pwd)
thisconf=$(<~/.komodo/komodo.conf)
curluser=$(echo $thisconf | grep -Po "rpcuser=(\S*)" | sed 's/rpcuser=//')
curlpass=$(echo $thisconf | grep -Po "rpcpassword=(\S*)" | sed 's/rpcpassword=//')
curlport=7771
curl -s --user $curluser:$curlpass --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listunspent", "params": [0, 9999999]}' -H 'content-type: text/plain;' http://127.0.0.1:$curlport/ | jq .result > $curdir/createrawtx.txt
# we will send all spendable and generated coins
transactions=$(cat $curdir/createrawtx.txt | jq '.[] | select (.spendable == true and .generated == true) | del (.generated, .address, .account, .scriptPubKey, .amount, .interest, .confirmations, .spendable)' | jq -r -s '. | tostring')
balance=$(cat $curdir/createrawtx.txt | jq '.[] | select (.spendable == true and .generated == true) | .amount' | jq -s add)
balance=$(echo "scale=8; $balance/1*1" | bc -l | sed 's/^\./0./')
# Print Date and Time
echo "----------------------------------------------------------------"
now=$(date +"%Y-%m-%d %T%z")
printf "$now \n";
# Print balance.
echo 'Balance: '$balance
# Balance less than 11 abort, we want maximum rewards.
if (( $(echo "$balance < 11" | bc -l) )); then
echo "----------------------------------------------------------------"
echo " "
# exit
fi
# Set the send to address, and send all coinbase transactions
addresses='{"RPx6hcNQkGSE3VLPupnQ45NNYR3NJbkbpk":'$balance'}'
echo "{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", \"method\": \"createrawtransaction\", \"params\": [$transactions,$addresses] }" > $curdir/createrawtx.curl
hex=$(curl -s --user $curluser:$curlpass --data-binary "@$curdir/createrawtx.curl" -H 'content-type: text/plain;' http://127.0.0.1:$curlport/ | jq -r .result)
# setting of nLockTime
nlocktime=$(printf "%08x" $(date +%s) | dd conv=swab 2> /dev/null | rev)
hex=${hex::-8}$nlocktime
signed=$(curl -s --user $curluser:$curlpass --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "signrawtransaction", "params": ["'$hex'"]}' -H 'content-type: text/plain;' http://127.0.0.1:$curlport/ | jq -r .result.hex)
echo $signed
#Broadcast the transaction
#txid=$(curl -s --user $curluser:$curlpass --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendrawtransaction", "params": ["'$signed'"]}' -H 'content-type: text/plain;' http://127.0.0.1:$curlport/ | jq -r .result)
#echo $txid
echo "----------------------------------------------------------------"
echo " "

14
a-team/scripts.seed/sendawaynn.sh

@ -12,14 +12,6 @@ transactions=$(cat $curdir/createrawtx.txt | jq '.[] | select (.spendable == tru
balance=$(cat $curdir/createrawtx.txt | jq '.[] | select (.spendable == true and .generated == true) | .amount' | jq -s add)
balance=$(echo "scale=8; $balance/1*1" | bc -l | sed 's/^\./0./')
# Print Date and Time
echo "----------------------------------------------------------------"
now=$(date +"%Y-%m-%d %T%z")
printf "$now \n";
# Print balance.
echo 'Balance: '$balance
# Balance less than 11 abort, we want maximum rewards.
if (( $(echo "$balance < 11" | bc -l) )); then
echo "----------------------------------------------------------------"
@ -40,5 +32,11 @@ signed=$(curl -s --user $curluser:$curlpass --data-binary '{"jsonrpc": "1.0", "i
#Broadcast the transaction
txid=$(curl -s --user $curluser:$curlpass --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendrawtransaction", "params": ["'$signed'"]}' -H 'content-type: text/plain;' http://127.0.0.1:$curlport/ | jq -r .result)
#echo $txid
# Print Date and Time
echo "----------------------------------------------------------------"
now=$(date +"%Y-%m-%d %T%z")
printf "$now \n";
# Print balance.
echo 'Balance: '$balance
echo "----------------------------------------------------------------"
echo " "

Loading…
Cancel
Save