-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
55 lines (34 loc) · 1.56 KB
/
main.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
#from wallet.wallet_key import generate_keys
#from transaction.transaction_logic import Transaction
from blockchain.blockchain_class import Block,Blockchain
import datetime as date
from blockchain.chat_block_link import block,Blockchain
from blockchain.new_blockchain_class import block,Blockchain
# x,y = generate_keys()
# print (x)
# print(y)
def block(self,transaction,date,previous_hash,hash):
# blockchain = Blockchain()
# blockchain.add_block(block(1, date.datetime.now(),"Transaction Data 1",""))
# blockchain.add_block(block(2, date.datetime.now(),"Transaction Data 2",""))
# blockchain.add_block(block(3, date.datetime.now(),"Transaction Data 3",""))
# blockchain.add_block(block(4, date.datetime.now(),"Transaction Data 3",""))
# blockchain.add_block(block(5, date.datetime.now(),"Transaction Data 3",""))
# for block in block.chain:
# print("Block #"+str(block.index))
# print("Timestamp:"+str(block.Timestamp))
# print("Data: "+block.data)
# print("Hash: "+block.hash)
# print("Previous Hash: "+block.previous_hash)
# print("\n")
blockchain = Blockchain()
blockchain.add_block(block(1, date.datetime.now(), "Block 1 Data", blockchain.get_latest_block().hash))
blockchain.add_block(block(2, date.datetime.now(), "Block 2 Data", blockchain.get_latest_block().hash))
for block in blockchain.chain:
print("\n\n\n")
print("Block #" + str(block.index))
print("Timestamp: " + str(block.timestamp))
print("Data: " + block.data)
print("Hash: " + block.hash)
print("Previous Hash: " + block.previous_hash)
print("\n")