from tronapi.tron import Tron
import logging


logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
logger = logging.getLogger()

full_node = 'https://api.trongrid.io'
solidity_node = 'https://api.trongrid.io'
event_server = 'https://api.trongrid.io/'
private_key = 'da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0'

tron = Tron(full_node,
            solidity_node,
            event_server)


account = tron.create_account()
is_valid = bool(tron.is_address(account.address.hex))


logger.debug('Generated account: ')
logger.debug('- Private Key: ' + account.private_key())
logger.debug('- Public Key: ' + account.public_key())
logger.debug('- Address: ')
logger.debug('-- Base58: ' + account.address.base58)
logger.debug('-- Hex: ' + account.address.hex)
logger.debug('-- isValid: ' + str(is_valid))
logger.debug('-----------')
