-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaleo_create_account.sh
executable file
·58 lines (36 loc) · 1.12 KB
/
aleo_create_account.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
# Usage:
# ./aleo_create_account.sh [ACCOUNT_NAME]
# Output JSON file:
# {
# "AccountName": "[ACCOUNT_NAME]",
# "AleoPrivateKey": "[Aleo Private Key]",
# "AleoViewKey": "[Aleo View Key]",
# "AleoAddress": "[Aloe Address]"
# }
# Check input, we should get at least 1 variable
if [ $# -eq 0 ]
then
echo "No arguments supplied. Usage: ./aleo_create_account.sh [ACCOUNT_NAME]"
else
# assign Aleo Key from script input
AccountName=$1
# generate Aleo keys using native Aleo CLI command
AleoKeys=$(aleo account new | grep 'Key\|Address')
# get 3 keys from Aleo CLI command output
stringarray=($AleoKeys)
AleoPrivateKey=${stringarray[2]}
AleoViewKey=${stringarray[5]}
AleoAddress=${stringarray[7]}
# prepare JSON file with Aleo Keys
output_json="
{
\"AccountName\": \""$AccountName"\",
\"AleoPrivateKey\": \""$AleoPrivateKey"\",
\"AleoViewKey\": \""$AleoViewKey"\",
\"AleoAddress\": \""$AleoAddress"\"
}
"
# save Aleo keys in JSON file in aleo_keys folder
python3 zkdrop_qr.py $AleoAddress
cd aleo_keys; echo $output_json > "aleo""_"$AccountName"_key.json"
fi