forked from itsdevcoffee/eos-smart-contract-info
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateWalletAccount.sh
38 lines (33 loc) · 1.16 KB
/
createWalletAccount.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
echo "What would you like to name your wallet?"
read WALLET_NAME
if [ -f ./walletInfo.txt ]; then
> walletInfo.txt
else
touch walletInfo.txt
fi
cleos wallet create -n $WALLET_NAME >> walletInfo.txt
MASTER_WALLET_PASSWORD=$(sed -n '4p' walletInfo.txt | sed 's/\"//g')
echo "Wallet created: $MASTER_WALLET_PASSWORD"
cleos create key >> walletInfo.txt
PRIVATE_KEY="$(sed -n '5p' walletInfo.txt | awk '{print $NF}')"
PUBLIC_KEY="$(sed -n '6p' walletInfo.txt | awk '{print $NF}')"
echo $PRIVATE_KEY
echo $PUBLIC_KEY
echo "What would you like to name your account?"
read ACCOUNT_NAME
cleos create account eosio $ACCOUNT_NAME $PUBLIC_KEY
cleos wallet import -n $WALLET_NAME $PRIVATE_KEY
if [[ ! -e test-wallets-accounts ]]; then
mkdir test-wallets-accounts
fi
# Create file with master password, private, public key, and account name
TIMESTAMP=$(date +"%T")
FILENAME_PATH=("./test-wallets-accounts/wallet-account-$TIMESTAMP.txt")
touch $FILENAME_PATH
echo "Wallet Name: $WALLET_NAME
Master Wallet Password: $MASTER_WALLET_PASSWORD
Private Key: $PRIVATE_KEY
Public Key: $PUBLIC_KEY
Account Name: $ACCOUNT_NAME" > $FILENAME_PATH
rm walletInfo.txt
echo "createWalletAccount script ended."