-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTXDebug.sh
70 lines (53 loc) · 2.07 KB
/
TXDebug.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Credits: Transaction Debug By S4Lsalsoft (https://github.com/DestroyerDarkNess) & Julio Moros
# v2.0
echo " starting... "
RED='\033[0;31m'
CYAN='\033[0;36m'
GREEN='\033[0;32m'
LBlue='\033[0;34m'
NC='\033[0m' # No Color
# In this loop-step te shell code asks the user for the transaction id
ProcessTransaction=true
while $ProcessTransaction; do
read -p "Enter the Transaction ID: " Transaction;
[ -z "$Transaction" ] && echo "" && echo -e "${RED} Transaction ID Is empty ${NC} Please re-enter it." && echo "" || ProcessTransaction=false
done
# In this loop-step the code asks the user for the server which hosts the specific RSK full node
ProcessServer=true
while $ProcessServer; do
echo " "
echo "Enter the server to request: "
echo " 1) mainnet.sovryn.app"
echo " 2) testnet.sovryn.app"
echo " 3) mainnet2.sovryn.app"
echo " 4) testnet2.sovryn.app"
#echo " 5) other mainnet node"
echo " "
read -n 1 server;
case $server in
1) ServerURL="https://mainnet.sovryn.app/rpc" && ProcessServer=false;;
2) ServerURL="https://testnet.sovryn.app/rpc" && ProcessServer=false;;
3) ServerURL="https://mainnet2.sovryn.app/rpc" && ProcessServer=false;;
4) ServerURL="https://testnet2.sovryn.app/rpc" && ProcessServer=false;;
#5) ServerURL="http://18.190.157.115:4444/" && ProcessServer=false;;
*) echo "invalid option";;
esac
done
# the screen is cleared and the query to the server starts using curl
clear
JSON_STRING='{"jsonrpc":"2.0","method":"debug_traceTransaction","params":["'"$Transaction"'"],"id":1}'
echo ""
echo -e "Your Transaction Is : ${CYAN} $Transaction ${NC} "
echo ""
echo ""
echo -e "Your Server Is : ${GREEN} $ServerURL ${NC} "
echo ""
echo ""
echo Starting... Please Wait!
echo ""
# this specific script is described at stackoverflow (https://cutt.ly/5bRuIsT)
# the response is stored in the file "output.json" as the data is received
out=$(curl -X POST -H "Content-Type:application/json" --data $JSON_STRING $ServerURL 1> ouput.json )
echo $out
read -p " Process Finished! - Press [Enter] key to exit..."
exit