def loado(cls, o: typing.Mapping[str, typing.Any]) -> 'Transaction':
     """Load from JSON-serializable object"""
     return cls(sender=stobin(o["sender"]),
                recipient=stobin(o["recipient"]),
                amount=o["amount"],
                inputs=[TransactionInput.loado(i) for i in o["inputs"]],
                outputs=[TransactionOutput.loado(out) for out in o["outputs"]],
                id_=stobin(o["id"]),
                signature=stobin(o["signature"]))
Exemple #2
0
 def loado(cls, o: typing.Mapping[str, typing.Any]) -> 'Block':
     """Load from JSON-serializable object"""
     current_hash = o["current_hash"]
     return cls(
         index=o["index"],
         previous_hash=stobin(o["previous_hash"]),
         timestamp=o["timestamp"],
         transactions=[Transaction.loado(t) for t in o["transactions"]],
         nonce=o["nonce"],
         current_hash=stobin(current_hash)
         if current_hash is not None else None)
Exemple #3
0
def getBlock(blockId=None):
    if blockId is not None:
        blockId = util.stobin(blockId)
    return blockchain.get_block(blockId)
 def loado(cls, o: typing.Mapping[str, typing.Any]) -> 'TransactionOutput':
     """Load from JSON-serializable object"""
     return cls(index=o["index"],
                recipient=stobin(o["recipient"]),
                amount=o["amount"])
 def loado(cls, o: typing.Mapping[str, typing.Any]) -> 'TransactionInput':
     """Load from JSON-serializable object"""
     return TransactionInput(stobin(o["transaction_id"]),
                             o["index"])