|
@@ -1,14 +1,17 @@
|
|
|
-from tkinter import *
|
|
|
|
|
-from lib.chain import Chain, Block
|
|
|
|
|
-from lib.transaction import Transaction
|
|
|
|
|
-from lib.block import CURRENT
|
|
|
|
|
-import rpyc
|
|
|
|
|
-import time
|
|
|
|
|
import json
|
|
import json
|
|
|
-from create_keys import make_keys, get_private_key, get_plain_key
|
|
|
|
|
import os
|
|
import os
|
|
|
|
|
+import time
|
|
|
|
|
+from tkinter import *
|
|
|
|
|
+
|
|
|
|
|
+import rpyc
|
|
|
|
|
+from create_keys import get_plain_key, get_private_key, make_keys
|
|
|
|
|
+from lib.block import CURRENT
|
|
|
|
|
+from lib.chain import Block, Chain
|
|
|
|
|
+from lib.transaction import Transaction
|
|
|
|
|
+
|
|
|
from gui.encyption import decrypt_data
|
|
from gui.encyption import decrypt_data
|
|
|
|
|
|
|
|
|
|
+
|
|
|
# from gui.encyption import decrypt
|
|
# from gui.encyption import decrypt
|
|
|
def new_contract():
|
|
def new_contract():
|
|
|
def add():
|
|
def add():
|
|
@@ -37,8 +40,9 @@ def new_contract():
|
|
|
t = Transaction()
|
|
t = Transaction()
|
|
|
t.set_contract(contract)
|
|
t.set_contract(contract)
|
|
|
t.hash(contract=name)
|
|
t.hash(contract=name)
|
|
|
|
|
+ temp = t.serialize(out_json=True)
|
|
|
conn = rpyc.connect(host='localhost', port=42069, keepalive=True)
|
|
conn = rpyc.connect(host='localhost', port=42069, keepalive=True)
|
|
|
- conn.root.push_transaction(t.serialize(out_json=True))
|
|
|
|
|
|
|
+ conn.root.push_transaction(temp)
|
|
|
|
|
|
|
|
conn.close()
|
|
conn.close()
|
|
|
newWindow.destroy()
|
|
newWindow.destroy()
|
|
@@ -138,7 +142,7 @@ def add_term():
|
|
|
|
|
|
|
|
t = Transaction()
|
|
t = Transaction()
|
|
|
t.set_contract(update)
|
|
t.set_contract(update)
|
|
|
- t.hash(contract=iden)
|
|
|
|
|
|
|
+ t.hash(contract=str(contract.get()))
|
|
|
conn.root.push_transaction(t.serialize(out_json=True))
|
|
conn.root.push_transaction(t.serialize(out_json=True))
|
|
|
|
|
|
|
|
#### TEST CODE PLEASE IGONRE ####
|
|
#### TEST CODE PLEASE IGONRE ####
|
|
@@ -154,7 +158,7 @@ def add_term():
|
|
|
|
|
|
|
|
t = Transaction()
|
|
t = Transaction()
|
|
|
t.set_contract(update)
|
|
t.set_contract(update)
|
|
|
- t.hash(contract=iden)
|
|
|
|
|
|
|
+ t.hash(contract=str(contract.get()))
|
|
|
conn.root.push_transaction(t.serialize(out_json=True))
|
|
conn.root.push_transaction(t.serialize(out_json=True))
|
|
|
|
|
|
|
|
#### END TEST CODE PLEASE DONT IGONRE ####
|
|
#### END TEST CODE PLEASE DONT IGONRE ####
|
|
@@ -294,8 +298,8 @@ def get_updates(transactions, iden=None, attr=None, accepted=None):
|
|
|
return updates
|
|
return updates
|
|
|
|
|
|
|
|
def decrypt_transactions(transactions, name):
|
|
def decrypt_transactions(transactions, name):
|
|
|
- decrypted_data = [decrypt_data(name, x) for x in transactions]
|
|
|
|
|
-
|
|
|
|
|
|
|
+ decrypted_data = [json.loads(decrypt_data(name, x)) for x in transactions]
|
|
|
|
|
+ print(type(decrypted_data[0]))
|
|
|
|
|
|
|
|
# old code
|
|
# old code
|
|
|
# for encrypted in transactions:
|
|
# for encrypted in transactions:
|
|
@@ -309,4 +313,4 @@ def decrypt_transactions(transactions, name):
|
|
|
# )
|
|
# )
|
|
|
# decrypted.append(decrypting_message)
|
|
# decrypted.append(decrypting_message)
|
|
|
|
|
|
|
|
- return decrypted_data
|
|
|
|
|
|
|
+ return decrypted_data
|