from struct import unpack import json from .tools import * from binascii import hexlify, unhexlify class Transaction(dict): def __init__(self, raw_tx = None): self["txId"] = None self["hash"] = None self["version"] = None self["size"] = 0 self["vSize"] = 0 self["bSize"] = 0 self["lockTime"] = None self["vIn"] = dict() self["vOut"] = dict() self["rawTx"] = None self["blockHash"] = None self["confirmations"] = None self["time"] = None self["blockTime"] = None self["blockIndex"] = None self["coinbase"] = None self["fee"] = None self["data"] = None self["amount"] = 0 if raw_tx is None: return stream = self.get_stream(raw_tx) start = stream.tell() (self["version"],) = unpack('