from web3 import Web3 from web3.middleware import geth_poa_middleware web3 = Web3(Web3.HTTPProvider("https://rpc-amoy.polygon.technology/")) # CAddress = '0x953113427cdCA32e360727d1298f9B83f06c23a6' web3.middleware_onion.inject(geth_poa_middleware, layer=0) def get_user_Balance(public_key): # Get the balance of the Ethereum address balance_wei = web3.eth.get_balance(public_key) # Convert the balance from Wei to Ether balance_eth = web3.fromWei(balance_wei, 'ether') return balance_eth # get_user_Balance("0x283d407Df981Ce546c650c168D7A5Bf238360314") def get_transction_recipt(tx): response = web3.eth.get_transaction_receipt(tx) timestamp = web3.eth.get_block(response.blockNumber).timestamp return response,timestamp # get_transction_recipt("0xfacda3343495205bf1de5cfe096290c82c6fafcf319844935139b883e00c47c8") def mypublickey(key): acc1 = web3.eth.account.from_key(key).address return acc1