英文:
Convert wallet address on Tron
问题
我需要从Trone网络上的TRC-20交易中获取钱包地址。
我发现这个信息可以从输入字段中提取。我使用web3.js来解析这个字段并获得一个类似的地址:
0xee564858c4874cac2d1fff98c1eabba915f50b2f
但我希望它像这样:
TXhRBjb8GDnodu3VY6vgmNXcGnLpQhm9NW
我找不到如何进行转换的信息。
英文:
I need to get the wallet address from the trc-20 transaction on the Trone network.
I found out that this info can be taken from the input field. I use web3.js to parse this field and get an address like
0xee564858c4874cac2d1fff98c1eabba915f50b2f
But I need it to be like
TXhRBjb8GDnodu3VY6vgmNXcGnLpQhm9NW
I can't find the info how to convert it
答案1
得分: 0
tronWeb.address.toHex :
将Base58格式的地址转换为十六进制格式
const convertedAddress = tronWeb.address.toHex(givenAddress);
tronWeb.address.fromHex :
将十六进制字符串格式的地址转换为Base58格式的地址
const convertedAddress = tronWeb.address.fromHex(givenAddress);
tronWeb.address.fromPrivateKey :
根据私钥派生相应的地址
const givenAddress = tronWeb.address.fromPrivateKey(privateKey);
源链接:link
英文:
tronWeb.address.toHex :
Convert Base58 format addresses to Hex
const convertedAddress = tronWeb.address.toHex(givenAddress);
tronWeb.address.fromHex :
Convert Hexstring format address to Base58 format address
const convertedAddress = tronWeb.address.fromHex(givenAddress);
tronWeb.address.fromPrivateKey :
Derive its corresponding address based on the private key
const givenAddress = tronWeb.address.fromPrivateKey(privateKey);
source link
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论