Move.

Post

Share your knowledge.

mssoni.
Jan 23, 2025
Expert Q&A

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
Share
Comments
.

Answers

2
CarlkawIy.
Jan 23 2025, 00:10

This restriction is actually there for security purposes to prevent PTB-based composition attacks. According to the documentation, there's no 'UnsafeRandom' object available for use to work around these constraints. You might have to consider developing your own custom Pseudorandom Number Generator (PRNG) if you need more flexibility.

2
Comments
.
cod.
cod95
Jan 23 2025, 04:52

The restriction is intended and thoroughly explained in the SUI documentation here: https://docs.sui.io/guides/developer/advanced/randomness-onchain#programmable-transaction-block-ptb-restrictions. It's done to ensure safety and integrity within the system.

2
Comments
.

Do you know the answer?

Please log in and share it.

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

148Posts231Answers
Sui.X.Peera.

Earn Your Share of 1000 Sui

Gain Reputation Points & Get Rewards for Helping the Sui Community Grow.

Reward CampaignJune
We use cookies to ensure you get the best experience on our website.
More info