How can I find user public address from his private key ? Already I found a way to convert public to hex Address also private to hex and reverse but get stuck in this one !
Asked
Active
Viewed 2,488 times
3 Answers
4
Using TronWeb, you can call this function:
const address = tronWeb.address.fromPrivateKey(newAccount.privateKey);
That code comes from one of TronWeb's tests

joeytwiddle
- 29,306
- 13
- 121
- 110
-
any equivalent for tronpy? I can't find this in the tronpy docs. – dezhi Nov 15 '22 at 14:08
0
for bitcoin you need use this package to find public key => dart_wif
print('hex :::::: ${HEX.encode(index.privateKey!)}');
WIF decoded = WIF(version: 128, privateKey: index.privateKey!, compressed: true);
String key = wif.encode(decoded);
print(key);

sajjad hajizadeh
- 11
- 3
0
If you are using python, the official tronpy document doesn't mentioned this. However, you can find the answer by yourself.
Open ipython from terminal, create a key object from a random key, input the key variable name and press tab twice, you will see all the attributes and functions of the object.
import tronpy
my_random_key = tronpy.keys.PrivateKey.random()
my_key = tronpy.keys.PrivateKey.fromhex(my_random_key)
my_key.public_key.to_base58check_address()

dezhi
- 809
- 8
- 10