Move.

帖子

分享您的知识。

Bolke .
Jan 26, 2025
专家问答

How to convert a public key to a Sui address?

I'm trying to convert a public key to a Sui address, but I'm unsure how to do this with Sui Move. I found some information about using BLAKE2b hashing function, but I'm not clear on why Sui Move doesn't provide a straightforward function for such an important task. How can I go about this conversion?

  • Move CLI
3
2
分享
评论
.

答案

2
Xavier.eth.
Jan 27 2025, 05:55

要将公钥转换为 Sui 地址,您需要使用 Blake2B 哈希函数对与公钥字节串联的签名方案标志字节进行哈希处理. Sui 地址将是 32 字节的哈希值. 你可以在 sui lib 中找到 Blake2B 哈希函数. 如果你正在寻找 Rust 示例,可以在 这里 查看.

3
最佳答案
评论
.
skywinder.
Jan 26 2025, 10:09

尽管Sui Move不直接提供此功能,但如上所述使用Blake2B哈希函数应该可以获得所需的Sui地址. 将标志字节与您的公钥字节串联起来是此过程中的关键步骤.

2
评论
.

你知道答案吗?

请登录并分享。

我们使用 cookie 确保您在我们的网站上获得最佳体验。
更多信息