Phantom Wallet (Solana) 使用什么算法来签署消息?
我试图了解当我们调用 window.solana.signMessage 时会发生什么。
I am trying to understand what happens under the hood when we call window.solana.signMessage.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Solana 使用 ed25519 曲线进行加密,因此交易签名为:
实际调用的代码是
tweetnacl
的sign.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:
The actual code called is
tweetnacl
'ssign.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