Пример #1
0
 def createSignaturePrecommitedBlock(cryptor: NooCrypto, pblock: str,
                                     hash: str):
     temp = json.dumps(
         {
             'TT': 'SG',
             'SENDER': cryptor.getPublicKey(),
             'HASH': hash,
             'SIGNPB': cryptor.signMessage(pblock)
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(temp)
     jtemp = json.loads(temp)
     jtemp.update({'SIGNATURE': sign})
     return json.dumps(jtemp, separators=(',', ':'))
Пример #2
0
 def createCommitBlockForResendHash(cryptor: NooCrypto, block: str,
                                    bheight: int):
     block = json.dumps(
         {
             'TT': 'CBRH',
             'SENDER': cryptor.getPublicKey(),
             "HASH": NooTree.hash(block),
             "STEM_SIGNATURE": cryptor.signMessage(block),
             "BHEIGHT": bheight
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(block)
     jblock = json.loads(block)
     jblock.update({'SIGNATURE': sign})
     return json.dumps(jblock, separators=(',', ':'))
Пример #3
0
 def badAnswer(cryptor: NooCrypto):
     temp = json.dumps({
         'TT': 'BAN',
         'SENDER': cryptor.getPublicKey()
     },
                       separators=(',', ':'))
     sign = cryptor.signMessage(temp)
     jtemp = json.loads(temp)
     jtemp.update({'SIGNATURE': sign})
     return json.dumps(jtemp, separators=(',', ':'))
Пример #4
0
 def universalPacket(cryptor: NooCrypto, type: str, value):
     temp = json.dumps(
         {
             'TT': type,
             'DATA': value,
             'SENDER': cryptor.getPublicKey()
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(temp)
     jtemp = json.loads(temp)
     jtemp.update({'SIGNATURE': sign})
     return json.dumps(jtemp, separators=(',', ':'))
Пример #5
0
 def benchmarkTesting(cryptor: NooCrypto, uuid: str):
     temp = json.dumps(
         {
             'TT': 'BT',
             'SENDER': cryptor.getPublicKey(),
             'START': uuid
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(temp)
     jtemp = json.loads(temp)
     jtemp.update({'SIGNATURE': sign})
     return json.dumps(jtemp, separators=(',', ':'))
Пример #6
0
 def giveAllSizeBlock(cryptor: NooCrypto, NBH: int):
     temp = json.dumps(
         {
             'TT': 'ASB',
             'SENDER': cryptor.getPublicKey(),
             "NBH": NBH
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(temp)
     jtemp = json.loads(temp)
     jtemp.update({'SIGNATURE': sign})
     return json.dumps(jtemp, separators=(',', ':'))
Пример #7
0
 def createCommitBlockForResend(cryptor: NooCrypto, block: str):
     block = json.dumps(
         {
             'TT': 'CBR',
             'SENDER': cryptor.getPublicKey(),
             "BLOCK": json.loads(block)
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(block)
     jblock = json.loads(block)
     jblock.update({'SIGNATURE': sign})
     return json.dumps(jblock, separators=(',', ':'))
Пример #8
0
 def myBenchmarkResult(cryptor: NooCrypto, result: str, start: str):
     temp = json.dumps(
         {
             'TT': 'MBR',
             'SENDER': cryptor.getPublicKey(),
             'RESULT': result,
             'START': start
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(temp)
     jtemp = json.loads(temp)
     jtemp.update({'SIGNATURE': sign})
     return json.dumps(jtemp, separators=(',', ':'))
Пример #9
0
 def createСomplaint(cryptor: NooCrypto, evidence_block: str,
                     evidence_transaction: str):
     temp = json.dumps(
         {
             'TT': 'COMPLAINT',
             'SENDER': cryptor.getPublicKey(),
             'EVIDENCE_BLOCK': evidence_block,
             'EVIDENCE_TRANSACTION': evidence_transaction
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(temp)
     jtemp = json.loads(temp)
     jtemp.update({'SIGNATURE': sign})
     return json.dumps(jtemp, separators=(',', ':'))
Пример #10
0
 def createCommitBlock(cryptor: NooCrypto, preCommitedBlock: str,
                       signs: list):
     block = json.dumps(
         {
             'TT': 'CB',
             'SENDER': cryptor.getPublicKey(),
             "BLOCK": json.loads(preCommitedBlock),
             "SIGNATURES": signs
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(block)
     jblock = json.loads(block)
     jblock.update({'SIGNATURE': sign})
     return json.dumps(jblock, separators=(',', ':'))
Пример #11
0
 def applicantTransaction(
         cryptor: NooCrypto, ip: str
 ):  # Транзакция заявка на участие в следующем туре валидации
     temp = json.dumps(
         {
             'TT': 'AT',
             'SENDER': cryptor.getPublicKey(),
             'IPADDR': ip,
             "TST": str(int(time.time()))
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(temp)
     jtemp = json.loads(temp)
     jtemp.update({'SIGNATURE': sign})
     return json.dumps(jtemp, separators=(',', ':'))
Пример #12
0
 def createPurifierBlock(cryptor: NooCrypto, addressList: list,
                         keyList: list, bheight: int):
     temp = json.dumps(
         {
             'TT': 'PURIFIER',
             'SENDER': cryptor.getPublicKey(),
             'CLEAN_LIST': addressList,
             'CLEAN_KEY_LIST': keyList,
             "BHEIGHT": bheight
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(temp)
     jtemp = json.loads(temp)
     jtemp.update({'SIGNATURE': sign})
     return json.dumps(jtemp, separators=(',', ':'))
Пример #13
0
 def chooserTransaction(
         cryptor: NooCrypto,
         blockchain_height):  # Транзакция выбора ноды для работы
     temp = json.dumps(
         {
             'TT': 'CT',
             'SENDER': cryptor.getPublicKey(),
             "NBH": blockchain_height,
             "TST": str(int(time.time()))
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(temp)
     jtemp = json.loads(temp)
     jtemp.update({'SIGNATURE': sign})
     return json.dumps(jtemp, separators=(',', ':'))
Пример #14
0
 def voteTransaction(
     cryptor: NooCrypto, reciever: str, vote_count: int
 ):  # Транзакция заявка на участие в следующем туре валидации
     temp = json.dumps(
         {
             'TT': 'AT',
             'SENDER': cryptor.getPublicKey(),
             'RECEIVER': reciever,
             'VOTES': vote_count,
             "TST": str(int(time.time()))
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(temp)
     jtemp = json.loads(temp)
     jtemp.update({'SIGNATURE': sign})
     return json.dumps(jtemp, separators=(',', ':'))
Пример #15
0
 def standartTransaction(
         cryptor: NooCrypto, reciever: str, token_count: int,
         token_type: str):  # Стандартная транзакция перевода средств
     temp = json.dumps(
         {
             'TT': 'ST',
             'SENDER': cryptor.getPublicKey(),
             'RECEIVER': reciever,
             'TTOKEN': token_type,
             'CTOKEN': str(token_count),
             "TST": str(int(time.time()))
         },
         separators=(',', ':'))
     sign = cryptor.signMessage(temp)
     jtemp = json.loads(temp)
     jtemp.update({'SIGNATURE': sign})
     return json.dumps(jtemp, separators=(',', ':'))
Пример #16
0
    def createPrecommitBlock(cryptor: NooCrypto, ver: str, transactions: set,
                             bheight: int, fee: float):
        jtransactions = []
        for tran in transactions:
            jtransactions.append(json.loads(tran))

        block = json.dumps(
            {
                'TT': 'BL',
                'SENDER': cryptor.getPublicKey(),
                'VERSION': ver,
                'TCOUNT': len(jtransactions),
                "BHEIGHT": bheight,
                'TRANSACTIONS': jtransactions,
                'FEE': fee
            },
            separators=(',', ':'))
        sign = cryptor.signMessage(block)
        jblock = json.loads(block)
        jblock.update({'SIGNATURE': sign})

        return json.dumps(jblock, separators=(',', ':'))