-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpythonTutorial.py
116 lines (68 loc) · 2.61 KB
/
pythonTutorial.py
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
from connect import Connect
from sendtransaction import private_key_alc, defaultAddr, sendTransaction, alc_1_addr, alc_2_addr, alc_1_pk
from generateaccount import generateAccounts, accounts
import time
import json
toConnect = Connect()
getConnected = toConnect.connectToNetwork()
# generate the two accounts from generateAccount Module
creatAlcs = generateAccounts()
print("Accounts generate: ", creatAlcs)
print('\n')
# visit https://bank.testnet.algorand.network/ with account 1 to get testnet Algo Token
# prints the information of the first account that send Token
print(getConnected.account_info(defaultAddr))
print('\n')
#Get addresses and private key of account_2
alc_1_addr = (accounts['account_1']['alc_address'])
alc_2_addr = (accounts['account_2']['alc_address'])
alc_3_addr = (accounts['account_3']['alc_address'])
alc_1_pk = (accounts['account_1']['pkey'])
alc_2_pk = (accounts['account_2']['pkey'])
# Call the he function from sendtransaction.py file
# Default account sends token to account 1
trxn_1 = sendTransaction(private_key_alc, defaultAddr, alc_1_addr, 303000)
print(trxn_1)
print('\n')
time.sleep(60)
# Account 1 sends token to account 2
trxn_2 = sendTransaction(alc_1_pk, alc_1_addr, alc_2_addr, 100000)
print(trxn_2)
print("Default Address: ", json.dumps(getConnected.account_info(defaultAddr)))
print("Address 1: ", json.dumps(getConnected.account_info(alc_1_addr)))
print("Address 2: ", json.dumps(getConnected.account_info(alc_2_addr)))
# Day 5 Tutorial
# def convertToMnemonicKey():
# return mnemonic.from_private_key(private_key)
# mnemonic_phrase = convertToMnemonicKey()
# print("My Mnemonic Phrase: ", mnemonic_phrase)
# print('\n')
# def convertToPrivateKey():
# result = "My Private Key:", mnemonic.to_private_key(mnemonic_phrase)
# return result
# private_key = convertToPrivateKey()
# print(private_key)
# def convertToPublicKey():
# result = "My public Key: " + str(mnemonic.to_public_key(mnemonic_phrase))
# print(result)
# convertToPublicKey()
# user_profile = {
# "name": "Fred",
# "lastname": "Blonde",
# "age": 39,
# "hobbies": ['traveling', 'cycling', 'skating'],
# "session_login_avg": {"daily": "twice", "weekly": "6 times", "monthly": 22,}
# }
# # user_profile["age"] = 37
# # print(user_profile)
# # print out all the values in a dictionary
# for x, y in user_profile.items():
# print(x,":", y)
# # check if a key exist
# if "hobbies" in user_profile:
# print("True")
# # prints all values in the user_profile
# for x in user_profile.values():
# print(x)
# # prints the length of user_profile
# print(len(user_profile))