Conversion_Kitchen_Code/kitchen_counter/Blockchain2/web3User.py

29 lines
636 B
Python
Executable File

from web3 import Web3
web3 = Web3(Web3.HTTPProvider("https://rpc-amoy.polygon.technology/"))
# CAddress = '0x953113427cdCA32e360727d1298f9B83f06c23a6'
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):
print(tx,"txx")
response = web3.eth.get_transaction_receipt(tx)
print(response)
return response