diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/FENETRE/block.txt b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/FENETRE/block.txt new file mode 100644 index 00000000..3fb20943 --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/FENETRE/block.txt @@ -0,0 +1,20 @@ +1709306506 N8.txt= -25 +1709306506 N2.txt= +25 +1709306506 N3.txt= -1 +1709306506 N10.txt= +1 +1709306506 N7.txt= -43 +1709306506 N8.txt= +43 +1709306506 N3.txt= -14 +1709306506 N10.txt= +14 +1709306506 N9.txt= -48 +1709306506 N6.txt= +48 +1709306506 N10.txt= -37 +1709306506 N9.txt= +37 +1709306506 N4.txt= -21 +1709306506 N5.txt= +21 +1709306506 N4.txt= -15 +1709306506 N7.txt= +15 +1709306506 N6.txt= -47 +1709306506 N3.txt= +47 +1709306506 N6.txt= -1 +1709306506 N3.txt= +1 diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/FENETRE/chaine.txt b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/FENETRE/chaine.txt new file mode 100644 index 00000000..838700d9 --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/FENETRE/chaine.txt @@ -0,0 +1,200 @@ +1709306497 N2.txt= -6 +1709306497 N4.txt= +6 +1709306497 N2.txt= -23 +1709306497 N7.txt= +23 +1709306497 N2.txt= -31 +1709306497 N8.txt= +31 +1709306497 N3.txt= -42 +1709306497 N8.txt= +42 +1709306497 N4.txt= -16 +1709306497 N8.txt= +16 +1709306497 N5.txt= -9 +1709306497 N3.txt= +9 +1709306497 N9.txt= -27 +1709306497 N10.txt= +27 +1709306497 N8.txt= -29 +1709306497 N10.txt= +29 +1709306497 N8.txt= -19 +1709306497 N4.txt= +19 +1709306497 N1.txt= -23 +1709306497 N9.txt= +23 +1709306498 N7.txt= -34 +1709306498 N5.txt= +34 +1709306498 N7.txt= -8 +1709306498 N4.txt= +8 +1709306498 N6.txt= -46 +1709306498 N4.txt= +46 +1709306498 N9.txt= -18 +1709306498 N5.txt= +18 +1709306498 N2.txt= -40 +1709306498 N3.txt= +40 +1709306498 N1.txt= -42 +1709306498 N9.txt= +42 +1709306498 N7.txt= -21 +1709306498 N10.txt= +21 +1709306498 N4.txt= -27 +1709306498 N8.txt= +27 +1709306498 N10.txt= -33 +1709306498 N1.txt= +33 +1709306498 N3.txt= -7 +1709306498 N10.txt= +7 +1709306499 N7.txt= -26 +1709306499 N6.txt= +26 +1709306499 N5.txt= -1 +1709306499 N3.txt= +1 +1709306499 N7.txt= -49 +1709306499 N10.txt= +49 +1709306499 N9.txt= -26 +1709306499 N3.txt= +26 +1709306499 N6.txt= -11 +1709306499 N10.txt= +11 +1709306499 N5.txt= -19 +1709306499 N9.txt= +19 +1709306499 N6.txt= -8 +1709306499 N3.txt= +8 +1709306499 N3.txt= -22 +1709306499 N5.txt= +22 +1709306499 N8.txt= -42 +1709306499 N5.txt= +42 +1709306499 N7.txt= -47 +1709306499 N6.txt= +47 +1709306500 N7.txt= -33 +1709306500 N5.txt= +33 +1709306500 N3.txt= -41 +1709306500 N7.txt= +41 +1709306500 N6.txt= -25 +1709306500 N3.txt= +25 +1709306500 N1.txt= -22 +1709306500 N8.txt= +22 +1709306500 N7.txt= -4 +1709306500 N8.txt= +4 +1709306500 N2.txt= -47 +1709306500 N3.txt= +47 +1709306500 N1.txt= -30 +1709306500 N9.txt= +30 +1709306500 N10.txt= -43 +1709306500 N1.txt= +43 +1709306500 N6.txt= -11 +1709306500 N1.txt= +11 +1709306500 N6.txt= -21 +1709306500 N8.txt= +21 +1709306501 N6.txt= -16 +1709306501 N8.txt= +16 +1709306501 N5.txt= -28 +1709306501 N6.txt= +28 +1709306501 N8.txt= -29 +1709306501 N4.txt= +29 +1709306501 N7.txt= -41 +1709306501 N10.txt= +41 +1709306501 N3.txt= -48 +1709306501 N6.txt= +48 +1709306501 N2.txt= -12 +1709306501 N9.txt= +12 +1709306501 N5.txt= -18 +1709306501 N4.txt= +18 +1709306501 N1.txt= -27 +1709306501 N2.txt= +27 +1709306501 N9.txt= -20 +1709306501 N2.txt= +20 +1709306501 N4.txt= -30 +1709306501 N8.txt= +30 +1709306502 N5.txt= -26 +1709306502 N10.txt= +26 +1709306502 N10.txt= -39 +1709306502 N6.txt= +39 +1709306502 N10.txt= -18 +1709306502 N4.txt= +18 +1709306502 N1.txt= -7 +1709306502 N3.txt= +7 +1709306502 N10.txt= -20 +1709306502 N2.txt= +20 +1709306502 N2.txt= -42 +1709306502 N5.txt= +42 +1709306502 N6.txt= -7 +1709306502 N2.txt= +7 +1709306502 N3.txt= -36 +1709306502 N1.txt= +36 +1709306502 N7.txt= -30 +1709306502 N10.txt= +30 +1709306502 N2.txt= -15 +1709306502 N6.txt= +15 +1709306503 N4.txt= -13 +1709306503 N8.txt= +13 +1709306503 N2.txt= -28 +1709306503 N9.txt= +28 +1709306503 N10.txt= -37 +1709306503 N1.txt= +37 +1709306503 N6.txt= -8 +1709306503 N1.txt= +8 +1709306503 N10.txt= -39 +1709306503 N6.txt= +39 +1709306503 N1.txt= -20 +1709306503 N3.txt= +20 +1709306503 N10.txt= -33 +1709306503 N4.txt= +33 +1709306503 N5.txt= -34 +1709306503 N9.txt= +34 +1709306503 N6.txt= -17 +1709306503 N4.txt= +17 +1709306503 N4.txt= -41 +1709306503 N5.txt= +41 +1709306504 N3.txt= -42 +1709306504 N10.txt= +42 +1709306504 N2.txt= -48 +1709306504 N1.txt= +48 +1709306504 N10.txt= -1 +1709306504 N2.txt= +1 +1709306504 N8.txt= -47 +1709306504 N5.txt= +47 +1709306504 N4.txt= -4 +1709306504 N1.txt= +4 +1709306504 N7.txt= -36 +1709306504 N10.txt= +36 +1709306504 N8.txt= -43 +1709306504 N5.txt= +43 +1709306504 N2.txt= -1 +1709306504 N10.txt= +1 +1709306504 N4.txt= -48 +1709306504 N10.txt= +48 +1709306504 N6.txt= -35 +1709306504 N7.txt= +35 +1709306505 N9.txt= -8 +1709306505 N2.txt= +8 +1709306505 N9.txt= -4 +1709306505 N2.txt= +4 +1709306505 N7.txt= -26 +1709306505 N10.txt= +26 +1709306505 N10.txt= -21 +1709306505 N7.txt= +21 +1709306505 N8.txt= -31 +1709306505 N7.txt= +31 +1709306505 N8.txt= -11 +1709306505 N10.txt= +11 +1709306505 N1.txt= -22 +1709306505 N6.txt= +22 +1709306505 N3.txt= -16 +1709306505 N5.txt= +16 +1709306505 N8.txt= -19 +1709306505 N3.txt= +19 +1709306505 N6.txt= -10 +1709306505 N4.txt= +10 +1709306506 N8.txt= -25 +1709306506 N2.txt= +25 +1709306506 N3.txt= -1 +1709306506 N10.txt= +1 +1709306506 N7.txt= -43 +1709306506 N8.txt= +43 +1709306506 N3.txt= -14 +1709306506 N10.txt= +14 +1709306506 N9.txt= -48 +1709306506 N6.txt= +48 +1709306506 N10.txt= -37 +1709306506 N9.txt= +37 +1709306506 N4.txt= -21 +1709306506 N5.txt= +21 +1709306506 N4.txt= -15 +1709306506 N7.txt= +15 +1709306506 N6.txt= -47 +1709306506 N3.txt= +47 +1709306506 N6.txt= -1 +1709306506 N3.txt= +1 diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/FENETRE/script.py b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/FENETRE/script.py new file mode 100644 index 00000000..c6b1e1d5 --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/FENETRE/script.py @@ -0,0 +1,80 @@ +import os +import random +import time + +folder_user = './../LACHAINE' + +def genesis(): + print("Lancement de la chaine") + with open("chaine.txt", "w") as fichier: + fichier.write("") + +def get_users_account(): + if os.path.isdir(folder_user): + users_name = os.listdir(folder_user) + return users_name + +def regeneration_account(users_name): + for user in users_name: + with open(os.path.join(folder_user, user), "w") as fichier: + fichier.write("N=100") + +def create_block(users_name): + with open("block.txt", "w") as fichier: + fichier.write("") + for i in range(10): + transaction = create_transaction(users_name) + +def create_transaction(users_name): + debtor = random.choice(users_name) + creditor = random.choice(users_name) + while debtor == creditor: + creditor = random.choice(users_name) + payment = random.randint(1, 50) + print('debtor:', debtor, 'creditor:', creditor, 'payment:', payment) + debit_value(debtor, payment) + credit_value(creditor, payment) + with open("block.txt", "a") as fichier: + timestamp = int(time.time()) + fichier.write(str(timestamp)+' '+debtor+"= -"+str(payment)+'\n') + fichier.write(str(timestamp)+' '+creditor+"= +"+str(payment)+'\n') + +def debit_value(debtor, payment): + with open(os.path.join(folder_user, debtor), "r") as fichier: + account = fichier.read() + account_value = int(account.split("=")[1]) + new_account_value = "N="+ str(account_value - payment) + with open(os.path.join(folder_user, debtor), "w") as fichier: + fichier.write(new_account_value) + + +def credit_value(creditor, payment): + with open(os.path.join(folder_user, creditor), "r") as fichier: + account = fichier.read() + account_value = int(account.split("=")[1]) + new_account_value = "N="+ str(account_value + payment) + with open(os.path.join(folder_user, creditor), "w") as fichier: + fichier.write(new_account_value) + + +def get_account_value(user): + path = os.path.join(folder_user, user) + with open(path, "r") as fichier: + contenu_lu = fichier.read() + print(user, contenu_lu) + +def push_to_chaine(): + with open("block.txt", "r") as fichier: + block = fichier.read() + with open("chaine.txt", "a") as fichier: + fichier.write(block) + +genesis() +users_name = get_users_account() +regeneration_account(users_name) +for i in range(10): + time.sleep(1) + create_block(users_name) + push_to_chaine() + + diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N1.txt b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N1.txt new file mode 100644 index 00000000..7aca9f73 --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N1.txt @@ -0,0 +1 @@ +N=127 \ No newline at end of file diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N10.txt b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N10.txt new file mode 100644 index 00000000..05e862c5 --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N10.txt @@ -0,0 +1 @@ +N=199 \ No newline at end of file diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N2.txt b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N2.txt new file mode 100644 index 00000000..7a5dbb1f --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N2.txt @@ -0,0 +1 @@ +N=-81 \ No newline at end of file diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N3.txt b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N3.txt new file mode 100644 index 00000000..a68aed42 --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N3.txt @@ -0,0 +1 @@ +N=81 \ No newline at end of file diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N4.txt b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N4.txt new file mode 100644 index 00000000..c4b9aa0b --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N4.txt @@ -0,0 +1 @@ +N=89 \ No newline at end of file diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N5.txt b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N5.txt new file mode 100644 index 00000000..4911f7aa --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N5.txt @@ -0,0 +1 @@ +N=324 \ No newline at end of file diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N6.txt b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N6.txt new file mode 100644 index 00000000..e38925bd --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N6.txt @@ -0,0 +1 @@ +N=149 \ No newline at end of file diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N7.txt b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N7.txt new file mode 100644 index 00000000..f677bfe4 --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N7.txt @@ -0,0 +1 @@ +N=-132 \ No newline at end of file diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N8.txt b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N8.txt new file mode 100644 index 00000000..08fd8625 --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N8.txt @@ -0,0 +1 @@ +N=70 \ No newline at end of file diff --git a/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N9.txt b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N9.txt new file mode 100644 index 00000000..b8840b55 --- /dev/null +++ b/adventure/BLOCKCHAIN/gaetan.corin@ynov.com/LACHAINE/N9.txt @@ -0,0 +1 @@ +N=174 \ No newline at end of file