将Tron上的钱包地址转换为(Translate wallet address on Tron)

huangapple go评论70阅读模式
英文:

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

huangapple
  • 本文由 发表于 2023年2月14日 20:51:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/75448102.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定