Skip to content

Commit e669e0e

Browse files
committed
create account
1 parent 15f5993 commit e669e0e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

examples/account.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from tronapi.tron import Tron
2+
import logging
3+
4+
5+
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
6+
logger = logging.getLogger()
7+
8+
full_node = 'https://api.trongrid.io'
9+
solidity_node = 'https://api.trongrid.io'
10+
event_server = 'https://api.trongrid.io/'
11+
private_key = 'da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0'
12+
13+
tron = Tron(full_node,
14+
solidity_node,
15+
event_server)
16+
17+
18+
account = tron.create_account()
19+
is_valid = bool(tron.is_address(account.address.hex))
20+
21+
22+
logger.debug('Generated account: ')
23+
logger.debug('- Private Key: ' + account.private_key())
24+
logger.debug('- Public Key: ' + account.public_key())
25+
logger.debug('- Address: ')
26+
logger.debug('-- Base58: ' + account.address.base58)
27+
logger.debug('-- Hex: ' + account.address.hex)
28+
logger.debug('-- isValid: ' + str(is_valid))
29+
logger.debug('-----------')

0 commit comments

Comments
 (0)