-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitmot
executable file
·65 lines (49 loc) · 1.15 KB
/
itmot
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
#!/bin/sh
echo "Ethereum Wallet Transfer"
#Displays account of the user
disp_account(){
echo "Your Wallet is:"
./geth --testnet --fast -exec "eth.accounts" attach
}
#Unlock user account and send certain number of 'ether'
send(){
SENDER=$1
RECEIVER=$2
AMOUNT=$3
PASSWORD=$4
./geth --exec "personal.unlockAccount('$SENDER', '$PASSWORD')" attach > /dev/null
TRANSACTION=`./geth --testnet --fast -exec "eth.sendTransaction({from: '$SENDER', to: '$RECEIVER', value: web3.toWei('$AMOUNT', 'ether')})" attach`
echo $TRANSACTION
}
cli_main(){
if [ ! -z $1 ] && [ $1 = "-h" ];
then
#help
exit
fi
#pulling variables from the UI script
if [ ! -z $1 ];
then
if [ $1 = "-a" ];
then
TRANSACTION="$(send $2 $3 $4 $5)"
echo $TRANSACTION
exit
fi
fi
while true
do
printf "Please enter the account of SENDER:\n"
echo $SENDER
printf "Please enter the account of RECEIVER:\n"
echo $RECEIVER
printf "Please enter the AMOUNT of ethers:\n"
echo $AMOUNT
printf "Please enter your account PASSWORD:\n"
echo -s $PASSWORD
TRANSACTION="$(send $SENDER $RECEIVER $AMOUNT $PASSWORD)"
echo "Transaction code is:"
echo $TRANSACTION
done
}
cli_main $*