Beispiel #1
0
 def deserialize_output_json(j_output):
     o = Output()
     o.value = int(j_output['value'])
     o.recipient_address = bytearray.fromhex(j_output['recipient'])
     o.script_pub_key = j_output['script_pub_key']
     o.script_pub_key_size = int(j_output['script_pub_key_size'])
     return o
Beispiel #2
0
 def deserialize_output(s):
     padd = 0
     r_o = Output()
     r_o.value = int.from_bytes(bytearray.fromhex(s[0:16]), byteorder='little')  #? value
     padd += 16
     s = s[16:]
     r_o.script_pub_key_size, v_int = var_int.varint_to_int(s)                     #? script pub_key size
     padd += v_int
     s = s[v_int:]
     r_o.script_pub_key = s[0:r_o.script_pub_key_size * 2]                       #? script pub_key
     padd += r_o.script_pub_key_size * 2
     a_len , v_int = var_int.varint_to_int(r_o.script_pub_key[5:7])
     r_o.recipient_address = r_o.script_pub_key[5 + v_int: a_len]            #? p2pkh getting addres from 
     return (r_o, padd)