44from web3 import Web3
55from web3 .middleware import geth_poa_middleware
66
7- from coti .crypto_utils import block_size , decrypt
8-
97SOLC_VERSION = '0.8.19'
108
119
@@ -156,35 +154,4 @@ def sign_and_send_tx(web3, private_key, transaction):
156154 tx_receipt = web3 .eth .wait_for_transaction_receipt (tx_hash )
157155 except Exception as e :
158156 raise Exception (f"Failed to wait for the transaction receipt: { e } " )
159- return tx_receipt
160-
161-
162- def decrypt_uint (contract_value , user_key ):
163- # Convert ct to bytes (big-endian)
164- byte_array = contract_value .to_bytes (32 , byteorder = 'big' )
165-
166- # Split ct into two 128-bit arrays r and cipher
167- cipher = byte_array [:block_size ]
168- r = byte_array [block_size :]
169-
170- # Decrypt the cipher
171- decrypted_message = decrypt (user_key , r , cipher )
172-
173- # Print the decrypted cipher
174- decrypted_balance = int .from_bytes (decrypted_message , 'big' )
175-
176- return decrypted_balance
177-
178- def decrypt_string (contract_value , user_key ):
179- string_from_input_tx = ""
180- for input_text_from_tx in contract_value :
181- decrypted_input_from_tx = decrypt_uint (input_text_from_tx , user_key )
182- byte_length = (decrypted_input_from_tx .bit_length () + 7 ) // 8 # calculate the byte length
183-
184- # Convert the integer to bytes
185- decrypted_bytes = decrypted_input_from_tx .to_bytes (byte_length , byteorder = 'big' )
186-
187- # Decode the bytes to a string
188- string_from_input_tx += decrypted_bytes .decode ('utf-8' )
189-
190- return string_from_input_tx
157+ return tx_receipt
0 commit comments