Пример #1
0
 def header_to_string(self, res):
     s = int_to_hex(res.get('version'),4) \
         + rev_hex(res.get('prev_block_hash')) \
         + rev_hex(res.get('merkle_root')) \
         + int_to_hex(int(res.get('timestamp')),4) \
         + int_to_hex(int(res.get('bits')),4) \
         + int_to_hex(int(res.get('nonce')),4)
     return s
Пример #2
0
 def header_to_string(self, res):
     s = int_to_hex(res.get('version'),4) \
         + rev_hex(res.get('prev_block_hash')) \
         + rev_hex(res.get('merkle_root')) \
         + int_to_hex(int(res.get('timestamp')),4) \
         + int_to_hex(int(res.get('bits')),4) \
         + int_to_hex(int(res.get('nonce')),4)
     return s
Пример #3
0
    def transaction_serialize(self, tx, for_sig, fields):
        unix_time = getattr(tx, 'timestamp', None)
        if unix_time is None:
            unix_time = int(time.time())
        timestamp = ('timestamp', int_to_hex(unix_time, 4))
        fields.insert(1, timestamp)

        tx_version = getattr(tx, 'version', 1)
        if tx_version < TX_VERSION_CLAMSPEECH:
            return
        else:
            txver = ('version', int_to_hex(tx_version, 4))
            fields[0] = txver

        speech = ('clamspeech', getattr(tx, 'clamspeech', '').encode('hex'))
        speech_len = ('clamspeech_len', var_int(len(speech[1])/2))
        fields.insert(-1,  speech_len)
        fields.insert(-1,  speech)
Пример #4
0
 def transaction_serialize(self, tx, for_sig, fields):
     unix_time = getattr(tx, 'timestamp', None)
     if unix_time is None:
         unix_time = int(time.time())
     timestamp = ('timestamp', [int_to_hex(unix_time, 4)])
     fields.insert(1, timestamp)