get_nonce

Function

def get_nonce(address, attempts=18):
    while attempts > 0:
        try:
            return web3.eth.get_transaction_count(web3.to_checksum_address(address))
        except Exception as e:
            logging.debug(e)
            time.sleep(1)
            attempts -= 1
    return -1

Description

  • Loop while there are attempts remaining

  • Return the transaction count for the address