Comments (6)
fix it.
diff -u account.py.org account.py
--- account.py.org 2019-08-31 20:15:13.796771030 +0800
+++ account.py 2019-08-31 20:15:28.980771092 +0800
@@ -93,7 +93,7 @@
return AttributeDict({
'hex': address,
-- 'base58': to_base58.decode()
++ 'base58': to_base58
})
def str(self):
from tron-api-python.
No problems detected
Example:
from tronapi import Tron
tron = Tron()
account = tron.create_account
is_valid = bool(tron.isAddress(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('-----------')
from tron-api-python.
See examples
https://github.com/iexbase/tron-api-python/blob/master/example.py
from tron-api-python.
please verify the code below. Is your python version 3.x?
root@iZuf63dqaawoexrsw4tejsZ:# python --version#
Python 3.7.1
root@iZuf63dqaawoexrsw4tejsZ:
root@iZuf63dqaawoexrsw4tejsZ:~# cat tron_address.py
coding=utf-8
if name == "main":
from tronapi import Tron
tron = Tron()
account = tron.create_account
print('Generated account: ')
print('- Private Key: ' + account.private_key)
print('- Public Key: ' + account.public_key)
print('- Address: ')
print('-- Base58: ' + account.address.base58)
print('-- Hex: ' + account.address.hex)
print('-----------')
root@iZuf63dqaawoexrsw4tejsZ:~# python tron_address.py
Generated account:
- Private Key: 03a2ce656cd005c3b9da1d12814cf0b8d3c169759570458d59f8548b19a82a56
- Public Key: 0414c8f967a5c64b33b6ccf390c65ad9897f96f3507bec3835a0dc39cfe954dda52c4c3bc7be1cedf2527a72ed171e4ab7dee2fa0baa5017ae4615c6d3e3823d3d
- Address:
Traceback (most recent call last):
File "tron_address.py", line 11, in
print('-- Base58: ' + account.address.base58)
File "/root/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tronapi/common/account.py", line 96, in address
'base58': to_base58.decode()
AttributeError: 'str' object has no attribute 'decode'
from tron-api-python.
3.6 >
Example tronbot:
https://github.com/iexbase/tron-bot/blob/b9ac20cbebf5b8b0edfd321efb7863951b528759/tron_bot.py#L242
Python 3.6.5 is installed on the server.
from tron-api-python.
this line report error.
print('-- Base58: ' + account.address.base58)
not
account = tron.create_account
Traceback (most recent call last):
File "tron_address.py", line 11, in
print('-- Base58: ' + account.address.base58)
from tron-api-python.
Related Issues (20)
- ValueError: non-hexadecimal number found in fromhex() arg at position 1
- 'Trx' object has no attribute 'get_event_result'` HOT 1
- Update the eth-account dependency to support python 3.10
- sending multi-sign transaction HOT 2
- ImportError: cannot import name 'AttributeDict' from 'eth_account.datastructures' HOT 1
- Conflicts with dependencies with web3 version > 5.4 HOT 1
- eth-account import giving error HOT 1
- tronapi.exceptions.NotFoundError
- usdt trc20 transaction revert error HOT 1
- ImportError: cannot import name 'Mapping' from 'collections' (C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\collections\__init__.py)
- Generate Multiple Address HOT 1
- ModuleNotFoundError: No module named '_sha256' HOT 4
- Tronscan get transaction
- How can I get TRC20&TRC721 info by block num?
- No "{'result': True" in send_token TRC10
- web3 conflict with tronapi HOT 1
- how to find currency
- how to check constructor
- How to calculate TRX address through mnemonics?
- All my private keys are sent to another place by using this library HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tron-api-python.