Esempio n. 1
0
 def sign_and_serialize_transaction(self, transaction):
     txn_from = to_address(transaction['from'])
     if txn_from not in self.keys:
         raise KeyError("No signing key registered for from address: {0}".format(txn_from))
     transaction = Transaction(
         nonce=to_decimal(transaction['nonce']),
         gasprice=to_decimal(transaction['gasPrice']),
         startgas=to_decimal(transaction['gas']),
         to=transaction['to'],
         value=to_decimal(transaction['value']),
         data=decode_hex(transaction['data']),
     )
     transaction.sign(self.keys[txn_from])
     assert to_address(transaction.sender) == txn_from
     return rlp.encode(transaction, Transaction)
Esempio n. 2
0
 def sign_and_serialize_transaction(self, transaction):
     txn_from = to_normalized_address(transaction['from'])
     if txn_from not in self.keys:
         raise KeyError("No signing key registered for from address: {0}".format(txn_from))
     transaction = Transaction(
         nonce=to_decimal(transaction['nonce']),
         gasprice=to_decimal(transaction['gasPrice']),
         startgas=to_decimal(transaction['gas']),
         to=transaction['to'],
         value=to_decimal(transaction['value']),
         data=decode_hex(transaction['data']),
     )
     transaction.sign(self.keys[txn_from])
     assert to_normalized_address(transaction.sender) == txn_from
     return rlp.encode(transaction, Transaction)
Esempio n. 3
0
 def recoverTransaction(self, serialized_transaction):
     txn_bytes = HexBytes(serialized_transaction)
     txn = Transaction.from_bytes(txn_bytes)
     msg_hash = hash_of_signed_transaction(txn)
     if sys.version_info.major < 3:
         msg_hash = to_hex(msg_hash)
     return self.recover(msg_hash, vrs=vrs_from(txn))
Esempio n. 4
0
 def recoverTransaction(self, serialized_transaction):
     txn_bytes = HexBytes(serialized_transaction)
     txn = Transaction.from_bytes(txn_bytes)
     msg_hash = hash_of_signed_transaction(txn)
     return self.recover(msg_hash, vrs=vrs_from(txn))
Esempio n. 5
0
 def recoverTransaction(self, serialized_transaction):
     txn_bytes = HexBytes(serialized_transaction)
     txn = Transaction.from_bytes(txn_bytes)
     msg_hash = hash_of_signed_transaction(txn)
     return self.recover(msg_hash, vrs=vrs_from(txn))