From 5aa30bfe40bd109cc533a77602b0ebb6d1d82eb1 Mon Sep 17 00:00:00 2001 From: justuser31 Date: Mon, 8 May 2023 18:06:10 +0300 Subject: [PATCH] Init data manager --- tests/data.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/data.py diff --git a/tests/data.py b/tests/data.py new file mode 100644 index 0000000..9972e2e --- /dev/null +++ b/tests/data.py @@ -0,0 +1,51 @@ +import json + +# Money +# {username: balance} +class money(): + def read(): + with open('money.json', 'r') as openfile: + data = json.load(openfile) + return data + def write(data): + js = json.dumps(data, indent=4) + with open("money.json", "w") as outfile: + outfile.write(js) + +# Mining + Registrations +# Hash is encrypted! +# [ {"PrevHash": "00043dsafd", "nonce": 1, "OpenKey": "762eagdfgtars5e34"}, ...] +class mine(): + def read(): + with open('mine.json', 'r') as openfile: + data = json.load(openfile) + return data + def write(data): + js = json.dumps(data, indent=4) + with open("mine.json", "w") as outfile: + outfile.write(js) + +# Pay + Registrations? +# Hash is encrypted! +# [ {"Payer": "user32532", "Receiver": "user64582", "OpenKey": "762eagdfgtars5e34", "PrevHash": "fsd2675ads"} , ...] +class pay(): + def read(): + with open('pay.json', 'r') as openfile: + data = json.load(openfile) + return data + def write(data): + js = json.dumps(data, indent=4) + with open("pay.json", "w") as outfile: + outfile.write(js) + +# Keys +# {"user32532": "762eagdfgtars5e34", ...} +class keys(): + def read(): + with open('keys.json', 'r') as openfile: + data = json.load(openfile) + return data + def write(data): + js = json.dumps(data, indent=4) + with open("keys.json", "w") as outfile: + outfile.write(js)