from pprint import pprint
from web3 import Web3

NODE_URL = "YOUR_CHAINSTACK_POLYGON_RPC" # This needs to be running on BOR and the eth_getTransactionReceiptsByBlock method is only available there
ADDRESS = '0x371ef444a12b951b492f19ed6343a8aac6fdca55' # Edit with the address you need to monitor

def decimal_to_hex(decimal_number):
    """Convert a decimal number to its hexadecimal representation."""
    return hex(decimal_number)

def hex_to_decimal(hex_string):
    """Convert a hexadecimal string to its decimal representation."""
    return int(hex_string, 16)

def get_logs_for_address(address, block_receipts):
    """
    Fetch and print logs for a given Ethereum address from the provided block receipts.
    """
    receipts = block_receipts.get('result', [])
    for receipt in receipts:
        if receipt['to'] == address:
            print('Block number:' , hex_to_decimal(receipt['blockNumber']))
            print('Transaction hash:', receipt['transactionHash'])
            print('To:' , receipt['to'], '\n')
            print('Logs:')
            pprint(receipt['logs'])

def main():
    web3 = Web3.HTTPProvider(NODE_URL)

    block = 45941582
    hex_block = decimal_to_hex(block)

    try:
        block_receipts = web3.make_request('eth_getTransactionReceiptsByBlock', [hex_block])
        get_logs_for_address(ADDRESS, block_receipts)
    except Exception as e:
        print(f"An error occurred: {e}")

if __name__ == "__main__":
    main()
{"success":true}
from pprint import pprint
from web3 import Web3

NODE_URL = "YOUR_CHAINSTACK_POLYGON_RPC" # This needs to be running on BOR and the eth_getTransactionReceiptsByBlock method is only available there
ADDRESS = '0x371ef444a12b951b492f19ed6343a8aac6fdca55' # Edit with the address you need to monitor

def decimal_to_hex(decimal_number):
    """Convert a decimal number to its hexadecimal representation."""
    return hex(decimal_number)

def hex_to_decimal(hex_string):
    """Convert a hexadecimal string to its decimal representation."""
    return int(hex_string, 16)

def get_logs_for_address(address, block_receipts):
    """
    Fetch and print logs for a given Ethereum address from the provided block receipts.
    """
    receipts = block_receipts.get('result', [])
    for receipt in receipts:
        if receipt['to'] == address:
            print('Block number:' , hex_to_decimal(receipt['blockNumber']))
            print('Transaction hash:', receipt['transactionHash'])
            print('To:' , receipt['to'], '\n')
            print('Logs:')
            pprint(receipt['logs'])

def main():
    web3 = Web3.HTTPProvider(NODE_URL)

    block = 45941582
    hex_block = decimal_to_hex(block)

    try:
        block_receipts = web3.make_request('eth_getTransactionReceiptsByBlock', [hex_block])
        get_logs_for_address(ADDRESS, block_receipts)
    except Exception as e:
        print(f"An error occurred: {e}")

if __name__ == "__main__":
    main()
{"success":true}