Phantom Wallet (Solana) 使用什么算法来签署消息?

发布于 2025-01-17 05:56:11 字数 51 浏览 1 评论 0原文

我试图了解当我们调用 window.solana.signMessage 时会发生什么。

I am trying to understand what happens under the hood when we call window.solana.signMessage.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随波逐流 2025-01-24 05:56:11

Solana 使用 ed25519 曲线进行加密,因此交易签名为:

R(32 字节)和 S(32 字节)的 64 字节 ed25519 签名。要求R是非小阶的压缩Edwards点并且S是0 <= S < 范围内的标量。 L. 此要求确保没有签名延展性。

实际调用的代码是 tweetnaclsign.detached 函数。

更多信息请参阅官方文档:https://docs.solana.com/terminology#signature

Solana 交易签名代码:https://github.com/solana-labs/solana/blob/2a5764ef79cff391da080cc19617f171109c4158/web3.js/src/transaction.ts#L522

底层 tweetnacl 代码:https://github.com/dchest/tweetnacl-js/blob/971d653d301cff2dd694e95a099cb42d9201e922/nacl.js#L1076

Solana uses the ed25519 curve for its cyrptography, so a transaction signature is:

A 64-byte ed25519 signature of R (32-bytes) and S (32-bytes). With the requirement that R is a packed Edwards point not of small order and S is a scalar in the range of 0 <= S < L. This requirement ensures no signature malleability.

The actual code called is tweetnacl's sign.detached function.

More information at the official docs: https://docs.solana.com/terminology#signature

The Solana transaction sign code: https://github.com/solana-labs/solana/blob/2a5764ef79cff391da080cc19617f171109c4158/web3.js/src/transaction.ts#L522

The underlying tweetnacl code: https://github.com/dchest/tweetnacl-js/blob/971d653d301cff2dd694e95a099cb42d9201e922/nacl.js#L1076

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文