Move.

帖子

分享您的知识。

mssoni.
Jan 23, 2025
专家问答

How to manage PTB restrictions on randomness in SUI?

I'm encountering a limitation with PTB where it restricts pulling in commands after using Random. I want to execute other commands within PTB. Is the only option here to develop a custom PRNG, or is there an 'UnsafeRandom' accessible for overcoming this?

  • Move Script
3
2
分享
评论
.

答案

2
CarlkawIy.
Jan 23 2025, 00:10

此限制实际上是出于安全目的,以防止基于 PTB 的组合攻击. 根据文档,没有 “unsafeRandom” 对象可用于绕过这些限制. 如果您需要更大的灵活性,可能需要考虑开发自己的自定义伪随机数生成器 (PRNG).

2
评论
.
cod.
cod95
Jan 23 2025, 04:52

此处的 SUI 文档详细解释了该限制:https://docs.sui.io/guides/developer/advanced/randomness-onchain#programmable-transaction-block-ptb-restrictions. 这样做是为了确保系统内的安全和完整性.

2
评论
.

你知道答案吗?

请登录并分享。

Move is an executable bytecode language used to implement custom transactions and smart contracts.

148帖子231答案
Sui.X.Peera.

赚取你的 1000 Sui 份额

获取声誉积分,并因帮助 Sui 社区成长而获得奖励。

奖励活动七月