def recoverTransactionRaw(rawTx): try: from transactions import Transaction, vrs_from from signing import hash_of_signed_transaction except Exception as e: logger.info('import eth_account path') eth_dir = eth_account.__path__[0] lib_path = os.path.abspath(os.path.join(eth_dir, 'internal')) sys.path.append(lib_path) from transactions import Transaction, vrs_from from signing import hash_of_signed_transaction txn_bytes = HexBytes(rawTx) txn = Transaction.from_bytes(txn_bytes) msg_hash = hash_of_signed_transaction(txn) sender = eth_account.Account.recoverHash(msg_hash, vrs=vrs_from(txn)) txn.sender = sender return txn